OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_DISPLAY_DISPLAY_CONTROLLER_H_ | 5 #ifndef ASH_DISPLAY_DISPLAY_CONTROLLER_H_ |
6 #define ASH_DISPLAY_DISPLAY_CONTROLLER_H_ | 6 #define ASH_DISPLAY_DISPLAY_CONTROLLER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 // Returns the root window for primary display. | 115 // Returns the root window for primary display. |
116 aura::Window* GetPrimaryRootWindow(); | 116 aura::Window* GetPrimaryRootWindow(); |
117 | 117 |
118 // Returns the root window for |display_id|. | 118 // Returns the root window for |display_id|. |
119 aura::Window* GetRootWindowForDisplayId(int64_t id); | 119 aura::Window* GetRootWindowForDisplayId(int64_t id); |
120 | 120 |
121 // Returns AshWTH for given display |id|. Call results in CHECK failure | 121 // Returns AshWTH for given display |id|. Call results in CHECK failure |
122 // if the WTH does not exist. | 122 // if the WTH does not exist. |
123 AshWindowTreeHost* GetAshWindowTreeHostForDisplayId(int64_t id); | 123 AshWindowTreeHost* GetAshWindowTreeHostForDisplayId(int64_t id); |
124 | 124 |
125 // Toggle mirror mode. | 125 // Swap primary and secondary display. Only used in tests; use |
126 void ToggleMirrorMode(); | 126 // DisplayConfigurationController::SetPrimaryDisplayId() instead. |
127 | 127 void SwapPrimaryDisplayForTest(); |
128 // Swap primary and secondary display. | |
129 void SwapPrimaryDisplay(); | |
130 | 128 |
131 // Sets the ID of the primary display. If the display is not connected, it | 129 // Sets the ID of the primary display. If the display is not connected, it |
132 // will switch the primary display when connected. | 130 // will switch the primary display when connected. |
133 void SetPrimaryDisplayId(int64_t id); | 131 void SetPrimaryDisplayId(int64_t id); |
134 | 132 |
135 // Sets primary display. This re-assigns the current root | 133 // Sets primary display. This re-assigns the current root |
136 // window to given |display|. | 134 // window to given |display|. |
137 void SetPrimaryDisplay(const gfx::Display& display); | 135 void SetPrimaryDisplay(const gfx::Display& display); |
138 | 136 |
139 // Closes all child windows in the all root windows. | 137 // Closes all child windows in the all root windows. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 FRIEND_TEST_ALL_PREFIXES(WindowTreeHostManagerTest, SecondaryDisplayLayout); | 189 FRIEND_TEST_ALL_PREFIXES(WindowTreeHostManagerTest, SecondaryDisplayLayout); |
192 friend class DisplayManager; | 190 friend class DisplayManager; |
193 friend class MirrorWindowController; | 191 friend class MirrorWindowController; |
194 | 192 |
195 // Creates a WindowTreeHost for |display| and stores it in the | 193 // Creates a WindowTreeHost for |display| and stores it in the |
196 // |window_tree_hosts_| map. | 194 // |window_tree_hosts_| map. |
197 AshWindowTreeHost* AddWindowTreeHostForDisplay( | 195 AshWindowTreeHost* AddWindowTreeHostForDisplay( |
198 const gfx::Display& display, | 196 const gfx::Display& display, |
199 const AshWindowTreeHostInitParams& params); | 197 const AshWindowTreeHostInitParams& params); |
200 | 198 |
201 void OnFadeOutForSwapDisplayFinished(); | |
202 | |
203 void SetMirrorModeAfterAnimation(bool mirror); | |
204 | |
205 // Delete the AsWindowTreeHost. This does not remove the entry from | 199 // Delete the AsWindowTreeHost. This does not remove the entry from |
206 // |window_tree_hosts_|. Caller has to explicitly remove it. | 200 // |window_tree_hosts_|. Caller has to explicitly remove it. |
207 void DeleteHost(AshWindowTreeHost* host_to_delete); | 201 void DeleteHost(AshWindowTreeHost* host_to_delete); |
208 | 202 |
209 class DisplayChangeLimiter { | |
210 public: | |
211 DisplayChangeLimiter(); | |
212 | |
213 // Sets how long the throttling should last. | |
214 void SetThrottleTimeout(int64_t throttle_ms); | |
215 | |
216 bool IsThrottled() const; | |
217 | |
218 private: | |
219 // The time when the throttling ends. | |
220 base::Time throttle_timeout_; | |
221 | |
222 DISALLOW_COPY_AND_ASSIGN(DisplayChangeLimiter); | |
223 }; | |
224 | |
225 // The limiter to throttle how fast a user can | |
226 // change the display configuration. | |
227 scoped_ptr<DisplayChangeLimiter> limiter_; | |
228 | |
229 typedef std::map<int64_t, AshWindowTreeHost*> WindowTreeHostMap; | 203 typedef std::map<int64_t, AshWindowTreeHost*> WindowTreeHostMap; |
230 // The mapping from display ID to its window tree host. | 204 // The mapping from display ID to its window tree host. |
231 WindowTreeHostMap window_tree_hosts_; | 205 WindowTreeHostMap window_tree_hosts_; |
232 | 206 |
233 base::ObserverList<Observer, true> observers_; | 207 base::ObserverList<Observer, true> observers_; |
234 | 208 |
235 // Store the primary window tree host temporarily while replacing | 209 // Store the primary window tree host temporarily while replacing |
236 // display. | 210 // display. |
237 AshWindowTreeHost* primary_tree_host_for_replace_; | 211 AshWindowTreeHost* primary_tree_host_for_replace_; |
238 | 212 |
(...skipping 17 matching lines...) Expand all Loading... |
256 int64_t cursor_display_id_for_restore_; | 230 int64_t cursor_display_id_for_restore_; |
257 | 231 |
258 base::WeakPtrFactory<WindowTreeHostManager> weak_ptr_factory_; | 232 base::WeakPtrFactory<WindowTreeHostManager> weak_ptr_factory_; |
259 | 233 |
260 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostManager); | 234 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostManager); |
261 }; | 235 }; |
262 | 236 |
263 } // namespace ash | 237 } // namespace ash |
264 | 238 |
265 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ | 239 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ |
OLD | NEW |