Chromium Code Reviews| 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> |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 | 23 |
| 24 namespace ash { | 24 namespace ash { |
| 25 | 25 |
| 26 class AccessibilityDelegate; | 26 class AccessibilityDelegate; |
| 27 class DisplayInfo; | 27 class DisplayInfo; |
| 28 class FocusCycler; | 28 class FocusCycler; |
| 29 class MruWindowTracker; | 29 class MruWindowTracker; |
| 30 class SessionStateDelegate; | 30 class SessionStateDelegate; |
| 31 class ShellObserver; | 31 class ShellObserver; |
| 32 class SystemTrayDelegate; | 32 class SystemTrayDelegate; |
| 33 class SystemTrayNotifier; | |
| 33 class WindowResizer; | 34 class WindowResizer; |
| 34 class WindowSelectorController; | 35 class WindowSelectorController; |
| 35 class WmActivationObserver; | 36 class WmActivationObserver; |
| 36 class WmDisplayObserver; | 37 class WmDisplayObserver; |
| 37 class SystemTrayNotifier; | 38 class WmRootWindowController; |
| 38 class WmWindow; | 39 class WmWindow; |
| 39 | 40 |
| 40 namespace wm { | 41 namespace wm { |
| 41 class WindowState; | 42 class WindowState; |
| 42 } | 43 } |
| 43 | 44 |
| 45 #if defined(OS_CHROMEOS) | |
| 46 class LogoutConfirmationController; | |
| 47 #endif | |
| 48 | |
| 44 // Similar to ash::Shell. Eventually the two will be merged. | 49 // Similar to ash::Shell. Eventually the two will be merged. |
| 45 class ASH_EXPORT WmShell { | 50 class ASH_EXPORT WmShell { |
| 46 public: | 51 public: |
| 47 // This is necessary for a handful of places that is difficult to plumb | 52 // This is necessary for a handful of places that is difficult to plumb |
| 48 // through context. | 53 // through context. |
| 49 static void Set(WmShell* instance); | 54 static void Set(WmShell* instance); |
| 50 static WmShell* Get(); | 55 static WmShell* Get(); |
| 51 static bool HasInstance() { return instance_ != nullptr; } | 56 static bool HasInstance() { return instance_ != nullptr; } |
| 52 | 57 |
| 53 FocusCycler* focus_cycler() { return focus_cycler_.get(); } | 58 FocusCycler* focus_cycler() { return focus_cycler_.get(); } |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 68 | 73 |
| 69 // Creates a new window used as a container of other windows. No painting is | 74 // Creates a new window used as a container of other windows. No painting is |
| 70 // done to the created window. | 75 // done to the created window. |
| 71 virtual WmWindow* NewContainerWindow() = 0; | 76 virtual WmWindow* NewContainerWindow() = 0; |
| 72 | 77 |
| 73 virtual WmWindow* GetFocusedWindow() = 0; | 78 virtual WmWindow* GetFocusedWindow() = 0; |
| 74 virtual WmWindow* GetActiveWindow() = 0; | 79 virtual WmWindow* GetActiveWindow() = 0; |
| 75 | 80 |
| 76 virtual WmWindow* GetPrimaryRootWindow() = 0; | 81 virtual WmWindow* GetPrimaryRootWindow() = 0; |
| 77 | 82 |
| 83 // Convenience method. Returns the WmRootWindowController for the primary | |
| 84 // root window. | |
| 85 WmRootWindowController* GetPrimaryRootWindowController(); | |
| 86 | |
| 78 // Returns the root window for the specified display. | 87 // Returns the root window for the specified display. |
| 79 virtual WmWindow* GetRootWindowForDisplayId(int64_t display_id) = 0; | 88 virtual WmWindow* GetRootWindowForDisplayId(int64_t display_id) = 0; |
| 80 | 89 |
| 81 // Returns the root window that newly created windows should be added to. | 90 // Returns the root window that newly created windows should be added to. |
| 82 // NOTE: this returns the root, newly created window should be added to the | 91 // NOTE: this returns the root, newly created window should be added to the |
| 83 // appropriate container in the returned window. | 92 // appropriate container in the returned window. |
| 84 virtual WmWindow* GetRootWindowForNewWindows() = 0; | 93 virtual WmWindow* GetRootWindowForNewWindows() = 0; |
| 85 | 94 |
| 86 // Retuns the display info associated with |display_id|. | 95 // Retuns the display info associated with |display_id|. |
| 87 // TODO(msw): Remove this when DisplayManager has been moved. crbug.com/622480 | 96 // TODO(msw): Remove this when DisplayManager has been moved. crbug.com/622480 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; | 159 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; |
| 151 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; | 160 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; |
| 152 | 161 |
| 153 virtual void AddShellObserver(ShellObserver* observer) = 0; | 162 virtual void AddShellObserver(ShellObserver* observer) = 0; |
| 154 virtual void RemoveShellObserver(ShellObserver* observer) = 0; | 163 virtual void RemoveShellObserver(ShellObserver* observer) = 0; |
| 155 | 164 |
| 156 virtual void AddPointerWatcher(views::PointerWatcher* watcher) = 0; | 165 virtual void AddPointerWatcher(views::PointerWatcher* watcher) = 0; |
| 157 virtual void RemovePointerWatcher(views::PointerWatcher* watcher) = 0; | 166 virtual void RemovePointerWatcher(views::PointerWatcher* watcher) = 0; |
| 158 | 167 |
| 159 #if defined(OS_CHROMEOS) | 168 #if defined(OS_CHROMEOS) |
| 169 LogoutConfirmationController* logout_confirmation_controller() { | |
| 170 return logout_confirmation_controller_.get(); | |
| 171 } | |
| 172 | |
| 160 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved. | 173 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved. |
| 161 virtual void ToggleIgnoreExternalKeyboard() = 0; | 174 virtual void ToggleIgnoreExternalKeyboard() = 0; |
| 162 #endif | 175 #endif |
| 163 | 176 |
| 164 protected: | 177 protected: |
| 165 WmShell(); | 178 WmShell(); |
| 166 virtual ~WmShell(); | 179 virtual ~WmShell(); |
| 167 | 180 |
| 168 // If |delegate| is not null, sets and initializes the delegate. If |delegate| | 181 // If |delegate| is not null, sets and initializes the delegate. If |delegate| |
| 169 // is null, shuts down and destroys the delegate. | 182 // is null, shuts down and destroys the delegate. |
| 170 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); | 183 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); |
| 171 | 184 |
| 172 void DeleteWindowSelectorController(); | 185 void DeleteWindowSelectorController(); |
| 173 | 186 |
| 187 #if defined(OS_CHROMEOS) | |
| 188 // Must be created after SystemTrayDelegate. | |
|
msw
2016/06/28 19:31:04
nit: // Must be created after and destroyed before
James Cook
2016/06/28 20:14:46
Deleted these methods.
| |
| 189 void CreateLogoutConfirmationController(); | |
| 190 void DeleteLogoutConfirmationController(); | |
| 191 #endif | |
| 192 | |
| 174 private: | 193 private: |
| 175 friend class Shell; | 194 friend class Shell; |
| 176 | 195 |
| 177 static WmShell* instance_; | 196 static WmShell* instance_; |
| 178 | 197 |
| 179 std::unique_ptr<FocusCycler> focus_cycler_; | 198 std::unique_ptr<FocusCycler> focus_cycler_; |
| 180 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; | 199 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; |
| 181 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; | 200 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; |
| 182 std::unique_ptr<WindowSelectorController> window_selector_controller_; | 201 std::unique_ptr<WindowSelectorController> window_selector_controller_; |
| 183 | 202 |
| 184 bool simulate_modal_window_open_for_testing_ = false; | 203 bool simulate_modal_window_open_for_testing_ = false; |
| 204 | |
| 205 #if defined(OS_CHROMEOS) | |
| 206 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_; | |
| 207 #endif | |
| 185 }; | 208 }; |
| 186 | 209 |
| 187 } // namespace ash | 210 } // namespace ash |
| 188 | 211 |
| 189 #endif // ASH_COMMON_WM_SHELL_H_ | 212 #endif // ASH_COMMON_WM_SHELL_H_ |
| OLD | NEW |