// 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 protocol_Target_h #define protocol_Target_h #include "chrome/browser/devtools/protocol/protocol.h" // For each imported domain we generate a ValueConversions struct instead of a full domain definition // and include Domain::API version from there. namespace protocol { namespace Target { // ------------- Forward and enum declarations. using TargetID = String; using BrowserContextID = String; class RemoteLocation; // ------------- Type and builder declarations. class RemoteLocation : public Serializable{ PROTOCOL_DISALLOW_COPY(RemoteLocation); public: static std::unique_ptr fromValue(protocol::Value* value, ErrorSupport* errors); ~RemoteLocation() override { } String GetHost() { return m_host; } void SetHost(const String& value) { m_host = value; } int GetPort() { return m_port; } void SetPort(int value) { m_port = value; } std::unique_ptr toValue() const; String serialize() override { return toValue()->serialize(); } std::unique_ptr clone() const; template class RemoteLocationBuilder { public: enum { NoFieldsSet = 0, HostSet = 1 << 1, PortSet = 1 << 2, AllFieldsSet = (HostSet | PortSet | 0)}; RemoteLocationBuilder& SetHost(const String& value) { static_assert(!(STATE & HostSet), "property host should not be set yet"); m_result->SetHost(value); return castState(); } RemoteLocationBuilder& SetPort(int value) { static_assert(!(STATE & PortSet), "property port should not be set yet"); m_result->SetPort(value); return castState(); } std::unique_ptr Build() { static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet"); return std::move(m_result); } private: friend class RemoteLocation; RemoteLocationBuilder() : m_result(new RemoteLocation()) { } template RemoteLocationBuilder& castState() { return *reinterpret_cast*>(this); } std::unique_ptr m_result; }; static RemoteLocationBuilder<0> Create() { return RemoteLocationBuilder<0>(); } private: RemoteLocation() { m_port = 0; } String m_host; int m_port; }; // ------------- Backend interface. class Backend { public: virtual ~Backend() { } virtual DispatchResponse CreateBrowserContext(String* out_browserContextId) = 0; virtual DispatchResponse GetBrowserContexts(std::unique_ptr>* out_browserContextIds) = 0; virtual DispatchResponse CreateTarget(const String& in_url, Maybe in_width, Maybe in_height, Maybe in_browserContextId, Maybe in_enableBeginFrameControl, String* out_targetId) = 0; class DisposeBrowserContextCallback { public: virtual void sendSuccess() = 0; virtual void sendFailure(const DispatchResponse&) = 0; virtual void fallThrough() = 0; virtual ~DisposeBrowserContextCallback() { } }; virtual void DisposeBrowserContext(const String& in_browserContextId, std::unique_ptr callback) = 0; virtual DispatchResponse SetRemoteLocations(std::unique_ptr> in_locations) = 0; virtual DispatchResponse Disable() { return DispatchResponse::OK(); } }; // ------------- Frontend interface. class Frontend { public: explicit Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { } void flush(); void sendRawNotification(const String&); private: FrontendChannel* m_frontendChannel; }; // ------------- Dispatcher. class Dispatcher { public: static void wire(UberDispatcher*, Backend*); private: Dispatcher() { } }; // ------------- Metainfo. class Metainfo { public: using BackendClass = Backend; using FrontendClass = Frontend; using DispatcherClass = Dispatcher; static const char domainName[]; static const char commandPrefix[]; static const char version[]; }; } // namespace Target } // namespace protocol #endif // !defined(protocol_Target_h)