Index: ash/common/devtools/widget_element.cc |
diff --git a/ash/common/devtools/widget_element.cc b/ash/common/devtools/widget_element.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..238c60fe1002f6e5cdb3703699fb916304edf895 |
--- /dev/null |
+++ b/ash/common/devtools/widget_element.cc |
@@ -0,0 +1,60 @@ |
+// 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/widget_element.h" |
+ |
+namespace ash { |
+namespace devtools { |
+ |
+WidgetElement::WidgetElement(views::Widget* widget) : widget_(widget) {} |
+ |
+void WidgetElement::OnWillRemoveView(views::Widget* widget, views::View* view) { |
+ if (view == widget->GetRootView()) |
+ DomAgentDelegate()->NotifyRemoveViewTree(view, nullptr, true); |
+} |
+ |
+void WidgetElement::OnWidgetBoundsChanged(views::Widget* widget, |
+ const gfx::Rect& new_bounds) { |
+ DomAgentDelegate()->NotifyOnWidgetBoundsChanged(widget); |
+} |
+ |
+bool WidgetElement::GetBounds(gfx::Rect* bounds) { |
+ if (widget_) { |
+ *bounds = widget_->GetRestoredBounds(); |
+ return true; |
+ } |
+ return false; |
+} |
+ |
+bool WidgetElement::SetBounds(const gfx::Rect& bounds) { |
+ if (widget_) { |
+ widget_->SetBounds(bounds); |
+ return true; |
+ } |
+ return false; |
+} |
+ |
+bool WidgetElement::GetVisible(bool* visible) { |
+ if (widget_) { |
+ *visible = widget_->IsVisible(); |
+ return true; |
+ } |
+ return false; |
+} |
+ |
+bool WidgetElement::SetVisible(bool visible) { |
+ if (widget_) { |
+ if (visible != widget_->IsVisible()) { |
+ if (visible) |
+ widget_->Show(); |
+ else |
+ widget_->Hide(); |
+ } |
+ return true; |
+ } |
+ return false; |
+} |
+ |
+} // namespace devtools |
+} // namespace ash |