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

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

Issue 21297003: Add ability to set resolution on external display (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
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 <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& s, bool i);
Daniel Erat 2013/07/31 17:34:05 nit: name parameters 'size' and 'interlaced' inste
oshima 2013/07/31 21:59:49 Done. I'll keept the constructor in .cc as this ha
24 gfx::Size size;
25 bool interlaced;
26 };
27
19 // DisplayInfo contains metadata for each display. This is used to 28 // DisplayInfo contains metadata for each display. This is used to
20 // create |gfx::Display| as well as to maintain extra infomation 29 // create |gfx::Display| as well as to maintain extra infomation
21 // to manage displays in ash environment. 30 // to manage displays in ash environment.
22 // This class is intentionally made copiable. 31 // This class is intentionally made copiable.
23 class ASH_EXPORT DisplayInfo { 32 class ASH_EXPORT DisplayInfo {
24 public: 33 public:
25 // Creates a DisplayInfo from string spec. 100+200-1440x800 creates display 34 // Creates a DisplayInfo from string spec. 100+200-1440x800 creates display
26 // whose size is 1440x800 at the location (100, 200) in host coordinates. 35 // whose size is 1440x800 at the location (100, 200) in host coordinates.
27 // The format is 36 // The format is
28 // 37 //
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 // and rotation settings. 116 // and rotation settings.
108 void UpdateDisplaySize(); 117 void UpdateDisplaySize();
109 118
110 // Sets/Clears the overscan insets. 119 // Sets/Clears the overscan insets.
111 void SetOverscanInsets(const gfx::Insets& insets_in_dip); 120 void SetOverscanInsets(const gfx::Insets& insets_in_dip);
112 gfx::Insets GetOverscanInsetsInPixel() const; 121 gfx::Insets GetOverscanInsetsInPixel() const;
113 122
114 void set_native(bool native) { native_ = native; } 123 void set_native(bool native) { native_ = native; }
115 bool native() const { return native_; } 124 bool native() const { return native_; }
116 125
117 // Returns a string representation of the DisplayInfo; 126 const std::vector<Resolution>& resolutions() const {
127 return resolutions_;
128 }
129 void set_resolutions(std::vector<Resolution>& resolution) {
130 resolutions_.swap(resolution);
131 }
132
133 // Returns a string representation of the DisplayInfo
134 // excluding resolutions.
118 std::string ToString() const; 135 std::string ToString() const;
119 136
137 // Returns a string representation of the DisplayInfo
138 // including resolutions.
139 std::string ToFullString() const;
140
120 private: 141 private:
121 int64 id_; 142 int64 id_;
122 std::string name_; 143 std::string name_;
123 bool has_overscan_; 144 bool has_overscan_;
124 gfx::Display::Rotation rotation_; 145 gfx::Display::Rotation rotation_;
125 float device_scale_factor_; 146 float device_scale_factor_;
126 gfx::Rect bounds_in_pixel_; 147 gfx::Rect bounds_in_pixel_;
127 // The size of the display in use. The size can be different from the size 148 // 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. 149 // of |bounds_in_pixel_| if the display has overscan insets and/or rotation.
129 gfx::Size size_in_pixel_; 150 gfx::Size size_in_pixel_;
130 gfx::Insets overscan_insets_in_dip_; 151 gfx::Insets overscan_insets_in_dip_;
131 152
132 // UI scale of the display. 153 // UI scale of the display.
133 float ui_scale_; 154 float ui_scale_;
134 155
135 // True if this comes from native platform (DisplayChangeObserverX11). 156 // True if this comes from native platform (DisplayChangeObserverX11).
136 bool native_; 157 bool native_;
158
159 // The list of resolutions supported by this display.
160 std::vector<Resolution> resolutions_;
137 }; 161 };
138 162
139 } // namespace internal 163 } // namespace internal
140 } // namespace ash 164 } // namespace ash
141 165
142 #endif // ASH_DISPLAY_DISPLAY_INFO_H_ 166 #endif // ASH_DISPLAY_DISPLAY_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698