OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_INFO_H_ | 5 #ifndef ASH_DISPLAY_DISPLAY_INFO_H_ |
6 #define ASH_DISPLAY_DISPLAY_INFO_H_ | 6 #define ASH_DISPLAY_DISPLAY_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
| 9 #include <vector> |
9 | 10 |
10 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
11 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
12 #include "ui/gfx/display.h" | 13 #include "ui/gfx/display.h" |
13 #include "ui/gfx/insets.h" | 14 #include "ui/gfx/insets.h" |
14 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
15 | 16 |
16 namespace ash { | 17 namespace ash { |
17 namespace internal { | 18 namespace internal { |
18 | 19 |
| 20 // A struct that represents the display's resolution and |
| 21 // interlaced info. |
| 22 struct ASH_EXPORT Resolution { |
| 23 Resolution(const gfx::Size& size, bool interlaced); |
| 24 |
| 25 gfx::Size size; |
| 26 bool interlaced; |
| 27 }; |
| 28 |
19 // DisplayInfo contains metadata for each display. This is used to | 29 // DisplayInfo contains metadata for each display. This is used to |
20 // create |gfx::Display| as well as to maintain extra infomation | 30 // create |gfx::Display| as well as to maintain extra infomation |
21 // to manage displays in ash environment. | 31 // to manage displays in ash environment. |
22 // This class is intentionally made copiable. | 32 // This class is intentionally made copiable. |
23 class ASH_EXPORT DisplayInfo { | 33 class ASH_EXPORT DisplayInfo { |
24 public: | 34 public: |
25 // Creates a DisplayInfo from string spec. 100+200-1440x800 creates display | 35 // Creates a DisplayInfo from string spec. 100+200-1440x800 creates display |
26 // whose size is 1440x800 at the location (100, 200) in host coordinates. | 36 // whose size is 1440x800 at the location (100, 200) in host coordinates. |
27 // The format is | 37 // The format is |
28 // | 38 // |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // and rotation settings. | 117 // and rotation settings. |
108 void UpdateDisplaySize(); | 118 void UpdateDisplaySize(); |
109 | 119 |
110 // Sets/Clears the overscan insets. | 120 // Sets/Clears the overscan insets. |
111 void SetOverscanInsets(const gfx::Insets& insets_in_dip); | 121 void SetOverscanInsets(const gfx::Insets& insets_in_dip); |
112 gfx::Insets GetOverscanInsetsInPixel() const; | 122 gfx::Insets GetOverscanInsetsInPixel() const; |
113 | 123 |
114 void set_native(bool native) { native_ = native; } | 124 void set_native(bool native) { native_ = native; } |
115 bool native() const { return native_; } | 125 bool native() const { return native_; } |
116 | 126 |
117 // Returns a string representation of the DisplayInfo; | 127 const std::vector<Resolution>& resolutions() const { |
| 128 return resolutions_; |
| 129 } |
| 130 void set_resolutions(std::vector<Resolution>& resolution) { |
| 131 resolutions_.swap(resolution); |
| 132 } |
| 133 |
| 134 // Returns a string representation of the DisplayInfo |
| 135 // excluding resolutions. |
118 std::string ToString() const; | 136 std::string ToString() const; |
119 | 137 |
| 138 // Returns a string representation of the DisplayInfo |
| 139 // including resolutions. |
| 140 std::string ToFullString() const; |
| 141 |
120 private: | 142 private: |
121 int64 id_; | 143 int64 id_; |
122 std::string name_; | 144 std::string name_; |
123 bool has_overscan_; | 145 bool has_overscan_; |
124 gfx::Display::Rotation rotation_; | 146 gfx::Display::Rotation rotation_; |
125 float device_scale_factor_; | 147 float device_scale_factor_; |
126 gfx::Rect bounds_in_pixel_; | 148 gfx::Rect bounds_in_pixel_; |
127 // The size of the display in use. The size can be different from the size | 149 // The size of the display in use. The size can be different from the size |
128 // of |bounds_in_pixel_| if the display has overscan insets and/or rotation. | 150 // of |bounds_in_pixel_| if the display has overscan insets and/or rotation. |
129 gfx::Size size_in_pixel_; | 151 gfx::Size size_in_pixel_; |
130 gfx::Insets overscan_insets_in_dip_; | 152 gfx::Insets overscan_insets_in_dip_; |
131 | 153 |
132 // UI scale of the display. | 154 // UI scale of the display. |
133 float ui_scale_; | 155 float ui_scale_; |
134 | 156 |
135 // True if this comes from native platform (DisplayChangeObserverX11). | 157 // True if this comes from native platform (DisplayChangeObserverX11). |
136 bool native_; | 158 bool native_; |
| 159 |
| 160 // The list of resolutions supported by this display. |
| 161 std::vector<Resolution> resolutions_; |
137 }; | 162 }; |
138 | 163 |
139 } // namespace internal | 164 } // namespace internal |
140 } // namespace ash | 165 } // namespace ash |
141 | 166 |
142 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ | 167 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ |
OLD | NEW |