| 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" |
| 11 #include "ash/common/accessibility_delegate.h" | 11 #include "ash/common/accessibility_delegate.h" |
| 12 #include "ash/common/focus_cycler.h" | 12 #include "ash/common/focus_cycler.h" |
| 13 #include "ash/common/keyboard/keyboard_ui.h" | 13 #include "ash/common/keyboard/keyboard_ui.h" |
| 14 #include "ash/common/new_window_delegate.h" | 14 #include "ash/common/new_window_delegate.h" |
| 15 #include "ash/common/session/session_state_delegate.h" | 15 #include "ash/common/session/session_state_delegate.h" |
| 16 #include "ash/common/shelf/app_list_shelf_item_delegate.h" | 16 #include "ash/common/shelf/app_list_shelf_item_delegate.h" |
| 17 #include "ash/common/shelf/shelf_delegate.h" | 17 #include "ash/common/shelf/shelf_delegate.h" |
| 18 #include "ash/common/shelf/shelf_model.h" | 18 #include "ash/common/shelf/shelf_model.h" |
| 19 #include "ash/common/shelf/shelf_window_watcher.h" |
| 19 #include "ash/common/shell_delegate.h" | 20 #include "ash/common/shell_delegate.h" |
| 20 #include "ash/common/shell_window_ids.h" | 21 #include "ash/common/shell_window_ids.h" |
| 21 #include "ash/common/system/brightness_control_delegate.h" | 22 #include "ash/common/system/brightness_control_delegate.h" |
| 22 #include "ash/common/system/keyboard_brightness_control_delegate.h" | 23 #include "ash/common/system/keyboard_brightness_control_delegate.h" |
| 23 #include "ash/common/system/toast/toast_manager.h" | 24 #include "ash/common/system/toast/toast_manager.h" |
| 24 #include "ash/common/system/tray/system_tray_delegate.h" | 25 #include "ash/common/system/tray/system_tray_delegate.h" |
| 25 #include "ash/common/system/tray/system_tray_notifier.h" | 26 #include "ash/common/system/tray/system_tray_notifier.h" |
| 26 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 27 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
| 27 #include "ash/common/wm/mru_window_tracker.h" | 28 #include "ash/common/wm/mru_window_tracker.h" |
| 28 #include "ash/common/wm/overview/window_selector_controller.h" | 29 #include "ash/common/wm/overview/window_selector_controller.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 // Install the custom factory early on so that views::FocusManagers for Tray, | 69 // Install the custom factory early on so that views::FocusManagers for Tray, |
| 69 // Shelf, and WallPaper could be created by the factory. | 70 // Shelf, and WallPaper could be created by the factory. |
| 70 views::FocusManagerFactory::Install(new AshFocusManagerFactory); | 71 views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
| 71 | 72 |
| 72 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate()); | 73 new_window_delegate_.reset(delegate_->CreateNewWindowDelegate()); |
| 73 } | 74 } |
| 74 | 75 |
| 75 void WmShell::Shutdown() { | 76 void WmShell::Shutdown() { |
| 76 // Accesses WmShell in its destructor. | 77 // Accesses WmShell in its destructor. |
| 77 accessibility_delegate_.reset(); | 78 accessibility_delegate_.reset(); |
| 79 // ShelfWindowWatcher has window observers and a pointer to the shelf model. |
| 80 shelf_window_watcher_.reset(); |
| 78 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC | 81 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC |
| 79 // shelf items in Chrome) so explicitly shutdown early. | 82 // shelf items in Chrome) so explicitly shutdown early. |
| 80 shelf_model_->DestroyItemDelegates(); | 83 shelf_model_->DestroyItemDelegates(); |
| 81 // Must be destroyed before FocusClient. | 84 // Must be destroyed before FocusClient. |
| 82 shelf_delegate_.reset(); | 85 shelf_delegate_.reset(); |
| 83 | 86 |
| 84 // Balances the Install() in Initialize(). | 87 // Balances the Install() in Initialize(). |
| 85 views::FocusManagerFactory::Install(nullptr); | 88 views::FocusManagerFactory::Install(nullptr); |
| 86 } | 89 } |
| 87 | 90 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 void WmShell::CreateShelfDelegate() { | 228 void WmShell::CreateShelfDelegate() { |
| 226 // May be called multiple times as shelves are created and destroyed. | 229 // May be called multiple times as shelves are created and destroyed. |
| 227 if (shelf_delegate_) | 230 if (shelf_delegate_) |
| 228 return; | 231 return; |
| 229 // Must occur after SessionStateDelegate creation and user login because | 232 // Must occur after SessionStateDelegate creation and user login because |
| 230 // Chrome's implementation of ShelfDelegate assumes it can get information | 233 // Chrome's implementation of ShelfDelegate assumes it can get information |
| 231 // about multi-profile login state. | 234 // about multi-profile login state. |
| 232 DCHECK(GetSessionStateDelegate()); | 235 DCHECK(GetSessionStateDelegate()); |
| 233 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); | 236 DCHECK_GT(GetSessionStateDelegate()->NumberOfLoggedInUsers(), 0); |
| 234 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model_.get())); | 237 shelf_delegate_.reset(delegate_->CreateShelfDelegate(shelf_model_.get())); |
| 238 shelf_window_watcher_.reset(new ShelfWindowWatcher(shelf_model_.get())); |
| 235 } | 239 } |
| 236 | 240 |
| 237 void WmShell::DeleteWindowCycleController() { | 241 void WmShell::DeleteWindowCycleController() { |
| 238 window_cycle_controller_.reset(); | 242 window_cycle_controller_.reset(); |
| 239 } | 243 } |
| 240 | 244 |
| 241 void WmShell::DeleteWindowSelectorController() { | 245 void WmShell::DeleteWindowSelectorController() { |
| 242 window_selector_controller_.reset(); | 246 window_selector_controller_.reset(); |
| 243 } | 247 } |
| 244 | 248 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 261 void WmShell::DeleteToastManager() { | 265 void WmShell::DeleteToastManager() { |
| 262 toast_manager_.reset(); | 266 toast_manager_.reset(); |
| 263 } | 267 } |
| 264 | 268 |
| 265 void WmShell::SetAcceleratorController( | 269 void WmShell::SetAcceleratorController( |
| 266 std::unique_ptr<AcceleratorController> accelerator_controller) { | 270 std::unique_ptr<AcceleratorController> accelerator_controller) { |
| 267 accelerator_controller_ = std::move(accelerator_controller); | 271 accelerator_controller_ = std::move(accelerator_controller); |
| 268 } | 272 } |
| 269 | 273 |
| 270 } // namespace ash | 274 } // namespace ash |
| OLD | NEW |