OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ash/common/devtools/window_element.h" |
| 6 #include "ash/common/devtools/widget_element.h" |
| 7 |
| 8 #include "ui/aura/window.h" |
| 9 |
| 10 namespace ash { |
| 11 namespace devtools { |
| 12 |
| 13 // Handles removing windows. |
| 14 void WindowElement::OnWindowHierarchyChanging( |
| 15 const aura::WindowObserver::HierarchyChangeParams& params) { |
| 16 DomAgentDelegate()->NotifyOnWindowHierarchyChanging(params); |
| 17 } |
| 18 |
| 19 // Handles adding windows. |
| 20 void WindowElement::OnWindowHierarchyChanged( |
| 21 const aura::WindowObserver::HierarchyChangeParams& params) { |
| 22 DomAgentDelegate()->NotifyOnWindowHierarchyChanged(params); |
| 23 } |
| 24 |
| 25 void WindowElement::OnWindowStackingChanged(aura::Window* window) { |
| 26 DomAgentDelegate()->NotifyRemoveWindowTree(WmWindow::Get(window), false); |
| 27 DomAgentDelegate()->NotifyAddWindowTree(WmWindow::Get(window)); |
| 28 } |
| 29 |
| 30 void WindowElement::OnWindowBoundsChanged(aura::Window* window, |
| 31 const gfx::Rect& old_bounds, |
| 32 const gfx::Rect& new_bounds) { |
| 33 LOG(ERROR) << "WindowElement::OnWindowBoundsChanged --------------"; |
| 34 DomAgentDelegate()->NotfiyOnWindowBoundsChanged(WmWindow::Get(window)); |
| 35 } |
| 36 |
| 37 bool WindowElement::GetBounds(gfx::Rect* bounds) { |
| 38 if (window) { |
| 39 *bounds = window->GetBounds(); |
| 40 return true; |
| 41 } |
| 42 return false; |
| 43 } |
| 44 |
| 45 bool WindowElement::SetBounds(const gfx::Rect& bounds) { |
| 46 if (window) { |
| 47 window->SetBounds(bounds); |
| 48 return true; |
| 49 } |
| 50 return false; |
| 51 } |
| 52 |
| 53 bool WindowElement::GetVisible(bool* visible) { |
| 54 if (window) { |
| 55 *visible = window->IsVisible(); |
| 56 return true; |
| 57 } |
| 58 return false; |
| 59 } |
| 60 |
| 61 bool WindowElement::SetVisible(bool visible) { |
| 62 if (window) { |
| 63 if (visible != window->IsVisible()) { |
| 64 if (visible) |
| 65 window->Show(); |
| 66 else |
| 67 window->Hide(); |
| 68 } |
| 69 return true; |
| 70 } |
| 71 return false; |
| 72 } |
| 73 |
| 74 } // namespace devtools |
| 75 } // namespace ash |
OLD | NEW |