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_MULTI_DISPLAY_MANAGER_H_ | 5 #ifndef ASH_DISPLAY_MULTI_DISPLAY_MANAGER_H_ |
6 #define ASH_DISPLAY_MULTI_DISPLAY_MANAGER_H_ | 6 #define ASH_DISPLAY_MULTI_DISPLAY_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 bool IsActiveDisplay(const gfx::Display& display) const; | 57 bool IsActiveDisplay(const gfx::Display& display) const; |
58 | 58 |
59 // True if there is an internal display. | 59 // True if there is an internal display. |
60 bool HasInternalDisplay() const; | 60 bool HasInternalDisplay() const; |
61 | 61 |
62 bool IsInternalDisplayId(int64 id) const; | 62 bool IsInternalDisplayId(int64 id) const; |
63 | 63 |
64 bool UpdateWorkAreaOfDisplayNearestWindow(const aura::Window* window, | 64 bool UpdateWorkAreaOfDisplayNearestWindow(const aura::Window* window, |
65 const gfx::Insets& insets); | 65 const gfx::Insets& insets); |
66 | 66 |
| 67 // Returns the list of currently connected display names. It doesn't |
| 68 // contain the name for the internal display. |
| 69 std::vector<std::string> GetExternalDisplayNames() const; |
| 70 |
67 // Returns display for given |id|; | 71 // Returns display for given |id|; |
68 const gfx::Display& GetDisplayForId(int64 id) const; | 72 const gfx::Display& GetDisplayForId(int64 id) const; |
69 | 73 |
70 // Finds the display that contains |point| in screeen coordinates. | 74 // Finds the display that contains |point| in screeen coordinates. |
71 // Returns invalid display if there is no display that can satisfy | 75 // Returns invalid display if there is no display that can satisfy |
72 // the condition. | 76 // the condition. |
73 const gfx::Display& FindDisplayContainingPoint( | 77 const gfx::Display& FindDisplayContainingPoint( |
74 const gfx::Point& point_in_screen) const; | 78 const gfx::Point& point_in_screen) const; |
75 | 79 |
76 // Registers the overscan insets for the display of the specified ID. Note | 80 // Registers the overscan insets for the display of the specified ID. Note |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 void AddDisplayFromSpec(const std::string& spec); | 131 void AddDisplayFromSpec(const std::string& spec); |
128 | 132 |
129 // Set the 1st display as an internal display and returns the display Id for | 133 // Set the 1st display as an internal display and returns the display Id for |
130 // the internal display. | 134 // the internal display. |
131 int64 SetFirstDisplayAsInternalDisplayForTest(); | 135 int64 SetFirstDisplayAsInternalDisplayForTest(); |
132 | 136 |
133 // Checks if the mouse pointer is on one of displays, and moves to | 137 // Checks if the mouse pointer is on one of displays, and moves to |
134 // the center of the nearest display if it's outside of all displays. | 138 // the center of the nearest display if it's outside of all displays. |
135 void EnsurePointerInDisplays(); | 139 void EnsurePointerInDisplays(); |
136 | 140 |
| 141 // Updates |display_names_| by calling platform-dependent functions. |
| 142 void RefreshDisplayNames(); |
| 143 |
137 // Update the display's id in the |display_list| to match the ones | 144 // Update the display's id in the |display_list| to match the ones |
138 // stored in this display manager's |displays_|. This is used to | 145 // stored in this display manager's |displays_|. This is used to |
139 // emulate display change behavior during the test byn creating the | 146 // emulate display change behavior during the test byn creating the |
140 // display list with the same display ids but with different bounds | 147 // display list with the same display ids but with different bounds |
141 void SetDisplayIdsForTest(DisplayList* display_list) const; | 148 void SetDisplayIdsForTest(DisplayList* display_list) const; |
142 | 149 |
143 DisplayList displays_; | 150 DisplayList displays_; |
144 | 151 |
145 int64 internal_display_id_; | 152 int64 internal_display_id_; |
146 | 153 |
147 // An internal display cache used when the internal display is disconnectd. | 154 // An internal display cache used when the internal display is disconnectd. |
148 scoped_ptr<gfx::Display> internal_display_; | 155 scoped_ptr<gfx::Display> internal_display_; |
149 | 156 |
150 bool force_bounds_changed_; | 157 bool force_bounds_changed_; |
151 | 158 |
152 // The mapping from the display ID to its overscan insets. | 159 // The mapping from the display ID to its overscan insets. |
153 std::map<int64, gfx::Insets> overscan_mapping_; | 160 std::map<int64, gfx::Insets> overscan_mapping_; |
154 | 161 |
| 162 // The cached display's name for the display ID. |
| 163 std::map<int64, std::string> display_names_; |
| 164 |
155 DISALLOW_COPY_AND_ASSIGN(MultiDisplayManager); | 165 DISALLOW_COPY_AND_ASSIGN(MultiDisplayManager); |
156 }; | 166 }; |
157 | 167 |
158 extern const aura::WindowProperty<int64>* const kDisplayIdKey; | 168 extern const aura::WindowProperty<int64>* const kDisplayIdKey; |
159 | 169 |
160 } // namespace internal | 170 } // namespace internal |
161 } // namespace ash | 171 } // namespace ash |
162 | 172 |
163 #endif // ASH_DISPLAY_MULTI_DISPLAY_MANAGER_H_ | 173 #endif // ASH_DISPLAY_MULTI_DISPLAY_MANAGER_H_ |
OLD | NEW |