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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 virtual bool IsForceMaximizeOnFirstRun() = 0; | 79 virtual bool IsForceMaximizeOnFirstRun() = 0; |
80 | 80 |
81 // Returns true if a system-modal dialog window is currently open. | 81 // Returns true if a system-modal dialog window is currently open. |
82 bool IsSystemModalWindowOpen(); | 82 bool IsSystemModalWindowOpen(); |
83 | 83 |
84 // For testing only: set simulation that a modal window is open | 84 // For testing only: set simulation that a modal window is open |
85 void SimulateModalWindowOpenForTesting(bool modal_window_open) { | 85 void SimulateModalWindowOpenForTesting(bool modal_window_open) { |
86 simulate_modal_window_open_for_testing_ = modal_window_open; | 86 simulate_modal_window_open_for_testing_ = modal_window_open; |
87 } | 87 } |
88 | 88 |
| 89 // Returns true if a window is currently pinned. |
| 90 virtual bool IsPinned() = 0; |
| 91 |
| 92 // Sets/Unsets the |window| to as a pinned window. If this is called with a |
| 93 // window with WINDOW_STATE_TYPE_PINNED state, then this sets the |window| |
| 94 // as a pinned window. Otherwise, this unsets it. |
| 95 // For setting, a caller needs to guarantee that no windows are set |
| 96 // as pinned window. For unsetting, a caller needs to guarantee that the |
| 97 // |window| is the one which is currently set as a pinned window via previous |
| 98 // this function invocation. |
| 99 virtual void SetPinnedWindow(WmWindow* window) = 0; |
| 100 |
89 // Returns true if |window| can be shown for the current user. This is | 101 // Returns true if |window| can be shown for the current user. This is |
90 // intended to check if the current user matches the user associated with | 102 // intended to check if the current user matches the user associated with |
91 // |window|. | 103 // |window|. |
92 // TODO(jamescook): Remove this when ShellDelegate is accessible via this | 104 // TODO(jamescook): Remove this when ShellDelegate is accessible via this |
93 // interface. | 105 // interface. |
94 virtual bool CanShowWindowForUser(WmWindow* window) = 0; | 106 virtual bool CanShowWindowForUser(WmWindow* window) = 0; |
95 | 107 |
96 // See aura::client::CursorClient for details on these. | 108 // See aura::client::CursorClient for details on these. |
97 virtual void LockCursor() = 0; | 109 virtual void LockCursor() = 0; |
98 virtual void UnlockCursor() = 0; | 110 virtual void UnlockCursor() = 0; |
(...skipping 27 matching lines...) Expand all Loading... |
126 | 138 |
127 virtual void AddActivationObserver(WmActivationObserver* observer) = 0; | 139 virtual void AddActivationObserver(WmActivationObserver* observer) = 0; |
128 virtual void RemoveActivationObserver(WmActivationObserver* observer) = 0; | 140 virtual void RemoveActivationObserver(WmActivationObserver* observer) = 0; |
129 | 141 |
130 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; | 142 virtual void AddDisplayObserver(WmDisplayObserver* observer) = 0; |
131 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; | 143 virtual void RemoveDisplayObserver(WmDisplayObserver* observer) = 0; |
132 | 144 |
133 virtual void AddShellObserver(ShellObserver* observer) = 0; | 145 virtual void AddShellObserver(ShellObserver* observer) = 0; |
134 virtual void RemoveShellObserver(ShellObserver* observer) = 0; | 146 virtual void RemoveShellObserver(ShellObserver* observer) = 0; |
135 | 147 |
136 // Notifies |observers_| when entering or exiting pinned mode for | |
137 // |pinned_window|. Entering or exiting can be checked by looking at | |
138 // |pinned_window|'s window state. | |
139 virtual void NotifyPinnedStateChanged(WmWindow* pinned_window) = 0; | |
140 | |
141 protected: | 148 protected: |
142 WmShell(); | 149 WmShell(); |
143 virtual ~WmShell(); | 150 virtual ~WmShell(); |
144 | 151 |
145 // If |delegate| is not null, sets and initializes the delegate. If |delegate| | 152 // If |delegate| is not null, sets and initializes the delegate. If |delegate| |
146 // is null, shuts down and destroys the delegate. | 153 // is null, shuts down and destroys the delegate. |
147 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); | 154 void SetSystemTrayDelegate(std::unique_ptr<SystemTrayDelegate> delegate); |
148 | 155 |
149 private: | 156 private: |
150 friend class Shell; | 157 friend class Shell; |
151 | 158 |
152 static WmShell* instance_; | 159 static WmShell* instance_; |
153 | 160 |
154 std::unique_ptr<FocusCycler> focus_cycler_; | 161 std::unique_ptr<FocusCycler> focus_cycler_; |
155 std::unique_ptr<WmSystemTrayNotifier> system_tray_notifier_; | 162 std::unique_ptr<WmSystemTrayNotifier> system_tray_notifier_; |
156 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; | 163 std::unique_ptr<SystemTrayDelegate> system_tray_delegate_; |
157 | 164 |
158 bool simulate_modal_window_open_for_testing_ = false; | 165 bool simulate_modal_window_open_for_testing_ = false; |
159 }; | 166 }; |
160 | 167 |
161 } // namespace ash | 168 } // namespace ash |
162 | 169 |
163 #endif // ASH_COMMON_WM_SHELL_H_ | 170 #endif // ASH_COMMON_WM_SHELL_H_ |
OLD | NEW |