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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 | 120 |
121 // Returns all oot window controllers. In non extended desktop | 121 // Returns all oot window controllers. In non extended desktop |
122 // mode, this return a RootWindowController for the primary root window only. | 122 // mode, this return a RootWindowController for the primary root window only. |
123 std::vector<internal::RootWindowController*> GetAllRootWindowControllers(); | 123 std::vector<internal::RootWindowController*> GetAllRootWindowControllers(); |
124 | 124 |
125 // Gets/Sets/Clears the overscan insets for the specified |display_id|. See | 125 // Gets/Sets/Clears the overscan insets for the specified |display_id|. See |
126 // display_manager.h for the details. | 126 // display_manager.h for the details. |
127 gfx::Insets GetOverscanInsets(int64 display_id) const; | 127 gfx::Insets GetOverscanInsets(int64 display_id) const; |
128 void SetOverscanInsets(int64 display_id, const gfx::Insets& insets_in_dip); | 128 void SetOverscanInsets(int64 display_id, const gfx::Insets& insets_in_dip); |
129 | 129 |
130 const DisplayLayout& default_display_layout() const { | |
131 return default_display_layout_; | |
132 } | |
133 void SetDefaultDisplayLayout(const DisplayLayout& layout); | |
134 | |
135 // Registeres the display layout info for the specified display(s). | |
136 void RegisterLayoutForDisplayIdPair(int64 id1, | |
137 int64 id2, | |
138 const DisplayLayout& layout); | |
139 // Sets the layout for the current display pair. The |layout| specifies | 130 // Sets the layout for the current display pair. The |layout| specifies |
140 // the locaion of the secondary display relative to the primary. | 131 // the locaion of the secondary display relative to the primary. |
141 void SetLayoutForCurrentDisplays(const DisplayLayout& layout); | 132 void SetLayoutForCurrentDisplays(const DisplayLayout& layout); |
142 | 133 |
143 // Returns the display layout used for current displays. | 134 // Returns the display layout used for current displays. |
144 DisplayLayout GetCurrentDisplayLayout(); | 135 DisplayLayout GetCurrentDisplayLayout(); |
145 | 136 |
146 // Returns the current display pair. | 137 // Returns the current display pair. |
147 DisplayIdPair GetCurrentDisplayIdPair() const; | 138 DisplayIdPair GetCurrentDisplayIdPair() const; |
148 | 139 |
149 // Returns the display layout registered for the given display id |pair|. | |
150 // If no layout is registered, it creatas new layout using | |
151 // |default_display_layout_|. | |
152 DisplayLayout GetRegisteredDisplayLayout(const DisplayIdPair& pair); | |
153 | |
154 // Checks if the mouse pointer is on one of displays, and moves to | 140 // Checks if the mouse pointer is on one of displays, and moves to |
155 // the center of the nearest display if it's outside of all displays. | 141 // the center of the nearest display if it's outside of all displays. |
156 void EnsurePointerInDisplays(); | 142 void EnsurePointerInDisplays(); |
157 | 143 |
158 gfx::Point GetNativeMouseCursorLocation() const; | 144 gfx::Point GetNativeMouseCursorLocation() const; |
159 | 145 |
160 // Update the current cursor image that is sutable for the given | 146 // Update the current cursor image that is sutable for the given |
161 // |point_in_native|. | 147 // |point_in_native|. |
162 void UpdateMouseCursor(const gfx::Point& point_in_native); | 148 void UpdateMouseCursor(const gfx::Point& point_in_native); |
163 | 149 |
(...skipping 12 matching lines...) Expand all Loading... |
176 aura::RootWindow* AddRootWindowForDisplay(const gfx::Display& display); | 162 aura::RootWindow* AddRootWindowForDisplay(const gfx::Display& display); |
177 | 163 |
178 void UpdateDisplayBoundsForLayout(); | 164 void UpdateDisplayBoundsForLayout(); |
179 | 165 |
180 void NotifyDisplayConfigurationChanging(); | 166 void NotifyDisplayConfigurationChanging(); |
181 void NotifyDisplayConfigurationChanged(); | 167 void NotifyDisplayConfigurationChanged(); |
182 | 168 |
183 void SetLayoutForDisplayIdPair(const DisplayIdPair& display_pair, | 169 void SetLayoutForDisplayIdPair(const DisplayIdPair& display_pair, |
184 const DisplayLayout& layout); | 170 const DisplayLayout& layout); |
185 | 171 |
186 void RegisterLayoutForDisplayIdPairInternal( | |
187 int64 id1, | |
188 int64 id2, | |
189 const DisplayLayout& layout, | |
190 bool override); | |
191 | |
192 void OnFadeOutForSwapDisplayFinished(); | 172 void OnFadeOutForSwapDisplayFinished(); |
193 | 173 |
194 // Returns the display layout for the display id pair | |
195 // with display swapping applied. That is, this returns | |
196 // flipped layout if the displays are swapped. | |
197 DisplayLayout ComputeDisplayLayoutForDisplayIdPair( | |
198 const DisplayIdPair& display_pair); | |
199 | |
200 void UpdateHostWindowNames(); | 174 void UpdateHostWindowNames(); |
201 | 175 |
202 // Creates new layout for display pair from |default_display_layout_|. | |
203 DisplayLayout CreateDisplayLayout(const DisplayIdPair& display_pair); | |
204 | |
205 bool in_bootstrap() const { return in_bootstrap_; } | 176 bool in_bootstrap() const { return in_bootstrap_; } |
206 | 177 |
207 class DisplayChangeLimiter { | 178 class DisplayChangeLimiter { |
208 public: | 179 public: |
209 DisplayChangeLimiter(); | 180 DisplayChangeLimiter(); |
210 | 181 |
211 // Sets how long the throttling should last. | 182 // Sets how long the throttling should last. |
212 void SetThrottleTimeout(int64 throttle_ms); | 183 void SetThrottleTimeout(int64 throttle_ms); |
213 | 184 |
214 bool IsThrottled() const; | 185 bool IsThrottled() const; |
215 | 186 |
216 private: | 187 private: |
217 // The time when the throttling ends. | 188 // The time when the throttling ends. |
218 base::Time throttle_timeout_; | 189 base::Time throttle_timeout_; |
219 | 190 |
220 DISALLOW_COPY_AND_ASSIGN(DisplayChangeLimiter); | 191 DISALLOW_COPY_AND_ASSIGN(DisplayChangeLimiter); |
221 }; | 192 }; |
222 | 193 |
223 // The limiter to throttle how fast a user can | 194 // The limiter to throttle how fast a user can |
224 // change the display configuration. | 195 // change the display configuration. |
225 scoped_ptr<DisplayChangeLimiter> limiter_; | 196 scoped_ptr<DisplayChangeLimiter> limiter_; |
226 | 197 |
227 // The mapping from display ID to its root window. | 198 // The mapping from display ID to its root window. |
228 std::map<int64, aura::RootWindow*> root_windows_; | 199 std::map<int64, aura::RootWindow*> root_windows_; |
229 | 200 |
230 // The default display layout. | |
231 DisplayLayout default_display_layout_; | |
232 | |
233 // Display layout per pair of devices. | |
234 std::map<DisplayIdPair, DisplayLayout> paired_layouts_; | |
235 | |
236 ObserverList<Observer> observers_; | 201 ObserverList<Observer> observers_; |
237 | 202 |
238 // Store the primary root window temporarily while replacing | 203 // Store the primary root window temporarily while replacing |
239 // display. | 204 // display. |
240 aura::RootWindow* primary_root_window_for_replace_; | 205 aura::RootWindow* primary_root_window_for_replace_; |
241 | 206 |
242 bool in_bootstrap_; | 207 bool in_bootstrap_; |
243 | 208 |
244 scoped_ptr<internal::FocusActivationStore> focus_activation_store_; | 209 scoped_ptr<internal::FocusActivationStore> focus_activation_store_; |
245 | 210 |
246 DISALLOW_COPY_AND_ASSIGN(DisplayController); | 211 DISALLOW_COPY_AND_ASSIGN(DisplayController); |
247 }; | 212 }; |
248 | 213 |
249 } // namespace ash | 214 } // namespace ash |
250 | 215 |
251 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ | 216 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ |
OLD | NEW |