Index: ash/devtools/ui_element.h |
diff --git a/ash/devtools/ui_element.h b/ash/devtools/ui_element.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..43701dfa9c51cfa10b7cd6c4aae93a83060e0ee6 |
--- /dev/null |
+++ b/ash/devtools/ui_element.h |
@@ -0,0 +1,70 @@ |
+// Copyright 2017 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 ASH_COMMON_DEVTOOLS_UI_ELEMENT_H_ |
+#define ASH_COMMON_DEVTOOLS_UI_ELEMENT_H_ |
+ |
+#include <vector> |
+ |
+#include "ash/ash_export.h" |
+#include "ash/wm_window.h" |
+#include "base/macros.h" |
+#include "ui/gfx/geometry/rect.h" |
+#include "ui/views/view.h" |
+ |
+namespace ash { |
+ |
+namespace devtools { |
+ |
+class UIElementDelegate; |
+ |
+// UIElement type. |
+enum UIElementType { WINDOW, WIDGET, VIEW }; |
+ |
+class ASH_EXPORT UIElement { |
+ public: |
+ UIElement(); |
sadrul
2017/04/19 18:21:39
Move this into a protected ctor.
Change the ctor
thanhph
2017/04/24 15:56:50
Done. I also added parent as an input.
|
+ virtual ~UIElement(); |
+ |
+ int GetNodeId() const; |
+ void SetNodeId(int node_id); |
+ |
+ UIElement* GetParent(); |
+ void SetParent(UIElement* parent); |
+ |
+ UIElementDelegate* GetUIElementDelegate(); |
+ void SetUIElementDelegate(UIElementDelegate* ui_element_delegate); |
+ |
+ UIElementType GetType() const; |
+ void SetType(UIElementType type); |
+ |
+ std::vector<UIElement*>& GetChildren(); |
+ void SetChildren(std::vector<UIElement*>& children); |
+ |
+ virtual void Destroy() = 0; |
+ virtual bool GetBounds(gfx::Rect* bounds) = 0; |
+ virtual bool SetBounds(const gfx::Rect& bounds) = 0; |
+ virtual bool GetVisible(bool* visible) = 0; |
+ virtual bool SetVisible(bool visible) = 0; |
+ virtual std::pair<WmWindow*, gfx::Rect> GetNodeWindowAndBounds() = 0; |
+ |
+ template <typename BackingT, typename T> |
+ static BackingT* GetBackingElement(UIElement* element) { |
+ return T::From(element); |
+ }; |
+ |
+ private: |
+ int node_id_; |
+ std::vector<UIElement*> children_; |
+ UIElementType type_; |
+ UIElement* parent_; |
+ UIElementDelegate* ui_element_delegate_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(UIElement); |
+}; |
+ |
+} // namespace devtools |
+} // namespace ash |
+ |
+#endif // ASH_COMMON_DEVTOOLS_UI_ELEMENT_H_ |