| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/devtools/window_element.h" | 5 #include "ash/devtools/window_element.h" |
| 6 | 6 |
| 7 #include "ash/devtools/ui_element_delegate.h" | 7 #include "ash/devtools/ui_element_delegate.h" |
| 8 #include "ui/aura/window.h" | 8 #include "ui/aura/window.h" |
| 9 | 9 |
| 10 namespace ash { | 10 namespace ash { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 WindowElement::~WindowElement() { | 32 WindowElement::~WindowElement() { |
| 33 if (window_) | 33 if (window_) |
| 34 window_->RemoveObserver(this); | 34 window_->RemoveObserver(this); |
| 35 } | 35 } |
| 36 | 36 |
| 37 // Handles removing window_. | 37 // Handles removing window_. |
| 38 void WindowElement::OnWindowHierarchyChanging( | 38 void WindowElement::OnWindowHierarchyChanging( |
| 39 const aura::WindowObserver::HierarchyChangeParams& params) { | 39 const aura::WindowObserver::HierarchyChangeParams& params) { |
| 40 if (params.target == window_) { | 40 if (params.target == window_) { |
| 41 LOG(ERROR) << __PRETTY_FUNCTION__; |
| 41 parent()->RemoveChild(this); | 42 parent()->RemoveChild(this); |
| 42 delete this; | 43 delete this; |
| 43 } | 44 } |
| 44 } | 45 } |
| 45 | 46 |
| 46 // Handles adding window_. | 47 // Handles adding window_. |
| 47 void WindowElement::OnWindowHierarchyChanged( | 48 void WindowElement::OnWindowHierarchyChanged( |
| 48 const aura::WindowObserver::HierarchyChangeParams& params) { | 49 const aura::WindowObserver::HierarchyChangeParams& params) { |
| 49 if (window_ == params.new_parent && params.receiver == params.new_parent) { | 50 if (window_ == params.new_parent && params.receiver == params.new_parent) { |
| 51 LOG(ERROR) << __PRETTY_FUNCTION__; |
| 50 if (delegate()->IsHighlightingWindow(params.target)) | 52 if (delegate()->IsHighlightingWindow(params.target)) |
| 51 return; | 53 return; |
| 54 LOG(ERROR) << __PRETTY_FUNCTION__ << " node_id: " << node_id() |
| 55 << " -- window_ bounds: " |
| 56 << window_->GetBoundsInScreen().ToString(); |
| 52 AddChild(new WindowElement(params.target, delegate(), this), | 57 AddChild(new WindowElement(params.target, delegate(), this), |
| 53 children().empty() ? nullptr : children().back()); | 58 children().empty() ? nullptr : children().back()); |
| 54 } | 59 } |
| 55 } | 60 } |
| 56 | 61 |
| 57 void WindowElement::OnWindowStackingChanged(aura::Window* window) { | 62 void WindowElement::OnWindowStackingChanged(aura::Window* window) { |
| 58 DCHECK_EQ(window_, window); | 63 DCHECK_EQ(window_, window); |
| 59 parent()->ReorderChild(this, GetIndexOfChildInParent(window)); | 64 parent()->ReorderChild(this, GetIndexOfChildInParent(window)); |
| 60 } | 65 } |
| 61 | 66 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 91 } | 96 } |
| 92 | 97 |
| 93 // static | 98 // static |
| 94 aura::Window* WindowElement::From(UIElement* element) { | 99 aura::Window* WindowElement::From(UIElement* element) { |
| 95 DCHECK_EQ(UIElementType::WINDOW, element->type()); | 100 DCHECK_EQ(UIElementType::WINDOW, element->type()); |
| 96 return static_cast<WindowElement*>(element)->window_; | 101 return static_cast<WindowElement*>(element)->window_; |
| 97 } | 102 } |
| 98 | 103 |
| 99 } // namespace devtools | 104 } // namespace devtools |
| 100 } // namespace ash | 105 } // namespace ash |
| OLD | NEW |