Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Unified Diff: ash/devtools/view_element.h

Issue 2776543002: Create a unified UIElement interface for Widget, View and Window. (Closed)
Patch Set: . Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/devtools/ui_element_delegate.h ('k') | ash/devtools/view_element.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/devtools/view_element.h
diff --git a/ash/devtools/view_element.h b/ash/devtools/view_element.h
new file mode 100644
index 0000000000000000000000000000000000000000..a5f0a387748359d47ebb73a6854218e7ed414821
--- /dev/null
+++ b/ash/devtools/view_element.h
@@ -0,0 +1,52 @@
+// 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_DEVTOOLS_VIEW_ELEMENT_H_
+#define ASH_DEVTOOLS_VIEW_ELEMENT_H_
+
+#include "ash/ash_export.h"
+#include "ash/devtools/ui_element.h"
+#include "base/macros.h"
+#include "ui/aura/window.h"
+#include "ui/gfx/geometry/rect.h"
+#include "ui/views/view.h"
+#include "ui/views/view_observer.h"
+
+namespace ash {
+namespace devtools {
+
+class UIElementDelegate;
+
+class ASH_EXPORT ViewElement : public views::ViewObserver, public UIElement {
+ public:
+ ViewElement(views::View* view,
+ UIElementDelegate* ui_element_delegate,
+ UIElement* parent);
+ ~ViewElement() override;
+ views::View* view() const { return view_; };
+
+ // views::ViewObserver
+ void OnChildViewRemoved(views::View* parent, views::View* view) override;
+ void OnChildViewAdded(views::View* parent, views::View* view) override;
+ void OnChildViewReordered(views::View* parent, views::View*) override;
+ void OnViewBoundsChanged(views::View* view) override;
+
+ // UIElement:
+ void GetBounds(gfx::Rect* bounds) const override;
+ void SetBounds(const gfx::Rect& bounds) override;
+ void GetVisible(bool* visible) const override;
+ void SetVisible(bool visible) override;
+ std::pair<aura::Window*, gfx::Rect> GetNodeWindowAndBounds() const override;
+ static views::View* From(UIElement* element);
+
+ private:
+ views::View* view_;
+
+ DISALLOW_COPY_AND_ASSIGN(ViewElement);
+};
+
+} // namespace devtools
+} // namespace ash
+
+#endif // ASH_DEVTOOLS_VIEW_ELEMENT_H_
« no previous file with comments | « ash/devtools/ui_element_delegate.h ('k') | ash/devtools/view_element.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698