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 <stdint.h> |
| 9 |
8 #include <map> | 10 #include <map> |
9 #include <string> | 11 #include <string> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "ash/ash_export.h" | 14 #include "ash/ash_export.h" |
13 #include "ui/display/types/display_constants.h" | 15 #include "ui/display/types/display_constants.h" |
14 #include "ui/gfx/display.h" | 16 #include "ui/gfx/display.h" |
15 #include "ui/gfx/geometry/insets.h" | 17 #include "ui/gfx/geometry/insets.h" |
16 #include "ui/gfx/geometry/rect.h" | 18 #include "ui/gfx/geometry/rect.h" |
17 | 19 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // 1.0 ui scale. | 78 // 1.0 ui scale. |
77 // "10+20-300x200/u@1.5" | 79 // "10+20-300x200/u@1.5" |
78 // 300x200 window at 10,20 origin. 1x device scale factor. | 80 // 300x200 window at 10,20 origin. 1x device scale factor. |
79 // no overscan. flipped upside-down (180 degree) and 1.5 ui scale. | 81 // no overscan. flipped upside-down (180 degree) and 1.5 ui scale. |
80 // "200x100#300x200|200x100%59.0|100x100%60" | 82 // "200x100#300x200|200x100%59.0|100x100%60" |
81 // 200x100 window at 0,0 origin, with 3 possible resolutions, | 83 // 200x100 window at 0,0 origin, with 3 possible resolutions, |
82 // 300x200, 200x100 at 59 Hz, and 100x100 at 60 Hz. | 84 // 300x200, 200x100 at 59 Hz, and 100x100 at 60 Hz. |
83 static DisplayInfo CreateFromSpec(const std::string& spec); | 85 static DisplayInfo CreateFromSpec(const std::string& spec); |
84 | 86 |
85 // Creates a DisplayInfo from string spec using given |id|. | 87 // Creates a DisplayInfo from string spec using given |id|. |
86 static DisplayInfo CreateFromSpecWithID(const std::string& spec, | 88 static DisplayInfo CreateFromSpecWithID(const std::string& spec, int64_t id); |
87 int64 id); | |
88 | 89 |
89 // When this is set to true on the device whose internal display has | 90 // When this is set to true on the device whose internal display has |
90 // 1.25 dsf, Chrome uses 1.0f as a default scale factor, and uses | 91 // 1.25 dsf, Chrome uses 1.0f as a default scale factor, and uses |
91 // dsf 1.25 when UI scaling is set to 0.8f. | 92 // dsf 1.25 when UI scaling is set to 0.8f. |
92 static void SetUse125DSFForUIScalingForTest(bool enable); | 93 static void SetUse125DSFForUIScalingForTest(bool enable); |
93 | 94 |
94 DisplayInfo(); | 95 DisplayInfo(); |
95 DisplayInfo(int64 id, const std::string& name, bool has_overscan); | 96 DisplayInfo(int64_t id, const std::string& name, bool has_overscan); |
96 ~DisplayInfo(); | 97 ~DisplayInfo(); |
97 | 98 |
98 int64 id() const { return id_; } | 99 int64_t id() const { return id_; } |
99 | 100 |
100 // The name of the display. | 101 // The name of the display. |
101 const std::string& name() const { return name_; } | 102 const std::string& name() const { return name_; } |
102 | 103 |
103 // True if the display EDID has the overscan flag. This does not create the | 104 // True if the display EDID has the overscan flag. This does not create the |
104 // actual overscan automatically, but used in the message. | 105 // actual overscan automatically, but used in the message. |
105 bool has_overscan() const { return has_overscan_; } | 106 bool has_overscan() const { return has_overscan_; } |
106 | 107 |
107 void set_touch_support(gfx::Display::TouchSupport support) { | 108 void set_touch_support(gfx::Display::TouchSupport support) { |
108 touch_support_ = support; | 109 touch_support_ = support; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 241 |
241 // Returns a string representation of the DisplayInfo, including display | 242 // Returns a string representation of the DisplayInfo, including display |
242 // modes. | 243 // modes. |
243 std::string ToFullString() const; | 244 std::string ToFullString() const; |
244 | 245 |
245 private: | 246 private: |
246 // Returns true if this display should use DSF=1.25 for UI scaling; i.e. | 247 // Returns true if this display should use DSF=1.25 for UI scaling; i.e. |
247 // SetUse125DSFForUIScaling(true) is called and this is the internal display. | 248 // SetUse125DSFForUIScaling(true) is called and this is the internal display. |
248 bool Use125DSFForUIScaling() const; | 249 bool Use125DSFForUIScaling() const; |
249 | 250 |
250 int64 id_; | 251 int64_t id_; |
251 std::string name_; | 252 std::string name_; |
252 bool has_overscan_; | 253 bool has_overscan_; |
253 std::map<gfx::Display::RotationSource, gfx::Display::Rotation> rotations_; | 254 std::map<gfx::Display::RotationSource, gfx::Display::Rotation> rotations_; |
254 gfx::Display::TouchSupport touch_support_; | 255 gfx::Display::TouchSupport touch_support_; |
255 | 256 |
256 // The set of input devices associated with this display. | 257 // The set of input devices associated with this display. |
257 std::vector<int> input_devices_; | 258 std::vector<int> input_devices_; |
258 | 259 |
259 // This specifies the device's pixel density. (For example, a | 260 // This specifies the device's pixel density. (For example, a |
260 // display whose DPI is higher than the threshold is considered to have | 261 // display whose DPI is higher than the threshold is considered to have |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 // If you add a new member, you need to update Copy(). | 305 // If you add a new member, you need to update Copy(). |
305 }; | 306 }; |
306 | 307 |
307 // Resets the synthesized display id for testing. This | 308 // Resets the synthesized display id for testing. This |
308 // is necessary to avoid overflowing the output index. | 309 // is necessary to avoid overflowing the output index. |
309 ASH_EXPORT void ResetDisplayIdForTest(); | 310 ASH_EXPORT void ResetDisplayIdForTest(); |
310 | 311 |
311 } // namespace ash | 312 } // namespace ash |
312 | 313 |
313 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ | 314 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ |
OLD | NEW |