| 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_MANAGER_H_ | 5 #ifndef ASH_DISPLAY_DISPLAY_MANAGER_H_ |
| 6 #define ASH_DISPLAY_DISPLAY_MANAGER_H_ | 6 #define ASH_DISPLAY_DISPLAY_MANAGER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class Rect; | 27 class Rect; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace ash { | 30 namespace ash { |
| 31 class AcceleratorControllerTest; | 31 class AcceleratorControllerTest; |
| 32 namespace test { | 32 namespace test { |
| 33 class DisplayManagerTestApi; | 33 class DisplayManagerTestApi; |
| 34 class SystemGestureEventFilterTest; | 34 class SystemGestureEventFilterTest; |
| 35 } | 35 } |
| 36 namespace internal { | 36 namespace internal { |
| 37 class DisplayLayoutStore; |
| 37 | 38 |
| 38 // DisplayManager maintains the current display configurations, | 39 // DisplayManager maintains the current display configurations, |
| 39 // and notifies observers when configuration changes. | 40 // and notifies observers when configuration changes. |
| 40 // This is exported for unittest. | 41 // This is exported for unittest. |
| 41 // | 42 // |
| 42 // TODO(oshima): Make this non internal. | 43 // TODO(oshima): Make this non internal. |
| 43 class ASH_EXPORT DisplayManager : | 44 class ASH_EXPORT DisplayManager : |
| 44 #if defined(OS_CHROMEOS) | 45 #if defined(OS_CHROMEOS) |
| 45 public chromeos::OutputConfigurator::SoftwareMirroringController, | 46 public chromeos::OutputConfigurator::SoftwareMirroringController, |
| 46 #endif | 47 #endif |
| 47 public aura::RootWindowObserver { | 48 public aura::RootWindowObserver { |
| 48 public: | 49 public: |
| 49 DisplayManager(); | 50 DisplayManager(); |
| 50 virtual ~DisplayManager(); | 51 virtual ~DisplayManager(); |
| 51 | 52 |
| 52 // Returns the list of possible UI scales for the display. | 53 // Returns the list of possible UI scales for the display. |
| 53 static std::vector<float> GetScalesForDisplay(const DisplayInfo& info); | 54 static std::vector<float> GetScalesForDisplay(const DisplayInfo& info); |
| 54 | 55 |
| 55 // Returns next valid UI scale. | 56 // Returns next valid UI scale. |
| 56 static float GetNextUIScale(const DisplayInfo& info, bool up); | 57 static float GetNextUIScale(const DisplayInfo& info, bool up); |
| 57 | 58 |
| 58 // Updates the bounds of |secondary_display| according to |layout|. | 59 // Updates the bounds of |secondary_display| according to |layout|. |
| 59 static void UpdateDisplayBoundsForLayout( | 60 static void UpdateDisplayBoundsForLayout( |
| 60 const DisplayLayout& layout, | 61 const DisplayLayout& layout, |
| 61 const gfx::Display& primary_display, | 62 const gfx::Display& primary_display, |
| 62 gfx::Display* secondary_display); | 63 gfx::Display* secondary_display); |
| 63 | 64 |
| 65 DisplayLayoutStore* layout_store() { |
| 66 return layout_store_.get(); |
| 67 } |
| 68 |
| 64 // When set to true, the MonitorManager calls OnDisplayBoundsChanged | 69 // When set to true, the MonitorManager calls OnDisplayBoundsChanged |
| 65 // even if the display's bounds didn't change. Used to swap primary | 70 // even if the display's bounds didn't change. Used to swap primary |
| 66 // display. | 71 // display. |
| 67 void set_force_bounds_changed(bool force_bounds_changed) { | 72 void set_force_bounds_changed(bool force_bounds_changed) { |
| 68 force_bounds_changed_ = force_bounds_changed; | 73 force_bounds_changed_ = force_bounds_changed; |
| 69 } | 74 } |
| 70 | 75 |
| 71 // Returns the display id of the first display in the outupt list. | 76 // Returns the display id of the first display in the outupt list. |
| 72 int64 first_display_id() const { return first_display_id_; } | 77 int64 first_display_id() const { return first_display_id_; } |
| 73 | 78 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 gfx::Display CreateDisplayFromDisplayInfoById(int64 display_id); | 236 gfx::Display CreateDisplayFromDisplayInfoById(int64 display_id); |
| 232 | 237 |
| 233 // Updates the bounds of the secondary display in |display_list| | 238 // Updates the bounds of the secondary display in |display_list| |
| 234 // using the layout registered for the display pair and set the | 239 // using the layout registered for the display pair and set the |
| 235 // index of display updated to |updated_index|. Returns true | 240 // index of display updated to |updated_index|. Returns true |
| 236 // if the secondary display's bounds has been changed from current | 241 // if the secondary display's bounds has been changed from current |
| 237 // value, or false otherwise. | 242 // value, or false otherwise. |
| 238 bool UpdateSecondaryDisplayBoundsForLayout(DisplayList* display_list, | 243 bool UpdateSecondaryDisplayBoundsForLayout(DisplayList* display_list, |
| 239 size_t* updated_index) const; | 244 size_t* updated_index) const; |
| 240 | 245 |
| 246 scoped_ptr<DisplayLayoutStore> layout_store_; |
| 247 |
| 241 int64 first_display_id_; | 248 int64 first_display_id_; |
| 242 | 249 |
| 243 gfx::Display mirrored_display_; | 250 gfx::Display mirrored_display_; |
| 244 | 251 |
| 245 // List of current active dispays. | 252 // List of current active dispays. |
| 246 DisplayList displays_; | 253 DisplayList displays_; |
| 247 | 254 |
| 248 int num_connected_displays_; | 255 int num_connected_displays_; |
| 249 | 256 |
| 250 bool force_bounds_changed_; | 257 bool force_bounds_changed_; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 263 | 270 |
| 264 DISALLOW_COPY_AND_ASSIGN(DisplayManager); | 271 DISALLOW_COPY_AND_ASSIGN(DisplayManager); |
| 265 }; | 272 }; |
| 266 | 273 |
| 267 extern const aura::WindowProperty<int64>* const kDisplayIdKey; | 274 extern const aura::WindowProperty<int64>* const kDisplayIdKey; |
| 268 | 275 |
| 269 } // namespace internal | 276 } // namespace internal |
| 270 } // namespace ash | 277 } // namespace ash |
| 271 | 278 |
| 272 #endif // ASH_DISPLAY_DISPLAY_MANAGER_H_ | 279 #endif // ASH_DISPLAY_DISPLAY_MANAGER_H_ |
| OLD | NEW |