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

Side by Side Diff: ash/display/window_tree_host_manager.h

Issue 1594683002: Introduce DisplayConfigurationController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@issue_576375_display1b1
Patch Set: Rebase Created 4 years, 11 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
OLDNEW
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
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.
126 void ToggleMirrorMode();
127
128 // Swap primary and secondary display. 125 // Swap primary and secondary display.
129 void SwapPrimaryDisplay(); 126 void SwapPrimaryDisplay();
130 127
131 // Sets the ID of the primary display. If the display is not connected, it 128 // Sets the ID of the primary display. If the display is not connected, it
132 // will switch the primary display when connected. 129 // will switch the primary display when connected.
133 void SetPrimaryDisplayId(int64_t id); 130 void SetPrimaryDisplayId(int64_t id);
134 131
135 // Sets primary display. This re-assigns the current root 132 // Sets primary display. This re-assigns the current root
136 // window to given |display|. 133 // window to given |display|.
137 void SetPrimaryDisplay(const gfx::Display& display); 134 void SetPrimaryDisplay(const gfx::Display& display);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 FRIEND_TEST_ALL_PREFIXES(WindowTreeHostManagerTest, SecondaryDisplayLayout); 188 FRIEND_TEST_ALL_PREFIXES(WindowTreeHostManagerTest, SecondaryDisplayLayout);
192 friend class DisplayManager; 189 friend class DisplayManager;
193 friend class MirrorWindowController; 190 friend class MirrorWindowController;
194 191
195 // Creates a WindowTreeHost for |display| and stores it in the 192 // Creates a WindowTreeHost for |display| and stores it in the
196 // |window_tree_hosts_| map. 193 // |window_tree_hosts_| map.
197 AshWindowTreeHost* AddWindowTreeHostForDisplay( 194 AshWindowTreeHost* AddWindowTreeHostForDisplay(
198 const gfx::Display& display, 195 const gfx::Display& display,
199 const AshWindowTreeHostInitParams& params); 196 const AshWindowTreeHostInitParams& params);
200 197
201 void OnFadeOutForSwapDisplayFinished();
202
203 void SetMirrorModeAfterAnimation(bool mirror);
204
205 // Delete the AsWindowTreeHost. This does not remove the entry from 198 // Delete the AsWindowTreeHost. This does not remove the entry from
206 // |window_tree_hosts_|. Caller has to explicitly remove it. 199 // |window_tree_hosts_|. Caller has to explicitly remove it.
207 void DeleteHost(AshWindowTreeHost* host_to_delete); 200 void DeleteHost(AshWindowTreeHost* host_to_delete);
208 201
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; 202 typedef std::map<int64_t, AshWindowTreeHost*> WindowTreeHostMap;
230 // The mapping from display ID to its window tree host. 203 // The mapping from display ID to its window tree host.
231 WindowTreeHostMap window_tree_hosts_; 204 WindowTreeHostMap window_tree_hosts_;
232 205
233 base::ObserverList<Observer, true> observers_; 206 base::ObserverList<Observer, true> observers_;
234 207
235 // Store the primary window tree host temporarily while replacing 208 // Store the primary window tree host temporarily while replacing
236 // display. 209 // display.
237 AshWindowTreeHost* primary_tree_host_for_replace_; 210 AshWindowTreeHost* primary_tree_host_for_replace_;
238 211
(...skipping 17 matching lines...) Expand all
256 int64_t cursor_display_id_for_restore_; 229 int64_t cursor_display_id_for_restore_;
257 230
258 base::WeakPtrFactory<WindowTreeHostManager> weak_ptr_factory_; 231 base::WeakPtrFactory<WindowTreeHostManager> weak_ptr_factory_;
259 232
260 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostManager); 233 DISALLOW_COPY_AND_ASSIGN(WindowTreeHostManager);
261 }; 234 };
262 235
263 } // namespace ash 236 } // namespace ash
264 237
265 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ 238 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698