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

Unified Diff: ash/devtools/view_element.h

Issue 2776543002: Create a unified UIElement interface for Widget, View and Window. (Closed)
Patch Set: nits Created 3 years, 8 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
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..6693bc8c3be785700e3ff9115d5a0d7179cd13f0
--- /dev/null
+++ b/ash/devtools/view_element.h
@@ -0,0 +1,53 @@
+// 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_VIEW_ELEMENT_H_
+#define ASH_COMMON_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();
+
+ // 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 Destroy() override;
+ bool GetBounds(gfx::Rect* bounds) override;
+ bool SetBounds(const gfx::Rect& bounds) override;
+ bool GetVisible(bool* visible) override;
+ bool SetVisible(bool visible) override;
+ std::pair<aura::Window*, gfx::Rect> GetNodeWindowAndBounds() override;
+ static views::View* From(UIElement* element);
+
+ private:
+ views::View* view_;
+
+ DISALLOW_COPY_AND_ASSIGN(ViewElement);
+};
+
+} // namespace devtools
+} // namespace ash
+
+#endif // ASH_COMMON_DEVTOOLS_VIEW_ELEMENT_H_

Powered by Google App Engine
This is Rietveld 408576698