// 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 ui_devtools_protocol_DOM_h #define ui_devtools_protocol_DOM_h #include "components/ui_devtools/devtools_export.h" #include "components/ui_devtools/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 ui_devtools { namespace protocol { namespace DOM { // ------------- Forward and enum declarations. using NodeId = int; using BackendNodeId = int; class Node; class RGBA; class NodeHighlightRequestedNotification; class ChildNodeInsertedNotification; class ChildNodeRemovedNotification; // ------------- Type and builder declarations. class UI_DEVTOOLS_EXPORT Node : public Serializable{ PROTOCOL_DISALLOW_COPY(Node); public: static std::unique_ptr fromValue(protocol::Value* value, ErrorSupport* errors); ~Node() override { } int getNodeId() { return m_nodeId; } void setNodeId(int value) { m_nodeId = value; } int getBackendNodeId() { return m_backendNodeId; } void setBackendNodeId(int value) { m_backendNodeId = value; } int getNodeType() { return m_nodeType; } void setNodeType(int value) { m_nodeType = value; } String getNodeName() { return m_nodeName; } void setNodeName(const String& value) { m_nodeName = value; } bool hasChildNodeCount() { return m_childNodeCount.isJust(); } int getChildNodeCount(int defaultValue) { return m_childNodeCount.isJust() ? m_childNodeCount.fromJust() : defaultValue; } void setChildNodeCount(int value) { m_childNodeCount = value; } bool hasChildren() { return m_children.isJust(); } protocol::Array* getChildren(protocol::Array* defaultValue) { return m_children.isJust() ? m_children.fromJust() : defaultValue; } void setChildren(std::unique_ptr> value) { m_children = std::move(value); } bool hasAttributes() { return m_attributes.isJust(); } protocol::Array* getAttributes(protocol::Array* defaultValue) { return m_attributes.isJust() ? m_attributes.fromJust() : defaultValue; } void setAttributes(std::unique_ptr> value) { m_attributes = std::move(value); } bool hasName() { return m_name.isJust(); } String getName(const String& defaultValue) { return m_name.isJust() ? m_name.fromJust() : defaultValue; } void setName(const String& value) { m_name = value; } bool hasValue() { return m_value.isJust(); } String getValue(const String& defaultValue) { return m_value.isJust() ? m_value.fromJust() : defaultValue; } void setValue(const String& value) { m_value = value; } std::unique_ptr toValue() const; String serialize() override { return toValue()->serialize(); } std::unique_ptr clone() const; template class NodeBuilder { public: enum { NoFieldsSet = 0, NodeIdSet = 1 << 1, BackendNodeIdSet = 1 << 2, NodeTypeSet = 1 << 3, NodeNameSet = 1 << 4, AllFieldsSet = (NodeIdSet | BackendNodeIdSet | NodeTypeSet | NodeNameSet | 0)}; NodeBuilder& setNodeId(int value) { static_assert(!(STATE & NodeIdSet), "property nodeId should not be set yet"); m_result->setNodeId(value); return castState(); } NodeBuilder& setBackendNodeId(int value) { static_assert(!(STATE & BackendNodeIdSet), "property backendNodeId should not be set yet"); m_result->setBackendNodeId(value); return castState(); } NodeBuilder& setNodeType(int value) { static_assert(!(STATE & NodeTypeSet), "property nodeType should not be set yet"); m_result->setNodeType(value); return castState(); } NodeBuilder& setNodeName(const String& value) { static_assert(!(STATE & NodeNameSet), "property nodeName should not be set yet"); m_result->setNodeName(value); return castState(); } NodeBuilder& setChildNodeCount(int value) { m_result->setChildNodeCount(value); return *this; } NodeBuilder& setChildren(std::unique_ptr> value) { m_result->setChildren(std::move(value)); return *this; } NodeBuilder& setAttributes(std::unique_ptr> value) { m_result->setAttributes(std::move(value)); return *this; } NodeBuilder& setName(const String& value) { m_result->setName(value); return *this; } NodeBuilder& setValue(const String& value) { m_result->setValue(value); return *this; } std::unique_ptr build() { static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet"); return std::move(m_result); } private: friend class Node; NodeBuilder() : m_result(new Node()) { } template NodeBuilder& castState() { return *reinterpret_cast*>(this); } std::unique_ptr m_result; }; static NodeBuilder<0> create() { return NodeBuilder<0>(); } private: Node() { m_nodeId = 0; m_backendNodeId = 0; m_nodeType = 0; } int m_nodeId; int m_backendNodeId; int m_nodeType; String m_nodeName; Maybe m_childNodeCount; Maybe> m_children; Maybe> m_attributes; Maybe m_name; Maybe m_value; }; class UI_DEVTOOLS_EXPORT RGBA : public Serializable{ PROTOCOL_DISALLOW_COPY(RGBA); public: static std::unique_ptr fromValue(protocol::Value* value, ErrorSupport* errors); ~RGBA() override { } int getR() { return m_r; } void setR(int value) { m_r = value; } int getG() { return m_g; } void setG(int value) { m_g = value; } int getB() { return m_b; } void setB(int value) { m_b = value; } bool hasA() { return m_a.isJust(); } double getA(double defaultValue) { return m_a.isJust() ? m_a.fromJust() : defaultValue; } void setA(double value) { m_a = value; } std::unique_ptr toValue() const; String serialize() override { return toValue()->serialize(); } std::unique_ptr clone() const; template class RGBABuilder { public: enum { NoFieldsSet = 0, RSet = 1 << 1, GSet = 1 << 2, BSet = 1 << 3, AllFieldsSet = (RSet | GSet | BSet | 0)}; RGBABuilder& setR(int value) { static_assert(!(STATE & RSet), "property r should not be set yet"); m_result->setR(value); return castState(); } RGBABuilder& setG(int value) { static_assert(!(STATE & GSet), "property g should not be set yet"); m_result->setG(value); return castState(); } RGBABuilder& setB(int value) { static_assert(!(STATE & BSet), "property b should not be set yet"); m_result->setB(value); return castState(); } RGBABuilder& setA(double value) { m_result->setA(value); return *this; } std::unique_ptr build() { static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet"); return std::move(m_result); } private: friend class RGBA; RGBABuilder() : m_result(new RGBA()) { } template RGBABuilder& castState() { return *reinterpret_cast*>(this); } std::unique_ptr m_result; }; static RGBABuilder<0> create() { return RGBABuilder<0>(); } private: RGBA() { m_r = 0; m_g = 0; m_b = 0; } int m_r; int m_g; int m_b; Maybe m_a; }; class UI_DEVTOOLS_EXPORT NodeHighlightRequestedNotification : public Serializable{ PROTOCOL_DISALLOW_COPY(NodeHighlightRequestedNotification); public: static std::unique_ptr fromValue(protocol::Value* value, ErrorSupport* errors); ~NodeHighlightRequestedNotification() override { } int getNodeId() { return m_nodeId; } void setNodeId(int value) { m_nodeId = value; } std::unique_ptr toValue() const; String serialize() override { return toValue()->serialize(); } std::unique_ptr clone() const; template class NodeHighlightRequestedNotificationBuilder { public: enum { NoFieldsSet = 0, NodeIdSet = 1 << 1, AllFieldsSet = (NodeIdSet | 0)}; NodeHighlightRequestedNotificationBuilder& setNodeId(int value) { static_assert(!(STATE & NodeIdSet), "property nodeId should not be set yet"); m_result->setNodeId(value); return castState(); } std::unique_ptr build() { static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet"); return std::move(m_result); } private: friend class NodeHighlightRequestedNotification; NodeHighlightRequestedNotificationBuilder() : m_result(new NodeHighlightRequestedNotification()) { } template NodeHighlightRequestedNotificationBuilder& castState() { return *reinterpret_cast*>(this); } std::unique_ptr m_result; }; static NodeHighlightRequestedNotificationBuilder<0> create() { return NodeHighlightRequestedNotificationBuilder<0>(); } private: NodeHighlightRequestedNotification() { m_nodeId = 0; } int m_nodeId; }; class UI_DEVTOOLS_EXPORT ChildNodeInsertedNotification : public Serializable{ PROTOCOL_DISALLOW_COPY(ChildNodeInsertedNotification); public: static std::unique_ptr fromValue(protocol::Value* value, ErrorSupport* errors); ~ChildNodeInsertedNotification() override { } int getParentNodeId() { return m_parentNodeId; } void setParentNodeId(int value) { m_parentNodeId = value; } int getPreviousNodeId() { return m_previousNodeId; } void setPreviousNodeId(int value) { m_previousNodeId = value; } protocol::DOM::Node* getNode() { return m_node.get(); } void setNode(std::unique_ptr value) { m_node = std::move(value); } std::unique_ptr toValue() const; String serialize() override { return toValue()->serialize(); } std::unique_ptr clone() const; template class ChildNodeInsertedNotificationBuilder { public: enum { NoFieldsSet = 0, ParentNodeIdSet = 1 << 1, PreviousNodeIdSet = 1 << 2, NodeSet = 1 << 3, AllFieldsSet = (ParentNodeIdSet | PreviousNodeIdSet | NodeSet | 0)}; ChildNodeInsertedNotificationBuilder& setParentNodeId(int value) { static_assert(!(STATE & ParentNodeIdSet), "property parentNodeId should not be set yet"); m_result->setParentNodeId(value); return castState(); } ChildNodeInsertedNotificationBuilder& setPreviousNodeId(int value) { static_assert(!(STATE & PreviousNodeIdSet), "property previousNodeId should not be set yet"); m_result->setPreviousNodeId(value); return castState(); } ChildNodeInsertedNotificationBuilder& setNode(std::unique_ptr value) { static_assert(!(STATE & NodeSet), "property node should not be set yet"); m_result->setNode(std::move(value)); return castState(); } std::unique_ptr build() { static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet"); return std::move(m_result); } private: friend class ChildNodeInsertedNotification; ChildNodeInsertedNotificationBuilder() : m_result(new ChildNodeInsertedNotification()) { } template ChildNodeInsertedNotificationBuilder& castState() { return *reinterpret_cast*>(this); } std::unique_ptr m_result; }; static ChildNodeInsertedNotificationBuilder<0> create() { return ChildNodeInsertedNotificationBuilder<0>(); } private: ChildNodeInsertedNotification() { m_parentNodeId = 0; m_previousNodeId = 0; } int m_parentNodeId; int m_previousNodeId; std::unique_ptr m_node; }; class UI_DEVTOOLS_EXPORT ChildNodeRemovedNotification : public Serializable{ PROTOCOL_DISALLOW_COPY(ChildNodeRemovedNotification); public: static std::unique_ptr fromValue(protocol::Value* value, ErrorSupport* errors); ~ChildNodeRemovedNotification() override { } int getParentNodeId() { return m_parentNodeId; } void setParentNodeId(int value) { m_parentNodeId = value; } int getNodeId() { return m_nodeId; } void setNodeId(int value) { m_nodeId = value; } std::unique_ptr toValue() const; String serialize() override { return toValue()->serialize(); } std::unique_ptr clone() const; template class ChildNodeRemovedNotificationBuilder { public: enum { NoFieldsSet = 0, ParentNodeIdSet = 1 << 1, NodeIdSet = 1 << 2, AllFieldsSet = (ParentNodeIdSet | NodeIdSet | 0)}; ChildNodeRemovedNotificationBuilder& setParentNodeId(int value) { static_assert(!(STATE & ParentNodeIdSet), "property parentNodeId should not be set yet"); m_result->setParentNodeId(value); return castState(); } ChildNodeRemovedNotificationBuilder& setNodeId(int value) { static_assert(!(STATE & NodeIdSet), "property nodeId should not be set yet"); m_result->setNodeId(value); return castState(); } std::unique_ptr build() { static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet"); return std::move(m_result); } private: friend class ChildNodeRemovedNotification; ChildNodeRemovedNotificationBuilder() : m_result(new ChildNodeRemovedNotification()) { } template ChildNodeRemovedNotificationBuilder& castState() { return *reinterpret_cast*>(this); } std::unique_ptr m_result; }; static ChildNodeRemovedNotificationBuilder<0> create() { return ChildNodeRemovedNotificationBuilder<0>(); } private: ChildNodeRemovedNotification() { m_parentNodeId = 0; m_nodeId = 0; } int m_parentNodeId; int m_nodeId; }; // ------------- Backend interface. class UI_DEVTOOLS_EXPORT Backend { public: virtual ~Backend() { } virtual DispatchResponse enable() = 0; virtual DispatchResponse disable() = 0; virtual DispatchResponse getDocument(std::unique_ptr* out_root) = 0; virtual DispatchResponse hideHighlight() = 0; virtual DispatchResponse pushNodesByBackendIdsToFrontend(std::unique_ptr> in_backendNodeIds, std::unique_ptr>* out_nodeIds) = 0; }; // ------------- Frontend interface. class UI_DEVTOOLS_EXPORT Frontend { public: explicit Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { } void nodeHighlightRequested(int nodeId); void childNodeInserted(int parentNodeId, int previousNodeId, std::unique_ptr node); void childNodeRemoved(int parentNodeId, int nodeId); void flush(); void sendRawNotification(const String&); private: FrontendChannel* m_frontendChannel; }; // ------------- Dispatcher. class UI_DEVTOOLS_EXPORT Dispatcher { public: static void wire(UberDispatcher*, Backend*); private: Dispatcher() { } }; // ------------- Metainfo. class UI_DEVTOOLS_EXPORT Metainfo { public: using BackendClass = Backend; using FrontendClass = Frontend; using DispatcherClass = Dispatcher; static const char domainName[]; static const char commandPrefix[]; static const char version[]; }; } // namespace DOM } // namespace ui_devtools } // namespace protocol #endif // !defined(ui_devtools_protocol_DOM_h)