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

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

Issue 289583002: Lock rotation when screen is manually rotated. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Define sources for rotation Created 6 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
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>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "ash/ash_export.h" 12 #include "ash/ash_export.h"
12 #include "ui/display/types/display_constants.h" 13 #include "ui/display/types/display_constants.h"
13 #include "ui/gfx/display.h" 14 #include "ui/gfx/display.h"
14 #include "ui/gfx/insets.h" 15 #include "ui/gfx/insets.h"
15 #include "ui/gfx/rect.h" 16 #include "ui/gfx/rect.h"
16 17
17 namespace ash { 18 namespace ash {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 89
89 int64 id() const { return id_; } 90 int64 id() const { return id_; }
90 91
91 // The name of the display. 92 // The name of the display.
92 const std::string& name() const { return name_; } 93 const std::string& name() const { return name_; }
93 94
94 // True if the display EDID has the overscan flag. This does not create the 95 // True if the display EDID has the overscan flag. This does not create the
95 // actual overscan automatically, but used in the message. 96 // actual overscan automatically, but used in the message.
96 bool has_overscan() const { return has_overscan_; } 97 bool has_overscan() const { return has_overscan_; }
97 98
98 void set_rotation(gfx::Display::Rotation rotation) { rotation_ = rotation; } 99 // Returns the last rotation set through either user actions, or the
99 gfx::Display::Rotation rotation() const { return rotation_; } 100 // accelerometer. The current active rotation of the display can be found by
101 // calling |rotation()|.
102 gfx::Display::Rotation GetRotation(ui::RotationSource source);
flackr 2014/05/16 16:00:22 Do we ever want to get the last saved acceleromete
jonross 2014/05/20 15:24:30 A few potential uses: - Testing - Saving as a
103
104 // Updates the rotation for the given source, and also sets the current
105 // rotation.
106 void SetRotation(gfx::Display::Rotation rotation, ui::RotationSource source);
107 gfx::Display::Rotation rotation() const { return current_rotation_; }
100 108
101 void set_touch_support(gfx::Display::TouchSupport support) { 109 void set_touch_support(gfx::Display::TouchSupport support) {
102 touch_support_ = support; 110 touch_support_ = support;
103 } 111 }
104 gfx::Display::TouchSupport touch_support() const { return touch_support_; } 112 gfx::Display::TouchSupport touch_support() const { return touch_support_; }
105 113
106 void set_touch_device_id(int id) { touch_device_id_ = id; } 114 void set_touch_device_id(int id) { touch_device_id_ = id; }
107 int touch_device_id() const { return touch_device_id_; } 115 int touch_device_id() const { return touch_device_id_; }
108 116
109 // Gets/Sets the device scale factor of the display. 117 // Gets/Sets the device scale factor of the display.
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 std::string ToString() const; 202 std::string ToString() const;
195 203
196 // Returns a string representation of the DisplayInfo, including display 204 // Returns a string representation of the DisplayInfo, including display
197 // modes. 205 // modes.
198 std::string ToFullString() const; 206 std::string ToFullString() const;
199 207
200 private: 208 private:
201 int64 id_; 209 int64 id_;
202 std::string name_; 210 std::string name_;
203 bool has_overscan_; 211 bool has_overscan_;
204 gfx::Display::Rotation rotation_; 212 gfx::Display::Rotation current_rotation_;
213 std::map<ui::RotationSource, gfx::Display::Rotation> rotations_;
205 gfx::Display::TouchSupport touch_support_; 214 gfx::Display::TouchSupport touch_support_;
206 215
207 // If the display is also a touch device, it will have a positive 216 // If the display is also a touch device, it will have a positive
208 // |touch_device_id_|. Otherwise |touch_device_id_| is 0. 217 // |touch_device_id_|. Otherwise |touch_device_id_| is 0.
209 int touch_device_id_; 218 int touch_device_id_;
210 219
211 // This specifies the device's pixel density. (For example, a 220 // This specifies the device's pixel density. (For example, a
212 // display whose DPI is higher than the threshold is considered to have 221 // display whose DPI is higher than the threshold is considered to have
213 // device_scale_factor = 2.0 on Chrome OS). This is used by the 222 // device_scale_factor = 2.0 on Chrome OS). This is used by the
214 // grapics layer to choose and draw appropriate images and scale 223 // grapics layer to choose and draw appropriate images and scale
(...skipping 23 matching lines...) Expand all
238 // The current profile of the color calibration. 247 // The current profile of the color calibration.
239 ui::ColorCalibrationProfile color_profile_; 248 ui::ColorCalibrationProfile color_profile_;
240 249
241 // The list of available variations for the color calibration. 250 // The list of available variations for the color calibration.
242 std::vector<ui::ColorCalibrationProfile> available_color_profiles_; 251 std::vector<ui::ColorCalibrationProfile> available_color_profiles_;
243 }; 252 };
244 253
245 } // namespace ash 254 } // namespace ash
246 255
247 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ 256 #endif // ASH_DISPLAY_DISPLAY_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698