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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 const gfx::Point& point_in_screen) const; | 76 const gfx::Point& point_in_screen) const; |
77 | 77 |
78 // Registers the overscan insets for the display of the specified ID. Note | 78 // Registers the overscan insets for the display of the specified ID. Note |
79 // that the insets size should be specified in DIP size. It also triggers the | 79 // that the insets size should be specified in DIP size. It also triggers the |
80 // display's bounds change. | 80 // display's bounds change. |
81 void SetOverscanInsets(int64 display_id, const gfx::Insets& insets_in_dip); | 81 void SetOverscanInsets(int64 display_id, const gfx::Insets& insets_in_dip); |
82 | 82 |
83 // Clears the overscan insets | 83 // Clears the overscan insets |
84 void ClearCustomOverscanInsets(int64 display_id); | 84 void ClearCustomOverscanInsets(int64 display_id); |
85 | 85 |
| 86 // Sets the display's rotation. |
| 87 void SetDisplayRotation(int64 display_id, DisplayInfo::Rotation rotation); |
| 88 |
86 // Returns the current overscan insets for the specified |display_id|. | 89 // Returns the current overscan insets for the specified |display_id|. |
87 // Returns an empty insets (0, 0, 0, 0) if no insets are specified for | 90 // Returns an empty insets (0, 0, 0, 0) if no insets are specified for |
88 // the display. | 91 // the display. |
89 gfx::Insets GetOverscanInsets(int64 display_id) const; | 92 gfx::Insets GetOverscanInsets(int64 display_id) const; |
90 | 93 |
91 // Called when display configuration has changed. The new display | 94 // Called when display configuration has changed. The new display |
92 // configurations is passed as a vector of Display object, which | 95 // configurations is passed as a vector of Display object, which |
93 // contains each display's new infomration. | 96 // contains each display's new infomration. |
94 void OnNativeDisplaysChanged( | 97 void OnNativeDisplaysChanged( |
95 const std::vector<DisplayInfo>& display_info_list); | 98 const std::vector<DisplayInfo>& display_info_list); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, | 140 FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, |
138 NativeDisplaysChangedAfterPrimaryChange); | 141 NativeDisplaysChangedAfterPrimaryChange); |
139 FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, AutomaticOverscanInsets); | 142 FRIEND_TEST_ALL_PREFIXES(DisplayManagerTest, AutomaticOverscanInsets); |
140 friend class ash::AcceleratorControllerTest; | 143 friend class ash::AcceleratorControllerTest; |
141 friend class test::DisplayManagerTestApi; | 144 friend class test::DisplayManagerTestApi; |
142 friend class DisplayManagerTest; | 145 friend class DisplayManagerTest; |
143 friend class test::SystemGestureEventFilterTest; | 146 friend class test::SystemGestureEventFilterTest; |
144 | 147 |
145 typedef std::vector<gfx::Display> DisplayList; | 148 typedef std::vector<gfx::Display> DisplayList; |
146 | 149 |
| 150 void set_change_display_upon_host_resize(bool value) { |
| 151 change_display_upon_host_resize_ = value; |
| 152 } |
| 153 |
147 void Init(); | 154 void Init(); |
148 void CycleDisplayImpl(); | 155 void CycleDisplayImpl(); |
149 void ScaleDisplayImpl(); | 156 void ScaleDisplayImpl(); |
150 | 157 |
151 gfx::Display& FindDisplayForRootWindow(const aura::RootWindow* root); | 158 gfx::Display& FindDisplayForRootWindow(const aura::RootWindow* root); |
152 gfx::Display& FindDisplayForId(int64 id); | 159 gfx::Display& FindDisplayForId(int64 id); |
153 | 160 |
154 // Refer to |CreateDisplayFromSpec| API for the format of |spec|. | 161 // Refer to |CreateDisplayFromSpec| API for the format of |spec|. |
155 void AddDisplayFromSpec(const std::string& spec); | 162 void AddDisplayFromSpec(const std::string& spec); |
156 | 163 |
157 // Checks if the mouse pointer is on one of displays, and moves to | 164 // Checks if the mouse pointer is on one of displays, and moves to |
158 // the center of the nearest display if it's outside of all displays. | 165 // the center of the nearest display if it's outside of all displays. |
159 void EnsurePointerInDisplays(); | 166 void EnsurePointerInDisplays(); |
160 | 167 |
161 // Inserts and update the DisplayInfo according to the overscan | 168 // Inserts and update the DisplayInfo according to the overscan |
162 // state. Note that The DisplayInfo stored in the |internal_display_info_| | 169 // state. Note that The DisplayInfo stored in the |internal_display_info_| |
163 // can be different from |new_info| (due to overscan state), so | 170 // can be different from |new_info| (due to overscan state), so |
164 // you must use |GetDisplayInfo| to get the correct DisplayInfo for | 171 // you must use |GetDisplayInfo| to get the correct DisplayInfo for |
165 // a display. | 172 // a display. |
166 void InsertAndUpdateDisplayInfo(const DisplayInfo& new_info, | 173 void InsertAndUpdateDisplayInfo(const DisplayInfo& new_info); |
167 bool can_overscan); | |
168 | 174 |
169 // Creates a display object from the DisplayInfo for |display_id|. | 175 // Creates a display object from the DisplayInfo for |display_id|. |
170 gfx::Display CreateDisplayFromDisplayInfoById(int64 display_id); | 176 gfx::Display CreateDisplayFromDisplayInfoById(int64 display_id); |
171 | 177 |
172 int64 first_display_id_; | 178 int64 first_display_id_; |
173 | 179 |
174 DisplayList displays_; | 180 DisplayList displays_; |
175 | 181 |
176 // An internal display info cache used when the internal display is | 182 // An internal display info cache used when the internal display is |
177 // disconnectd. | 183 // disconnectd. |
178 scoped_ptr<DisplayInfo> internal_display_info_; | 184 scoped_ptr<DisplayInfo> internal_display_info_; |
179 | 185 |
180 bool force_bounds_changed_; | 186 bool force_bounds_changed_; |
181 | 187 |
182 // The mapping from the display ID to its internal data. | 188 // The mapping from the display ID to its internal data. |
183 std::map<int64, DisplayInfo> display_info_; | 189 std::map<int64, DisplayInfo> display_info_; |
184 | 190 |
| 191 // When set to true, the host window's resize event updates |
| 192 // the display's size. This is set to true when running on |
| 193 // desktop environment (for debugging) so that resizing the host |
| 194 // window wil update the display properly. This is set to false |
| 195 // on device as well as during the unit tests. |
| 196 bool change_display_upon_host_resize_; |
| 197 |
185 DISALLOW_COPY_AND_ASSIGN(DisplayManager); | 198 DISALLOW_COPY_AND_ASSIGN(DisplayManager); |
186 }; | 199 }; |
187 | 200 |
188 extern const aura::WindowProperty<int64>* const kDisplayIdKey; | 201 extern const aura::WindowProperty<int64>* const kDisplayIdKey; |
189 | 202 |
190 } // namespace internal | 203 } // namespace internal |
191 } // namespace ash | 204 } // namespace ash |
192 | 205 |
193 #endif // ASH_DISPLAY_DISPLAY_MANAGER_H_ | 206 #endif // ASH_DISPLAY_DISPLAY_MANAGER_H_ |
OLD | NEW |