Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Side by Side Diff: ui/display/manager/managed_display_info.h

Issue 2522563002: Remove unnecessary display:: namespaces. (Closed)
Patch Set: Rebase. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_ 5 #ifndef UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_
6 #define UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_ 6 #define UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "ui/display/display.h" 16 #include "ui/display/display.h"
17 #include "ui/display/display_export.h" 17 #include "ui/display/display_export.h"
18 #include "ui/display/types/display_constants.h" 18 #include "ui/display/types/display_constants.h"
19 #include "ui/gfx/geometry/insets.h" 19 #include "ui/gfx/geometry/insets.h"
20 #include "ui/gfx/geometry/rect.h" 20 #include "ui/gfx/geometry/rect.h"
21 21
22 namespace display { 22 namespace display {
23 23
24 // A class that represents the display's mode info. 24 // A class that represents the display's mode info.
25 class DISPLAY_EXPORT ManagedDisplayMode 25 class DISPLAY_EXPORT ManagedDisplayMode
26 : public base::RefCounted<ManagedDisplayMode> { 26 : public base::RefCounted<ManagedDisplayMode> {
27 public: 27 public:
28 ManagedDisplayMode(); 28 ManagedDisplayMode();
29 29
30 ManagedDisplayMode(const gfx::Size& size); 30 explicit ManagedDisplayMode(const gfx::Size& size);
31 31
32 ManagedDisplayMode(const gfx::Size& size, 32 ManagedDisplayMode(const gfx::Size& size,
33 float refresh_rate, 33 float refresh_rate,
34 bool is_interlaced, 34 bool is_interlaced,
35 bool native); 35 bool native);
36 36
37 ManagedDisplayMode(const gfx::Size& size, 37 ManagedDisplayMode(const gfx::Size& size,
38 float refresh_rate, 38 float refresh_rate,
39 bool is_interlaced, 39 bool is_interlaced,
40 bool native, 40 bool native,
(...skipping 26 matching lines...) Expand all
67 float refresh_rate_; // Refresh rate of the display, in Hz. 67 float refresh_rate_; // Refresh rate of the display, in Hz.
68 bool is_interlaced_; // True if mode is interlaced. 68 bool is_interlaced_; // True if mode is interlaced.
69 bool native_; // True if mode is native mode of the display. 69 bool native_; // True if mode is native mode of the display.
70 bool is_default_ = false; // True if mode is one with default UI scale. 70 bool is_default_ = false; // True if mode is one with default UI scale.
71 float ui_scale_; // The UI scale factor of the mode. 71 float ui_scale_; // The UI scale factor of the mode.
72 float device_scale_factor_; // The device scale factor of the mode. 72 float device_scale_factor_; // The device scale factor of the mode.
73 73
74 DISALLOW_COPY_AND_ASSIGN(ManagedDisplayMode); 74 DISALLOW_COPY_AND_ASSIGN(ManagedDisplayMode);
75 }; 75 };
76 76
77 // ManagedDisplayInfo contains metadata for each display. This is used to 77 // ManagedDisplayInfo contains metadata for each display. This is used to create
78 // create |display::Display| as well as to maintain extra infomation 78 // |Display| as well as to maintain extra infomation to manage displays in ash
79 // to manage displays in ash environment. 79 // environment. This class is intentionally made copiable.
80 // This class is intentionally made copiable.
81 class DISPLAY_EXPORT ManagedDisplayInfo { 80 class DISPLAY_EXPORT ManagedDisplayInfo {
82 public: 81 public:
83 using ManagedDisplayModeList = std::vector<scoped_refptr<ManagedDisplayMode>>; 82 using ManagedDisplayModeList = std::vector<scoped_refptr<ManagedDisplayMode>>;
84 83
85 // Creates a ManagedDisplayInfo from string spec. 100+200-1440x800 creates 84 // Creates a ManagedDisplayInfo from string spec. 100+200-1440x800 creates
86 // display 85 // display
87 // whose size is 1440x800 at the location (100, 200) in host coordinates. 86 // whose size is 1440x800 at the location (100, 200) in host coordinates.
88 // The format is 87 // The format is
89 // 88 //
90 // [origin-]widthxheight[*device_scale_factor][#resolutions list] 89 // [origin-]widthxheight[*device_scale_factor][#resolutions list]
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 const std::string& name() const { return name_; } 139 const std::string& name() const { return name_; }
141 140
142 // The path to the display device in the sysfs filesystem. 141 // The path to the display device in the sysfs filesystem.
143 void set_sys_path(const base::FilePath& sys_path) { sys_path_ = sys_path; } 142 void set_sys_path(const base::FilePath& sys_path) { sys_path_ = sys_path; }
144 const base::FilePath& sys_path() const { return sys_path_; } 143 const base::FilePath& sys_path() const { return sys_path_; }
145 144
146 // True if the display EDID has the overscan flag. This does not create the 145 // True if the display EDID has the overscan flag. This does not create the
147 // actual overscan automatically, but used in the message. 146 // actual overscan automatically, but used in the message.
148 bool has_overscan() const { return has_overscan_; } 147 bool has_overscan() const { return has_overscan_; }
149 148
150 void set_touch_support(display::Display::TouchSupport support) { 149 void set_touch_support(Display::TouchSupport support) {
151 touch_support_ = support; 150 touch_support_ = support;
152 } 151 }
153 display::Display::TouchSupport touch_support() const { 152 Display::TouchSupport touch_support() const { return touch_support_; }
154 return touch_support_;
155 }
156 153
157 // Associate the input device with identifier |id| with this display. 154 // Associate the input device with identifier |id| with this display.
158 void AddInputDevice(int id); 155 void AddInputDevice(int id);
159 156
160 // Clear the list of input devices associated with this display. 157 // Clear the list of input devices associated with this display.
161 void ClearInputDevices(); 158 void ClearInputDevices();
162 159
163 // The input device ids that are associated with this display. 160 // The input device ids that are associated with this display.
164 std::vector<int> input_devices() const { return input_devices_; } 161 std::vector<int> input_devices() const { return input_devices_; }
165 162
(...skipping 19 matching lines...) Expand all
185 } 182 }
186 183
187 // Sets/gets configured ui scale. This can be different from the ui 184 // Sets/gets configured ui scale. This can be different from the ui
188 // scale actually used when the scale is 2.0 and DSF is 2.0. 185 // scale actually used when the scale is 2.0 and DSF is 2.0.
189 // (the effective ui scale is 1.0 in this case). 186 // (the effective ui scale is 1.0 in this case).
190 float configured_ui_scale() const { return configured_ui_scale_; } 187 float configured_ui_scale() const { return configured_ui_scale_; }
191 void set_configured_ui_scale(float scale) { configured_ui_scale_ = scale; } 188 void set_configured_ui_scale(float scale) { configured_ui_scale_ = scale; }
192 189
193 // Sets the rotation for the given |source|. Setting a new rotation will also 190 // Sets the rotation for the given |source|. Setting a new rotation will also
194 // have it become the active rotation. 191 // have it become the active rotation.
195 void SetRotation(display::Display::Rotation rotation, 192 void SetRotation(Display::Rotation rotation, Display::RotationSource source);
196 display::Display::RotationSource source);
197 193
198 // Returns the currently active rotation for this display. 194 // Returns the currently active rotation for this display.
199 display::Display::Rotation GetActiveRotation() const; 195 Display::Rotation GetActiveRotation() const;
200 196
201 // Returns the source which set the active rotation for this display. 197 // Returns the source which set the active rotation for this display.
202 display::Display::RotationSource active_rotation_source() const { 198 Display::RotationSource active_rotation_source() const {
203 return active_rotation_source_; 199 return active_rotation_source_;
204 } 200 }
205 201
206 // Returns the rotation set by a given |source|. 202 // Returns the rotation set by a given |source|.
207 display::Display::Rotation GetRotation( 203 Display::Rotation GetRotation(Display::RotationSource source) const;
208 display::Display::RotationSource source) const;
209 204
210 // Returns the ui scale and device scale factor actually used to create 205 // Returns the ui scale and device scale factor actually used to create
211 // display that chrome sees. This can be different from one obtained 206 // display that chrome sees. This can be different from one obtained
212 // from dispaly or one specified by a user in following situation. 207 // from dispaly or one specified by a user in following situation.
213 // 1) DSF is 2.0f and UI scale is 2.0f. (Returns 1.0f and 1.0f respectiely) 208 // 1) DSF is 2.0f and UI scale is 2.0f. (Returns 1.0f and 1.0f respectiely)
214 // 2) A user specified 0.8x on the device that has 1.25 DSF. 1.25 DSF device 209 // 2) A user specified 0.8x on the device that has 1.25 DSF. 1.25 DSF device
215 // uses 1.0f DFS unless 0.8x UI scaling is specified. 210 // uses 1.0f DFS unless 0.8x UI scaling is specified.
216 float GetEffectiveDeviceScaleFactor() const; 211 float GetEffectiveDeviceScaleFactor() const;
217 212
218 // Returns the ui scale used for the device scale factor. This 213 // Returns the ui scale used for the device scale factor. This
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 292
298 private: 293 private:
299 // Returns true if this display should use DSF=1.25 for UI scaling; i.e. 294 // Returns true if this display should use DSF=1.25 for UI scaling; i.e.
300 // SetUse125DSFForUIScaling(true) is called and this is the internal display. 295 // SetUse125DSFForUIScaling(true) is called and this is the internal display.
301 bool Use125DSFForUIScaling() const; 296 bool Use125DSFForUIScaling() const;
302 297
303 int64_t id_; 298 int64_t id_;
304 std::string name_; 299 std::string name_;
305 base::FilePath sys_path_; 300 base::FilePath sys_path_;
306 bool has_overscan_; 301 bool has_overscan_;
307 std::map<display::Display::RotationSource, display::Display::Rotation> 302 std::map<Display::RotationSource, Display::Rotation> rotations_;
308 rotations_; 303 Display::RotationSource active_rotation_source_;
309 display::Display::RotationSource active_rotation_source_; 304 Display::TouchSupport touch_support_;
310 display::Display::TouchSupport touch_support_;
311 305
312 // The set of input devices associated with this display. 306 // The set of input devices associated with this display.
313 std::vector<int> input_devices_; 307 std::vector<int> input_devices_;
314 308
315 // This specifies the device's pixel density. (For example, a 309 // This specifies the device's pixel density. (For example, a
316 // display whose DPI is higher than the threshold is considered to have 310 // display whose DPI is higher than the threshold is considered to have
317 // device_scale_factor = 2.0 on Chrome OS). This is used by the 311 // device_scale_factor = 2.0 on Chrome OS). This is used by the
318 // grapics layer to choose and draw appropriate images and scale 312 // grapics layer to choose and draw appropriate images and scale
319 // layers properly. 313 // layers properly.
320 float device_scale_factor_; 314 float device_scale_factor_;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 // If you add a new member, you need to update Copy(). 357 // If you add a new member, you need to update Copy().
364 }; 358 };
365 359
366 // Resets the synthesized display id for testing. This 360 // Resets the synthesized display id for testing. This
367 // is necessary to avoid overflowing the output index. 361 // is necessary to avoid overflowing the output index.
368 void DISPLAY_EXPORT ResetDisplayIdForTest(); 362 void DISPLAY_EXPORT ResetDisplayIdForTest();
369 363
370 } // namespace display 364 } // namespace display
371 365
372 #endif // UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_ 366 #endif // UI_DISPLAY_MANAGER_MANAGED_DISPLAY_INFO_H_
OLDNEW
« no previous file with comments | « ui/display/manager/display_manager_utilities_unittest.cc ('k') | ui/display/manager/managed_display_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698