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 <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 class Value; | 30 class Value; |
31 template <typename T> class JSONValueConverter; | 31 template <typename T> class JSONValueConverter; |
32 } | 32 } |
33 | 33 |
34 namespace gfx { | 34 namespace gfx { |
35 class Display; | 35 class Display; |
36 class Insets; | 36 class Insets; |
37 } | 37 } |
38 | 38 |
39 namespace ash { | 39 namespace ash { |
| 40 class AshWindowTreeHost; |
40 class CursorWindowController; | 41 class CursorWindowController; |
41 class DisplayInfo; | 42 class DisplayInfo; |
42 class DisplayManager; | 43 class DisplayManager; |
43 class FocusActivationStore; | 44 class FocusActivationStore; |
44 class MirrorWindowController; | 45 class MirrorWindowController; |
45 class RootWindowController; | 46 class RootWindowController; |
46 class VirtualKeyboardWindowController; | 47 class VirtualKeyboardWindowController; |
47 | 48 |
48 // DisplayController owns and maintains RootWindows for each attached | 49 // DisplayController owns and maintains RootWindows for each attached |
49 // display, keeping them in sync with display configuration changes. | 50 // display, keeping them in sync with display configuration changes. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 } | 85 } |
85 | 86 |
86 MirrorWindowController* mirror_window_controller() { | 87 MirrorWindowController* mirror_window_controller() { |
87 return mirror_window_controller_.get(); | 88 return mirror_window_controller_.get(); |
88 } | 89 } |
89 | 90 |
90 VirtualKeyboardWindowController* virtual_keyboard_window_controller() { | 91 VirtualKeyboardWindowController* virtual_keyboard_window_controller() { |
91 return virtual_keyboard_window_controller_.get(); | 92 return virtual_keyboard_window_controller_.get(); |
92 } | 93 } |
93 | 94 |
94 // Initializes primary display. | 95 // Create a WindowTreeHost for the primary display. |
95 void InitPrimaryDisplay(); | 96 void CreatePrimaryHost(); |
96 | 97 |
97 // Initialize secondary displays. | 98 // Initializes all displays. |
98 void InitSecondaryDisplays(); | 99 void InitDisplays(); |
99 | 100 |
100 // Add/Remove observers. | 101 // Add/Remove observers. |
101 void AddObserver(Observer* observer); | 102 void AddObserver(Observer* observer); |
102 void RemoveObserver(Observer* observer); | 103 void RemoveObserver(Observer* observer); |
103 | 104 |
104 // Returns the root window for primary display. | 105 // Returns the root window for primary display. |
105 aura::Window* GetPrimaryRootWindow(); | 106 aura::Window* GetPrimaryRootWindow(); |
106 | 107 |
107 // Returns the root window for |display_id|. | 108 // Returns the root window for |display_id|. |
108 aura::Window* GetRootWindowForDisplayId(int64 id); | 109 aura::Window* GetRootWindowForDisplayId(int64 id); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 virtual void CloseNonDesktopDisplay() OVERRIDE; | 160 virtual void CloseNonDesktopDisplay() OVERRIDE; |
160 virtual void PreDisplayConfigurationChange(bool clear_focus) OVERRIDE; | 161 virtual void PreDisplayConfigurationChange(bool clear_focus) OVERRIDE; |
161 virtual void PostDisplayConfigurationChange() OVERRIDE; | 162 virtual void PostDisplayConfigurationChange() OVERRIDE; |
162 | 163 |
163 private: | 164 private: |
164 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, BoundsUpdated); | 165 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, BoundsUpdated); |
165 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, SecondaryDisplayLayout); | 166 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, SecondaryDisplayLayout); |
166 friend class DisplayManager; | 167 friend class DisplayManager; |
167 friend class MirrorWindowController; | 168 friend class MirrorWindowController; |
168 | 169 |
169 // Creates a WindowTreeHost for |display| and stores it in the |root_windows_| | 170 // Creates a WindowTreeHost for |display| and stores it in the |
170 // map. | 171 // |window_tree_hosts_| map. |
171 aura::WindowTreeHost* AddWindowTreeHostForDisplay( | 172 AshWindowTreeHost* AddWindowTreeHostForDisplay(const gfx::Display& display); |
172 const gfx::Display& display); | |
173 | 173 |
174 void OnFadeOutForSwapDisplayFinished(); | 174 void OnFadeOutForSwapDisplayFinished(); |
175 | 175 |
176 void UpdateHostWindowNames(); | 176 void UpdateHostWindowNames(); |
177 | 177 |
178 class DisplayChangeLimiter { | 178 class DisplayChangeLimiter { |
179 public: | 179 public: |
180 DisplayChangeLimiter(); | 180 DisplayChangeLimiter(); |
181 | 181 |
182 // Sets how long the throttling should last. | 182 // Sets how long the throttling should last. |
183 void SetThrottleTimeout(int64 throttle_ms); | 183 void SetThrottleTimeout(int64 throttle_ms); |
184 | 184 |
185 bool IsThrottled() const; | 185 bool IsThrottled() const; |
186 | 186 |
187 private: | 187 private: |
188 // The time when the throttling ends. | 188 // The time when the throttling ends. |
189 base::Time throttle_timeout_; | 189 base::Time throttle_timeout_; |
190 | 190 |
191 DISALLOW_COPY_AND_ASSIGN(DisplayChangeLimiter); | 191 DISALLOW_COPY_AND_ASSIGN(DisplayChangeLimiter); |
192 }; | 192 }; |
193 | 193 |
194 // The limiter to throttle how fast a user can | 194 // The limiter to throttle how fast a user can |
195 // change the display configuration. | 195 // change the display configuration. |
196 scoped_ptr<DisplayChangeLimiter> limiter_; | 196 scoped_ptr<DisplayChangeLimiter> limiter_; |
197 | 197 |
198 // The mapping from display ID to its root window. | 198 typedef std::map<int64, AshWindowTreeHost*> WindowTreeHostMap; |
199 std::map<int64, aura::Window*> root_windows_; | 199 // The mapping from display ID to its window tree host. |
| 200 WindowTreeHostMap window_tree_hosts_; |
200 | 201 |
201 ObserverList<Observer> observers_; | 202 ObserverList<Observer> observers_; |
202 | 203 |
203 // Store the primary root window temporarily while replacing | 204 // Store the primary window tree host temporarily while replacing |
204 // display. | 205 // display. |
205 aura::Window* primary_root_window_for_replace_; | 206 AshWindowTreeHost* primary_tree_host_for_replace_; |
206 | 207 |
207 scoped_ptr<FocusActivationStore> focus_activation_store_; | 208 scoped_ptr<FocusActivationStore> focus_activation_store_; |
208 | 209 |
209 scoped_ptr<CursorWindowController> cursor_window_controller_; | 210 scoped_ptr<CursorWindowController> cursor_window_controller_; |
210 scoped_ptr<MirrorWindowController> mirror_window_controller_; | 211 scoped_ptr<MirrorWindowController> mirror_window_controller_; |
211 scoped_ptr<VirtualKeyboardWindowController> | 212 scoped_ptr<VirtualKeyboardWindowController> |
212 virtual_keyboard_window_controller_; | 213 virtual_keyboard_window_controller_; |
213 | 214 |
214 // Stores the curent cursor location (in native coordinates) used to | 215 // Stores the curent cursor location (in native coordinates) used to |
215 // restore the cursor location when display configuration | 216 // restore the cursor location when display configuration |
216 // changed. | 217 // changed. |
217 gfx::Point cursor_location_in_native_coords_for_restore_; | 218 gfx::Point cursor_location_in_native_coords_for_restore_; |
218 | 219 |
219 DISALLOW_COPY_AND_ASSIGN(DisplayController); | 220 DISALLOW_COPY_AND_ASSIGN(DisplayController); |
220 }; | 221 }; |
221 | 222 |
222 } // namespace ash | 223 } // namespace ash |
223 | 224 |
224 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ | 225 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ |
OLD | NEW |