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 #ifndef ASH_COMMON_WM_SHELL_H_ | 5 #ifndef ASH_COMMON_WM_SHELL_H_ |
6 #define ASH_COMMON_WM_SHELL_H_ | 6 #define ASH_COMMON_WM_SHELL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "ash/ash_export.h" | 13 #include "ash/ash_export.h" |
14 #include "ash/common/media_delegate.h" | 14 #include "ash/common/media_delegate.h" |
15 #include "ash/common/metrics/user_metrics_action.h" | 15 #include "ash/common/metrics/user_metrics_action.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 | 17 |
18 namespace gfx { | 18 namespace gfx { |
19 class Rect; | 19 class Rect; |
20 } | 20 } |
21 | 21 |
22 namespace views { | 22 namespace views { |
23 class PointerWatcher; | 23 class PointerWatcher; |
24 } | 24 } |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
27 | 27 |
28 class AccessibilityDelegate; | 28 class AccessibilityDelegate; |
29 class BrightnessControlDelegate; | |
29 class DisplayInfo; | 30 class DisplayInfo; |
30 class FocusCycler; | 31 class FocusCycler; |
31 class KeyboardUI; | 32 class KeyboardUI; |
32 class MaximizeModeController; | 33 class MaximizeModeController; |
33 class MruWindowTracker; | 34 class MruWindowTracker; |
34 class ScopedDisableInternalMouseAndKeyboard; | 35 class ScopedDisableInternalMouseAndKeyboard; |
35 class SessionStateDelegate; | 36 class SessionStateDelegate; |
36 class ShellDelegate; | 37 class ShellDelegate; |
37 class ShellObserver; | 38 class ShellObserver; |
38 class SystemTrayDelegate; | 39 class SystemTrayDelegate; |
39 class SystemTrayNotifier; | 40 class SystemTrayNotifier; |
40 class WindowResizer; | 41 class WindowResizer; |
41 class WindowSelectorController; | 42 class WindowSelectorController; |
42 class WmActivationObserver; | 43 class WmActivationObserver; |
43 class WmDisplayObserver; | 44 class WmDisplayObserver; |
44 class WmRootWindowController; | 45 class WmRootWindowController; |
45 class WmWindow; | 46 class WmWindow; |
46 | 47 |
48 namespace test { | |
49 class AshTestBase; | |
50 } | |
51 | |
47 namespace wm { | 52 namespace wm { |
48 class MaximizeModeEventHandler; | 53 class MaximizeModeEventHandler; |
49 class WindowState; | 54 class WindowState; |
50 } | 55 } |
51 | 56 |
52 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
53 class LogoutConfirmationController; | 58 class LogoutConfirmationController; |
54 #endif | 59 #endif |
55 | 60 |
56 // Similar to ash::Shell. Eventually the two will be merged. | 61 // Similar to ash::Shell. Eventually the two will be merged. |
57 class ASH_EXPORT WmShell { | 62 class ASH_EXPORT WmShell { |
58 public: | 63 public: |
59 // This is necessary for a handful of places that is difficult to plumb | 64 // This is necessary for a handful of places that is difficult to plumb |
60 // through context. | 65 // through context. |
61 static void Set(WmShell* instance); | 66 static void Set(WmShell* instance); |
62 static WmShell* Get(); | 67 static WmShell* Get(); |
63 static bool HasInstance() { return instance_ != nullptr; } | 68 static bool HasInstance() { return instance_ != nullptr; } |
64 | 69 |
65 ShellDelegate* delegate() { return delegate_.get(); } | 70 ShellDelegate* delegate() { return delegate_.get(); } |
66 | 71 |
72 BrightnessControlDelegate* brightness_control_delegate() const { | |
73 return brightness_control_delegate_.get(); | |
74 } | |
75 | |
67 FocusCycler* focus_cycler() { return focus_cycler_.get(); } | 76 FocusCycler* focus_cycler() { return focus_cycler_.get(); } |
68 | 77 |
69 KeyboardUI* keyboard_ui() { return keyboard_ui_.get(); } | 78 KeyboardUI* keyboard_ui() { return keyboard_ui_.get(); } |
70 | 79 |
71 MaximizeModeController* maximize_mode_controller() { | 80 MaximizeModeController* maximize_mode_controller() { |
72 return maximize_mode_controller_.get(); | 81 return maximize_mode_controller_.get(); |
73 } | 82 } |
74 | 83 |
75 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } | 84 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); } |
76 | 85 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
210 #endif | 219 #endif |
211 | 220 |
212 protected: | 221 protected: |
213 explicit WmShell(ShellDelegate* delegate); | 222 explicit WmShell(ShellDelegate* delegate); |
214 virtual ~WmShell(); | 223 virtual ~WmShell(); |
215 | 224 |
216 base::ObserverList<ShellObserver>* shell_observers() { | 225 base::ObserverList<ShellObserver>* shell_observers() { |
217 return &shell_observers_; | 226 return &shell_observers_; |
218 } | 227 } |
219 | 228 |
229 void SetBrightnessControlDelegate( | |
230 std::unique_ptr<BrightnessControlDelegate> brightness_control_delegate); | |
231 | |
220 void SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui); | 232 void SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui); |
221 | 233 |
222 // Helpers to set (and initialize) or destroy various delegates. | 234 // Helpers to set (and initialize) or destroy various delegates. |
223 // TODO(msw|jamescook): Remove these once ShellDelegate, etc. are ported. | 235 // TODO(msw|jamescook): Remove these once ShellDelegate, etc. are ported. |
224 void SetMediaDelegate(std::unique_ptr<MediaDelegate> delegate); | 236 void SetMediaDelegate(std::unique_ptr<MediaDelegate> delegate); |
225 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); | 237 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); |
226 void DeleteSystemTrayDelegate(); | 238 void DeleteSystemTrayDelegate(); |
227 | 239 |
228 void DeleteWindowSelectorController(); | 240 void DeleteWindowSelectorController(); |
229 | 241 |
230 void CreateMaximizeModeController(); | 242 void CreateMaximizeModeController(); |
231 void DeleteMaximizeModeController(); | 243 void DeleteMaximizeModeController(); |
232 | 244 |
233 void CreateMruWindowTracker(); | 245 void CreateMruWindowTracker(); |
234 void DeleteMruWindowTracker(); | 246 void DeleteMruWindowTracker(); |
235 | 247 |
236 private: | 248 private: |
237 friend class Shell; | 249 friend class Shell; |
250 friend class test::AshTestBase; | |
msw
2016/07/07 22:41:59
I could instead make SetBrightnessControlDelegate
James Cook
2016/07/07 23:08:49
I would friend AcceleratorControllerTest.
msw
2016/07/08 01:40:48
Done.
| |
238 | 251 |
239 static WmShell* instance_; | 252 static WmShell* instance_; |
240 | 253 |
241 base::ObserverList<ShellObserver> shell_observers_; | 254 base::ObserverList<ShellObserver> shell_observers_; |
242 std::unique_ptr<ShellDelegate> delegate_; | 255 std::unique_ptr<ShellDelegate> delegate_; |
256 | |
257 std::unique_ptr<BrightnessControlDelegate> brightness_control_delegate_; | |
243 std::unique_ptr<FocusCycler> focus_cycler_; | 258 std::unique_ptr<FocusCycler> focus_cycler_; |
244 std::unique_ptr<KeyboardUI> keyboard_ui_; | 259 std::unique_ptr<KeyboardUI> keyboard_ui_; |
245 std::unique_ptr<MaximizeModeController> maximize_mode_controller_; | 260 std::unique_ptr<MaximizeModeController> maximize_mode_controller_; |
246 std::unique_ptr<MediaDelegate> media_delegate_; | 261 std::unique_ptr<MediaDelegate> media_delegate_; |
247 std::unique_ptr<MruWindowTracker> mru_window_tracker_; | 262 std::unique_ptr<MruWindowTracker> mru_window_tracker_; |
248 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; | 263 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; |
249 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; | 264 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; |
250 std::unique_ptr<WindowSelectorController> window_selector_controller_; | 265 std::unique_ptr<WindowSelectorController> window_selector_controller_; |
251 | 266 |
252 bool simulate_modal_window_open_for_testing_ = false; | 267 bool simulate_modal_window_open_for_testing_ = false; |
253 | 268 |
254 #if defined(OS_CHROMEOS) | 269 #if defined(OS_CHROMEOS) |
255 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_; | 270 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_; |
256 #endif | 271 #endif |
257 }; | 272 }; |
258 | 273 |
259 } // namespace ash | 274 } // namespace ash |
260 | 275 |
261 #endif // ASH_COMMON_WM_SHELL_H_ | 276 #endif // ASH_COMMON_WM_SHELL_H_ |
OLD | NEW |