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

Unified Diff: ash/common/devtools/view_element.cc

Issue 2776543002: Create a unified UIElement interface for Widget, View and Window. (Closed)
Patch Set: . Created 3 years, 9 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/common/devtools/view_element.cc
diff --git a/ash/common/devtools/view_element.cc b/ash/common/devtools/view_element.cc
new file mode 100644
index 0000000000000000000000000000000000000000..270eb3d8032d99eb731d9b32c66b5c49112f3c0e
--- /dev/null
+++ b/ash/common/devtools/view_element.cc
@@ -0,0 +1,62 @@
+// 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.
+
+#include "ash/common/devtools/view_element.h"
+
+namespace ash {
+namespace devtools {
+
+void ViewElement::OnChildViewRemoved(views::View* parent, views::View* view) {
+ DomAgentDelegate()->NotifyRemoveViewTree(view, parent, true);
+}
+
+void ViewElement::OnChildViewAdded(views::View* parent, views::View* view) {
+ DomAgentDelegate()->NotifyAddViewTree(view);
+}
+
+void ViewElement::OnChildViewReordered(views::View* parent, views::View* view) {
+ DomAgentDelegate()->NotifyRemoveViewTree(view, parent, false);
+ DomAgentDelegate()->NotifyAddViewTree(view);
+}
+
+void ViewElement::OnViewBoundsChanged(views::View* view) {
+ LOG(ERROR) << "WiewElement::OnViewBoundsChanged --------------";
+ DomAgentDelegate()->NotifyOnViewBoundsChanged(view);
+}
+
+bool ViewElement::GetBounds(gfx::Rect* bounds) {
+ if (view) {
+ *bounds = view->bounds();
+ return true;
+ }
+ return false;
+}
+
+bool ViewElement::SetBounds(const gfx::Rect& bounds) {
+ if (view) {
+ view->SetBoundsRect(bounds);
+ return true;
+ }
+ return false;
+}
+
+bool ViewElement::GetVisible(bool* visible) {
+ if (view) {
+ *visible = view->visible();
+ return true;
+ }
+ return false;
+}
+
+bool ViewElement::SetVisible(bool visible) {
+ if (view) {
+ if (visible != view->visible())
+ view->SetVisible(visible);
+ return true;
+ }
+ return false;
+}
+
+} // namespace devtools
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698