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

Side by Side Diff: ash/display/display_info.h

Issue 1108343002: Revert of Merge Prevent DisplayPreferences from saving incorrect rotations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2357
Patch Set: Created 5 years, 7 months 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
« no previous file with comments | « ash/display/display_controller_unittest.cc ('k') | ash/display/display_info.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 <map>
9 #include <string> 8 #include <string>
10 #include <vector> 9 #include <vector>
11 10
12 #include "ash/ash_export.h" 11 #include "ash/ash_export.h"
13 #include "ui/display/types/display_constants.h" 12 #include "ui/display/types/display_constants.h"
14 #include "ui/gfx/display.h" 13 #include "ui/gfx/display.h"
15 #include "ui/gfx/geometry/insets.h" 14 #include "ui/gfx/geometry/insets.h"
16 #include "ui/gfx/geometry/rect.h" 15 #include "ui/gfx/geometry/rect.h"
17 16
18 namespace ash { 17 namespace ash {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 96
98 int64 id() const { return id_; } 97 int64 id() const { return id_; }
99 98
100 // The name of the display. 99 // The name of the display.
101 const std::string& name() const { return name_; } 100 const std::string& name() const { return name_; }
102 101
103 // True if the display EDID has the overscan flag. This does not create the 102 // True if the display EDID has the overscan flag. This does not create the
104 // actual overscan automatically, but used in the message. 103 // actual overscan automatically, but used in the message.
105 bool has_overscan() const { return has_overscan_; } 104 bool has_overscan() const { return has_overscan_; }
106 105
106 void set_rotation(gfx::Display::Rotation rotation) { rotation_ = rotation; }
107 gfx::Display::Rotation rotation() const { return rotation_; }
108
107 void set_touch_support(gfx::Display::TouchSupport support) { 109 void set_touch_support(gfx::Display::TouchSupport support) {
108 touch_support_ = support; 110 touch_support_ = support;
109 } 111 }
110 gfx::Display::TouchSupport touch_support() const { return touch_support_; } 112 gfx::Display::TouchSupport touch_support() const { return touch_support_; }
111 113
112 void set_touch_device_id(int id) { touch_device_id_ = id; } 114 void set_touch_device_id(int id) { touch_device_id_ = id; }
113 int touch_device_id() const { return touch_device_id_; } 115 int touch_device_id() const { return touch_device_id_; }
114 116
115 // Gets/Sets the device scale factor of the display. 117 // Gets/Sets the device scale factor of the display.
116 float device_scale_factor() const { return device_scale_factor_; } 118 float device_scale_factor() const { return device_scale_factor_; }
(...skipping 13 matching lines...) Expand all
130 const gfx::Insets& overscan_insets_in_dip() const { 132 const gfx::Insets& overscan_insets_in_dip() const {
131 return overscan_insets_in_dip_; 133 return overscan_insets_in_dip_;
132 } 134 }
133 135
134 // Sets/gets configured ui scale. This can be different from the ui 136 // Sets/gets configured ui scale. This can be different from the ui
135 // scale actually used when the scale is 2.0 and DSF is 2.0. 137 // scale actually used when the scale is 2.0 and DSF is 2.0.
136 // (the effective ui scale is 1.0 in this case). 138 // (the effective ui scale is 1.0 in this case).
137 float configured_ui_scale() const { return configured_ui_scale_; } 139 float configured_ui_scale() const { return configured_ui_scale_; }
138 void set_configured_ui_scale(float scale) { configured_ui_scale_ = scale; } 140 void set_configured_ui_scale(float scale) { configured_ui_scale_ = scale; }
139 141
140 // Sets the rotation for the given |source|. Setting a new rotation will also
141 // have it become the active rotation.
142 void SetRotation(gfx::Display::Rotation rotation,
143 gfx::Display::RotationSource source);
144
145 // Returns the currently active rotation for this display.
146 gfx::Display::Rotation GetActiveRotation() const;
147
148 // Returns the rotation set by a given |source|.
149 gfx::Display::Rotation GetRotation(gfx::Display::RotationSource source) const;
150
151 // Returns the ui scale and device scale factor actually used to create 142 // Returns the ui scale and device scale factor actually used to create
152 // display that chrome sees. This can be different from one obtained 143 // display that chrome sees. This can be different from one obtained
153 // from dispaly or one specified by a user in following situation. 144 // from dispaly or one specified by a user in following situation.
154 // 1) DSF is 2.0f and UI scale is 2.0f. (Returns 1.0f and 1.0f respectiely) 145 // 1) DSF is 2.0f and UI scale is 2.0f. (Returns 1.0f and 1.0f respectiely)
155 // 2) A user specified 0.8x on the device that has 1.25 DSF. 1.25 DSF device 146 // 2) A user specified 0.8x on the device that has 1.25 DSF. 1.25 DSF device
156 // uses 1.0f DFS unless 0.8x UI scaling is specified. 147 // uses 1.0f DFS unless 0.8x UI scaling is specified.
157 float GetEffectiveDeviceScaleFactor() const; 148 float GetEffectiveDeviceScaleFactor() const;
158 149
159 // Returns the ui scale used for the device scale factor. This 150 // Returns the ui scale used for the device scale factor. This
160 // return 1.0f if the ui scale and dsf are both set to 2.0. 151 // return 1.0f if the ui scale and dsf are both set to 2.0.
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 std::string ToFullString() const; 224 std::string ToFullString() const;
234 225
235 private: 226 private:
236 // Returns true if this display should use DSF=1.25 for UI scaling; i.e. 227 // Returns true if this display should use DSF=1.25 for UI scaling; i.e.
237 // SetUse125DSFForUIScaling(true) is called and this is the internal display. 228 // SetUse125DSFForUIScaling(true) is called and this is the internal display.
238 bool Use125DSFRorUIScaling() const; 229 bool Use125DSFRorUIScaling() const;
239 230
240 int64 id_; 231 int64 id_;
241 std::string name_; 232 std::string name_;
242 bool has_overscan_; 233 bool has_overscan_;
243 std::map<gfx::Display::RotationSource, gfx::Display::Rotation> rotations_; 234 gfx::Display::Rotation rotation_;
244 gfx::Display::TouchSupport touch_support_; 235 gfx::Display::TouchSupport touch_support_;
245 236
246 // If the display is also a touch device, it will have a positive 237 // If the display is also a touch device, it will have a positive
247 // |touch_device_id_|. Otherwise |touch_device_id_| is 0. 238 // |touch_device_id_|. Otherwise |touch_device_id_| is 0.
248 int touch_device_id_; 239 int touch_device_id_;
249 240
250 // This specifies the device's pixel density. (For example, a 241 // This specifies the device's pixel density. (For example, a
251 // display whose DPI is higher than the threshold is considered to have 242 // display whose DPI is higher than the threshold is considered to have
252 // device_scale_factor = 2.0 on Chrome OS). This is used by the 243 // device_scale_factor = 2.0 on Chrome OS). This is used by the
253 // grapics layer to choose and draw appropriate images and scale 244 // grapics layer to choose and draw appropriate images and scale
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 279
289 // The list of available variations for the color calibration. 280 // The list of available variations for the color calibration.
290 std::vector<ui::ColorCalibrationProfile> available_color_profiles_; 281 std::vector<ui::ColorCalibrationProfile> available_color_profiles_;
291 282
292 // If you add a new member, you need to update Copy(). 283 // If you add a new member, you need to update Copy().
293 }; 284 };
294 285
295 } // namespace ash 286 } // namespace ash
296 287
297 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ 288 #endif // ASH_DISPLAY_DISPLAY_INFO_H_
OLDNEW
« no previous file with comments | « ash/display/display_controller_unittest.cc ('k') | ash/display/display_info.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698