| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 // RootWindowObserver overrides: | 117 // RootWindowObserver overrides: |
| 118 virtual void OnRootWindowResized(const aura::RootWindow* root, | 118 virtual void OnRootWindowResized(const aura::RootWindow* root, |
| 119 const gfx::Size& new_size) OVERRIDE; | 119 const gfx::Size& new_size) OVERRIDE; |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, ConvertPoint); | 122 FRIEND_TEST_ALL_PREFIXES(ExtendedDesktopTest, ConvertPoint); |
| 123 FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, TestNativeDisplaysChanged); | 123 FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, TestNativeDisplaysChanged); |
| 124 FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, | 124 FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, |
| 125 NativeDisplaysChangedAfterPrimaryChange); | 125 NativeDisplaysChangedAfterPrimaryChange); |
| 126 FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, AutomaticOverscanInsets); |
| 126 friend class ash::AcceleratorControllerTest; | 127 friend class ash::AcceleratorControllerTest; |
| 127 friend class test::DisplayManagerTestApi; | 128 friend class test::DisplayManagerTestApi; |
| 128 friend class DisplayManagerTest; | 129 friend class DisplayManagerTest; |
| 129 friend class test::SystemGestureEventFilterTest; | 130 friend class test::SystemGestureEventFilterTest; |
| 130 | 131 |
| 131 typedef std::vector<gfx::Display> DisplayList; | 132 typedef std::vector<gfx::Display> DisplayList; |
| 132 | 133 |
| 133 // Metadata for each display. | 134 // Metadata for each display. |
| 134 struct DisplayInfo { | 135 struct DisplayInfo { |
| 136 DisplayInfo(); |
| 137 |
| 135 // The cached name of the display. | 138 // The cached name of the display. |
| 136 std::string name; | 139 std::string name; |
| 137 | 140 |
| 138 // The original bounds_in_pixel for the display. This can be different from | 141 // The original bounds_in_pixel for the display. This can be different from |
| 139 // the current one in case of overscan insets. | 142 // the current one in case of overscan insets. |
| 140 gfx::Rect original_bounds_in_pixel; | 143 gfx::Rect original_bounds_in_pixel; |
| 141 | 144 |
| 142 // The overscan insets for the display. | 145 // The overscan insets for the display. |
| 143 gfx::Insets overscan_insets_in_dip; | 146 gfx::Insets overscan_insets_in_dip; |
| 147 |
| 148 // True if we detect that the display has overscan area. False if the |
| 149 // display doesn't have it, or failed to detect it. |
| 150 bool has_overscan; |
| 151 |
| 152 // True if the |overscan_insets_in_dip| is specified. This is set because |
| 153 // the user may specify an empty intentionally. |
| 154 bool has_custom_overscan_insets; |
| 144 }; | 155 }; |
| 145 | 156 |
| 146 void Init(); | 157 void Init(); |
| 147 void CycleDisplayImpl(); | 158 void CycleDisplayImpl(); |
| 148 void ScaleDisplayImpl(); | 159 void ScaleDisplayImpl(); |
| 149 | 160 |
| 150 gfx::Display& FindDisplayForRootWindow(const aura::RootWindow* root); | 161 gfx::Display& FindDisplayForRootWindow(const aura::RootWindow* root); |
| 151 gfx::Display& FindDisplayForId(int64 id); | 162 gfx::Display& FindDisplayForId(int64 id); |
| 152 | 163 |
| 153 // Refer to |aura::DisplayManager::CreateDisplayFromSpec| API for | 164 // Refer to |aura::DisplayManager::CreateDisplayFromSpec| API for |
| 154 // the format of |spec|. | 165 // the format of |spec|. |
| 155 void AddDisplayFromSpec(const std::string& spec); | 166 void AddDisplayFromSpec(const std::string& spec); |
| 156 | 167 |
| 157 // Set the 1st display as an internal display and returns the display Id for | 168 // Set the 1st display as an internal display and returns the display Id for |
| 158 // the internal display. | 169 // the internal display. |
| 159 int64 SetFirstDisplayAsInternalDisplayForTest(); | 170 int64 SetFirstDisplayAsInternalDisplayForTest(); |
| 160 | 171 |
| 161 // Checks if the mouse pointer is on one of displays, and moves to | 172 // Checks if the mouse pointer is on one of displays, and moves to |
| 162 // the center of the nearest display if it's outside of all displays. | 173 // the center of the nearest display if it's outside of all displays. |
| 163 void EnsurePointerInDisplays(); | 174 void EnsurePointerInDisplays(); |
| 164 | 175 |
| 165 // Updates |display_names_| by calling platform-dependent functions. | 176 // Updates |display_info_| by calling platform-dependent functions. |
| 166 void RefreshDisplayNames(); | 177 void RefreshDisplayInfo(); |
| 167 | 178 |
| 168 // Update the display's id in the |display_list| to match the ones | 179 // Update the display's id in the |display_list| to match the ones |
| 169 // stored in this display manager's |displays_|. This is used to | 180 // stored in this display manager's |displays_|. This is used to |
| 170 // emulate display change behavior during the test byn creating the | 181 // emulate display change behavior during the test byn creating the |
| 171 // display list with the same display ids but with different bounds | 182 // display list with the same display ids but with different bounds |
| 172 void SetDisplayIdsForTest(DisplayList* display_list) const; | 183 void SetDisplayIdsForTest(DisplayList* display_list) const; |
| 173 | 184 |
| 185 // Forcibly specify 'has_overscan' flag of the DisplayInfo for specified |id|. |
| 186 void SetHasOverscanFlagForTest(int64 id, bool has_overscan); |
| 187 |
| 174 DisplayList displays_; | 188 DisplayList displays_; |
| 175 | 189 |
| 176 int64 internal_display_id_; | 190 int64 internal_display_id_; |
| 177 | 191 |
| 178 // An internal display cache used when the internal display is disconnectd. | 192 // An internal display cache used when the internal display is disconnectd. |
| 179 scoped_ptr<gfx::Display> internal_display_; | 193 scoped_ptr<gfx::Display> internal_display_; |
| 180 | 194 |
| 181 bool force_bounds_changed_; | 195 bool force_bounds_changed_; |
| 182 | 196 |
| 183 // The mapping from the display ID to its internal data. | 197 // The mapping from the display ID to its internal data. |
| 184 std::map<int64, DisplayInfo> display_info_; | 198 std::map<int64, DisplayInfo> display_info_; |
| 185 | 199 |
| 186 DISALLOW_COPY_AND_ASSIGN(DisplayManager); | 200 DISALLOW_COPY_AND_ASSIGN(DisplayManager); |
| 187 }; | 201 }; |
| 188 | 202 |
| 189 extern const aura::WindowProperty<int64>* const kDisplayIdKey; | 203 extern const aura::WindowProperty<int64>* const kDisplayIdKey; |
| 190 | 204 |
| 191 } // namespace internal | 205 } // namespace internal |
| 192 } // namespace ash | 206 } // namespace ash |
| 193 | 207 |
| 194 #endif // ASH_DISPLAY_DISPLAY_MANAGER_H_ | 208 #endif // ASH_DISPLAY_DISPLAY_MANAGER_H_ |
| OLD | NEW |