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/accessibility_delegate.h" | 9 #include "ash/common/accessibility_delegate.h" |
10 #include "ash/common/focus_cycler.h" | 10 #include "ash/common/focus_cycler.h" |
11 #include "ash/common/keyboard/keyboard_ui.h" | 11 #include "ash/common/keyboard/keyboard_ui.h" |
12 #include "ash/common/shelf/app_list_shelf_item_delegate.h" | |
12 #include "ash/common/shelf/shelf_model.h" | 13 #include "ash/common/shelf/shelf_model.h" |
13 #include "ash/common/shell_delegate.h" | 14 #include "ash/common/shell_delegate.h" |
14 #include "ash/common/shell_window_ids.h" | 15 #include "ash/common/shell_window_ids.h" |
15 #include "ash/common/system/brightness_control_delegate.h" | 16 #include "ash/common/system/brightness_control_delegate.h" |
16 #include "ash/common/system/keyboard_brightness_control_delegate.h" | 17 #include "ash/common/system/keyboard_brightness_control_delegate.h" |
17 #include "ash/common/system/toast/toast_manager.h" | 18 #include "ash/common/system/toast/toast_manager.h" |
18 #include "ash/common/system/tray/system_tray_delegate.h" | 19 #include "ash/common/system/tray/system_tray_delegate.h" |
19 #include "ash/common/system/tray/system_tray_notifier.h" | 20 #include "ash/common/system/tray/system_tray_notifier.h" |
20 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" | 21 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" |
21 #include "ash/common/wm/mru_window_tracker.h" | 22 #include "ash/common/wm/mru_window_tracker.h" |
(...skipping 25 matching lines...) Expand all Loading... | |
47 WmShell* WmShell::Get() { | 48 WmShell* WmShell::Get() { |
48 return instance_; | 49 return instance_; |
49 } | 50 } |
50 | 51 |
51 void WmShell::Initialize() { | 52 void WmShell::Initialize() { |
52 // Some delegates access WmShell during their construction. Create them here | 53 // Some delegates access WmShell during their construction. Create them here |
53 // instead of the WmShell constructor. | 54 // instead of the WmShell constructor. |
54 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate()); | 55 accessibility_delegate_.reset(delegate_->CreateAccessibilityDelegate()); |
55 media_delegate_.reset(delegate_->CreateMediaDelegate()); | 56 media_delegate_.reset(delegate_->CreateMediaDelegate()); |
56 toast_manager_.reset(new ToastManager); | 57 toast_manager_.reset(new ToastManager); |
58 | |
59 // Create the app list item in the shelf data model. | |
60 AppListShelfItemDelegate::CreateAppListItemAndDelegate(shelf_model_.get()); | |
57 } | 61 } |
58 | 62 |
59 void WmShell::Shutdown() { | 63 void WmShell::Shutdown() { |
60 // Accesses WmShell in its destructor. | 64 // Accesses WmShell in its destructor. |
61 accessibility_delegate_.reset(); | 65 accessibility_delegate_.reset(); |
66 // ShelfItemDelegate subclasses it owns have complex cleanup to run, so | |
msw
2016/07/21 21:30:53
Is this still needed? Don't stress too much lookin
James Cook
2016/07/22 01:20:08
My worries about ARC items are the same as in the
msw
2016/07/22 01:49:51
Do you mean ArcAppDeferredLauncherItemController a
| |
67 // explicitly shutdown early. | |
68 shelf_model_->Shutdown(); | |
62 } | 69 } |
63 | 70 |
64 void WmShell::OnMaximizeModeStarted() { | 71 void WmShell::OnMaximizeModeStarted() { |
65 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeStarted()); | 72 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeStarted()); |
66 } | 73 } |
67 | 74 |
68 void WmShell::OnMaximizeModeEnded() { | 75 void WmShell::OnMaximizeModeEnded() { |
69 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeEnded()); | 76 FOR_EACH_OBSERVER(ShellObserver, shell_observers_, OnMaximizeModeEnded()); |
70 } | 77 } |
71 | 78 |
(...skipping 24 matching lines...) Expand all Loading... | |
96 lock_state_observers_.AddObserver(observer); | 103 lock_state_observers_.AddObserver(observer); |
97 } | 104 } |
98 | 105 |
99 void WmShell::RemoveLockStateObserver(LockStateObserver* observer) { | 106 void WmShell::RemoveLockStateObserver(LockStateObserver* observer) { |
100 lock_state_observers_.RemoveObserver(observer); | 107 lock_state_observers_.RemoveObserver(observer); |
101 } | 108 } |
102 | 109 |
103 WmShell::WmShell(std::unique_ptr<ShellDelegate> shell_delegate) | 110 WmShell::WmShell(std::unique_ptr<ShellDelegate> shell_delegate) |
104 : delegate_(std::move(shell_delegate)), | 111 : delegate_(std::move(shell_delegate)), |
105 focus_cycler_(new FocusCycler), | 112 focus_cycler_(new FocusCycler), |
106 shelf_model_(new ShelfModel), | 113 shelf_model_(new ShelfModel), // Must create before ShelfDelegate. |
107 system_tray_notifier_(new SystemTrayNotifier), | 114 system_tray_notifier_(new SystemTrayNotifier), |
115 window_cycle_controller_(new WindowCycleController), | |
108 window_selector_controller_(new WindowSelectorController) { | 116 window_selector_controller_(new WindowSelectorController) { |
109 #if defined(OS_CHROMEOS) | 117 #if defined(OS_CHROMEOS) |
110 brightness_control_delegate_.reset(new system::BrightnessControllerChromeos); | 118 brightness_control_delegate_.reset(new system::BrightnessControllerChromeos); |
111 keyboard_brightness_control_delegate_.reset(new KeyboardBrightnessController); | 119 keyboard_brightness_control_delegate_.reset(new KeyboardBrightnessController); |
112 #endif | 120 #endif |
113 window_cycle_controller_.reset(new WindowCycleController()); | |
114 } | 121 } |
115 | 122 |
116 WmShell::~WmShell() {} | 123 WmShell::~WmShell() {} |
117 | 124 |
118 bool WmShell::IsSystemModalWindowOpen() { | 125 bool WmShell::IsSystemModalWindowOpen() { |
119 if (simulate_modal_window_open_for_testing_) | 126 if (simulate_modal_window_open_for_testing_) |
120 return true; | 127 return true; |
121 | 128 |
122 // Traverse all system modal containers, and find its direct child window | 129 // Traverse all system modal containers, and find its direct child window |
123 // with "SystemModal" setting, and visible. | 130 // with "SystemModal" setting, and visible. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 | 216 |
210 void WmShell::DeleteMruWindowTracker() { | 217 void WmShell::DeleteMruWindowTracker() { |
211 mru_window_tracker_.reset(); | 218 mru_window_tracker_.reset(); |
212 } | 219 } |
213 | 220 |
214 void WmShell::DeleteToastManager() { | 221 void WmShell::DeleteToastManager() { |
215 toast_manager_.reset(); | 222 toast_manager_.reset(); |
216 } | 223 } |
217 | 224 |
218 } // namespace ash | 225 } // namespace ash |
OLD | NEW |