| 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 1106 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(); | 1127 Shell* shell = Shell::GetInstance(); |
| 1128 // Change the target root window before closing child windows. If any child | 1128 // 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 | 1129 // 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 | 1130 // window list adding windows from the target root window's containers which |
| 1131 // may have already gone away. | 1131 // may have already gone away. |
| 1132 WmWindow* root = GetWindow(); | 1132 WmWindow* root = GetWindow(); |
| 1133 if (shell->GetRootWindowForNewWindows() == root) { | 1133 if (shell->GetRootWindowForNewWindows() == root) { |
| 1134 // The root window for new windows is being destroyed. Switch to the primary | 1134 // The root window for new windows is being destroyed. Switch to the primary |
| 1135 // root window if possible. | 1135 // root window if possible. |
| 1136 WmWindow* primary_root = shell->GetPrimaryRootWindow(); | 1136 WmWindow* primary_root = WmShell::Get()->GetPrimaryRootWindow(); |
| 1137 shell->set_root_window_for_new_windows(primary_root == root ? nullptr | 1137 shell->set_root_window_for_new_windows(primary_root == root ? nullptr |
| 1138 : primary_root); | 1138 : primary_root); |
| 1139 } | 1139 } |
| 1140 } | 1140 } |
| 1141 | 1141 |
| 1142 void RootWindowController::OnMenuClosed() { | 1142 void RootWindowController::OnMenuClosed() { |
| 1143 menu_runner_.reset(); | 1143 menu_runner_.reset(); |
| 1144 menu_model_adapter_.reset(); | 1144 menu_model_adapter_.reset(); |
| 1145 menu_model_.reset(); | 1145 menu_model_.reset(); |
| 1146 wm_shelf_->UpdateVisibilityState(); | 1146 wm_shelf_->UpdateVisibilityState(); |
| 1147 } | 1147 } |
| 1148 | 1148 |
| 1149 void RootWindowController::OnLoginStateChanged(LoginStatus status) { | 1149 void RootWindowController::OnLoginStateChanged(LoginStatus status) { |
| 1150 wm_shelf_->UpdateVisibilityState(); | 1150 wm_shelf_->UpdateVisibilityState(); |
| 1151 } | 1151 } |
| 1152 | 1152 |
| 1153 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { | 1153 void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { |
| 1154 if (enabled) | 1154 if (enabled) |
| 1155 EnableTouchHudProjection(); | 1155 EnableTouchHudProjection(); |
| 1156 else | 1156 else |
| 1157 DisableTouchHudProjection(); | 1157 DisableTouchHudProjection(); |
| 1158 } | 1158 } |
| 1159 | 1159 |
| 1160 RootWindowController* GetRootWindowController(const aura::Window* root_window) { | 1160 RootWindowController* GetRootWindowController(const aura::Window* root_window) { |
| 1161 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; | 1161 return root_window ? GetRootWindowSettings(root_window)->controller : nullptr; |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 } // namespace ash | 1164 } // namespace ash |
| OLD | NEW |