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/widget_element.h" |
| 6 |
| 7 namespace ash { |
| 8 namespace devtools { |
| 9 |
| 10 WidgetElement::WidgetElement(views::Widget* widget) : widget_(widget) {} |
| 11 |
| 12 void WidgetElement::OnWillRemoveView(views::Widget* widget, views::View* view) { |
| 13 if (view == widget->GetRootView()) |
| 14 DomAgentDelegate()->NotifyRemoveViewTree(view, nullptr, true); |
| 15 } |
| 16 |
| 17 void WidgetElement::OnWidgetBoundsChanged(views::Widget* widget, |
| 18 const gfx::Rect& new_bounds) { |
| 19 DomAgentDelegate()->NotifyOnWidgetBoundsChanged(widget); |
| 20 } |
| 21 |
| 22 bool WidgetElement::GetBounds(gfx::Rect* bounds) { |
| 23 if (widget_) { |
| 24 *bounds = widget_->GetRestoredBounds(); |
| 25 return true; |
| 26 } |
| 27 return false; |
| 28 } |
| 29 |
| 30 bool WidgetElement::SetBounds(const gfx::Rect& bounds) { |
| 31 if (widget_) { |
| 32 widget_->SetBounds(bounds); |
| 33 return true; |
| 34 } |
| 35 return false; |
| 36 } |
| 37 |
| 38 bool WidgetElement::GetVisible(bool* visible) { |
| 39 if (widget_) { |
| 40 *visible = widget_->IsVisible(); |
| 41 return true; |
| 42 } |
| 43 return false; |
| 44 } |
| 45 |
| 46 bool WidgetElement::SetVisible(bool visible) { |
| 47 if (widget_) { |
| 48 if (visible != widget_->IsVisible()) { |
| 49 if (visible) |
| 50 widget_->Show(); |
| 51 else |
| 52 widget_->Hide(); |
| 53 } |
| 54 return true; |
| 55 } |
| 56 return false; |
| 57 } |
| 58 |
| 59 } // namespace devtools |
| 60 } // namespace ash |
OLD | NEW |