Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: ash/common/wm_shell.h

Issue 2115663002: Folds methods in WmShellCommon to WmShell (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/common/wm/window_positioner.cc ('k') | ash/common/wm_shell.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 17
17 namespace gfx { 18 namespace gfx {
18 class Rect; 19 class Rect;
19 } 20 }
20 21
21 namespace views { 22 namespace views {
22 class PointerWatcher; 23 class PointerWatcher;
23 } 24 }
24 25
25 namespace ash { 26 namespace ash {
(...skipping 29 matching lines...) Expand all
55 // This is necessary for a handful of places that is difficult to plumb 56 // This is necessary for a handful of places that is difficult to plumb
56 // through context. 57 // through context.
57 static void Set(WmShell* instance); 58 static void Set(WmShell* instance);
58 static WmShell* Get(); 59 static WmShell* Get();
59 static bool HasInstance() { return instance_ != nullptr; } 60 static bool HasInstance() { return instance_ != nullptr; }
60 61
61 FocusCycler* focus_cycler() { return focus_cycler_.get(); } 62 FocusCycler* focus_cycler() { return focus_cycler_.get(); }
62 63
63 KeyboardUI* keyboard_ui() { return keyboard_ui_.get(); } 64 KeyboardUI* keyboard_ui() { return keyboard_ui_.get(); }
64 65
66 MruWindowTracker* mru_window_tracker() { return mru_window_tracker_.get(); }
67
65 MediaDelegate* media_delegate() { return media_delegate_.get(); } 68 MediaDelegate* media_delegate() { return media_delegate_.get(); }
66 69
67 SystemTrayNotifier* system_tray_notifier() { 70 SystemTrayNotifier* system_tray_notifier() {
68 return system_tray_notifier_.get(); 71 return system_tray_notifier_.get();
69 } 72 }
70 73
71 SystemTrayDelegate* system_tray_delegate() { 74 SystemTrayDelegate* system_tray_delegate() {
72 return system_tray_delegate_.get(); 75 return system_tray_delegate_.get();
73 } 76 }
74 77
75 WindowSelectorController* window_selector_controller() { 78 WindowSelectorController* window_selector_controller() {
76 return window_selector_controller_.get(); 79 return window_selector_controller_.get();
77 } 80 }
78 81
79 virtual MruWindowTracker* GetMruWindowTracker() = 0;
80
81 // Creates a new window used as a container of other windows. No painting is 82 // Creates a new window used as a container of other windows. No painting is
82 // done to the created window. 83 // done to the created window.
83 virtual WmWindow* NewContainerWindow() = 0; 84 virtual WmWindow* NewContainerWindow() = 0;
84 85
85 virtual WmWindow* GetFocusedWindow() = 0; 86 virtual WmWindow* GetFocusedWindow() = 0;
86 virtual WmWindow* GetActiveWindow() = 0; 87 virtual WmWindow* GetActiveWindow() = 0;
87 88
88 virtual WmWindow* GetPrimaryRootWindow() = 0; 89 virtual WmWindow* GetPrimaryRootWindow() = 0;
89 90
90 // Returns the root window for the specified display. 91 // Returns the root window for the specified display.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 virtual std::unique_ptr<wm::MaximizeModeEventHandler> 149 virtual std::unique_ptr<wm::MaximizeModeEventHandler>
149 CreateMaximizeModeEventHandler() = 0; 150 CreateMaximizeModeEventHandler() = 0;
150 151
151 // Called when the overview mode is about to be started (before the windows 152 // Called when the overview mode is about to be started (before the windows
152 // get re-arranged). 153 // get re-arranged).
153 virtual void OnOverviewModeStarting() = 0; 154 virtual void OnOverviewModeStarting() = 0;
154 155
155 // Called after overview mode has ended. 156 // Called after overview mode has ended.
156 virtual void OnOverviewModeEnded() = 0; 157 virtual void OnOverviewModeEnded() = 0;
157 158
159 // Notifies |observers_| when entering or exiting pinned mode for
160 // |pinned_window|. Entering or exiting can be checked by looking at
161 // |pinned_window|'s window state.
162 void NotifyPinnedStateChanged(WmWindow* pinned_window);
163
158 virtual AccessibilityDelegate* GetAccessibilityDelegate() = 0; 164 virtual AccessibilityDelegate* GetAccessibilityDelegate() = 0;
159 165
160 virtual SessionStateDelegate* GetSessionStateDelegate() = 0; 166 virtual SessionStateDelegate* GetSessionStateDelegate() = 0;
161 167
162 virtual void AddActivationObserver(WmActivationObserver* observer) = 0; 168 virtual void AddActivationObserver(WmActivationObserver* observer) = 0;
163 virtual void RemoveActivationObserver(WmActivationObserver* observer) = 0; 169 virtual void RemoveActivationObserver(WmActivationObserver* observer) = 0;
164 170
165 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; 171 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0;
166 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; 172 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0;
167 173
168 virtual void AddShellObserver(ShellObserver* observer) = 0; 174 void AddShellObserver(ShellObserver* observer);
169 virtual void RemoveShellObserver(ShellObserver* observer) = 0; 175 void RemoveShellObserver(ShellObserver* observer);
170 176
171 virtual void AddPointerWatcher(views::PointerWatcher* watcher) = 0; 177 virtual void AddPointerWatcher(views::PointerWatcher* watcher) = 0;
172 virtual void RemovePointerWatcher(views::PointerWatcher* watcher) = 0; 178 virtual void RemovePointerWatcher(views::PointerWatcher* watcher) = 0;
173 179
174 #if defined(OS_CHROMEOS) 180 #if defined(OS_CHROMEOS)
175 LogoutConfirmationController* logout_confirmation_controller() { 181 LogoutConfirmationController* logout_confirmation_controller() {
176 return logout_confirmation_controller_.get(); 182 return logout_confirmation_controller_.get();
177 } 183 }
178 184
179 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved. 185 // TODO(jamescook): Remove this when VirtualKeyboardController has been moved.
180 virtual void ToggleIgnoreExternalKeyboard() = 0; 186 virtual void ToggleIgnoreExternalKeyboard() = 0;
181 #endif 187 #endif
182 188
183 protected: 189 protected:
184 WmShell(); 190 WmShell();
185 virtual ~WmShell(); 191 virtual ~WmShell();
186 192
193 base::ObserverList<ShellObserver>* shell_observers() {
194 return &shell_observers_;
195 }
196
187 void SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui); 197 void SetKeyboardUI(std::unique_ptr<KeyboardUI> keyboard_ui);
188 198
189 // Helpers to set (and initialize) or destroy various delegates. 199 // Helpers to set (and initialize) or destroy various delegates.
190 // TODO(msw|jamescook): Remove these once ShellDelegate, etc. are ported. 200 // TODO(msw|jamescook): Remove these once ShellDelegate, etc. are ported.
191 void SetMediaDelegate(std::unique_ptr<MediaDelegate> delegate); 201 void SetMediaDelegate(std::unique_ptr<MediaDelegate> delegate);
192 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); 202 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate);
193 void DeleteSystemTrayDelegate(); 203 void DeleteSystemTrayDelegate();
194 204
195 void DeleteWindowSelectorController(); 205 void DeleteWindowSelectorController();
196 206
207 void CreateMruWindowTracker();
208 void DeleteMruWindowTracker();
209
197 private: 210 private:
198 friend class Shell; 211 friend class Shell;
199 212
200 static WmShell* instance_; 213 static WmShell* instance_;
201 214
215 base::ObserverList<ShellObserver> shell_observers_;
216
202 std::unique_ptr<FocusCycler> focus_cycler_; 217 std::unique_ptr<FocusCycler> focus_cycler_;
203 std::unique_ptr<KeyboardUI> keyboard_ui_; 218 std::unique_ptr<KeyboardUI> keyboard_ui_;
204 std::unique_ptr<MediaDelegate> media_delegate_; 219 std::unique_ptr<MediaDelegate> media_delegate_;
220 std::unique_ptr<MruWindowTracker> mru_window_tracker_;
205 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_; 221 std::unique_ptr<SystemTrayNotifier> system_tray_notifier_;
206 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; 222 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_;
207 std::unique_ptr<WindowSelectorController> window_selector_controller_; 223 std::unique_ptr<WindowSelectorController> window_selector_controller_;
208 224
209 bool simulate_modal_window_open_for_testing_ = false; 225 bool simulate_modal_window_open_for_testing_ = false;
210 226
211 #if defined(OS_CHROMEOS) 227 #if defined(OS_CHROMEOS)
212 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_; 228 std::unique_ptr<LogoutConfirmationController> logout_confirmation_controller_;
213 #endif 229 #endif
214 }; 230 };
215 231
216 } // namespace ash 232 } // namespace ash
217 233
218 #endif // ASH_COMMON_WM_SHELL_H_ 234 #endif // ASH_COMMON_WM_SHELL_H_
OLDNEW
« no previous file with comments | « ash/common/wm/window_positioner.cc ('k') | ash/common/wm_shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698