| 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..0800a1150882eba9bba2a3c4754498a51fc2f1b0
|
| --- /dev/null
|
| +++ b/ash/devtools/ui_element.h
|
| @@ -0,0 +1,75 @@
|
| +// 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 "base/macros.h"
|
| +#include "ui/aura/window.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:
|
| + 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);
|
| +
|
| + std::vector<UIElement*>::iterator RemoveChild();
|
| +
|
| + 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<aura::Window*, gfx::Rect> GetNodeWindowAndBounds() = 0;
|
| +
|
| + template <typename BackingT, typename T>
|
| + static BackingT* GetBackingElement(UIElement* element) {
|
| + return T::From(element);
|
| + };
|
| +
|
| + protected:
|
| + UIElement(UIElementType type,
|
| + UIElementDelegate* ui_element_delegate,
|
| + UIElement* parent);
|
| + virtual ~UIElement();
|
| +
|
| + 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_
|
|
|