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

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

Issue 201573015: Introdcue AshWindowTreeHost and move ash/chrome specific code in WTH to ash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 19 matching lines...) Expand all
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 namespace internal { 41 namespace internal {
41 class CursorWindowController; 42 class CursorWindowController;
42 class DisplayInfo; 43 class DisplayInfo;
43 class DisplayManager; 44 class DisplayManager;
44 class FocusActivationStore; 45 class FocusActivationStore;
45 class MirrorWindowController; 46 class MirrorWindowController;
46 class RootWindowController; 47 class RootWindowController;
47 class VirtualKeyboardWindowController; 48 class VirtualKeyboardWindowController;
48 } 49 }
49 50
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 88
88 internal::MirrorWindowController* mirror_window_controller() { 89 internal::MirrorWindowController* mirror_window_controller() {
89 return mirror_window_controller_.get(); 90 return mirror_window_controller_.get();
90 } 91 }
91 92
92 internal::VirtualKeyboardWindowController* 93 internal::VirtualKeyboardWindowController*
93 virtual_keyboard_window_controller() { 94 virtual_keyboard_window_controller() {
94 return virtual_keyboard_window_controller_.get(); 95 return virtual_keyboard_window_controller_.get();
95 } 96 }
96 97
97 // Initializes primary display. 98 void CreatePrimaryHost();
98 void InitPrimaryDisplay();
99 99
100 // Initialize secondary displays. 100 // Initializes displays.
101 void InitSecondaryDisplays(); 101 void InitDisplays();
102 102
103 // Add/Remove observers. 103 // Add/Remove observers.
104 void AddObserver(Observer* observer); 104 void AddObserver(Observer* observer);
105 void RemoveObserver(Observer* observer); 105 void RemoveObserver(Observer* observer);
106 106
107 // Returns the root window for primary display. 107 // Returns the root window for primary display.
108 aura::Window* GetPrimaryRootWindow(); 108 aura::Window* GetPrimaryRootWindow();
109 109
110 // Returns the root window for |display_id|. 110 // Returns the root window for |display_id|.
111 aura::Window* GetRootWindowForDisplayId(int64 id); 111 aura::Window* GetRootWindowForDisplayId(int64 id);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 virtual void PostDisplayConfigurationChange() OVERRIDE; 164 virtual void PostDisplayConfigurationChange() OVERRIDE;
165 165
166 private: 166 private:
167 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, BoundsUpdated); 167 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, BoundsUpdated);
168 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, SecondaryDisplayLayout); 168 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, SecondaryDisplayLayout);
169 friend class internal::DisplayManager; 169 friend class internal::DisplayManager;
170 friend class internal::MirrorWindowController; 170 friend class internal::MirrorWindowController;
171 171
172 // Creates a WindowTreeHost for |display| and stores it in the |root_windows_| 172 // Creates a WindowTreeHost for |display| and stores it in the |root_windows_|
173 // map. 173 // map.
174 aura::WindowTreeHost* AddWindowTreeHostForDisplay( 174 AshWindowTreeHost* AddWindowTreeHostForDisplay(
175 const gfx::Display& display); 175 const gfx::Display& display);
176 176
177 void OnFadeOutForSwapDisplayFinished(); 177 void OnFadeOutForSwapDisplayFinished();
178 178
179 void UpdateHostWindowNames(); 179 void UpdateHostWindowNames();
180 180
181 class DisplayChangeLimiter { 181 class DisplayChangeLimiter {
182 public: 182 public:
183 DisplayChangeLimiter(); 183 DisplayChangeLimiter();
184 184
185 // Sets how long the throttling should last. 185 // Sets how long the throttling should last.
186 void SetThrottleTimeout(int64 throttle_ms); 186 void SetThrottleTimeout(int64 throttle_ms);
187 187
188 bool IsThrottled() const; 188 bool IsThrottled() const;
189 189
190 private: 190 private:
191 // The time when the throttling ends. 191 // The time when the throttling ends.
192 base::Time throttle_timeout_; 192 base::Time throttle_timeout_;
193 193
194 DISALLOW_COPY_AND_ASSIGN(DisplayChangeLimiter); 194 DISALLOW_COPY_AND_ASSIGN(DisplayChangeLimiter);
195 }; 195 };
196 196
197 // The limiter to throttle how fast a user can 197 // The limiter to throttle how fast a user can
198 // change the display configuration. 198 // change the display configuration.
199 scoped_ptr<DisplayChangeLimiter> limiter_; 199 scoped_ptr<DisplayChangeLimiter> limiter_;
200 200
201 // The mapping from display ID to its root window. 201
202 std::map<int64, aura::Window*> root_windows_; 202 typedef std::map<int64, AshWindowTreeHost*> WindowTreeHostMap;
203 // The mapping from display ID to its window tree host.
204 WindowTreeHostMap window_tree_hosts_;
203 205
204 ObserverList<Observer> observers_; 206 ObserverList<Observer> observers_;
205 207
206 // Store the primary root window temporarily while replacing 208 // Store the primary window tree host temporarily while replacing
207 // display. 209 // display.
208 aura::Window* primary_root_window_for_replace_; 210 AshWindowTreeHost* primary_tree_host_for_replace_;
209 211
210 scoped_ptr<internal::FocusActivationStore> focus_activation_store_; 212 scoped_ptr<internal::FocusActivationStore> focus_activation_store_;
211 213
212 scoped_ptr<internal::CursorWindowController> cursor_window_controller_; 214 scoped_ptr<internal::CursorWindowController> cursor_window_controller_;
213 scoped_ptr<internal::MirrorWindowController> mirror_window_controller_; 215 scoped_ptr<internal::MirrorWindowController> mirror_window_controller_;
214 scoped_ptr<internal::VirtualKeyboardWindowController> 216 scoped_ptr<internal::VirtualKeyboardWindowController>
215 virtual_keyboard_window_controller_; 217 virtual_keyboard_window_controller_;
216 218
217 // Stores the curent cursor location (in native coordinates) used to 219 // Stores the curent cursor location (in native coordinates) used to
218 // restore the cursor location when display configuration 220 // restore the cursor location when display configuration
219 // changed. 221 // changed.
220 gfx::Point cursor_location_in_native_coords_for_restore_; 222 gfx::Point cursor_location_in_native_coords_for_restore_;
221 223
222 DISALLOW_COPY_AND_ASSIGN(DisplayController); 224 DISALLOW_COPY_AND_ASSIGN(DisplayController);
223 }; 225 };
224 226
225 } // namespace ash 227 } // namespace ash
226 228
227 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ 229 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698