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/accessibility_delegate.h" | 11 #include "ash/common/accessibility_delegate.h" |
11 #include "ash/common/focus_cycler.h" | 12 #include "ash/common/focus_cycler.h" |
12 #include "ash/common/keyboard/keyboard_ui.h" | 13 #include "ash/common/keyboard/keyboard_ui.h" |
13 #include "ash/common/session/session_state_delegate.h" | 14 #include "ash/common/session/session_state_delegate.h" |
14 #include "ash/common/shelf/app_list_shelf_item_delegate.h" | 15 #include "ash/common/shelf/app_list_shelf_item_delegate.h" |
15 #include "ash/common/shelf/shelf_delegate.h" | 16 #include "ash/common/shelf/shelf_delegate.h" |
16 #include "ash/common/shelf/shelf_model.h" | 17 #include "ash/common/shelf/shelf_model.h" |
17 #include "ash/common/shell_delegate.h" | 18 #include "ash/common/shell_delegate.h" |
18 #include "ash/common/shell_window_ids.h" | 19 #include "ash/common/shell_window_ids.h" |
19 #include "ash/common/system/brightness_control_delegate.h" | 20 #include "ash/common/system/brightness_control_delegate.h" |
20 #include "ash/common/system/keyboard_brightness_control_delegate.h" | 21 #include "ash/common/system/keyboard_brightness_control_delegate.h" |
21 #include "ash/common/system/toast/toast_manager.h" | 22 #include "ash/common/system/toast/toast_manager.h" |
22 #include "ash/common/system/tray/system_tray_delegate.h" | 23 #include "ash/common/system/tray/system_tray_delegate.h" |
23 #include "ash/common/system/tray/system_tray_notifier.h" | 24 #include "ash/common/system/tray/system_tray_notifier.h" |
24 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 25 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
25 #include "ash/common/wm/mru_window_tracker.h" | 26 #include "ash/common/wm/mru_window_tracker.h" |
26 #include "ash/common/wm/overview/window_selector_controller.h" | 27 #include "ash/common/wm/overview/window_selector_controller.h" |
27 #include "ash/common/wm/window_cycle_controller.h" | 28 #include "ash/common/wm/window_cycle_controller.h" |
28 #include "ash/common/wm_window.h" | 29 #include "ash/common/wm_window.h" |
29 #include "base/bind.h" | 30 #include "base/bind.h" |
30 #include "base/logging.h" | 31 #include "base/logging.h" |
31 #include "ui/app_list/presenter/app_list_presenter.h" | 32 #include "ui/app_list/presenter/app_list_presenter.h" |
32 #include "ui/display/display.h" | 33 #include "ui/display/display.h" |
| 34 #include "ui/views/focus/focus_manager_factory.h" |
33 | 35 |
34 #if defined(OS_CHROMEOS) | 36 #if defined(OS_CHROMEOS) |
35 #include "ash/common/system/chromeos/brightness/brightness_controller_chromeos.h
" | 37 #include "ash/common/system/chromeos/brightness/brightness_controller_chromeos.h
" |
36 #include "ash/common/system/chromeos/keyboard_brightness_controller.h" | 38 #include "ash/common/system/chromeos/keyboard_brightness_controller.h" |
37 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" | 39 #include "ash/common/system/chromeos/session/logout_confirmation_controller.h" |
38 #endif | 40 #endif |
39 | 41 |
40 namespace ash { | 42 namespace ash { |
41 | 43 |
42 // static | 44 // static |
(...skipping 11 matching lines...) Expand all Loading... |
54 | 56 |
55 void WmShell::Initialize() { | 57 void WmShell::Initialize() { |
56 // Some delegates access WmShell during their construction. Create them here | 58 // Some delegates access WmShell during their construction. Create them here |
57 // instead of the WmShell constructor. | 59 // instead of the WmShell constructor. |
58 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate()); | 60 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate()); |
59 media_delegate_.reset(delegate_->CreateMediaDelegate()); | 61 media_delegate_.reset(delegate_->CreateMediaDelegate()); |
60 toast_manager_.reset(new ToastManager); | 62 toast_manager_.reset(new ToastManager); |
61 | 63 |
62 // Create the app list item in the shelf data model. | 64 // Create the app list item in the shelf data model. |
63 AppListShelfItemDelegate::CreateAppListItemAndDelegate(shelf_model_.get()); | 65 AppListShelfItemDelegate::CreateAppListItemAndDelegate(shelf_model_.get()); |
| 66 |
| 67 // Install the custom factory early on so that views::FocusManagers for Tray, |
| 68 // Shelf, and WallPaper could be created by the factory. |
| 69 views::FocusManagerFactory::Install(new AshFocusManagerFactory); |
64 } | 70 } |
65 | 71 |
66 void WmShell::Shutdown() { | 72 void WmShell::Shutdown() { |
67 // Accesses WmShell in its destructor. | 73 // Accesses WmShell in its destructor. |
68 accessibility_delegate_.reset(); | 74 accessibility_delegate_.reset(); |
69 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC | 75 // ShelfItemDelegate subclasses it owns have complex cleanup to run (e.g. ARC |
70 // shelf items in Chrome) so explicitly shutdown early. | 76 // shelf items in Chrome) so explicitly shutdown early. |
71 shelf_model_->DestroyItemDelegates(); | 77 shelf_model_->DestroyItemDelegates(); |
72 // Must be destroyed before FocusClient. | 78 // Must be destroyed before FocusClient. |
73 shelf_delegate_.reset(); | 79 shelf_delegate_.reset(); |
| 80 |
| 81 // Balances the Install() in Initialize(). |
| 82 views::FocusManagerFactory::Install(nullptr); |
74 } | 83 } |
75 | 84 |
76 void WmShell::OnMaximizeModeStarted() { | 85 void WmShell::OnMaximizeModeStarted() { |
77 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeStarted()); | 86 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeStarted()); |
78 } | 87 } |
79 | 88 |
80 void WmShell::OnMaximizeModeEnded() { | 89 void WmShell::OnMaximizeModeEnded() { |
81 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeEnded()); | 90 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeEnded()); |
82 } | 91 } |
83 | 92 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 void WmShell::DeleteToastManager() { | 252 void WmShell::DeleteToastManager() { |
244 toast_manager_.reset(); | 253 toast_manager_.reset(); |
245 } | 254 } |
246 | 255 |
247 void WmShell::SetAcceleratorController( | 256 void WmShell::SetAcceleratorController( |
248 std::unique_ptr<AcceleratorController> accelerator_controller) { | 257 std::unique_ptr<AcceleratorController> accelerator_controller) { |
249 accelerator_controller_ = std::move(accelerator_controller); | 258 accelerator_controller_ = std::move(accelerator_controller); |
250 } | 259 } |
251 | 260 |
252 } // namespace ash | 261 } // namespace ash |
OLD | NEW |