blob: 28c642581e28aa18d787ec5af69eb0bd2f76420d [file] [log] [blame]
// This file is generated
// Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef {{class_name}}_h
#define {{class_name}}_h
#include "platform/inspector_protocol/Backend.h"
#include "platform/inspector_protocol/TypeBuilder.h"
namespace blink {
namespace protocol {
class FrontendChannel;
class DispatcherImplWeakPtr;
class PLATFORM_EXPORT Dispatcher {
public:
static std::unique_ptr<Dispatcher> create(FrontendChannel* frontendChannel);
virtual ~Dispatcher() { }
class PLATFORM_EXPORT CallbackBase {
public:
CallbackBase(std::unique_ptr<DispatcherImplWeakPtr> backendImpl, int callId);
virtual ~CallbackBase();
void sendFailure(const ErrorString&);
void dispose();
protected:
void sendIfActive(std::unique_ptr<protocol::DictionaryValue> partialMessage, const ErrorString& invocationError);
private:
std::unique_ptr<DispatcherImplWeakPtr> m_backendImpl;
int m_callId;
};
{% for domain in api.domains %}
virtual void registerAgent(blink::protocol::Backend::{{domain.domain}}*) = 0;
{% endfor %}
virtual void clearFrontend() = 0;
enum CommonErrorCode {
ParseError = 0,
InvalidRequest,
MethodNotFound,
InvalidParams,
InternalError,
ServerError,
LastEntry,
};
void reportProtocolError(int callId, CommonErrorCode, const String16& errorMessage) const;
virtual void reportProtocolError(int callId, CommonErrorCode, const String16& errorMessage, ErrorSupport*) const = 0;
virtual void dispatch(const String16& message) = 0;
static bool getCommandName(const String16& message, String16* result);
};
} // namespace protocol
} // namespace blink
#endif // !defined({{class_name}}_h)