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

Unified Diff: ash/common/devtools/window_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/window_element.cc
diff --git a/ash/common/devtools/window_element.cc b/ash/common/devtools/window_element.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8630375157a1e3ea68e03961b4e6ae69939f38f7
--- /dev/null
+++ b/ash/common/devtools/window_element.cc
@@ -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.
+
+#include "ash/common/devtools/window_element.h"
+#include "ash/common/devtools/widget_element.h"
+
+#include "ui/aura/window.h"
+
+namespace ash {
+namespace devtools {
+
+// Handles removing windows.
+void WindowElement::OnWindowHierarchyChanging(
+ const aura::WindowObserver::HierarchyChangeParams& params) {
+ DomAgentDelegate()->NotifyOnWindowHierarchyChanging(params);
+}
+
+// Handles adding windows.
+void WindowElement::OnWindowHierarchyChanged(
+ const aura::WindowObserver::HierarchyChangeParams& params) {
+ DomAgentDelegate()->NotifyOnWindowHierarchyChanged(params);
+}
+
+void WindowElement::OnWindowStackingChanged(aura::Window* window) {
+ DomAgentDelegate()->NotifyRemoveWindowTree(WmWindow::Get(window), false);
+ DomAgentDelegate()->NotifyAddWindowTree(WmWindow::Get(window));
+}
+
+void WindowElement::OnWindowBoundsChanged(aura::Window* window,
+ const gfx::Rect& old_bounds,
+ const gfx::Rect& new_bounds) {
+ LOG(ERROR) << "WindowElement::OnWindowBoundsChanged --------------";
+ DomAgentDelegate()->NotfiyOnWindowBoundsChanged(WmWindow::Get(window));
+}
+
+bool WindowElement::GetBounds(gfx::Rect* bounds) {
+ if (window) {
+ *bounds = window->GetBounds();
+ return true;
+ }
+ return false;
+}
+
+bool WindowElement::SetBounds(const gfx::Rect& bounds) {
+ if (window) {
+ window->SetBounds(bounds);
+ return true;
+ }
+ return false;
+}
+
+bool WindowElement::GetVisible(bool* visible) {
+ if (window) {
+ *visible = window->IsVisible();
+ return true;
+ }
+ return false;
+}
+
+bool WindowElement::SetVisible(bool visible) {
+ if (window) {
+ if (visible != window->IsVisible()) {
+ if (visible)
+ window->Show();
+ else
+ window->Hide();
+ }
+ return true;
+ }
+ return false;
+}
+
+} // namespace devtools
+} // namespace ash
« ash/common/devtools/ash_devtools_dom_agent.h ('K') | « ash/common/devtools/window_element.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698