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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Add/Remove observers. | 99 // Add/Remove observers. |
100 void AddObserver(Observer* observer); | 100 void AddObserver(Observer* observer); |
101 void RemoveObserver(Observer* observer); | 101 void RemoveObserver(Observer* observer); |
102 | 102 |
103 // Returns the root window for primary display. | 103 // Returns the root window for primary display. |
104 aura::Window* GetPrimaryRootWindow(); | 104 aura::Window* GetPrimaryRootWindow(); |
105 | 105 |
106 // Returns the root window for |display_id|. | 106 // Returns the root window for |display_id|. |
107 aura::Window* GetRootWindowForDisplayId(int64 id); | 107 aura::Window* GetRootWindowForDisplayId(int64 id); |
108 | 108 |
| 109 // Returns AshWTH for given display |id|. Call results in CHECK failure |
| 110 // if the WTH does not exist. |
| 111 AshWindowTreeHost* GetAshWindowTreeHostForDisplayId(int64 id); |
| 112 |
109 // Toggle mirror mode. | 113 // Toggle mirror mode. |
110 void ToggleMirrorMode(); | 114 void ToggleMirrorMode(); |
111 | 115 |
112 // Swap primary and secondary display. | 116 // Swap primary and secondary display. |
113 void SwapPrimaryDisplay(); | 117 void SwapPrimaryDisplay(); |
114 | 118 |
115 // Sets the ID of the primary display. If the display is not connected, it | 119 // Sets the ID of the primary display. If the display is not connected, it |
116 // will switch the primary display when connected. | 120 // will switch the primary display when connected. |
117 void SetPrimaryDisplayId(int64 id); | 121 void SetPrimaryDisplayId(int64 id); |
118 | 122 |
(...skipping 27 matching lines...) Expand all Loading... |
146 // gfx::DisplayObserver overrides: | 150 // gfx::DisplayObserver overrides: |
147 void OnDisplayAdded(const gfx::Display& display) override; | 151 void OnDisplayAdded(const gfx::Display& display) override; |
148 void OnDisplayRemoved(const gfx::Display& display) override; | 152 void OnDisplayRemoved(const gfx::Display& display) override; |
149 void OnDisplayMetricsChanged(const gfx::Display& display, | 153 void OnDisplayMetricsChanged(const gfx::Display& display, |
150 uint32_t metrics) override; | 154 uint32_t metrics) override; |
151 | 155 |
152 // aura::WindowTreeHostObserver overrides: | 156 // aura::WindowTreeHostObserver overrides: |
153 void OnHostResized(const aura::WindowTreeHost* host) override; | 157 void OnHostResized(const aura::WindowTreeHost* host) override; |
154 | 158 |
155 // aura::DisplayManager::Delegate overrides: | 159 // aura::DisplayManager::Delegate overrides: |
156 void CreateOrUpdateMirroringDisplay(const DisplayInfo& info) override; | 160 void CreateOrUpdateMirroringDisplay( |
| 161 const DisplayInfoList& info_list) override; |
157 void CloseMirroringDisplay() override; | 162 void CloseMirroringDisplay() override; |
158 void PreDisplayConfigurationChange(bool clear_focus) override; | 163 void PreDisplayConfigurationChange(bool clear_focus) override; |
159 void PostDisplayConfigurationChange() override; | 164 void PostDisplayConfigurationChange() override; |
160 | 165 |
161 private: | 166 private: |
162 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, BoundsUpdated); | 167 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, BoundsUpdated); |
163 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, SecondaryDisplayLayout); | 168 FRIEND_TEST_ALL_PREFIXES(DisplayControllerTest, SecondaryDisplayLayout); |
164 friend class DisplayManager; | 169 friend class DisplayManager; |
165 friend class MirrorWindowController; | 170 friend class MirrorWindowController; |
166 | 171 |
167 // Creates a WindowTreeHost for |display| and stores it in the | 172 // Creates a WindowTreeHost for |display| and stores it in the |
168 // |window_tree_hosts_| map. | 173 // |window_tree_hosts_| map. |
169 AshWindowTreeHost* AddWindowTreeHostForDisplay( | 174 AshWindowTreeHost* AddWindowTreeHostForDisplay( |
170 const gfx::Display& display, | 175 const gfx::Display& display, |
171 const AshWindowTreeHostInitParams& params); | 176 const AshWindowTreeHostInitParams& params); |
172 | 177 |
173 void OnFadeOutForSwapDisplayFinished(); | 178 void OnFadeOutForSwapDisplayFinished(); |
174 | 179 |
175 void SetMirrorModeAfterAnimation(bool mirror); | 180 void SetMirrorModeAfterAnimation(bool mirror); |
176 | 181 |
| 182 // Delete the AsWindowTreeHost. This does not remove the entry from |
| 183 // |window_tree_hosts_|. Caller has to explicitly remove it. |
| 184 void DeleteHost(AshWindowTreeHost* host_to_delete); |
| 185 |
177 class DisplayChangeLimiter { | 186 class DisplayChangeLimiter { |
178 public: | 187 public: |
179 DisplayChangeLimiter(); | 188 DisplayChangeLimiter(); |
180 | 189 |
181 // Sets how long the throttling should last. | 190 // Sets how long the throttling should last. |
182 void SetThrottleTimeout(int64 throttle_ms); | 191 void SetThrottleTimeout(int64 throttle_ms); |
183 | 192 |
184 bool IsThrottled() const; | 193 bool IsThrottled() const; |
185 | 194 |
186 private: | 195 private: |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 int64 cursor_display_id_for_restore_; | 230 int64 cursor_display_id_for_restore_; |
222 | 231 |
223 base::WeakPtrFactory<DisplayController> weak_ptr_factory_; | 232 base::WeakPtrFactory<DisplayController> weak_ptr_factory_; |
224 | 233 |
225 DISALLOW_COPY_AND_ASSIGN(DisplayController); | 234 DISALLOW_COPY_AND_ASSIGN(DisplayController); |
226 }; | 235 }; |
227 | 236 |
228 } // namespace ash | 237 } // namespace ash |
229 | 238 |
230 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ | 239 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ |
OLD | NEW |