| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 const aura::Window* window) { | 317 const aura::Window* window) { |
| 318 DCHECK(window); | 318 DCHECK(window); |
| 319 CHECK(WmShell::HasInstance() && | 319 CHECK(WmShell::HasInstance() && |
| 320 (WmShell::Get()->IsRunningInMash() || Shell::HasInstance())); | 320 (WmShell::Get()->IsRunningInMash() || Shell::HasInstance())); |
| 321 return GetRootWindowController(window->GetRootWindow()); | 321 return GetRootWindowController(window->GetRootWindow()); |
| 322 } | 322 } |
| 323 | 323 |
| 324 // static | 324 // static |
| 325 RootWindowController* RootWindowController::ForTargetRootWindow() { | 325 RootWindowController* RootWindowController::ForTargetRootWindow() { |
| 326 CHECK(Shell::HasInstance()); | 326 CHECK(Shell::HasInstance()); |
| 327 return GetRootWindowController(Shell::GetTargetRootWindow()); | 327 return GetRootWindowController(Shell::GetRootWindowForNewWindows()); |
| 328 } | 328 } |
| 329 | 329 |
| 330 void RootWindowController::ConfigureWidgetInitParamsForContainer( | 330 void RootWindowController::ConfigureWidgetInitParamsForContainer( |
| 331 views::Widget* widget, | 331 views::Widget* widget, |
| 332 int shell_container_id, | 332 int shell_container_id, |
| 333 views::Widget::InitParams* init_params) { | 333 views::Widget::InitParams* init_params) { |
| 334 init_params->parent = GetContainer(shell_container_id); | 334 init_params->parent = GetContainer(shell_container_id); |
| 335 } | 335 } |
| 336 | 336 |
| 337 aura::WindowTreeHost* RootWindowController::GetHost() { | 337 aura::WindowTreeHost* RootWindowController::GetHost() { |
| (...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 set_touch_hud_projection(new TouchHudProjection(GetRootWindow())); | 1117 set_touch_hud_projection(new TouchHudProjection(GetRootWindow())); |
| 1118 } | 1118 } |
| 1119 | 1119 |
| 1120 void RootWindowController::DisableTouchHudProjection() { | 1120 void RootWindowController::DisableTouchHudProjection() { |
| 1121 if (!touch_hud_projection_) | 1121 if (!touch_hud_projection_) |
| 1122 return; | 1122 return; |
| 1123 touch_hud_projection_->Remove(); | 1123 touch_hud_projection_->Remove(); |
| 1124 } | 1124 } |
| 1125 | 1125 |
| 1126 void RootWindowController::ResetRootForNewWindowsIfNecessary() { | 1126 void RootWindowController::ResetRootForNewWindowsIfNecessary() { |
| 1127 WmShell* shell = WmShell::Get(); | |
| 1128 // Change the target root window before closing child windows. If any child | 1127 // Change the target root window before closing child windows. If any child |
| 1129 // being removed triggers a relayout of the shelf it will try to build a | 1128 // being removed triggers a relayout of the shelf it will try to build a |
| 1130 // window list adding windows from the target root window's containers which | 1129 // window list adding windows from the target root window's containers which |
| 1131 // may have already gone away. | 1130 // may have already gone away. |
| 1132 WmWindow* root = GetWindow(); | 1131 WmWindow* root = GetWindow(); |
| 1133 if (shell->GetRootWindowForNewWindows() == root) { | 1132 if (Shell::GetWmRootWindowForNewWindows() == root) { |
| 1134 // The root window for new windows is being destroyed. Switch to the primary | 1133 // The root window for new windows is being destroyed. Switch to the primary |
| 1135 // root window if possible. | 1134 // root window if possible. |
| 1136 WmWindow* primary_root = shell->GetPrimaryRootWindow(); | 1135 WmWindow* primary_root = WmShell::Get()->GetPrimaryRootWindow(); |
| 1137 shell->set_root_window_for_new_windows(primary_root == root ? nullptr | 1136 Shell::GetInstance()->set_root_window_for_new_windows( |
| 1138 : primary_root); | 1137 primary_root == root ? nullptr : primary_root); |
| 1139 } | 1138 } |
| 1140 } | 1139 } |
| 1141 | 1140 |
| 1142 void RootWindowController::OnMenuClosed() { | 1141 void RootWindowController::OnMenuClosed() { |
| 1143 menu_runner_.reset(); | 1142 menu_runner_.reset(); |
| 1144 menu_model_adapter_.reset(); | 1143 menu_model_adapter_.reset(); |
| 1145 menu_model_.reset(); | 1144 menu_model_.reset(); |
| 1146 wm_shelf_->UpdateVisibilityState(); | 1145 wm_shelf_->UpdateVisibilityState(); |
| 1147 } | 1146 } |
| 1148 | 1147 |
| 1149 void RootWindowController::OnLoginStateChanged(LoginStatus status) { | 1148 void RootWindowController::OnLoginStateChanged(LoginStatus status) { |
| 1150 wm_shelf_->UpdateVisibilityState(); | 1149 wm_shelf_->UpdateVisibilityState(); |
| 1151 } | 1150 } |
| 1152 | 1151 |
| 1153 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { | 1152 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { |
| 1154 if (enabled) | 1153 if (enabled) |
| 1155 EnableTouchHudProjection(); | 1154 EnableTouchHudProjection(); |
| 1156 else | 1155 else |
| 1157 DisableTouchHudProjection(); | 1156 DisableTouchHudProjection(); |
| 1158 } | 1157 } |
| 1159 | 1158 |
| 1160 RootWindowController* GetRootWindowController(const aura::Window* root_window) { | 1159 RootWindowController* GetRootWindowController(const aura::Window* root_window) { |
| 1161 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; | 1160 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; |
| 1162 } | 1161 } |
| 1163 | 1162 |
| 1164 } // namespace ash | 1163 } // namespace ash |
| OLD | NEW |