| 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // Returns the current overscan insets for the specified |display_id|. | 79 // Returns the current overscan insets for the specified |display_id|. |
| 80 // Returns an empty insets (0, 0, 0, 0) if no insets are specified for | 80 // Returns an empty insets (0, 0, 0, 0) if no insets are specified for |
| 81 // the display. | 81 // the display. |
| 82 gfx::Insets GetOverscanInsets(int64 display_id) const; | 82 gfx::Insets GetOverscanInsets(int64 display_id) const; |
| 83 | 83 |
| 84 // Called when display configuration has changed. The new display | 84 // Called when display configuration has changed. The new display |
| 85 // configurations is passed as a vector of Display object, which | 85 // configurations is passed as a vector of Display object, which |
| 86 // contains each display's new infomration. | 86 // contains each display's new infomration. |
| 87 void OnNativeDisplaysChanged(const std::vector<gfx::Display>& displays); | 87 void OnNativeDisplaysChanged(const std::vector<gfx::Display>& displays); |
| 88 | 88 |
| 89 // Updates the internal display data and notifies observers about the changes. |
| 90 void UpdateDisplays(const std::vector<gfx::Display>& displays); |
| 91 |
| 89 // Create a root window for given |display|. | 92 // Create a root window for given |display|. |
| 90 aura::RootWindow* CreateRootWindowForDisplay(const gfx::Display& display); | 93 aura::RootWindow* CreateRootWindowForDisplay(const gfx::Display& display); |
| 91 | 94 |
| 92 // Obsoleted: Do not use in new code. | 95 // Obsoleted: Do not use in new code. |
| 93 // Returns the display at |index|. The display at 0 is | 96 // Returns the display at |index|. The display at 0 is |
| 94 // no longer considered "primary". | 97 // no longer considered "primary". |
| 95 gfx::Display* GetDisplayAt(size_t index); | 98 gfx::Display* GetDisplayAt(size_t index); |
| 96 | 99 |
| 97 size_t GetNumDisplays() const; | 100 size_t GetNumDisplays() const; |
| 98 | 101 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 120 FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, TestNativeDisplaysChanged); | 123 FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, TestNativeDisplaysChanged); |
| 121 FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, | 124 FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, |
| 122 NativeDisplaysChangedAfterPrimaryChange); | 125 NativeDisplaysChangedAfterPrimaryChange); |
| 123 friend class ash::AcceleratorControllerTest; | 126 friend class ash::AcceleratorControllerTest; |
| 124 friend class test::DisplayManagerTestApi; | 127 friend class test::DisplayManagerTestApi; |
| 125 friend class DisplayManagerTest; | 128 friend class DisplayManagerTest; |
| 126 friend class test::SystemGestureEventFilterTest; | 129 friend class test::SystemGestureEventFilterTest; |
| 127 | 130 |
| 128 typedef std::vector<gfx::Display> DisplayList; | 131 typedef std::vector<gfx::Display> DisplayList; |
| 129 | 132 |
| 133 // Metadata for each display. |
| 134 struct DisplayInfo { |
| 135 // The cached name of the display. |
| 136 std::string name; |
| 137 |
| 138 // The original bounds_in_pixel for the display. This can be different from |
| 139 // the current one in case of overscan insets. |
| 140 gfx::Rect original_bounds_in_pixel; |
| 141 |
| 142 // The overscan insets for the display. |
| 143 gfx::Insets overscan_insets_in_dip; |
| 144 }; |
| 145 |
| 130 void Init(); | 146 void Init(); |
| 131 void CycleDisplayImpl(); | 147 void CycleDisplayImpl(); |
| 132 void ScaleDisplayImpl(); | 148 void ScaleDisplayImpl(); |
| 133 | 149 |
| 134 gfx::Display& FindDisplayForRootWindow(const aura::RootWindow* root); | 150 gfx::Display& FindDisplayForRootWindow(const aura::RootWindow* root); |
| 135 gfx::Display& FindDisplayForId(int64 id); | 151 gfx::Display& FindDisplayForId(int64 id); |
| 136 | 152 |
| 137 // Refer to |aura::DisplayManager::CreateDisplayFromSpec| API for | 153 // Refer to |aura::DisplayManager::CreateDisplayFromSpec| API for |
| 138 // the format of |spec|. | 154 // the format of |spec|. |
| 139 void AddDisplayFromSpec(const std::string& spec); | 155 void AddDisplayFromSpec(const std::string& spec); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 157 | 173 |
| 158 DisplayList displays_; | 174 DisplayList displays_; |
| 159 | 175 |
| 160 int64 internal_display_id_; | 176 int64 internal_display_id_; |
| 161 | 177 |
| 162 // An internal display cache used when the internal display is disconnectd. | 178 // An internal display cache used when the internal display is disconnectd. |
| 163 scoped_ptr<gfx::Display> internal_display_; | 179 scoped_ptr<gfx::Display> internal_display_; |
| 164 | 180 |
| 165 bool force_bounds_changed_; | 181 bool force_bounds_changed_; |
| 166 | 182 |
| 167 // The mapping from the display ID to its overscan insets. | 183 // The mapping from the display ID to its internal data. |
| 168 std::map<int64, gfx::Insets> overscan_mapping_; | 184 std::map<int64, DisplayInfo> display_info_; |
| 169 | |
| 170 // The cached display's name for the display ID. | |
| 171 std::map<int64, std::string> display_names_; | |
| 172 | 185 |
| 173 DISALLOW_COPY_AND_ASSIGN(DisplayManager); | 186 DISALLOW_COPY_AND_ASSIGN(DisplayManager); |
| 174 }; | 187 }; |
| 175 | 188 |
| 176 extern const aura::WindowProperty<int64>* const kDisplayIdKey; | 189 extern const aura::WindowProperty<int64>* const kDisplayIdKey; |
| 177 | 190 |
| 178 } // namespace internal | 191 } // namespace internal |
| 179 } // namespace ash | 192 } // namespace ash |
| 180 | 193 |
| 181 #endif // ASH_DISPLAY_DISPLAY_MANAGER_H_ | 194 #endif // ASH_DISPLAY_DISPLAY_MANAGER_H_ |
| OLD | NEW |