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

Side by Side Diff: ash/display/display_manager.cc

Issue 2270553002: Move ash::DisplayInfo to ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 3 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_manager.h ('k') | ash/display/display_manager_unittest.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/display/display_manager.h" 5 #include "ash/display/display_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <map> 10 #include <map>
11 #include <set> 11 #include <set>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 #include <vector> 14 #include <vector>
15 15
16 #include "ash/common/ash_switches.h" 16 #include "ash/common/ash_switches.h"
17 #include "ash/common/display/display_info.h"
18 #include "ash/display/display_util.h" 17 #include "ash/display/display_util.h"
19 #include "ash/display/extended_mouse_warp_controller.h" 18 #include "ash/display/extended_mouse_warp_controller.h"
20 #include "ash/display/null_mouse_warp_controller.h" 19 #include "ash/display/null_mouse_warp_controller.h"
21 #include "ash/display/screen_ash.h" 20 #include "ash/display/screen_ash.h"
22 #include "ash/display/unified_mouse_warp_controller.h" 21 #include "ash/display/unified_mouse_warp_controller.h"
23 #include "ash/screen_util.h" 22 #include "ash/screen_util.h"
24 #include "ash/shell.h" 23 #include "ash/shell.h"
25 #include "base/auto_reset.h" 24 #include "base/auto_reset.h"
26 #include "base/command_line.h" 25 #include "base/command_line.h"
27 #include "base/logging.h" 26 #include "base/logging.h"
28 #include "base/memory/ptr_util.h" 27 #include "base/memory/ptr_util.h"
29 #include "base/metrics/histogram.h" 28 #include "base/metrics/histogram.h"
30 #include "base/run_loop.h" 29 #include "base/run_loop.h"
31 #include "base/strings/string_number_conversions.h" 30 #include "base/strings/string_number_conversions.h"
32 #include "base/strings/string_split.h" 31 #include "base/strings/string_split.h"
33 #include "base/strings/stringprintf.h" 32 #include "base/strings/stringprintf.h"
34 #include "base/strings/utf_string_conversions.h" 33 #include "base/strings/utf_string_conversions.h"
35 #include "base/threading/thread_task_runner_handle.h" 34 #include "base/threading/thread_task_runner_handle.h"
36 #include "grit/ash_strings.h" 35 #include "grit/ash_strings.h"
37 #include "ui/base/l10n/l10n_util.h" 36 #include "ui/base/l10n/l10n_util.h"
38 #include "ui/display/display.h" 37 #include "ui/display/display.h"
39 #include "ui/display/display_observer.h" 38 #include "ui/display/display_observer.h"
40 #include "ui/display/manager/display_layout_store.h" 39 #include "ui/display/manager/display_layout_store.h"
40 #include "ui/display/manager/managed_display_info.h"
41 #include "ui/display/screen.h" 41 #include "ui/display/screen.h"
42 #include "ui/gfx/font_render_params.h" 42 #include "ui/gfx/font_render_params.h"
43 #include "ui/gfx/geometry/rect.h" 43 #include "ui/gfx/geometry/rect.h"
44 #include "ui/gfx/geometry/size_conversions.h" 44 #include "ui/gfx/geometry/size_conversions.h"
45 45
46 #if defined(USE_X11) 46 #if defined(USE_X11)
47 #include "ui/base/x/x11_util.h" // nogncheck 47 #include "ui/base/x/x11_util.h" // nogncheck
48 #endif 48 #endif
49 49
50 #if defined(OS_CHROMEOS) 50 #if defined(OS_CHROMEOS)
51 #include "base/sys_info.h" 51 #include "base/sys_info.h"
52 #endif 52 #endif
53 53
54 #if defined(OS_WIN) 54 #if defined(OS_WIN)
55 #include "base/win/windows_version.h" 55 #include "base/win/windows_version.h"
56 #endif 56 #endif
57 57
58 namespace ash { 58 namespace ash {
59 typedef std::vector<DisplayInfo> DisplayInfoList;
60 59
61 namespace { 60 namespace {
62 61
63 // We need to keep this in order for unittests to tell if 62 // We need to keep this in order for unittests to tell if
64 // the object in display::Screen::GetScreenByType is for shutdown. 63 // the object in display::Screen::GetScreenByType is for shutdown.
65 display::Screen* screen_for_shutdown = nullptr; 64 display::Screen* screen_for_shutdown = nullptr;
66 65
67 // The number of pixels to overlap between the primary and secondary displays, 66 // The number of pixels to overlap between the primary and secondary displays,
68 // in case that the offset value is too large. 67 // in case that the offset value is too large.
69 const int kMinimumOverlapForInvalidOffset = 100; 68 const int kMinimumOverlapForInvalidOffset = 100;
70 69
71 struct DisplaySortFunctor { 70 struct DisplaySortFunctor {
72 bool operator()(const display::Display& a, const display::Display& b) { 71 bool operator()(const display::Display& a, const display::Display& b) {
73 return CompareDisplayIds(a.id(), b.id()); 72 return CompareDisplayIds(a.id(), b.id());
74 } 73 }
75 }; 74 };
76 75
77 struct DisplayInfoSortFunctor { 76 struct DisplayInfoSortFunctor {
78 bool operator()(const DisplayInfo& a, const DisplayInfo& b) { 77 bool operator()(const display::ManagedDisplayInfo& a,
78 const display::ManagedDisplayInfo& b) {
79 return CompareDisplayIds(a.id(), b.id()); 79 return CompareDisplayIds(a.id(), b.id());
80 } 80 }
81 }; 81 };
82 82
83 display::Display& GetInvalidDisplay() { 83 display::Display& GetInvalidDisplay() {
84 static display::Display* invalid_display = new display::Display(); 84 static display::Display* invalid_display = new display::Display();
85 return *invalid_display; 85 return *invalid_display;
86 } 86 }
87 87
88 DisplayInfo::ManagedDisplayModeList::const_iterator FindDisplayMode( 88 display::ManagedDisplayInfo::ManagedDisplayModeList::const_iterator
89 const DisplayInfo& info, 89 FindDisplayMode(const display::ManagedDisplayInfo& info,
90 const scoped_refptr<ManagedDisplayMode>& target_mode) { 90 const scoped_refptr<display::ManagedDisplayMode>& target_mode) {
91 const DisplayInfo::ManagedDisplayModeList& modes = info.display_modes(); 91 const display::ManagedDisplayInfo::ManagedDisplayModeList& modes =
92 info.display_modes();
92 return std::find_if( 93 return std::find_if(
93 modes.begin(), modes.end(), 94 modes.begin(), modes.end(),
94 [target_mode](const scoped_refptr<ManagedDisplayMode>& mode) { 95 [target_mode](const scoped_refptr<display::ManagedDisplayMode>& mode) {
95 return target_mode->IsEquivalent(mode); 96 return target_mode->IsEquivalent(mode);
96 }); 97 });
97 } 98 }
98 99
99 void SetInternalManagedDisplayModeList(DisplayInfo* info) { 100 void SetInternalManagedDisplayModeList(display::ManagedDisplayInfo* info) {
100 scoped_refptr<ManagedDisplayMode> native_mode = new ManagedDisplayMode( 101 scoped_refptr<display::ManagedDisplayMode> native_mode =
101 info->bounds_in_native().size(), 0.0 /* refresh_rate */, 102 new display::ManagedDisplayMode(
102 false /* interlaced */, false /* native_mode */, 1.0 /* ui_scale */, 103 info->bounds_in_native().size(), 0.0 /* refresh_rate */,
103 info->device_scale_factor()); 104 false /* interlaced */, false /* native_mode */, 1.0 /* ui_scale */,
105 info->device_scale_factor());
104 info->SetManagedDisplayModes( 106 info->SetManagedDisplayModes(
105 CreateInternalManagedDisplayModeList(native_mode)); 107 CreateInternalManagedDisplayModeList(native_mode));
106 } 108 }
107 109
108 void MaybeInitInternalDisplay(DisplayInfo* info) { 110 void MaybeInitInternalDisplay(display::ManagedDisplayInfo* info) {
109 int64_t id = info->id(); 111 int64_t id = info->id();
110 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 112 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
111 if (command_line->HasSwitch(switches::kAshUseFirstDisplayAsInternal)) { 113 if (command_line->HasSwitch(switches::kAshUseFirstDisplayAsInternal)) {
112 display::Display::SetInternalDisplayId(id); 114 display::Display::SetInternalDisplayId(id);
113 SetInternalManagedDisplayModeList(info); 115 SetInternalManagedDisplayModeList(info);
114 } 116 }
115 } 117 }
116 118
117 gfx::Size GetMaxNativeSize(const DisplayInfo& info) { 119 gfx::Size GetMaxNativeSize(const display::ManagedDisplayInfo& info) {
118 gfx::Size size; 120 gfx::Size size;
119 for (auto& mode : info.display_modes()) { 121 for (auto& mode : info.display_modes()) {
120 if (mode->size().GetArea() > size.GetArea()) 122 if (mode->size().GetArea() > size.GetArea())
121 size = mode->size(); 123 size = mode->size();
122 } 124 }
123 return size; 125 return size;
124 } 126 }
125 127
126 } // namespace 128 } // namespace
127 129
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 169
168 bool DisplayManager::InitFromCommandLine() { 170 bool DisplayManager::InitFromCommandLine() {
169 DisplayInfoList info_list; 171 DisplayInfoList info_list;
170 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 172 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
171 if (!command_line->HasSwitch(switches::kAshHostWindowBounds)) 173 if (!command_line->HasSwitch(switches::kAshHostWindowBounds))
172 return false; 174 return false;
173 const string size_str = 175 const string size_str =
174 command_line->GetSwitchValueASCII(switches::kAshHostWindowBounds); 176 command_line->GetSwitchValueASCII(switches::kAshHostWindowBounds);
175 for (const std::string& part : base::SplitString( 177 for (const std::string& part : base::SplitString(
176 size_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) { 178 size_str, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
177 info_list.push_back(DisplayInfo::CreateFromSpec(part)); 179 info_list.push_back(display::ManagedDisplayInfo::CreateFromSpec(part));
178 info_list.back().set_native(true); 180 info_list.back().set_native(true);
179 } 181 }
180 MaybeInitInternalDisplay(&info_list[0]); 182 MaybeInitInternalDisplay(&info_list[0]);
181 if (info_list.size() > 1 && 183 if (info_list.size() > 1 &&
182 command_line->HasSwitch(switches::kAshEnableSoftwareMirroring)) { 184 command_line->HasSwitch(switches::kAshEnableSoftwareMirroring)) {
183 SetMultiDisplayMode(MIRRORING); 185 SetMultiDisplayMode(MIRRORING);
184 } 186 }
185 OnNativeDisplaysChanged(info_list); 187 OnNativeDisplaysChanged(info_list);
186 return true; 188 return true;
187 } 189 }
188 190
189 void DisplayManager::InitDefaultDisplay() { 191 void DisplayManager::InitDefaultDisplay() {
190 DisplayInfoList info_list; 192 DisplayInfoList info_list;
191 info_list.push_back(DisplayInfo::CreateFromSpec(std::string())); 193 info_list.push_back(
194 display::ManagedDisplayInfo::CreateFromSpec(std::string()));
192 info_list.back().set_native(true); 195 info_list.back().set_native(true);
193 MaybeInitInternalDisplay(&info_list[0]); 196 MaybeInitInternalDisplay(&info_list[0]);
194 OnNativeDisplaysChanged(info_list); 197 OnNativeDisplaysChanged(info_list);
195 } 198 }
196 199
197 void DisplayManager::RefreshFontParams() { 200 void DisplayManager::RefreshFontParams() {
198 #if defined(OS_CHROMEOS) 201 #if defined(OS_CHROMEOS)
199 // Use the largest device scale factor among currently active displays. Non 202 // Use the largest device scale factor among currently active displays. Non
200 // internal display may have bigger scale factor in case the external display 203 // internal display may have bigger scale factor in case the external display
201 // is an 4K display. 204 // is an 4K display.
202 float largest_device_scale_factor = 1.0f; 205 float largest_device_scale_factor = 1.0f;
203 for (const display::Display& display : active_display_list_) { 206 for (const display::Display& display : active_display_list_) {
204 const ash::DisplayInfo& info = display_info_[display.id()]; 207 const display::ManagedDisplayInfo& info = display_info_[display.id()];
205 largest_device_scale_factor = std::max( 208 largest_device_scale_factor = std::max(
206 largest_device_scale_factor, info.GetEffectiveDeviceScaleFactor()); 209 largest_device_scale_factor, info.GetEffectiveDeviceScaleFactor());
207 } 210 }
208 gfx::SetFontRenderParamsDeviceScaleFactor(largest_device_scale_factor); 211 gfx::SetFontRenderParamsDeviceScaleFactor(largest_device_scale_factor);
209 #endif // OS_CHROMEOS 212 #endif // OS_CHROMEOS
210 } 213 }
211 214
212 const display::DisplayLayout& DisplayManager::GetCurrentDisplayLayout() const { 215 const display::DisplayLayout& DisplayManager::GetCurrentDisplayLayout() const {
213 DCHECK_LE(2U, num_connected_displays()); 216 DCHECK_LE(2U, num_connected_displays());
214 if (num_connected_displays() > 1) { 217 if (num_connected_displays() > 1) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 *display, display::DisplayObserver::DISPLAY_METRIC_WORK_AREA); 301 *display, display::DisplayObserver::DISPLAY_METRIC_WORK_AREA);
299 } 302 }
300 return workarea_changed; 303 return workarea_changed;
301 } 304 }
302 305
303 void DisplayManager::SetOverscanInsets(int64_t display_id, 306 void DisplayManager::SetOverscanInsets(int64_t display_id,
304 const gfx::Insets& insets_in_dip) { 307 const gfx::Insets& insets_in_dip) {
305 bool update = false; 308 bool update = false;
306 DisplayInfoList display_info_list; 309 DisplayInfoList display_info_list;
307 for (const auto& display : active_display_list_) { 310 for (const auto& display : active_display_list_) {
308 DisplayInfo info = GetDisplayInfo(display.id()); 311 display::ManagedDisplayInfo info = GetDisplayInfo(display.id());
309 if (info.id() == display_id) { 312 if (info.id() == display_id) {
310 if (insets_in_dip.IsEmpty()) { 313 if (insets_in_dip.IsEmpty()) {
311 info.set_clear_overscan_insets(true); 314 info.set_clear_overscan_insets(true);
312 } else { 315 } else {
313 info.set_clear_overscan_insets(false); 316 info.set_clear_overscan_insets(false);
314 info.SetOverscanInsets(insets_in_dip); 317 info.SetOverscanInsets(insets_in_dip);
315 } 318 }
316 update = true; 319 update = true;
317 } 320 }
318 display_info_list.push_back(info); 321 display_info_list.push_back(info);
319 } 322 }
320 if (update) { 323 if (update) {
321 AddMirrorDisplayInfoIfAny(&display_info_list); 324 AddMirrorDisplayInfoIfAny(&display_info_list);
322 UpdateDisplaysWith(display_info_list); 325 UpdateDisplaysWith(display_info_list);
323 } else { 326 } else {
324 display_info_[display_id].SetOverscanInsets(insets_in_dip); 327 display_info_[display_id].SetOverscanInsets(insets_in_dip);
325 } 328 }
326 } 329 }
327 330
328 void DisplayManager::SetDisplayRotation( 331 void DisplayManager::SetDisplayRotation(
329 int64_t display_id, 332 int64_t display_id,
330 display::Display::Rotation rotation, 333 display::Display::Rotation rotation,
331 display::Display::RotationSource source) { 334 display::Display::RotationSource source) {
332 if (IsInUnifiedMode()) 335 if (IsInUnifiedMode())
333 return; 336 return;
334 337
335 DisplayInfoList display_info_list; 338 DisplayInfoList display_info_list;
336 bool is_active = false; 339 bool is_active = false;
337 for (const auto& display : active_display_list_) { 340 for (const auto& display : active_display_list_) {
338 DisplayInfo info = GetDisplayInfo(display.id()); 341 display::ManagedDisplayInfo info = GetDisplayInfo(display.id());
339 if (info.id() == display_id) { 342 if (info.id() == display_id) {
340 if (info.GetRotation(source) == rotation && 343 if (info.GetRotation(source) == rotation &&
341 info.GetActiveRotation() == rotation) { 344 info.GetActiveRotation() == rotation) {
342 return; 345 return;
343 } 346 }
344 info.SetRotation(rotation, source); 347 info.SetRotation(rotation, source);
345 is_active = true; 348 is_active = true;
346 } 349 }
347 display_info_list.push_back(info); 350 display_info_list.push_back(info);
348 } 351 }
349 if (is_active) { 352 if (is_active) {
350 AddMirrorDisplayInfoIfAny(&display_info_list); 353 AddMirrorDisplayInfoIfAny(&display_info_list);
351 UpdateDisplaysWith(display_info_list); 354 UpdateDisplaysWith(display_info_list);
352 } else if (display_info_.find(display_id) != display_info_.end()) { 355 } else if (display_info_.find(display_id) != display_info_.end()) {
353 // Inactive displays can reactivate, ensure they have been updated. 356 // Inactive displays can reactivate, ensure they have been updated.
354 display_info_[display_id].SetRotation(rotation, source); 357 display_info_[display_id].SetRotation(rotation, source);
355 } 358 }
356 } 359 }
357 360
358 bool DisplayManager::SetDisplayMode( 361 bool DisplayManager::SetDisplayMode(
359 int64_t display_id, 362 int64_t display_id,
360 const scoped_refptr<ManagedDisplayMode>& display_mode) { 363 const scoped_refptr<display::ManagedDisplayMode>& display_mode) {
361 bool change_ui_scale = GetDisplayIdForUIScaling() == display_id; 364 bool change_ui_scale = GetDisplayIdForUIScaling() == display_id;
362 365
363 DisplayInfoList display_info_list; 366 DisplayInfoList display_info_list;
364 bool display_property_changed = false; 367 bool display_property_changed = false;
365 bool resolution_changed = false; 368 bool resolution_changed = false;
366 for (const auto& display : active_display_list_) { 369 for (const auto& display : active_display_list_) {
367 DisplayInfo info = GetDisplayInfo(display.id()); 370 display::ManagedDisplayInfo info = GetDisplayInfo(display.id());
368 if (info.id() == display_id) { 371 if (info.id() == display_id) {
369 auto iter = FindDisplayMode(info, display_mode); 372 auto iter = FindDisplayMode(info, display_mode);
370 if (iter == info.display_modes().end()) { 373 if (iter == info.display_modes().end()) {
371 LOG(WARNING) << "Unsupported display mode was requested:" 374 LOG(WARNING) << "Unsupported display mode was requested:"
372 << "size=" << display_mode->size().ToString() 375 << "size=" << display_mode->size().ToString()
373 << ", ui scale=" << display_mode->ui_scale() 376 << ", ui scale=" << display_mode->ui_scale()
374 << ", scale factor=" 377 << ", scale factor="
375 << display_mode->device_scale_factor(); 378 << display_mode->device_scale_factor();
376 return false; 379 return false;
377 } 380 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 412
410 void DisplayManager::RegisterDisplayProperty( 413 void DisplayManager::RegisterDisplayProperty(
411 int64_t display_id, 414 int64_t display_id,
412 display::Display::Rotation rotation, 415 display::Display::Rotation rotation,
413 float ui_scale, 416 float ui_scale,
414 const gfx::Insets* overscan_insets, 417 const gfx::Insets* overscan_insets,
415 const gfx::Size& resolution_in_pixels, 418 const gfx::Size& resolution_in_pixels,
416 float device_scale_factor, 419 float device_scale_factor,
417 ui::ColorCalibrationProfile color_profile) { 420 ui::ColorCalibrationProfile color_profile) {
418 if (display_info_.find(display_id) == display_info_.end()) 421 if (display_info_.find(display_id) == display_info_.end())
419 display_info_[display_id] = DisplayInfo(display_id, std::string(), false); 422 display_info_[display_id] =
423 display::ManagedDisplayInfo(display_id, std::string(), false);
420 424
421 // Do not allow rotation in unified desktop mode. 425 // Do not allow rotation in unified desktop mode.
422 if (display_id == kUnifiedDisplayId) 426 if (display_id == kUnifiedDisplayId)
423 rotation = display::Display::ROTATE_0; 427 rotation = display::Display::ROTATE_0;
424 428
425 display_info_[display_id].SetRotation(rotation, 429 display_info_[display_id].SetRotation(rotation,
426 display::Display::ROTATION_SOURCE_USER); 430 display::Display::ROTATION_SOURCE_USER);
427 display_info_[display_id].SetRotation( 431 display_info_[display_id].SetRotation(
428 rotation, display::Display::ROTATION_SOURCE_ACTIVE); 432 rotation, display::Display::ROTATION_SOURCE_ACTIVE);
429 display_info_[display_id].SetColorProfile(color_profile); 433 display_info_[display_id].SetColorProfile(color_profile);
430 // Just in case the preference file was corrupted. 434 // Just in case the preference file was corrupted.
431 // TODO(mukai): register |display_modes_| here as well, so the lookup for the 435 // TODO(mukai): register |display_modes_| here as well, so the lookup for the
432 // default mode in GetActiveModeForDisplayId() gets much simpler. 436 // default mode in GetActiveModeForDisplayId() gets much simpler.
433 if (0.5f <= ui_scale && ui_scale <= 2.0f) 437 if (0.5f <= ui_scale && ui_scale <= 2.0f)
434 display_info_[display_id].set_configured_ui_scale(ui_scale); 438 display_info_[display_id].set_configured_ui_scale(ui_scale);
435 if (overscan_insets) 439 if (overscan_insets)
436 display_info_[display_id].SetOverscanInsets(*overscan_insets); 440 display_info_[display_id].SetOverscanInsets(*overscan_insets);
437 if (!resolution_in_pixels.IsEmpty()) { 441 if (!resolution_in_pixels.IsEmpty()) {
438 DCHECK(!display::Display::IsInternalDisplayId(display_id)); 442 DCHECK(!display::Display::IsInternalDisplayId(display_id));
439 // Default refresh rate, until OnNativeDisplaysChanged() updates us with the 443 // Default refresh rate, until OnNativeDisplaysChanged() updates us with the
440 // actual display info, is 60 Hz. 444 // actual display info, is 60 Hz.
441 scoped_refptr<ManagedDisplayMode> mode = new ManagedDisplayMode( 445 scoped_refptr<display::ManagedDisplayMode> mode =
442 resolution_in_pixels, 60.0f, false, false, 1.0, device_scale_factor); 446 new display::ManagedDisplayMode(resolution_in_pixels, 60.0f, false,
447 false, 1.0, device_scale_factor);
443 display_modes_[display_id] = mode; 448 display_modes_[display_id] = mode;
444 } 449 }
445 } 450 }
446 451
447 scoped_refptr<ManagedDisplayMode> DisplayManager::GetActiveModeForDisplayId( 452 scoped_refptr<display::ManagedDisplayMode>
448 int64_t display_id) const { 453 DisplayManager::GetActiveModeForDisplayId(int64_t display_id) const {
449 scoped_refptr<ManagedDisplayMode> selected_mode( 454 scoped_refptr<display::ManagedDisplayMode> selected_mode(
450 GetSelectedModeForDisplayId(display_id)); 455 GetSelectedModeForDisplayId(display_id));
451 if (selected_mode) 456 if (selected_mode)
452 return selected_mode; 457 return selected_mode;
453 458
454 // If 'selected' mode is empty, it should return the default mode. This means 459 // If 'selected' mode is empty, it should return the default mode. This means
455 // the native mode for the external display. Unfortunately this is not true 460 // the native mode for the external display. Unfortunately this is not true
456 // for the internal display because restoring UI-scale doesn't register the 461 // for the internal display because restoring UI-scale doesn't register the
457 // restored mode to |display_mode_|, so it needs to look up the mode whose 462 // restored mode to |display_mode_|, so it needs to look up the mode whose
458 // UI-scale value matches. See the TODO in RegisterDisplayProperty(). 463 // UI-scale value matches. See the TODO in RegisterDisplayProperty().
459 const DisplayInfo& info = GetDisplayInfo(display_id); 464 const display::ManagedDisplayInfo& info = GetDisplayInfo(display_id);
460 465
461 for (auto& mode : info.display_modes()) { 466 for (auto& mode : info.display_modes()) {
462 if (GetDisplayIdForUIScaling() == display_id) { 467 if (GetDisplayIdForUIScaling() == display_id) {
463 if (info.configured_ui_scale() == mode->ui_scale()) 468 if (info.configured_ui_scale() == mode->ui_scale())
464 return mode.get(); 469 return mode.get();
465 } else if (mode->native()) { 470 } else if (mode->native()) {
466 return mode.get(); 471 return mode.get();
467 } 472 }
468 } 473 }
469 return selected_mode; 474 return selected_mode;
470 } 475 }
471 476
472 void DisplayManager::RegisterDisplayRotationProperties( 477 void DisplayManager::RegisterDisplayRotationProperties(
473 bool rotation_lock, 478 bool rotation_lock,
474 display::Display::Rotation rotation) { 479 display::Display::Rotation rotation) {
475 if (delegate_) 480 if (delegate_)
476 delegate_->PreDisplayConfigurationChange(false); 481 delegate_->PreDisplayConfigurationChange(false);
477 registered_internal_display_rotation_lock_ = rotation_lock; 482 registered_internal_display_rotation_lock_ = rotation_lock;
478 registered_internal_display_rotation_ = rotation; 483 registered_internal_display_rotation_ = rotation;
479 if (delegate_) 484 if (delegate_)
480 delegate_->PostDisplayConfigurationChange(); 485 delegate_->PostDisplayConfigurationChange();
481 } 486 }
482 487
483 scoped_refptr<ManagedDisplayMode> DisplayManager::GetSelectedModeForDisplayId( 488 scoped_refptr<display::ManagedDisplayMode>
484 int64_t id) const { 489 DisplayManager::GetSelectedModeForDisplayId(int64_t id) const {
485 std::map<int64_t, scoped_refptr<ManagedDisplayMode>>::const_iterator iter = 490 std::map<int64_t, scoped_refptr<display::ManagedDisplayMode>>::const_iterator
486 display_modes_.find(id); 491 iter = display_modes_.find(id);
487 if (iter == display_modes_.end()) 492 if (iter == display_modes_.end())
488 return scoped_refptr<ManagedDisplayMode>(); 493 return scoped_refptr<display::ManagedDisplayMode>();
489 return iter->second; 494 return iter->second;
490 } 495 }
491 496
492 bool DisplayManager::IsDisplayUIScalingEnabled() const { 497 bool DisplayManager::IsDisplayUIScalingEnabled() const {
493 return GetDisplayIdForUIScaling() != display::Display::kInvalidDisplayID; 498 return GetDisplayIdForUIScaling() != display::Display::kInvalidDisplayID;
494 } 499 }
495 500
496 gfx::Insets DisplayManager::GetOverscanInsets(int64_t display_id) const { 501 gfx::Insets DisplayManager::GetOverscanInsets(int64_t display_id) const {
497 std::map<int64_t, DisplayInfo>::const_iterator it = 502 std::map<int64_t, display::ManagedDisplayInfo>::const_iterator it =
498 display_info_.find(display_id); 503 display_info_.find(display_id);
499 return (it != display_info_.end()) ? it->second.overscan_insets_in_dip() 504 return (it != display_info_.end()) ? it->second.overscan_insets_in_dip()
500 : gfx::Insets(); 505 : gfx::Insets();
501 } 506 }
502 507
503 void DisplayManager::SetColorCalibrationProfile( 508 void DisplayManager::SetColorCalibrationProfile(
504 int64_t display_id, 509 int64_t display_id,
505 ui::ColorCalibrationProfile profile) { 510 ui::ColorCalibrationProfile profile) {
506 #if defined(OS_CHROMEOS) 511 #if defined(OS_CHROMEOS)
507 if (!display_info_[display_id].IsColorProfileAvailable(profile)) 512 if (!display_info_[display_id].IsColorProfileAvailable(profile))
508 return; 513 return;
509 514
510 if (delegate_) 515 if (delegate_)
511 delegate_->PreDisplayConfigurationChange(false); 516 delegate_->PreDisplayConfigurationChange(false);
512 // Just sets color profile if it's not running on ChromeOS (like tests). 517 // Just sets color profile if it's not running on ChromeOS (like tests).
513 if (!base::SysInfo::IsRunningOnChromeOS() || 518 if (!base::SysInfo::IsRunningOnChromeOS() ||
514 Shell::GetInstance()->display_configurator()->SetColorCalibrationProfile( 519 Shell::GetInstance()->display_configurator()->SetColorCalibrationProfile(
515 display_id, profile)) { 520 display_id, profile)) {
516 display_info_[display_id].SetColorProfile(profile); 521 display_info_[display_id].SetColorProfile(profile);
517 UMA_HISTOGRAM_ENUMERATION("ChromeOS.Display.ColorProfile", profile, 522 UMA_HISTOGRAM_ENUMERATION("ChromeOS.Display.ColorProfile", profile,
518 ui::NUM_COLOR_PROFILES); 523 ui::NUM_COLOR_PROFILES);
519 } 524 }
520 if (delegate_) 525 if (delegate_)
521 delegate_->PostDisplayConfigurationChange(); 526 delegate_->PostDisplayConfigurationChange();
522 #endif 527 #endif
523 } 528 }
524 529
525 void DisplayManager::OnNativeDisplaysChanged( 530 void DisplayManager::OnNativeDisplaysChanged(
526 const std::vector<DisplayInfo>& updated_displays) { 531 const DisplayInfoList& updated_displays) {
527 if (updated_displays.empty()) { 532 if (updated_displays.empty()) {
528 VLOG(1) << "OnNativeDisplaysChanged(0): # of current displays=" 533 VLOG(1) << "OnNativeDisplaysChanged(0): # of current displays="
529 << active_display_list_.size(); 534 << active_display_list_.size();
530 // If the device is booted without display, or chrome is started 535 // If the device is booted without display, or chrome is started
531 // without --ash-host-window-bounds on linux desktop, use the 536 // without --ash-host-window-bounds on linux desktop, use the
532 // default display. 537 // default display.
533 if (active_display_list_.empty()) { 538 if (active_display_list_.empty()) {
534 std::vector<DisplayInfo> init_displays; 539 DisplayInfoList init_displays;
535 init_displays.push_back(DisplayInfo::CreateFromSpec(std::string())); 540 init_displays.push_back(
541 display::ManagedDisplayInfo::CreateFromSpec(std::string()));
536 MaybeInitInternalDisplay(&init_displays[0]); 542 MaybeInitInternalDisplay(&init_displays[0]);
537 OnNativeDisplaysChanged(init_displays); 543 OnNativeDisplaysChanged(init_displays);
538 } else { 544 } else {
539 // Otherwise don't update the displays when all displays are disconnected. 545 // Otherwise don't update the displays when all displays are disconnected.
540 // This happens when: 546 // This happens when:
541 // - the device is idle and powerd requested to turn off all displays. 547 // - the device is idle and powerd requested to turn off all displays.
542 // - the device is suspended. (kernel turns off all displays) 548 // - the device is suspended. (kernel turns off all displays)
543 // - the internal display's brightness is set to 0 and no external 549 // - the internal display's brightness is set to 0 and no external
544 // display is connected. 550 // display is connected.
545 // - the internal display's brightness is 0 and external display is 551 // - the internal display's brightness is 0 and external display is
(...skipping 27 matching lines...) Expand all
573 // Mirrored monitors have the same origins. 579 // Mirrored monitors have the same origins.
574 gfx::Point origin = iter->bounds_in_native().origin(); 580 gfx::Point origin = iter->bounds_in_native().origin();
575 if (origins.find(origin) != origins.end()) { 581 if (origins.find(origin) != origins.end()) {
576 InsertAndUpdateDisplayInfo(*iter); 582 InsertAndUpdateDisplayInfo(*iter);
577 mirroring_display_id_ = iter->id(); 583 mirroring_display_id_ = iter->id();
578 } else { 584 } else {
579 origins.insert(origin); 585 origins.insert(origin);
580 new_display_info_list.push_back(*iter); 586 new_display_info_list.push_back(*iter);
581 } 587 }
582 588
583 scoped_refptr<ManagedDisplayMode> new_mode(new ManagedDisplayMode( 589 scoped_refptr<display::ManagedDisplayMode> new_mode(
584 iter->bounds_in_native().size(), 0.0 /* refresh rate */, 590 new display::ManagedDisplayMode(
585 false /* interlaced */, false /* native */, iter->configured_ui_scale(), 591 iter->bounds_in_native().size(), 0.0 /* refresh rate */,
586 iter->device_scale_factor())); 592 false /* interlaced */, false /* native */,
587 const DisplayInfo::ManagedDisplayModeList& display_modes = 593 iter->configured_ui_scale(), iter->device_scale_factor()));
594 const display::ManagedDisplayInfo::ManagedDisplayModeList& display_modes =
588 iter->display_modes(); 595 iter->display_modes();
589 // This is empty the displays are initialized from InitFromCommandLine. 596 // This is empty the displays are initialized from InitFromCommandLine.
590 if (display_modes.empty()) 597 if (display_modes.empty())
591 continue; 598 continue;
592 auto display_modes_iter = FindDisplayMode(*iter, new_mode); 599 auto display_modes_iter = FindDisplayMode(*iter, new_mode);
593 // Update the actual resolution selected as the resolution request may fail. 600 // Update the actual resolution selected as the resolution request may fail.
594 if (display_modes_iter == display_modes.end()) 601 if (display_modes_iter == display_modes.end())
595 display_modes_.erase(iter->id()); 602 display_modes_.erase(iter->id());
596 else if (display_modes_.find(iter->id()) != display_modes_.end()) 603 else if (display_modes_.find(iter->id()) != display_modes_.end())
597 display_modes_[iter->id()] = *display_modes_iter; 604 display_modes_[iter->id()] = *display_modes_iter;
598 } 605 }
599 if (display::Display::HasInternalDisplay() && !internal_display_connected) { 606 if (display::Display::HasInternalDisplay() && !internal_display_connected) {
600 if (display_info_.find(display::Display::InternalDisplayId()) == 607 if (display_info_.find(display::Display::InternalDisplayId()) ==
601 display_info_.end()) { 608 display_info_.end()) {
602 // Create a dummy internal display if the chrome restarted 609 // Create a dummy internal display if the chrome restarted
603 // in docked mode. 610 // in docked mode.
604 DisplayInfo internal_display_info( 611 display::ManagedDisplayInfo internal_display_info(
605 display::Display::InternalDisplayId(), 612 display::Display::InternalDisplayId(),
606 l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME), 613 l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME),
607 false /*Internal display must not have overscan */); 614 false /*Internal display must not have overscan */);
608 internal_display_info.SetBounds(gfx::Rect(0, 0, 800, 600)); 615 internal_display_info.SetBounds(gfx::Rect(0, 0, 800, 600));
609 display_info_[display::Display::InternalDisplayId()] = 616 display_info_[display::Display::InternalDisplayId()] =
610 internal_display_info; 617 internal_display_info;
611 } else { 618 } else {
612 // Internal display is no longer active. Reset its rotation to user 619 // Internal display is no longer active. Reset its rotation to user
613 // preference, so that it is restored when the internal display becomes 620 // preference, so that it is restored when the internal display becomes
614 // active again. 621 // active again.
615 display::Display::Rotation user_rotation = 622 display::Display::Rotation user_rotation =
616 display_info_[display::Display::InternalDisplayId()].GetRotation( 623 display_info_[display::Display::InternalDisplayId()].GetRotation(
617 display::Display::ROTATION_SOURCE_USER); 624 display::Display::ROTATION_SOURCE_USER);
618 display_info_[display::Display::InternalDisplayId()].SetRotation( 625 display_info_[display::Display::InternalDisplayId()].SetRotation(
619 user_rotation, display::Display::ROTATION_SOURCE_USER); 626 user_rotation, display::Display::ROTATION_SOURCE_USER);
620 } 627 }
621 } 628 }
622 629
623 #if defined(OS_CHROMEOS) 630 #if defined(OS_CHROMEOS)
624 if (!base::SysInfo::IsRunningOnChromeOS() && 631 if (!base::SysInfo::IsRunningOnChromeOS() &&
625 new_display_info_list.size() > 1) { 632 new_display_info_list.size() > 1) {
626 display::DisplayIdList list = GenerateDisplayIdList( 633 display::DisplayIdList list = GenerateDisplayIdList(
627 new_display_info_list.begin(), new_display_info_list.end(), 634 new_display_info_list.begin(), new_display_info_list.end(),
628 [](const DisplayInfo& info) { return info.id(); }); 635 [](const display::ManagedDisplayInfo& info) { return info.id(); });
629 636
630 const display::DisplayLayout& layout = 637 const display::DisplayLayout& layout =
631 layout_store_->GetRegisteredDisplayLayout(list); 638 layout_store_->GetRegisteredDisplayLayout(list);
632 // Mirror mode is set by DisplayConfigurator on the device. 639 // Mirror mode is set by DisplayConfigurator on the device.
633 // Emulate it when running on linux desktop. 640 // Emulate it when running on linux desktop.
634 if (layout.mirrored) 641 if (layout.mirrored)
635 SetMultiDisplayMode(MIRRORING); 642 SetMultiDisplayMode(MIRRORING);
636 } 643 }
637 #endif 644 #endif
638 645
639 UpdateDisplaysWith(new_display_info_list); 646 UpdateDisplaysWith(new_display_info_list);
640 } 647 }
641 648
642 void DisplayManager::UpdateDisplays() { 649 void DisplayManager::UpdateDisplays() {
643 DisplayInfoList display_info_list; 650 DisplayInfoList display_info_list;
644 for (const auto& display : active_display_list_) 651 for (const auto& display : active_display_list_)
645 display_info_list.push_back(GetDisplayInfo(display.id())); 652 display_info_list.push_back(GetDisplayInfo(display.id()));
646 AddMirrorDisplayInfoIfAny(&display_info_list); 653 AddMirrorDisplayInfoIfAny(&display_info_list);
647 UpdateDisplaysWith(display_info_list); 654 UpdateDisplaysWith(display_info_list);
648 } 655 }
649 656
650 void DisplayManager::UpdateDisplaysWith( 657 void DisplayManager::UpdateDisplaysWith(
651 const std::vector<DisplayInfo>& updated_display_info_list) { 658 const DisplayInfoList& updated_display_info_list) {
652 #if defined(OS_WIN) 659 #if defined(OS_WIN)
653 DCHECK_EQ(1u, updated_display_info_list.size()) 660 DCHECK_EQ(1u, updated_display_info_list.size())
654 << ": Multiple display test does not work on Windows bots. Please " 661 << ": Multiple display test does not work on Windows bots. Please "
655 "skip (don't disable) the test using SupportsMultipleDisplays()"; 662 "skip (don't disable) the test using SupportsMultipleDisplays()";
656 #endif 663 #endif
657 664
658 DisplayInfoList new_display_info_list = updated_display_info_list; 665 DisplayInfoList new_display_info_list = updated_display_info_list;
659 std::sort(active_display_list_.begin(), active_display_list_.end(), 666 std::sort(active_display_list_.begin(), active_display_list_.end(),
660 DisplaySortFunctor()); 667 DisplaySortFunctor());
661 std::sort(new_display_info_list.begin(), new_display_info_list.end(), 668 std::sort(new_display_info_list.begin(), new_display_info_list.end(),
662 DisplayInfoSortFunctor()); 669 DisplayInfoSortFunctor());
663 670
664 if (new_display_info_list.size() > 1) { 671 if (new_display_info_list.size() > 1) {
665 display::DisplayIdList list = GenerateDisplayIdList( 672 display::DisplayIdList list = GenerateDisplayIdList(
666 new_display_info_list.begin(), new_display_info_list.end(), 673 new_display_info_list.begin(), new_display_info_list.end(),
667 [](const DisplayInfo& info) { return info.id(); }); 674 [](const display::ManagedDisplayInfo& info) { return info.id(); });
668 const display::DisplayLayout& layout = 675 const display::DisplayLayout& layout =
669 layout_store_->GetRegisteredDisplayLayout(list); 676 layout_store_->GetRegisteredDisplayLayout(list);
670 current_default_multi_display_mode_ = 677 current_default_multi_display_mode_ =
671 (layout.default_unified && unified_desktop_enabled_) ? UNIFIED 678 (layout.default_unified && unified_desktop_enabled_) ? UNIFIED
672 : EXTENDED; 679 : EXTENDED;
673 } 680 }
674 681
675 if (multi_display_mode_ != MIRRORING) 682 if (multi_display_mode_ != MIRRORING)
676 multi_display_mode_ = current_default_multi_display_mode_; 683 multi_display_mode_ = current_default_multi_display_mode_;
677 684
(...skipping 22 matching lines...) Expand all
700 CreateDisplayFromDisplayInfoById(new_info_iter->id())); 707 CreateDisplayFromDisplayInfoById(new_info_iter->id()));
701 ++new_info_iter; 708 ++new_info_iter;
702 } else if (new_info_iter == new_display_info_list.end()) { 709 } else if (new_info_iter == new_display_info_list.end()) {
703 // more displays in current list. 710 // more displays in current list.
704 removed_displays.push_back(*curr_iter); 711 removed_displays.push_back(*curr_iter);
705 ++curr_iter; 712 ++curr_iter;
706 } else if (curr_iter->id() == new_info_iter->id()) { 713 } else if (curr_iter->id() == new_info_iter->id()) {
707 const display::Display& current_display = *curr_iter; 714 const display::Display& current_display = *curr_iter;
708 // Copy the info because |InsertAndUpdateDisplayInfo| updates the 715 // Copy the info because |InsertAndUpdateDisplayInfo| updates the
709 // instance. 716 // instance.
710 const DisplayInfo current_display_info = 717 const display::ManagedDisplayInfo current_display_info =
711 GetDisplayInfo(current_display.id()); 718 GetDisplayInfo(current_display.id());
712 InsertAndUpdateDisplayInfo(*new_info_iter); 719 InsertAndUpdateDisplayInfo(*new_info_iter);
713 display::Display new_display = 720 display::Display new_display =
714 CreateDisplayFromDisplayInfoById(new_info_iter->id()); 721 CreateDisplayFromDisplayInfoById(new_info_iter->id());
715 const DisplayInfo& new_display_info = GetDisplayInfo(new_display.id()); 722 const display::ManagedDisplayInfo& new_display_info =
723 GetDisplayInfo(new_display.id());
716 724
717 uint32_t metrics = display::DisplayObserver::DISPLAY_METRIC_NONE; 725 uint32_t metrics = display::DisplayObserver::DISPLAY_METRIC_NONE;
718 726
719 // At that point the new Display objects we have are not entirely updated, 727 // At that point the new Display objects we have are not entirely updated,
720 // they are missing the translation related to the Display disposition in 728 // they are missing the translation related to the Display disposition in
721 // the layout. 729 // the layout.
722 // Using display.bounds() and display.work_area() would fail most of the 730 // Using display.bounds() and display.work_area() would fail most of the
723 // time. 731 // time.
724 if (force_bounds_changed_ || (current_display_info.bounds_in_native() != 732 if (force_bounds_changed_ || (current_display_info.bounds_in_native() !=
725 new_display_info.bounds_in_native()) || 733 new_display_info.bounds_in_native()) ||
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
891 // info in hardware mirroring comes from DisplayConfigurator. 899 // info in hardware mirroring comes from DisplayConfigurator.
892 if (!IsInMirrorMode()) 900 if (!IsInMirrorMode())
893 ReconfigureDisplays(); 901 ReconfigureDisplays();
894 } 902 }
895 903
896 bool DisplayManager::IsInUnifiedMode() const { 904 bool DisplayManager::IsInUnifiedMode() const {
897 return multi_display_mode_ == UNIFIED && 905 return multi_display_mode_ == UNIFIED &&
898 !software_mirroring_display_list_.empty(); 906 !software_mirroring_display_list_.empty();
899 } 907 }
900 908
901 const DisplayInfo& DisplayManager::GetDisplayInfo(int64_t display_id) const { 909 const display::ManagedDisplayInfo& DisplayManager::GetDisplayInfo(
910 int64_t display_id) const {
902 DCHECK_NE(display::Display::kInvalidDisplayID, display_id); 911 DCHECK_NE(display::Display::kInvalidDisplayID, display_id);
903 912
904 std::map<int64_t, DisplayInfo>::const_iterator iter = 913 std::map<int64_t, display::ManagedDisplayInfo>::const_iterator iter =
905 display_info_.find(display_id); 914 display_info_.find(display_id);
906 CHECK(iter != display_info_.end()) << display_id; 915 CHECK(iter != display_info_.end()) << display_id;
907 return iter->second; 916 return iter->second;
908 } 917 }
909 918
910 const display::Display DisplayManager::GetMirroringDisplayById( 919 const display::Display DisplayManager::GetMirroringDisplayById(
911 int64_t display_id) const { 920 int64_t display_id) const {
912 auto iter = std::find_if(software_mirroring_display_list_.begin(), 921 auto iter = std::find_if(software_mirroring_display_list_.begin(),
913 software_mirroring_display_list_.end(), 922 software_mirroring_display_list_.end(),
914 [display_id](const display::Display& display) { 923 [display_id](const display::Display& display) {
915 return display.id() == display_id; 924 return display.id() == display_id;
916 }); 925 });
917 return iter == software_mirroring_display_list_.end() ? display::Display() 926 return iter == software_mirroring_display_list_.end() ? display::Display()
918 : *iter; 927 : *iter;
919 } 928 }
920 929
921 std::string DisplayManager::GetDisplayNameForId(int64_t id) { 930 std::string DisplayManager::GetDisplayNameForId(int64_t id) {
922 if (id == display::Display::kInvalidDisplayID) 931 if (id == display::Display::kInvalidDisplayID)
923 return l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME); 932 return l10n_util::GetStringUTF8(IDS_ASH_STATUS_TRAY_UNKNOWN_DISPLAY_NAME);
924 933
925 std::map<int64_t, DisplayInfo>::const_iterator iter = display_info_.find(id); 934 std::map<int64_t, display::ManagedDisplayInfo>::const_iterator iter =
935 display_info_.find(id);
926 if (iter != display_info_.end() && !iter->second.name().empty()) 936 if (iter != display_info_.end() && !iter->second.name().empty())
927 return iter->second.name(); 937 return iter->second.name();
928 938
929 return base::StringPrintf("Display %d", static_cast<int>(id)); 939 return base::StringPrintf("Display %d", static_cast<int>(id));
930 } 940 }
931 941
932 int64_t DisplayManager::GetDisplayIdForUIScaling() const { 942 int64_t DisplayManager::GetDisplayIdForUIScaling() const {
933 // UI Scaling is effective on internal display. 943 // UI Scaling is effective on internal display.
934 return display::Display::HasInternalDisplay() 944 return display::Display::HasInternalDisplay()
935 ? display::Display::InternalDisplayId() 945 ? display::Display::InternalDisplayId()
(...skipping 14 matching lines...) Expand all
950 return; 960 return;
951 } 961 }
952 #endif 962 #endif
953 multi_display_mode_ = 963 multi_display_mode_ =
954 mirror ? MIRRORING : current_default_multi_display_mode_; 964 mirror ? MIRRORING : current_default_multi_display_mode_;
955 ReconfigureDisplays(); 965 ReconfigureDisplays();
956 } 966 }
957 967
958 void DisplayManager::AddRemoveDisplay() { 968 void DisplayManager::AddRemoveDisplay() {
959 DCHECK(!active_display_list_.empty()); 969 DCHECK(!active_display_list_.empty());
960 std::vector<DisplayInfo> new_display_info_list; 970 DisplayInfoList new_display_info_list;
961 const DisplayInfo& first_display = 971 const display::ManagedDisplayInfo& first_display =
962 IsInUnifiedMode() 972 IsInUnifiedMode()
963 ? GetDisplayInfo(software_mirroring_display_list_[0].id()) 973 ? GetDisplayInfo(software_mirroring_display_list_[0].id())
964 : GetDisplayInfo(active_display_list_[0].id()); 974 : GetDisplayInfo(active_display_list_[0].id());
965 new_display_info_list.push_back(first_display); 975 new_display_info_list.push_back(first_display);
966 // Add if there is only one display connected. 976 // Add if there is only one display connected.
967 if (num_connected_displays() == 1) { 977 if (num_connected_displays() == 1) {
968 const int kVerticalOffsetPx = 100; 978 const int kVerticalOffsetPx = 100;
969 // Layout the 2nd display below the primary as with the real device. 979 // Layout the 2nd display below the primary as with the real device.
970 gfx::Rect host_bounds = first_display.bounds_in_native(); 980 gfx::Rect host_bounds = first_display.bounds_in_native();
971 new_display_info_list.push_back( 981 new_display_info_list.push_back(
972 DisplayInfo::CreateFromSpec(base::StringPrintf( 982 display::ManagedDisplayInfo::CreateFromSpec(base::StringPrintf(
973 "%d+%d-600x%d", host_bounds.x(), 983 "%d+%d-600x%d", host_bounds.x(),
974 host_bounds.bottom() + kVerticalOffsetPx, host_bounds.height()))); 984 host_bounds.bottom() + kVerticalOffsetPx, host_bounds.height())));
975 } 985 }
976 num_connected_displays_ = new_display_info_list.size(); 986 num_connected_displays_ = new_display_info_list.size();
977 mirroring_display_id_ = display::Display::kInvalidDisplayID; 987 mirroring_display_id_ = display::Display::kInvalidDisplayID;
978 software_mirroring_display_list_.clear(); 988 software_mirroring_display_list_.clear();
979 UpdateDisplaysWith(new_display_info_list); 989 UpdateDisplaysWith(new_display_info_list);
980 } 990 }
981 991
982 void DisplayManager::ToggleDisplayScaleFactor() { 992 void DisplayManager::ToggleDisplayScaleFactor() {
983 DCHECK(!active_display_list_.empty()); 993 DCHECK(!active_display_list_.empty());
984 std::vector<DisplayInfo> new_display_info_list; 994 DisplayInfoList new_display_info_list;
985 for (display::DisplayList::const_iterator iter = active_display_list_.begin(); 995 for (display::DisplayList::const_iterator iter = active_display_list_.begin();
986 iter != active_display_list_.end(); ++iter) { 996 iter != active_display_list_.end(); ++iter) {
987 DisplayInfo display_info = GetDisplayInfo(iter->id()); 997 display::ManagedDisplayInfo display_info = GetDisplayInfo(iter->id());
988 display_info.set_device_scale_factor( 998 display_info.set_device_scale_factor(
989 display_info.device_scale_factor() == 1.0f ? 2.0f : 1.0f); 999 display_info.device_scale_factor() == 1.0f ? 2.0f : 1.0f);
990 new_display_info_list.push_back(display_info); 1000 new_display_info_list.push_back(display_info);
991 } 1001 }
992 AddMirrorDisplayInfoIfAny(&new_display_info_list); 1002 AddMirrorDisplayInfoIfAny(&new_display_info_list);
993 UpdateDisplaysWith(new_display_info_list); 1003 UpdateDisplaysWith(new_display_info_list);
994 } 1004 }
995 1005
996 #if defined(OS_CHROMEOS) 1006 #if defined(OS_CHROMEOS)
997 void DisplayManager::SetSoftwareMirroring(bool enabled) { 1007 void DisplayManager::SetSoftwareMirroring(bool enabled) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 void DisplayManager::CreateScreenForShutdown() const { 1084 void DisplayManager::CreateScreenForShutdown() const {
1075 delete screen_for_shutdown; 1085 delete screen_for_shutdown;
1076 screen_for_shutdown = screen_->CloneForShutdown(); 1086 screen_for_shutdown = screen_->CloneForShutdown();
1077 display::Screen::SetScreenInstance(screen_for_shutdown); 1087 display::Screen::SetScreenInstance(screen_for_shutdown);
1078 } 1088 }
1079 1089
1080 void DisplayManager::UpdateInternalManagedDisplayModeListForTest() { 1090 void DisplayManager::UpdateInternalManagedDisplayModeListForTest() {
1081 if (!display::Display::HasInternalDisplay() || 1091 if (!display::Display::HasInternalDisplay() ||
1082 display_info_.count(display::Display::InternalDisplayId()) == 0) 1092 display_info_.count(display::Display::InternalDisplayId()) == 0)
1083 return; 1093 return;
1084 DisplayInfo* info = &display_info_[display::Display::InternalDisplayId()]; 1094 display::ManagedDisplayInfo* info =
1095 &display_info_[display::Display::InternalDisplayId()];
1085 SetInternalManagedDisplayModeList(info); 1096 SetInternalManagedDisplayModeList(info);
1086 } 1097 }
1087 1098
1088 void DisplayManager::CreateSoftwareMirroringDisplayInfo( 1099 void DisplayManager::CreateSoftwareMirroringDisplayInfo(
1089 DisplayInfoList* display_info_list) { 1100 DisplayInfoList* display_info_list) {
1090 // Use the internal display or 1st as the mirror source, then scale 1101 // Use the internal display or 1st as the mirror source, then scale
1091 // the root window so that it matches the external display's 1102 // the root window so that it matches the external display's
1092 // resolution. This is necessary in order for scaling to work while 1103 // resolution. This is necessary in order for scaling to work while
1093 // mirrored. 1104 // mirrored.
1094 switch (multi_display_mode_) { 1105 switch (multi_display_mode_) {
1095 case MIRRORING: { 1106 case MIRRORING: {
1096 if (display_info_list->size() != 2) 1107 if (display_info_list->size() != 2)
1097 return; 1108 return;
1098 bool zero_is_source = 1109 bool zero_is_source =
1099 first_display_id_ == (*display_info_list)[0].id() || 1110 first_display_id_ == (*display_info_list)[0].id() ||
1100 display::Display::IsInternalDisplayId((*display_info_list)[0].id()); 1111 display::Display::IsInternalDisplayId((*display_info_list)[0].id());
1101 DCHECK_EQ(MIRRORING, multi_display_mode_); 1112 DCHECK_EQ(MIRRORING, multi_display_mode_);
1102 mirroring_display_id_ = (*display_info_list)[zero_is_source ? 1 : 0].id(); 1113 mirroring_display_id_ = (*display_info_list)[zero_is_source ? 1 : 0].id();
1103 1114
1104 int64_t display_id = mirroring_display_id_; 1115 int64_t display_id = mirroring_display_id_;
1105 auto iter = 1116 auto iter =
1106 std::find_if(display_info_list->begin(), display_info_list->end(), 1117 std::find_if(display_info_list->begin(), display_info_list->end(),
1107 [display_id](const DisplayInfo& info) { 1118 [display_id](const display::ManagedDisplayInfo& info) {
1108 return info.id() == display_id; 1119 return info.id() == display_id;
1109 }); 1120 });
1110 DCHECK(iter != display_info_list->end()); 1121 DCHECK(iter != display_info_list->end());
1111 1122
1112 DisplayInfo info = *iter; 1123 display::ManagedDisplayInfo info = *iter;
1113 info.SetOverscanInsets(gfx::Insets()); 1124 info.SetOverscanInsets(gfx::Insets());
1114 InsertAndUpdateDisplayInfo(info); 1125 InsertAndUpdateDisplayInfo(info);
1115 software_mirroring_display_list_.push_back( 1126 software_mirroring_display_list_.push_back(
1116 CreateMirroringDisplayFromDisplayInfoById(mirroring_display_id_, 1127 CreateMirroringDisplayFromDisplayInfoById(mirroring_display_id_,
1117 gfx::Point(), 1.0f)); 1128 gfx::Point(), 1.0f));
1118 display_info_list->erase(iter); 1129 display_info_list->erase(iter);
1119 break; 1130 break;
1120 } 1131 }
1121 case UNIFIED: { 1132 case UNIFIED: {
1122 if (display_info_list->size() == 1) 1133 if (display_info_list->size() == 1)
(...skipping 10 matching lines...) Expand all
1133 float default_device_scale_factor = 1.0f; 1144 float default_device_scale_factor = 1.0f;
1134 for (auto& info : *display_info_list) { 1145 for (auto& info : *display_info_list) {
1135 max_height = std::max(max_height, info.size_in_pixel().height()); 1146 max_height = std::max(max_height, info.size_in_pixel().height());
1136 if (!default_height || 1147 if (!default_height ||
1137 display::Display::IsInternalDisplayId(info.id())) { 1148 display::Display::IsInternalDisplayId(info.id())) {
1138 default_height = info.size_in_pixel().height(); 1149 default_height = info.size_in_pixel().height();
1139 default_device_scale_factor = info.device_scale_factor(); 1150 default_device_scale_factor = info.device_scale_factor();
1140 } 1151 }
1141 } 1152 }
1142 1153
1143 DisplayInfo::ManagedDisplayModeList display_mode_list; 1154 display::ManagedDisplayInfo::ManagedDisplayModeList display_mode_list;
1144 std::set<std::pair<float, float>> dsf_scale_list; 1155 std::set<std::pair<float, float>> dsf_scale_list;
1145 1156
1146 // 2nd Pass. Compute the unified display size. 1157 // 2nd Pass. Compute the unified display size.
1147 for (auto& info : *display_info_list) { 1158 for (auto& info : *display_info_list) {
1148 InsertAndUpdateDisplayInfo(info); 1159 InsertAndUpdateDisplayInfo(info);
1149 gfx::Point origin(unified_bounds.right(), 0); 1160 gfx::Point origin(unified_bounds.right(), 0);
1150 float scale = 1161 float scale =
1151 info.size_in_pixel().height() / static_cast<float>(max_height); 1162 info.size_in_pixel().height() / static_cast<float>(max_height);
1152 // The display is scaled to fit the unified desktop size. 1163 // The display is scaled to fit the unified desktop size.
1153 display::Display display = CreateMirroringDisplayFromDisplayInfoById( 1164 display::Display display = CreateMirroringDisplayFromDisplayInfoById(
1154 info.id(), origin, 1.0f / scale); 1165 info.id(), origin, 1.0f / scale);
1155 unified_bounds.Union(display.bounds()); 1166 unified_bounds.Union(display.bounds());
1156 1167
1157 dsf_scale_list.insert( 1168 dsf_scale_list.insert(
1158 std::make_pair(info.device_scale_factor(), scale)); 1169 std::make_pair(info.device_scale_factor(), scale));
1159 } 1170 }
1160 1171
1161 DisplayInfo info(kUnifiedDisplayId, "Unified Desktop", false); 1172 display::ManagedDisplayInfo info(kUnifiedDisplayId, "Unified Desktop",
1173 false);
1162 1174
1163 scoped_refptr<ManagedDisplayMode> native_mode(new ManagedDisplayMode( 1175 scoped_refptr<display::ManagedDisplayMode> native_mode(
1164 unified_bounds.size(), 60.0f, false, true, 1.0, 1.0)); 1176 new display::ManagedDisplayMode(unified_bounds.size(), 60.0f, false,
1165 DisplayInfo::ManagedDisplayModeList modes = 1177 true, 1.0, 1.0));
1178 display::ManagedDisplayInfo::ManagedDisplayModeList modes =
1166 CreateUnifiedManagedDisplayModeList(native_mode, dsf_scale_list); 1179 CreateUnifiedManagedDisplayModeList(native_mode, dsf_scale_list);
1167 1180
1168 // Find the default mode. 1181 // Find the default mode.
1169 auto iter = std::find_if( 1182 auto iter = std::find_if(
1170 modes.begin(), modes.end(), 1183 modes.begin(), modes.end(),
1171 [default_height, default_device_scale_factor]( 1184 [default_height, default_device_scale_factor](
1172 const scoped_refptr<ManagedDisplayMode>& mode) { 1185 const scoped_refptr<display::ManagedDisplayMode>& mode) {
1173 return mode->size().height() == default_height && 1186 return mode->size().height() == default_height &&
1174 mode->device_scale_factor() == default_device_scale_factor; 1187 mode->device_scale_factor() == default_device_scale_factor;
1175 }); 1188 });
1176 1189
1177 scoped_refptr<ManagedDisplayMode> dm(*iter); 1190 scoped_refptr<display::ManagedDisplayMode> dm(*iter);
1178 *iter = make_scoped_refptr(new ManagedDisplayMode( 1191 *iter = make_scoped_refptr(new display::ManagedDisplayMode(
1179 dm->size(), dm->refresh_rate(), dm->is_interlaced(), 1192 dm->size(), dm->refresh_rate(), dm->is_interlaced(),
1180 true /* native */, dm->ui_scale(), dm->device_scale_factor())); 1193 true /* native */, dm->ui_scale(), dm->device_scale_factor()));
1181 1194
1182 info.SetManagedDisplayModes(modes); 1195 info.SetManagedDisplayModes(modes);
1183 info.set_device_scale_factor(dm->device_scale_factor()); 1196 info.set_device_scale_factor(dm->device_scale_factor());
1184 info.SetBounds(gfx::Rect(dm->size())); 1197 info.SetBounds(gfx::Rect(dm->size()));
1185 1198
1186 // Forget the configured resolution if the original unified 1199 // Forget the configured resolution if the original unified
1187 // desktop resolution has changed. 1200 // desktop resolution has changed.
1188 if (display_info_.count(kUnifiedDisplayId) != 0 && 1201 if (display_info_.count(kUnifiedDisplayId) != 0 &&
1189 GetMaxNativeSize(display_info_[kUnifiedDisplayId]) != 1202 GetMaxNativeSize(display_info_[kUnifiedDisplayId]) !=
1190 unified_bounds.size()) { 1203 unified_bounds.size()) {
1191 display_modes_.erase(kUnifiedDisplayId); 1204 display_modes_.erase(kUnifiedDisplayId);
1192 } 1205 }
1193 1206
1194 // 3rd Pass. Set the selected mode, then recompute the mirroring 1207 // 3rd Pass. Set the selected mode, then recompute the mirroring
1195 // display size. 1208 // display size.
1196 scoped_refptr<ManagedDisplayMode> mode = 1209 scoped_refptr<display::ManagedDisplayMode> mode =
1197 GetSelectedModeForDisplayId(kUnifiedDisplayId); 1210 GetSelectedModeForDisplayId(kUnifiedDisplayId);
1198 if (mode && FindDisplayMode(info, mode) != info.display_modes().end()) { 1211 if (mode && FindDisplayMode(info, mode) != info.display_modes().end()) {
1199 info.set_device_scale_factor(mode->device_scale_factor()); 1212 info.set_device_scale_factor(mode->device_scale_factor());
1200 info.SetBounds(gfx::Rect(mode->size())); 1213 info.SetBounds(gfx::Rect(mode->size()));
1201 } else { 1214 } else {
1202 display_modes_.erase(kUnifiedDisplayId); 1215 display_modes_.erase(kUnifiedDisplayId);
1203 } 1216 }
1204 1217
1205 int unified_display_height = info.size_in_pixel().height(); 1218 int unified_display_height = info.size_in_pixel().height();
1206 gfx::Point origin; 1219 gfx::Point origin;
(...skipping 24 matching lines...) Expand all
1231 if (iter != active_display_list_.end()) 1244 if (iter != active_display_list_.end())
1232 return &(*iter); 1245 return &(*iter);
1233 // TODO(oshima): This happens when windows in unified desktop have 1246 // TODO(oshima): This happens when windows in unified desktop have
1234 // been moved to a normal window. Fix this. 1247 // been moved to a normal window. Fix this.
1235 if (id != kUnifiedDisplayId) 1248 if (id != kUnifiedDisplayId)
1236 DLOG(WARNING) << "Could not find display:" << id; 1249 DLOG(WARNING) << "Could not find display:" << id;
1237 return nullptr; 1250 return nullptr;
1238 } 1251 }
1239 1252
1240 void DisplayManager::AddMirrorDisplayInfoIfAny( 1253 void DisplayManager::AddMirrorDisplayInfoIfAny(
1241 std::vector<DisplayInfo>* display_info_list) { 1254 DisplayInfoList* display_info_list) {
1242 if (software_mirroring_enabled() && IsInMirrorMode()) { 1255 if (software_mirroring_enabled() && IsInMirrorMode()) {
1243 display_info_list->push_back(GetDisplayInfo(mirroring_display_id_)); 1256 display_info_list->push_back(GetDisplayInfo(mirroring_display_id_));
1244 software_mirroring_display_list_.clear(); 1257 software_mirroring_display_list_.clear();
1245 } 1258 }
1246 } 1259 }
1247 1260
1248 void DisplayManager::InsertAndUpdateDisplayInfo(const DisplayInfo& new_info) { 1261 void DisplayManager::InsertAndUpdateDisplayInfo(
1249 std::map<int64_t, DisplayInfo>::iterator info = 1262 const display::ManagedDisplayInfo& new_info) {
1263 std::map<int64_t, display::ManagedDisplayInfo>::iterator info =
1250 display_info_.find(new_info.id()); 1264 display_info_.find(new_info.id());
1251 if (info != display_info_.end()) { 1265 if (info != display_info_.end()) {
1252 info->second.Copy(new_info); 1266 info->second.Copy(new_info);
1253 } else { 1267 } else {
1254 display_info_[new_info.id()] = new_info; 1268 display_info_[new_info.id()] = new_info;
1255 display_info_[new_info.id()].set_native(false); 1269 display_info_[new_info.id()].set_native(false);
1256 // FHD with 1.25 DSF behaves differently from other configuration. 1270 // FHD with 1.25 DSF behaves differently from other configuration.
1257 // It uses 1.25 DSF only when UI-Scale is set to 0.8. 1271 // It uses 1.25 DSF only when UI-Scale is set to 0.8.
1258 // For new users, use the UI-scale to 0.8 so that it will use DSF=1.25 1272 // For new users, use the UI-scale to 0.8 so that it will use DSF=1.25
1259 // internally. 1273 // internally.
1260 if (display::Display::IsInternalDisplayId(new_info.id()) && 1274 if (display::Display::IsInternalDisplayId(new_info.id()) &&
1261 new_info.bounds_in_native().height() == 1080 && 1275 new_info.bounds_in_native().height() == 1080 &&
1262 new_info.device_scale_factor() == 1.25f) { 1276 new_info.device_scale_factor() == 1.25f) {
1263 display_info_[new_info.id()].set_configured_ui_scale(0.8f); 1277 display_info_[new_info.id()].set_configured_ui_scale(0.8f);
1264 } 1278 }
1265 } 1279 }
1266 display_info_[new_info.id()].UpdateDisplaySize(); 1280 display_info_[new_info.id()].UpdateDisplaySize();
1267 OnDisplayInfoUpdated(display_info_[new_info.id()]); 1281 OnDisplayInfoUpdated(display_info_[new_info.id()]);
1268 } 1282 }
1269 1283
1270 void DisplayManager::OnDisplayInfoUpdated(const DisplayInfo& display_info) { 1284 void DisplayManager::OnDisplayInfoUpdated(
1285 const display::ManagedDisplayInfo& display_info) {
1271 #if defined(OS_CHROMEOS) 1286 #if defined(OS_CHROMEOS)
1272 ui::ColorCalibrationProfile color_profile = display_info.color_profile(); 1287 ui::ColorCalibrationProfile color_profile = display_info.color_profile();
1273 if (color_profile != ui::COLOR_PROFILE_STANDARD) { 1288 if (color_profile != ui::COLOR_PROFILE_STANDARD) {
1274 Shell::GetInstance()->display_configurator()->SetColorCalibrationProfile( 1289 Shell::GetInstance()->display_configurator()->SetColorCalibrationProfile(
1275 display_info.id(), color_profile); 1290 display_info.id(), color_profile);
1276 } 1291 }
1277 #endif 1292 #endif
1278 } 1293 }
1279 1294
1280 display::Display DisplayManager::CreateDisplayFromDisplayInfoById(int64_t id) { 1295 display::Display DisplayManager::CreateDisplayFromDisplayInfoById(int64_t id) {
1281 DCHECK(display_info_.find(id) != display_info_.end()) << "id=" << id; 1296 DCHECK(display_info_.find(id) != display_info_.end()) << "id=" << id;
1282 const DisplayInfo& display_info = display_info_[id]; 1297 const display::ManagedDisplayInfo& display_info = display_info_[id];
1283 1298
1284 display::Display new_display(display_info.id()); 1299 display::Display new_display(display_info.id());
1285 gfx::Rect bounds_in_native(display_info.size_in_pixel()); 1300 gfx::Rect bounds_in_native(display_info.size_in_pixel());
1286 float device_scale_factor = display_info.GetEffectiveDeviceScaleFactor(); 1301 float device_scale_factor = display_info.GetEffectiveDeviceScaleFactor();
1287 1302
1288 // Simply set the origin to (0,0). The primary display's origin is 1303 // Simply set the origin to (0,0). The primary display's origin is
1289 // always (0,0) and the bounds of non-primary display(s) will be updated 1304 // always (0,0) and the bounds of non-primary display(s) will be updated
1290 // in |UpdateNonPrimaryDisplayBoundsForLayout| called in |UpdateDisplay|. 1305 // in |UpdateNonPrimaryDisplayBoundsForLayout| called in |UpdateDisplay|.
1291 new_display.SetScaleAndBounds(device_scale_factor, 1306 new_display.SetScaleAndBounds(device_scale_factor,
1292 gfx::Rect(bounds_in_native.size())); 1307 gfx::Rect(bounds_in_native.size()));
1293 new_display.set_rotation(display_info.GetActiveRotation()); 1308 new_display.set_rotation(display_info.GetActiveRotation());
1294 new_display.set_touch_support(display_info.touch_support()); 1309 new_display.set_touch_support(display_info.touch_support());
1295 new_display.set_maximum_cursor_size(display_info.maximum_cursor_size()); 1310 new_display.set_maximum_cursor_size(display_info.maximum_cursor_size());
1296 return new_display; 1311 return new_display;
1297 } 1312 }
1298 1313
1299 display::Display DisplayManager::CreateMirroringDisplayFromDisplayInfoById( 1314 display::Display DisplayManager::CreateMirroringDisplayFromDisplayInfoById(
1300 int64_t id, 1315 int64_t id,
1301 const gfx::Point& origin, 1316 const gfx::Point& origin,
1302 float scale) { 1317 float scale) {
1303 DCHECK(display_info_.find(id) != display_info_.end()) << "id=" << id; 1318 DCHECK(display_info_.find(id) != display_info_.end()) << "id=" << id;
1304 const DisplayInfo& display_info = display_info_[id]; 1319 const display::ManagedDisplayInfo& display_info = display_info_[id];
1305 1320
1306 display::Display new_display(display_info.id()); 1321 display::Display new_display(display_info.id());
1307 new_display.SetScaleAndBounds( 1322 new_display.SetScaleAndBounds(
1308 1.0f, gfx::Rect(origin, gfx::ScaleToFlooredSize( 1323 1.0f, gfx::Rect(origin, gfx::ScaleToFlooredSize(
1309 display_info.size_in_pixel(), scale))); 1324 display_info.size_in_pixel(), scale)));
1310 new_display.set_touch_support(display_info.touch_support()); 1325 new_display.set_touch_support(display_info.touch_support());
1311 new_display.set_maximum_cursor_size(display_info.maximum_cursor_size()); 1326 new_display.set_maximum_cursor_size(display_info.maximum_cursor_size());
1312 return new_display; 1327 return new_display;
1313 } 1328 }
1314 1329
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 layout.ApplyToDisplayList(display_list, updated_ids, 1370 layout.ApplyToDisplayList(display_list, updated_ids,
1356 kMinimumOverlapForInvalidOffset); 1371 kMinimumOverlapForInvalidOffset);
1357 } 1372 }
1358 1373
1359 void DisplayManager::RunPendingTasksForTest() { 1374 void DisplayManager::RunPendingTasksForTest() {
1360 if (!software_mirroring_display_list_.empty()) 1375 if (!software_mirroring_display_list_.empty())
1361 base::RunLoop().RunUntilIdle(); 1376 base::RunLoop().RunUntilIdle();
1362 } 1377 }
1363 1378
1364 } // namespace ash 1379 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/display_manager.h ('k') | ash/display/display_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698