// 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_Overlay_h #define ui_devtools_protocol_Overlay_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. #include "components/ui_devtools/DOM.h" namespace ui_devtools { namespace protocol { namespace Overlay { // ------------- Forward and enum declarations. class HighlightConfig; using InspectMode = String; class NodeHighlightRequestedNotification; class InspectNodeRequestedNotification; namespace InspectModeEnum { UI_DEVTOOLS_EXPORT extern const char SearchForNode[]; UI_DEVTOOLS_EXPORT extern const char SearchForUAShadowDOM[]; UI_DEVTOOLS_EXPORT extern const char None[]; } // namespace InspectModeEnum // ------------- Type and builder declarations. class UI_DEVTOOLS_EXPORT HighlightConfig : public Serializable{ PROTOCOL_DISALLOW_COPY(HighlightConfig); public: static std::unique_ptr fromValue(protocol::Value* value, ErrorSupport* errors); ~HighlightConfig() override { } bool hasShowInfo() { return m_showInfo.isJust(); } bool getShowInfo(bool defaultValue) { return m_showInfo.isJust() ? m_showInfo.fromJust() : defaultValue; } void setShowInfo(bool value) { m_showInfo = value; } bool hasShowRulers() { return m_showRulers.isJust(); } bool getShowRulers(bool defaultValue) { return m_showRulers.isJust() ? m_showRulers.fromJust() : defaultValue; } void setShowRulers(bool value) { m_showRulers = value; } bool hasShowExtensionLines() { return m_showExtensionLines.isJust(); } bool getShowExtensionLines(bool defaultValue) { return m_showExtensionLines.isJust() ? m_showExtensionLines.fromJust() : defaultValue; } void setShowExtensionLines(bool value) { m_showExtensionLines = value; } bool hasDisplayAsMaterial() { return m_displayAsMaterial.isJust(); } bool getDisplayAsMaterial(bool defaultValue) { return m_displayAsMaterial.isJust() ? m_displayAsMaterial.fromJust() : defaultValue; } void setDisplayAsMaterial(bool value) { m_displayAsMaterial = value; } bool hasContentColor() { return m_contentColor.isJust(); } protocol::DOM::RGBA* getContentColor(protocol::DOM::RGBA* defaultValue) { return m_contentColor.isJust() ? m_contentColor.fromJust() : defaultValue; } void setContentColor(std::unique_ptr value) { m_contentColor = std::move(value); } bool hasPaddingColor() { return m_paddingColor.isJust(); } protocol::DOM::RGBA* getPaddingColor(protocol::DOM::RGBA* defaultValue) { return m_paddingColor.isJust() ? m_paddingColor.fromJust() : defaultValue; } void setPaddingColor(std::unique_ptr value) { m_paddingColor = std::move(value); } bool hasBorderColor() { return m_borderColor.isJust(); } protocol::DOM::RGBA* getBorderColor(protocol::DOM::RGBA* defaultValue) { return m_borderColor.isJust() ? m_borderColor.fromJust() : defaultValue; } void setBorderColor(std::unique_ptr value) { m_borderColor = std::move(value); } bool hasMarginColor() { return m_marginColor.isJust(); } protocol::DOM::RGBA* getMarginColor(protocol::DOM::RGBA* defaultValue) { return m_marginColor.isJust() ? m_marginColor.fromJust() : defaultValue; } void setMarginColor(std::unique_ptr value) { m_marginColor = std::move(value); } bool hasEventTargetColor() { return m_eventTargetColor.isJust(); } protocol::DOM::RGBA* getEventTargetColor(protocol::DOM::RGBA* defaultValue) { return m_eventTargetColor.isJust() ? m_eventTargetColor.fromJust() : defaultValue; } void setEventTargetColor(std::unique_ptr value) { m_eventTargetColor = std::move(value); } bool hasShapeColor() { return m_shapeColor.isJust(); } protocol::DOM::RGBA* getShapeColor(protocol::DOM::RGBA* defaultValue) { return m_shapeColor.isJust() ? m_shapeColor.fromJust() : defaultValue; } void setShapeColor(std::unique_ptr value) { m_shapeColor = std::move(value); } bool hasShapeMarginColor() { return m_shapeMarginColor.isJust(); } protocol::DOM::RGBA* getShapeMarginColor(protocol::DOM::RGBA* defaultValue) { return m_shapeMarginColor.isJust() ? m_shapeMarginColor.fromJust() : defaultValue; } void setShapeMarginColor(std::unique_ptr value) { m_shapeMarginColor = std::move(value); } bool hasSelectorList() { return m_selectorList.isJust(); } String getSelectorList(const String& defaultValue) { return m_selectorList.isJust() ? m_selectorList.fromJust() : defaultValue; } void setSelectorList(const String& value) { m_selectorList = value; } std::unique_ptr toValue() const; String serialize() override { return toValue()->serialize(); } std::unique_ptr clone() const; template class HighlightConfigBuilder { public: enum { NoFieldsSet = 0, AllFieldsSet = (0)}; HighlightConfigBuilder& setShowInfo(bool value) { m_result->setShowInfo(value); return *this; } HighlightConfigBuilder& setShowRulers(bool value) { m_result->setShowRulers(value); return *this; } HighlightConfigBuilder& setShowExtensionLines(bool value) { m_result->setShowExtensionLines(value); return *this; } HighlightConfigBuilder& setDisplayAsMaterial(bool value) { m_result->setDisplayAsMaterial(value); return *this; } HighlightConfigBuilder& setContentColor(std::unique_ptr value) { m_result->setContentColor(std::move(value)); return *this; } HighlightConfigBuilder& setPaddingColor(std::unique_ptr value) { m_result->setPaddingColor(std::move(value)); return *this; } HighlightConfigBuilder& setBorderColor(std::unique_ptr value) { m_result->setBorderColor(std::move(value)); return *this; } HighlightConfigBuilder& setMarginColor(std::unique_ptr value) { m_result->setMarginColor(std::move(value)); return *this; } HighlightConfigBuilder& setEventTargetColor(std::unique_ptr value) { m_result->setEventTargetColor(std::move(value)); return *this; } HighlightConfigBuilder& setShapeColor(std::unique_ptr value) { m_result->setShapeColor(std::move(value)); return *this; } HighlightConfigBuilder& setShapeMarginColor(std::unique_ptr value) { m_result->setShapeMarginColor(std::move(value)); return *this; } HighlightConfigBuilder& setSelectorList(const String& value) { m_result->setSelectorList(value); return *this; } std::unique_ptr build() { static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet"); return std::move(m_result); } private: friend class HighlightConfig; HighlightConfigBuilder() : m_result(new HighlightConfig()) { } template HighlightConfigBuilder& castState() { return *reinterpret_cast*>(this); } std::unique_ptr m_result; }; static HighlightConfigBuilder<0> create() { return HighlightConfigBuilder<0>(); } private: HighlightConfig() { } Maybe m_showInfo; Maybe m_showRulers; Maybe m_showExtensionLines; Maybe m_displayAsMaterial; Maybe m_contentColor; Maybe m_paddingColor; Maybe m_borderColor; Maybe m_marginColor; Maybe m_eventTargetColor; Maybe m_shapeColor; Maybe m_shapeMarginColor; Maybe m_selectorList; }; 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 InspectNodeRequestedNotification : public Serializable{ PROTOCOL_DISALLOW_COPY(InspectNodeRequestedNotification); public: static std::unique_ptr fromValue(protocol::Value* value, ErrorSupport* errors); ~InspectNodeRequestedNotification() override { } int getBackendNodeId() { return m_backendNodeId; } void setBackendNodeId(int value) { m_backendNodeId = value; } std::unique_ptr toValue() const; String serialize() override { return toValue()->serialize(); } std::unique_ptr clone() const; template class InspectNodeRequestedNotificationBuilder { public: enum { NoFieldsSet = 0, BackendNodeIdSet = 1 << 1, AllFieldsSet = (BackendNodeIdSet | 0)}; InspectNodeRequestedNotificationBuilder& setBackendNodeId(int value) { static_assert(!(STATE & BackendNodeIdSet), "property backendNodeId should not be set yet"); m_result->setBackendNodeId(value); return castState(); } std::unique_ptr build() { static_assert(STATE == AllFieldsSet, "state should be AllFieldsSet"); return std::move(m_result); } private: friend class InspectNodeRequestedNotification; InspectNodeRequestedNotificationBuilder() : m_result(new InspectNodeRequestedNotification()) { } template InspectNodeRequestedNotificationBuilder& castState() { return *reinterpret_cast*>(this); } std::unique_ptr m_result; }; static InspectNodeRequestedNotificationBuilder<0> create() { return InspectNodeRequestedNotificationBuilder<0>(); } private: InspectNodeRequestedNotification() { m_backendNodeId = 0; } int m_backendNodeId; }; // ------------- Backend interface. class UI_DEVTOOLS_EXPORT Backend { public: virtual ~Backend() { } virtual DispatchResponse enable() = 0; virtual DispatchResponse disable() = 0; virtual DispatchResponse highlightNode(std::unique_ptr in_highlightConfig, Maybe in_nodeId) = 0; virtual DispatchResponse hideHighlight() = 0; virtual DispatchResponse setInspectMode(const String& in_mode, Maybe in_highlightConfig) = 0; }; // ------------- Frontend interface. class UI_DEVTOOLS_EXPORT Frontend { public: explicit Frontend(FrontendChannel* frontendChannel) : m_frontendChannel(frontendChannel) { } void nodeHighlightRequested(int nodeId); void inspectNodeRequested(int backendNodeId); 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 Overlay } // namespace ui_devtools } // namespace protocol #endif // !defined(ui_devtools_protocol_Overlay_h)