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