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 |