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

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

Issue 2522563002: Remove unnecessary display:: namespaces. (Closed)
Patch Set: Rebase. Created 4 years 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 #include "ui/display/manager/managed_display_info.h" 5 #include "ui/display/manager/managed_display_info.h"
6 6
7 #include <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return false; 54 return false;
55 } 55 }
56 56
57 // Display mode list is sorted by: 57 // Display mode list is sorted by:
58 // * the area in pixels in ascending order 58 // * the area in pixels in ascending order
59 // * refresh rate in descending order 59 // * refresh rate in descending order
60 struct ManagedDisplayModeSorter { 60 struct ManagedDisplayModeSorter {
61 explicit ManagedDisplayModeSorter(bool is_internal) 61 explicit ManagedDisplayModeSorter(bool is_internal)
62 : is_internal(is_internal) {} 62 : is_internal(is_internal) {}
63 63
64 bool operator()(const scoped_refptr<display::ManagedDisplayMode>& a, 64 bool operator()(const scoped_refptr<ManagedDisplayMode>& a,
65 const scoped_refptr<display::ManagedDisplayMode>& b) { 65 const scoped_refptr<ManagedDisplayMode>& b) {
66 gfx::Size size_a_dip = a->GetSizeInDIP(is_internal); 66 gfx::Size size_a_dip = a->GetSizeInDIP(is_internal);
67 gfx::Size size_b_dip = b->GetSizeInDIP(is_internal); 67 gfx::Size size_b_dip = b->GetSizeInDIP(is_internal);
68 if (size_a_dip.GetArea() == size_b_dip.GetArea()) 68 if (size_a_dip.GetArea() == size_b_dip.GetArea())
69 return (a->refresh_rate() > b->refresh_rate()); 69 return (a->refresh_rate() > b->refresh_rate());
70 return (size_a_dip.GetArea() < size_b_dip.GetArea()); 70 return (size_a_dip.GetArea() < size_b_dip.GetArea());
71 } 71 }
72 72
73 bool is_internal; 73 bool is_internal;
74 }; 74 };
75 75
(...skipping 18 matching lines...) Expand all
94 float refresh_rate, 94 float refresh_rate,
95 bool is_interlaced, 95 bool is_interlaced,
96 bool native) 96 bool native)
97 : size_(size), 97 : size_(size),
98 refresh_rate_(refresh_rate), 98 refresh_rate_(refresh_rate),
99 is_interlaced_(is_interlaced), 99 is_interlaced_(is_interlaced),
100 native_(native), 100 native_(native),
101 ui_scale_(1.0f), 101 ui_scale_(1.0f),
102 device_scale_factor_(1.0f) {} 102 device_scale_factor_(1.0f) {}
103 103
104 ManagedDisplayMode::~ManagedDisplayMode(){}; 104 ManagedDisplayMode::~ManagedDisplayMode() {}
105 105
106 ManagedDisplayMode::ManagedDisplayMode(const gfx::Size& size, 106 ManagedDisplayMode::ManagedDisplayMode(const gfx::Size& size,
107 float refresh_rate, 107 float refresh_rate,
108 bool is_interlaced, 108 bool is_interlaced,
109 bool native, 109 bool native,
110 float ui_scale, 110 float ui_scale,
111 float device_scale_factor) 111 float device_scale_factor)
112 : size_(size), 112 : size_(size),
113 refresh_rate_(refresh_rate), 113 refresh_rate_(refresh_rate),
114 is_interlaced_(is_interlaced), 114 is_interlaced_(is_interlaced),
115 native_(native), 115 native_(native),
116 ui_scale_(ui_scale), 116 ui_scale_(ui_scale),
117 device_scale_factor_(device_scale_factor) {} 117 device_scale_factor_(device_scale_factor) {}
118 118
119 gfx::Size ManagedDisplayMode::GetSizeInDIP(bool is_internal) const { 119 gfx::Size ManagedDisplayMode::GetSizeInDIP(bool is_internal) const {
120 gfx::SizeF size_dip(size_); 120 gfx::SizeF size_dip(size_);
121 size_dip.Scale(ui_scale_); 121 size_dip.Scale(ui_scale_);
122 // DSF=1.25 is special on internal display. The screen is drawn with DSF=1.25 122 // DSF=1.25 is special on internal display. The screen is drawn with DSF=1.25
123 // but it doesn't affect the screen size computation. 123 // but it doesn't affect the screen size computation.
124 if (use_125_dsf_for_ui_scaling && is_internal && 124 if (use_125_dsf_for_ui_scaling && is_internal &&
125 device_scale_factor_ == 1.25f) 125 device_scale_factor_ == 1.25f)
126 return gfx::ToFlooredSize(size_dip); 126 return gfx::ToFlooredSize(size_dip);
127 size_dip.Scale(1.0f / device_scale_factor_); 127 size_dip.Scale(1.0f / device_scale_factor_);
128 return gfx::ToFlooredSize(size_dip); 128 return gfx::ToFlooredSize(size_dip);
129 } 129 }
130 130
131 bool ManagedDisplayMode::IsEquivalent( 131 bool ManagedDisplayMode::IsEquivalent(
132 const scoped_refptr<display::ManagedDisplayMode>& other) const { 132 const scoped_refptr<ManagedDisplayMode>& other) const {
133 const float kEpsilon = 0.0001f; 133 const float kEpsilon = 0.0001f;
134 return size_ == other->size_ && 134 return size_ == other->size_ &&
135 std::abs(ui_scale_ - other->ui_scale_) < kEpsilon && 135 std::abs(ui_scale_ - other->ui_scale_) < kEpsilon &&
136 std::abs(device_scale_factor_ - other->device_scale_factor_) < 136 std::abs(device_scale_factor_ - other->device_scale_factor_) <
137 kEpsilon; 137 kEpsilon;
138 } 138 }
139 139
140 // static 140 // static
141 ManagedDisplayInfo ManagedDisplayInfo::CreateFromSpec(const std::string& spec) { 141 ManagedDisplayInfo ManagedDisplayInfo::CreateFromSpec(const std::string& spec) {
142 return CreateFromSpecWithID(spec, kInvalidDisplayId); 142 return CreateFromSpecWithID(spec, kInvalidDisplayId);
(...skipping 22 matching lines...) Expand all
165 main_spec, "@", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); 165 main_spec, "@", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
166 if (parts.size() == 2) { 166 if (parts.size() == 2) {
167 double scale_in_double = 0; 167 double scale_in_double = 0;
168 if (base::StringToDouble(parts[1], &scale_in_double)) 168 if (base::StringToDouble(parts[1], &scale_in_double))
169 ui_scale = scale_in_double; 169 ui_scale = scale_in_double;
170 main_spec = parts[0]; 170 main_spec = parts[0];
171 } 171 }
172 172
173 parts = base::SplitString(main_spec, "/", base::KEEP_WHITESPACE, 173 parts = base::SplitString(main_spec, "/", base::KEEP_WHITESPACE,
174 base::SPLIT_WANT_NONEMPTY); 174 base::SPLIT_WANT_NONEMPTY);
175 display::Display::Rotation rotation(display::Display::ROTATE_0); 175 Display::Rotation rotation(Display::ROTATE_0);
176 bool has_overscan = false; 176 bool has_overscan = false;
177 if (!parts.empty()) { 177 if (!parts.empty()) {
178 main_spec = parts[0]; 178 main_spec = parts[0];
179 if (parts.size() >= 2) { 179 if (parts.size() >= 2) {
180 std::string options = parts[1]; 180 std::string options = parts[1];
181 for (size_t i = 0; i < options.size(); ++i) { 181 for (size_t i = 0; i < options.size(); ++i) {
182 char c = options[i]; 182 char c = options[i];
183 switch (c) { 183 switch (c) {
184 case 'o': 184 case 'o':
185 has_overscan = true; 185 has_overscan = true;
186 break; 186 break;
187 case 'r': // rotate 90 degrees to 'right'. 187 case 'r': // rotate 90 degrees to 'right'.
188 rotation = display::Display::ROTATE_90; 188 rotation = Display::ROTATE_90;
189 break; 189 break;
190 case 'u': // 180 degrees, 'u'pside-down. 190 case 'u': // 180 degrees, 'u'pside-down.
191 rotation = display::Display::ROTATE_180; 191 rotation = Display::ROTATE_180;
192 break; 192 break;
193 case 'l': // rotate 90 degrees to 'left'. 193 case 'l': // rotate 90 degrees to 'left'.
194 rotation = display::Display::ROTATE_270; 194 rotation = Display::ROTATE_270;
195 break; 195 break;
196 } 196 }
197 } 197 }
198 } 198 }
199 } 199 }
200 200
201 float device_scale_factor = 1.0f; 201 float device_scale_factor = 1.0f;
202 if (!GetDisplayBounds(main_spec, &bounds_in_native, &device_scale_factor)) { 202 if (!GetDisplayBounds(main_spec, &bounds_in_native, &device_scale_factor)) {
203 #if defined(OS_WIN) 203 #if defined(OS_WIN)
204 device_scale_factor = display::win::GetDPIScale(); 204 device_scale_factor = win::GetDPIScale();
205 #endif 205 #endif
206 } 206 }
207 207
208 ManagedDisplayModeList display_modes; 208 ManagedDisplayModeList display_modes;
209 parts = base::SplitString(main_spec, "#", base::KEEP_WHITESPACE, 209 parts = base::SplitString(main_spec, "#", base::KEEP_WHITESPACE,
210 base::SPLIT_WANT_NONEMPTY); 210 base::SPLIT_WANT_NONEMPTY);
211 if (parts.size() == 2) { 211 if (parts.size() == 2) {
212 size_t native_mode = 0; 212 size_t native_mode = 0;
213 int largest_area = -1; 213 int largest_area = -1;
214 float highest_refresh_rate = -1.0f; 214 float highest_refresh_rate = -1.0f;
(...skipping 18 matching lines...) Expand all
233 // Use mode with largest area and highest refresh rate as native. 233 // Use mode with largest area and highest refresh rate as native.
234 largest_area = size.GetArea(); 234 largest_area = size.GetArea();
235 highest_refresh_rate = refresh_rate; 235 highest_refresh_rate = refresh_rate;
236 native_mode = i; 236 native_mode = i;
237 } 237 }
238 display_modes.push_back(make_scoped_refptr( 238 display_modes.push_back(make_scoped_refptr(
239 new ManagedDisplayMode(size, refresh_rate, is_interlaced, false, 239 new ManagedDisplayMode(size, refresh_rate, is_interlaced, false,
240 1.0, device_scale_factor))); 240 1.0, device_scale_factor)));
241 } 241 }
242 } 242 }
243 scoped_refptr<display::ManagedDisplayMode> dm = display_modes[native_mode]; 243 scoped_refptr<ManagedDisplayMode> dm = display_modes[native_mode];
244 display_modes[native_mode] = new ManagedDisplayMode( 244 display_modes[native_mode] = new ManagedDisplayMode(
245 dm->size(), dm->refresh_rate(), dm->is_interlaced(), true, 245 dm->size(), dm->refresh_rate(), dm->is_interlaced(), true,
246 dm->ui_scale(), dm->device_scale_factor()); 246 dm->ui_scale(), dm->device_scale_factor());
247 } 247 }
248 248
249 if (id == kInvalidDisplayId) 249 if (id == kInvalidDisplayId)
250 id = synthesized_display_id++; 250 id = synthesized_display_id++;
251 display::ManagedDisplayInfo display_info( 251 ManagedDisplayInfo display_info(
252 id, base::StringPrintf("Display-%d", static_cast<int>(id)), has_overscan); 252 id, base::StringPrintf("Display-%d", static_cast<int>(id)), has_overscan);
253 display_info.set_device_scale_factor(device_scale_factor); 253 display_info.set_device_scale_factor(device_scale_factor);
254 display_info.SetRotation(rotation, display::Display::ROTATION_SOURCE_ACTIVE); 254 display_info.SetRotation(rotation, Display::ROTATION_SOURCE_ACTIVE);
255 display_info.set_configured_ui_scale(ui_scale); 255 display_info.set_configured_ui_scale(ui_scale);
256 display_info.SetBounds(bounds_in_native); 256 display_info.SetBounds(bounds_in_native);
257 display_info.SetManagedDisplayModes(display_modes); 257 display_info.SetManagedDisplayModes(display_modes);
258 258
259 // To test the overscan, it creates the default 5% overscan. 259 // To test the overscan, it creates the default 5% overscan.
260 if (has_overscan) { 260 if (has_overscan) {
261 int width = bounds_in_native.width() / device_scale_factor / 40; 261 int width = bounds_in_native.width() / device_scale_factor / 40;
262 int height = bounds_in_native.height() / device_scale_factor / 40; 262 int height = bounds_in_native.height() / device_scale_factor / 40;
263 display_info.SetOverscanInsets(gfx::Insets(height, width, height, width)); 263 display_info.SetOverscanInsets(gfx::Insets(height, width, height, width));
264 display_info.UpdateDisplaySize(); 264 display_info.UpdateDisplaySize();
265 } 265 }
266 266
267 DVLOG(1) << "DisplayInfoFromSpec info=" << display_info.ToString() 267 DVLOG(1) << "DisplayInfoFromSpec info=" << display_info.ToString()
268 << ", spec=" << spec; 268 << ", spec=" << spec;
269 return display_info; 269 return display_info;
270 } 270 }
271 271
272 // static 272 // static
273 void ManagedDisplayInfo::SetUse125DSFForUIScalingForTest(bool enable) { 273 void ManagedDisplayInfo::SetUse125DSFForUIScalingForTest(bool enable) {
274 use_125_dsf_for_ui_scaling = enable; 274 use_125_dsf_for_ui_scaling = enable;
275 } 275 }
276 276
277 ManagedDisplayInfo::ManagedDisplayInfo() 277 ManagedDisplayInfo::ManagedDisplayInfo()
278 : id_(kInvalidDisplayId), 278 : id_(kInvalidDisplayId),
279 has_overscan_(false), 279 has_overscan_(false),
280 active_rotation_source_(display::Display::ROTATION_SOURCE_UNKNOWN), 280 active_rotation_source_(Display::ROTATION_SOURCE_UNKNOWN),
281 touch_support_(display::Display::TOUCH_SUPPORT_UNKNOWN), 281 touch_support_(Display::TOUCH_SUPPORT_UNKNOWN),
282 device_scale_factor_(1.0f), 282 device_scale_factor_(1.0f),
283 device_dpi_(kDpi96), 283 device_dpi_(kDpi96),
284 overscan_insets_in_dip_(0, 0, 0, 0), 284 overscan_insets_in_dip_(0, 0, 0, 0),
285 configured_ui_scale_(1.0f), 285 configured_ui_scale_(1.0f),
286 native_(false), 286 native_(false),
287 is_aspect_preserving_scaling_(false), 287 is_aspect_preserving_scaling_(false),
288 clear_overscan_insets_(false), 288 clear_overscan_insets_(false),
289 color_profile_(ui::COLOR_PROFILE_STANDARD) {} 289 color_profile_(ui::COLOR_PROFILE_STANDARD) {}
290 290
291 ManagedDisplayInfo::ManagedDisplayInfo(int64_t id, 291 ManagedDisplayInfo::ManagedDisplayInfo(int64_t id,
292 const std::string& name, 292 const std::string& name,
293 bool has_overscan) 293 bool has_overscan)
294 : id_(id), 294 : id_(id),
295 name_(name), 295 name_(name),
296 has_overscan_(has_overscan), 296 has_overscan_(has_overscan),
297 active_rotation_source_(display::Display::ROTATION_SOURCE_UNKNOWN), 297 active_rotation_source_(Display::ROTATION_SOURCE_UNKNOWN),
298 touch_support_(display::Display::TOUCH_SUPPORT_UNKNOWN), 298 touch_support_(Display::TOUCH_SUPPORT_UNKNOWN),
299 device_scale_factor_(1.0f), 299 device_scale_factor_(1.0f),
300 device_dpi_(kDpi96), 300 device_dpi_(kDpi96),
301 overscan_insets_in_dip_(0, 0, 0, 0), 301 overscan_insets_in_dip_(0, 0, 0, 0),
302 configured_ui_scale_(1.0f), 302 configured_ui_scale_(1.0f),
303 native_(false), 303 native_(false),
304 is_aspect_preserving_scaling_(false), 304 is_aspect_preserving_scaling_(false),
305 clear_overscan_insets_(false), 305 clear_overscan_insets_(false),
306 color_profile_(ui::COLOR_PROFILE_STANDARD) {} 306 color_profile_(ui::COLOR_PROFILE_STANDARD) {}
307 307
308 ManagedDisplayInfo::ManagedDisplayInfo(const ManagedDisplayInfo& other) = 308 ManagedDisplayInfo::ManagedDisplayInfo(const ManagedDisplayInfo& other) =
309 default; 309 default;
310 310
311 ManagedDisplayInfo::~ManagedDisplayInfo() {} 311 ManagedDisplayInfo::~ManagedDisplayInfo() {}
312 312
313 void ManagedDisplayInfo::SetRotation(display::Display::Rotation rotation, 313 void ManagedDisplayInfo::SetRotation(Display::Rotation rotation,
314 display::Display::RotationSource source) { 314 Display::RotationSource source) {
315 rotations_[source] = rotation; 315 rotations_[source] = rotation;
316 rotations_[display::Display::ROTATION_SOURCE_ACTIVE] = rotation; 316 rotations_[Display::ROTATION_SOURCE_ACTIVE] = rotation;
317 active_rotation_source_ = source; 317 active_rotation_source_ = source;
318 } 318 }
319 319
320 display::Display::Rotation ManagedDisplayInfo::GetActiveRotation() const { 320 Display::Rotation ManagedDisplayInfo::GetActiveRotation() const {
321 return GetRotation(display::Display::ROTATION_SOURCE_ACTIVE); 321 return GetRotation(Display::ROTATION_SOURCE_ACTIVE);
322 } 322 }
323 323
324 display::Display::Rotation ManagedDisplayInfo::GetRotation( 324 Display::Rotation ManagedDisplayInfo::GetRotation(
325 display::Display::RotationSource source) const { 325 Display::RotationSource source) const {
326 if (rotations_.find(source) == rotations_.end()) 326 if (rotations_.find(source) == rotations_.end())
327 return display::Display::ROTATE_0; 327 return Display::ROTATE_0;
328 return rotations_.at(source); 328 return rotations_.at(source);
329 } 329 }
330 330
331 void ManagedDisplayInfo::Copy(const ManagedDisplayInfo& native_info) { 331 void ManagedDisplayInfo::Copy(const ManagedDisplayInfo& native_info) {
332 DCHECK(id_ == native_info.id_); 332 DCHECK(id_ == native_info.id_);
333 name_ = native_info.name_; 333 name_ = native_info.name_;
334 has_overscan_ = native_info.has_overscan_; 334 has_overscan_ = native_info.has_overscan_;
335 335
336 active_rotation_source_ = native_info.active_rotation_source_; 336 active_rotation_source_ = native_info.active_rotation_source_;
337 touch_support_ = native_info.touch_support_; 337 touch_support_ = native_info.touch_support_;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 void ManagedDisplayInfo::UpdateDisplaySize() { 388 void ManagedDisplayInfo::UpdateDisplaySize() {
389 size_in_pixel_ = bounds_in_native_.size(); 389 size_in_pixel_ = bounds_in_native_.size();
390 if (!overscan_insets_in_dip_.IsEmpty()) { 390 if (!overscan_insets_in_dip_.IsEmpty()) {
391 gfx::Insets insets_in_pixel = 391 gfx::Insets insets_in_pixel =
392 overscan_insets_in_dip_.Scale(device_scale_factor_); 392 overscan_insets_in_dip_.Scale(device_scale_factor_);
393 size_in_pixel_.Enlarge(-insets_in_pixel.width(), -insets_in_pixel.height()); 393 size_in_pixel_.Enlarge(-insets_in_pixel.width(), -insets_in_pixel.height());
394 } else { 394 } else {
395 overscan_insets_in_dip_.Set(0, 0, 0, 0); 395 overscan_insets_in_dip_.Set(0, 0, 0, 0);
396 } 396 }
397 397
398 if (GetActiveRotation() == display::Display::ROTATE_90 || 398 if (GetActiveRotation() == Display::ROTATE_90 ||
399 GetActiveRotation() == display::Display::ROTATE_270) { 399 GetActiveRotation() == Display::ROTATE_270) {
400 size_in_pixel_.SetSize(size_in_pixel_.height(), size_in_pixel_.width()); 400 size_in_pixel_.SetSize(size_in_pixel_.height(), size_in_pixel_.width());
401 } 401 }
402 gfx::SizeF size_f(size_in_pixel_); 402 gfx::SizeF size_f(size_in_pixel_);
403 size_f.Scale(GetEffectiveUIScale()); 403 size_f.Scale(GetEffectiveUIScale());
404 size_in_pixel_ = gfx::ToFlooredSize(size_f); 404 size_in_pixel_ = gfx::ToFlooredSize(size_f);
405 } 405 }
406 406
407 void ManagedDisplayInfo::SetOverscanInsets(const gfx::Insets& insets_in_dip) { 407 void ManagedDisplayInfo::SetOverscanInsets(const gfx::Insets& insets_in_dip) {
408 overscan_insets_in_dip_ = insets_in_dip; 408 overscan_insets_in_dip_ = insets_in_dip;
409 } 409 }
410 410
411 gfx::Insets ManagedDisplayInfo::GetOverscanInsetsInPixel() const { 411 gfx::Insets ManagedDisplayInfo::GetOverscanInsetsInPixel() const {
412 return overscan_insets_in_dip_.Scale(device_scale_factor_); 412 return overscan_insets_in_dip_.Scale(device_scale_factor_);
413 } 413 }
414 414
415 void ManagedDisplayInfo::SetManagedDisplayModes( 415 void ManagedDisplayInfo::SetManagedDisplayModes(
416 const ManagedDisplayModeList& display_modes) { 416 const ManagedDisplayModeList& display_modes) {
417 display_modes_ = display_modes; 417 display_modes_ = display_modes;
418 std::sort( 418 std::sort(display_modes_.begin(), display_modes_.end(),
419 display_modes_.begin(), display_modes_.end(), 419 ManagedDisplayModeSorter(Display::IsInternalDisplayId(id_)));
420 ManagedDisplayModeSorter(display::Display::IsInternalDisplayId(id_)));
421 } 420 }
422 421
423 gfx::Size ManagedDisplayInfo::GetNativeModeSize() const { 422 gfx::Size ManagedDisplayInfo::GetNativeModeSize() const {
424 for (size_t i = 0; i < display_modes_.size(); ++i) { 423 for (size_t i = 0; i < display_modes_.size(); ++i) {
425 if (display_modes_[i]->native()) 424 if (display_modes_[i]->native())
426 return display_modes_[i]->size(); 425 return display_modes_[i]->size();
427 } 426 }
428 return gfx::Size(); 427 return gfx::Size();
429 } 428 }
430 429
431 std::string ManagedDisplayInfo::ToString() const { 430 std::string ManagedDisplayInfo::ToString() const {
432 int rotation_degree = static_cast<int>(GetActiveRotation()) * 90; 431 int rotation_degree = static_cast<int>(GetActiveRotation()) * 90;
433 std::string devices_str; 432 std::string devices_str;
434 433
435 for (size_t i = 0; i < input_devices_.size(); ++i) { 434 for (size_t i = 0; i < input_devices_.size(); ++i) {
436 devices_str += base::IntToString(input_devices_[i]); 435 devices_str += base::IntToString(input_devices_[i]);
437 if (i != input_devices_.size() - 1) 436 if (i != input_devices_.size() - 1)
438 devices_str += ", "; 437 devices_str += ", ";
439 } 438 }
440 439
441 std::string result = base::StringPrintf( 440 std::string result = base::StringPrintf(
442 "ManagedDisplayInfo[%lld] native bounds=%s, size=%s, device-scale=%g, " 441 "ManagedDisplayInfo[%lld] native bounds=%s, size=%s, device-scale=%g, "
443 "overscan=%s, rotation=%d, ui-scale=%g, touchscreen=%s, " 442 "overscan=%s, rotation=%d, ui-scale=%g, touchscreen=%s, "
444 "input_devices=[%s]", 443 "input_devices=[%s]",
445 static_cast<long long int>(id_), bounds_in_native_.ToString().c_str(), 444 static_cast<long long int>(id_), bounds_in_native_.ToString().c_str(),
446 size_in_pixel_.ToString().c_str(), device_scale_factor_, 445 size_in_pixel_.ToString().c_str(), device_scale_factor_,
447 overscan_insets_in_dip_.ToString().c_str(), rotation_degree, 446 overscan_insets_in_dip_.ToString().c_str(), rotation_degree,
448 configured_ui_scale_, 447 configured_ui_scale_,
449 touch_support_ == display::Display::TOUCH_SUPPORT_AVAILABLE 448 touch_support_ == Display::TOUCH_SUPPORT_AVAILABLE
450 ? "yes" 449 ? "yes"
451 : touch_support_ == display::Display::TOUCH_SUPPORT_UNAVAILABLE 450 : touch_support_ == Display::TOUCH_SUPPORT_UNAVAILABLE ? "no"
452 ? "no" 451 : "unknown",
453 : "unknown",
454 devices_str.c_str()); 452 devices_str.c_str());
455 453
456 return result; 454 return result;
457 } 455 }
458 456
459 std::string ManagedDisplayInfo::ToFullString() const { 457 std::string ManagedDisplayInfo::ToFullString() const {
460 std::string display_modes_str; 458 std::string display_modes_str;
461 ManagedDisplayModeList::const_iterator iter = display_modes_.begin(); 459 ManagedDisplayModeList::const_iterator iter = display_modes_.begin();
462 for (; iter != display_modes_.end(); ++iter) { 460 for (; iter != display_modes_.end(); ++iter) {
463 scoped_refptr<ManagedDisplayMode> m(*iter); 461 scoped_refptr<ManagedDisplayMode> m(*iter);
(...skipping 13 matching lines...) Expand all
477 } 475 }
478 476
479 bool ManagedDisplayInfo::IsColorProfileAvailable( 477 bool ManagedDisplayInfo::IsColorProfileAvailable(
480 ui::ColorCalibrationProfile profile) const { 478 ui::ColorCalibrationProfile profile) const {
481 return std::find(available_color_profiles_.begin(), 479 return std::find(available_color_profiles_.begin(),
482 available_color_profiles_.end(), 480 available_color_profiles_.end(),
483 profile) != available_color_profiles_.end(); 481 profile) != available_color_profiles_.end();
484 } 482 }
485 483
486 bool ManagedDisplayInfo::Use125DSFForUIScaling() const { 484 bool ManagedDisplayInfo::Use125DSFForUIScaling() const {
487 return use_125_dsf_for_ui_scaling && 485 return use_125_dsf_for_ui_scaling && Display::IsInternalDisplayId(id_);
488 display::Display::IsInternalDisplayId(id_);
489 } 486 }
490 487
491 void ManagedDisplayInfo::AddInputDevice(int id) { 488 void ManagedDisplayInfo::AddInputDevice(int id) {
492 input_devices_.push_back(id); 489 input_devices_.push_back(id);
493 } 490 }
494 491
495 void ManagedDisplayInfo::ClearInputDevices() { 492 void ManagedDisplayInfo::ClearInputDevices() {
496 input_devices_.clear(); 493 input_devices_.clear();
497 } 494 }
498 495
499 void ResetDisplayIdForTest() { 496 void ResetDisplayIdForTest() {
500 synthesized_display_id = kSynthesizedDisplayIdStart; 497 synthesized_display_id = kSynthesizedDisplayIdStart;
501 } 498 }
502 499
503 } // namespace display 500 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/manager/managed_display_info.h ('k') | ui/display/manager/managed_display_info_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698