| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/common/wm/container_finder.h" | 5 #include "ash/common/wm/container_finder.h" |
| 6 | 6 |
| 7 #include "ash/common/session/session_state_delegate.h" | 7 #include "ash/common/session/session_state_delegate.h" |
| 8 #include "ash/common/wm/always_on_top_controller.h" | 8 #include "ash/common/wm/always_on_top_controller.h" |
| 9 #include "ash/common/wm/root_window_finder.h" | 9 #include "ash/common/wm/root_window_finder.h" |
| 10 #include "ash/common/wm/window_state.h" | 10 #include "ash/common/wm/window_state.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } // namespace | 63 } // namespace |
| 64 | 64 |
| 65 WmWindow* GetContainerForWindow(WmWindow* window) { | 65 WmWindow* GetContainerForWindow(WmWindow* window) { |
| 66 WmWindow* parent = window->GetParent(); | 66 WmWindow* parent = window->GetParent(); |
| 67 // The first parent with an explicit shell window ID is the container. | 67 // The first parent with an explicit shell window ID is the container. |
| 68 while (parent && parent->GetShellWindowId() == kShellWindowId_Invalid) | 68 while (parent && parent->GetShellWindowId() == kShellWindowId_Invalid) |
| 69 parent = parent->GetParent(); | 69 parent = parent->GetParent(); |
| 70 return parent; | 70 return parent; |
| 71 } | 71 } |
| 72 | 72 |
| 73 WmWindow* GetDefaultParent(WmWindow* context, | 73 WmWindow* GetDefaultParent(WmWindow* window, const gfx::Rect& bounds) { |
| 74 WmWindow* window, | |
| 75 const gfx::Rect& bounds) { | |
| 76 WmWindow* target_root = nullptr; | 74 WmWindow* target_root = nullptr; |
| 77 WmWindow* transient_parent = window->GetTransientParent(); | 75 WmWindow* transient_parent = window->GetTransientParent(); |
| 78 if (transient_parent) { | 76 if (transient_parent) { |
| 79 // Transient window should use the same root as its transient parent. | 77 // Transient window should use the same root as its transient parent. |
| 80 target_root = transient_parent->GetRootWindow(); | 78 target_root = transient_parent->GetRootWindow(); |
| 81 } else { | 79 } else { |
| 82 target_root = FindContainerRoot(bounds); | 80 target_root = FindContainerRoot(bounds); |
| 83 } | 81 } |
| 84 | 82 |
| 85 switch (window->GetType()) { | 83 switch (window->GetType()) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 if (priority_root && priority_root->Contains(container)) | 121 if (priority_root && priority_root->Contains(container)) |
| 124 containers.insert(containers.begin(), container); | 122 containers.insert(containers.begin(), container); |
| 125 else | 123 else |
| 126 containers.push_back(container); | 124 containers.push_back(container); |
| 127 } | 125 } |
| 128 return containers; | 126 return containers; |
| 129 } | 127 } |
| 130 | 128 |
| 131 } // namespace wm | 129 } // namespace wm |
| 132 } // namespace ash | 130 } // namespace ash |
| OLD | NEW |