| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "content/browser/web_contents/aura/constrained_windows_observer.h" | 5 #include "content/browser/web_contents/aura/constrained_windows_observer.h" |
| 6 | 6 |
| 7 #include "content/browser/renderer_host/render_view_host_factory.h" | 7 #include "content/browser/renderer_host/render_view_host_factory.h" |
| 8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 8 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 9 #include "content/browser/renderer_host/render_widget_host_view_aura.h" | 9 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 // We need to undo the above if we were parented to the root window and then | 123 // We need to undo the above if we were parented to the root window and then |
| 124 // got parented to another window. At that point, the code before the ifdef | 124 // got parented to another window. At that point, the code before the ifdef |
| 125 // would have stopped watching the root window. | 125 // would have stopped watching the root window. |
| 126 if (window->GetRootWindow() && | 126 if (window->GetRootWindow() && |
| 127 parent != window->GetRootWindow() && | 127 parent != window->GetRootWindow() && |
| 128 !window->GetRootWindow()->HasObserver(this)) { | 128 !window->GetRootWindow()->HasObserver(this)) { |
| 129 window->GetRootWindow()->AddObserver(this); | 129 window->GetRootWindow()->AddObserver(this); |
| 130 } | 130 } |
| 131 | 131 |
| 132 constrained_parent_ = parent; | 132 constrained_parent_ = NULL; |
| 133 if (parent) |
| 134 constrained_parent_ = parent->parent(); |
| 133 | 135 |
| 134 if (constrained_parent_) { | 136 if (constrained_parent_) { |
| 135 constrained_parent_->AddObserver(this); | 137 constrained_parent_->AddObserver(this); |
| 136 if (constrained_parent_ != window->GetRootWindow()) { | 138 if (constrained_parent_ != window->GetRootWindow()) { |
| 137 const aura::Window::Windows& children = constrained_parent_->children(); | 139 const aura::Window::Windows& children = constrained_parent_->children(); |
| 138 for (size_t i = 0; i < children.size(); ++i) { | 140 for (size_t i = 0; i < children.size(); ++i) { |
| 139 if (children[i] != view_->window_) | 141 if (children[i] != view_->window_) |
| 140 children[i]->AddObserver(this); | 142 children[i]->AddObserver(this); |
| 141 } | 143 } |
| 142 } | 144 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 children[i] != exclude && | 190 children[i] != exclude && |
| 189 children[i]->IsVisible()) { | 191 children[i]->IsVisible()) { |
| 190 constrained_windows.push_back(children[i]->GetBoundsInRootWindow()); | 192 constrained_windows.push_back(children[i]->GetBoundsInRootWindow()); |
| 191 } | 193 } |
| 192 } | 194 } |
| 193 | 195 |
| 194 view->UpdateConstrainedWindowRects(constrained_windows); | 196 view->UpdateConstrainedWindowRects(constrained_windows); |
| 195 } | 197 } |
| 196 | 198 |
| 197 } // namespace content | 199 } // namespace content |
| OLD | NEW |