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 12 matching lines...) Expand all Loading... |
23 class RootWindow; | 23 class RootWindow; |
24 } | 24 } |
25 | 25 |
26 namespace base { | 26 namespace base { |
27 class Value; | 27 class Value; |
28 template <typename T> class JSONValueConverter; | 28 template <typename T> class JSONValueConverter; |
29 } | 29 } |
30 | 30 |
31 namespace ash { | 31 namespace ash { |
32 namespace internal { | 32 namespace internal { |
| 33 class DisplayManager; |
33 class RootWindowController; | 34 class RootWindowController; |
34 } | 35 } |
35 | 36 |
36 typedef std::pair<int64, int64> DisplayIdPair; | 37 typedef std::pair<int64, int64> DisplayIdPair; |
37 | 38 |
38 struct ASH_EXPORT DisplayLayout { | 39 struct ASH_EXPORT DisplayLayout { |
39 // Layout options where the secondary display should be positioned. | 40 // Layout options where the secondary display should be positioned. |
40 enum Position { | 41 enum Position { |
41 TOP, | 42 TOP, |
42 RIGHT, | 43 RIGHT, |
(...skipping 29 matching lines...) Expand all Loading... |
72 // DisplayController owns and maintains RootWindows for each attached | 73 // DisplayController owns and maintains RootWindows for each attached |
73 // display, keeping them in sync with display configuration changes. | 74 // display, keeping them in sync with display configuration changes. |
74 class ASH_EXPORT DisplayController : public gfx::DisplayObserver { | 75 class ASH_EXPORT DisplayController : public gfx::DisplayObserver { |
75 public: | 76 public: |
76 class ASH_EXPORT Observer { | 77 class ASH_EXPORT Observer { |
77 public: | 78 public: |
78 // Invoked when the display configuration change is requested, | 79 // Invoked when the display configuration change is requested, |
79 // but before the change is applied to aura/ash. | 80 // but before the change is applied to aura/ash. |
80 virtual void OnDisplayConfigurationChanging() = 0; | 81 virtual void OnDisplayConfigurationChanging() = 0; |
81 | 82 |
| 83 // Invoked when the all display configuration changes |
| 84 // have been applied. |
| 85 virtual void OnDisplayConfigurationChanged() {}; |
| 86 |
82 protected: | 87 protected: |
83 virtual ~Observer() {} | 88 virtual ~Observer() {} |
84 }; | 89 }; |
85 | 90 |
86 DisplayController(); | 91 DisplayController(); |
87 virtual ~DisplayController(); | 92 virtual ~DisplayController(); |
88 | 93 |
89 void Shutdown(); | 94 void Shutdown(); |
90 | 95 |
91 // Returns primary display. This is safe to use after ash::Shell is | 96 // Returns primary display. This is safe to use after ash::Shell is |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // Returns the display layout registered for the given display id |pair|. | 178 // Returns the display layout registered for the given display id |pair|. |
174 DisplayLayout GetRegisteredDisplayLayout(const DisplayIdPair& pair) const; | 179 DisplayLayout GetRegisteredDisplayLayout(const DisplayIdPair& pair) const; |
175 | 180 |
176 // aura::DisplayObserver overrides: | 181 // aura::DisplayObserver overrides: |
177 virtual void OnDisplayBoundsChanged( | 182 virtual void OnDisplayBoundsChanged( |
178 const gfx::Display& display) OVERRIDE; | 183 const gfx::Display& display) OVERRIDE; |
179 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; | 184 virtual void OnDisplayAdded(const gfx::Display& display) OVERRIDE; |
180 virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE; | 185 virtual void OnDisplayRemoved(const gfx::Display& display) OVERRIDE; |
181 | 186 |
182 private: | 187 private: |
| 188 friend class internal::DisplayManager; |
| 189 |
183 // Create a root window for given |display|. | 190 // Create a root window for given |display|. |
184 aura::RootWindow* CreateRootWindowForDisplay(const gfx::Display& display); | 191 aura::RootWindow* CreateRootWindowForDisplay(const gfx::Display& display); |
185 | 192 |
186 // Creates a root window for |display| and stores it in the |root_windows_| | 193 // Creates a root window for |display| and stores it in the |root_windows_| |
187 // map. | 194 // map. |
188 aura::RootWindow* AddRootWindowForDisplay(const gfx::Display& display); | 195 aura::RootWindow* AddRootWindowForDisplay(const gfx::Display& display); |
189 | 196 |
190 void UpdateDisplayBoundsForLayout(); | 197 void UpdateDisplayBoundsForLayout(); |
191 | 198 |
192 void NotifyDisplayConfigurationChanging(); | 199 void NotifyDisplayConfigurationChanging(); |
| 200 void NotifyDisplayConfigurationChanged(); |
193 | 201 |
194 void SetLayoutForDisplayIdPair(const DisplayIdPair& display_pair, | 202 void SetLayoutForDisplayIdPair(const DisplayIdPair& display_pair, |
195 const DisplayLayout& layout); | 203 const DisplayLayout& layout); |
196 | 204 |
197 void RegisterLayoutForDisplayIdPairInternal( | 205 void RegisterLayoutForDisplayIdPairInternal( |
198 int64 id1, | 206 int64 id1, |
199 int64 id2, | 207 int64 id2, |
200 const DisplayLayout& layout, | 208 const DisplayLayout& layout, |
201 bool override); | 209 bool override); |
202 | 210 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 // Store the primary root window temporarily while replacing | 248 // Store the primary root window temporarily while replacing |
241 // display. | 249 // display. |
242 aura::RootWindow* primary_root_window_for_replace_; | 250 aura::RootWindow* primary_root_window_for_replace_; |
243 | 251 |
244 DISALLOW_COPY_AND_ASSIGN(DisplayController); | 252 DISALLOW_COPY_AND_ASSIGN(DisplayController); |
245 }; | 253 }; |
246 | 254 |
247 } // namespace ash | 255 } // namespace ash |
248 | 256 |
249 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ | 257 #endif // ASH_DISPLAY_DISPLAY_CONTROLLER_H_ |
OLD | NEW |