| 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_shell.h" | 5 #include "ash/common/wm_shell.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/common/accelerators/accelerator_controller.h" | 9 #include "ash/common/accelerators/accelerator_controller.h" |
| 10 #include "ash/common/accelerators/ash_focus_manager_factory.h" | 10 #include "ash/common/accelerators/ash_focus_manager_factory.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC | 83 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC |
| 84 // shelf items in Chrome) so explicitly shutdown early. | 84 // shelf items in Chrome) so explicitly shutdown early. |
| 85 shelf_model_->DestroyItemDelegates(); | 85 shelf_model_->DestroyItemDelegates(); |
| 86 // Must be destroyed before FocusClient. | 86 // Must be destroyed before FocusClient. |
| 87 shelf_delegate_.reset(); | 87 shelf_delegate_.reset(); |
| 88 | 88 |
| 89 // Balances the Install() in Initialize(). | 89 // Balances the Install() in Initialize(). |
| 90 views::FocusManagerFactory::Install(nullptr); | 90 views::FocusManagerFactory::Install(nullptr); |
| 91 } | 91 } |
| 92 | 92 |
| 93 void WmShell::CreateShelfDelegate() { |
| 94 // May be called multiple times as shelves are created and destroyed. |
| 95 if (shelf_delegate_) |
| 96 return; |
| 97 // Must occur after SessionStateDelegate creation and user login because |
| 98 // Chrome's implementation of ShelfDelegate assumes it can get information |
| 99 // about multi-profile login state. |
| 100 DCHECK(GetSessionStateDelegate()); |
| 101 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); |
| 102 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model_.get())); |
| 103 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model_.get())); |
| 104 } |
| 105 |
| 93 void WmShell::OnMaximizeModeStarted() { | 106 void WmShell::OnMaximizeModeStarted() { |
| 94 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeStarted()); | 107 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeStarted()); |
| 95 } | 108 } |
| 96 | 109 |
| 97 void WmShell::OnMaximizeModeEnded() { | 110 void WmShell::OnMaximizeModeEnded() { |
| 98 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeEnded()); | 111 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeEnded()); |
| 99 } | 112 } |
| 100 | 113 |
| 101 void WmShell::NotifyFullscreenStateChanged(bool is_fullscreen, | 114 void WmShell::NotifyFullscreenStateChanged(bool is_fullscreen, |
| 102 WmWindow* root_window) { | 115 WmWindow* root_window) { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 } | 254 } |
| 242 | 255 |
| 243 void WmShell::DeleteSystemTrayDelegate() { | 256 void WmShell::DeleteSystemTrayDelegate() { |
| 244 DCHECK(system_tray_delegate_); | 257 DCHECK(system_tray_delegate_); |
| 245 #if defined(OS_CHROMEOS) | 258 #if defined(OS_CHROMEOS) |
| 246 logout_confirmation_controller_.reset(); | 259 logout_confirmation_controller_.reset(); |
| 247 #endif | 260 #endif |
| 248 system_tray_delegate_.reset(); | 261 system_tray_delegate_.reset(); |
| 249 } | 262 } |
| 250 | 263 |
| 251 void WmShell::CreateShelfDelegate() { | |
| 252 // May be called multiple times as shelves are created and destroyed. | |
| 253 if (shelf_delegate_) | |
| 254 return; | |
| 255 // Must occur after SessionStateDelegate creation and user login because | |
| 256 // Chrome's implementation of ShelfDelegate assumes it can get information | |
| 257 // about multi-profile login state. | |
| 258 DCHECK(GetSessionStateDelegate()); | |
| 259 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); | |
| 260 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model_.get())); | |
| 261 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model_.get())); | |
| 262 } | |
| 263 | |
| 264 void WmShell::DeleteWindowCycleController() { | 264 void WmShell::DeleteWindowCycleController() { |
| 265 window_cycle_controller_.reset(); | 265 window_cycle_controller_.reset(); |
| 266 } | 266 } |
| 267 | 267 |
| 268 void WmShell::DeleteWindowSelectorController() { | 268 void WmShell::DeleteWindowSelectorController() { |
| 269 window_selector_controller_.reset(); | 269 window_selector_controller_.reset(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void WmShell::CreateMaximizeModeController() { | 272 void WmShell::CreateMaximizeModeController() { |
| 273 maximize_mode_controller_.reset(new MaximizeModeController); | 273 maximize_mode_controller_.reset(new MaximizeModeController); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 288 void WmShell::DeleteToastManager() { | 288 void WmShell::DeleteToastManager() { |
| 289 toast_manager_.reset(); | 289 toast_manager_.reset(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 void WmShell::SetAcceleratorController( | 292 void WmShell::SetAcceleratorController( |
| 293 std::unique_ptr<AcceleratorController> accelerator_controller) { | 293 std::unique_ptr<AcceleratorController> accelerator_controller) { |
| 294 accelerator_controller_ = std::move(accelerator_controller); | 294 accelerator_controller_ = std::move(accelerator_controller); |
| 295 } | 295 } |
| 296 | 296 |
| 297 } // namespace ash | 297 } // namespace ash |
| OLD | NEW |