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

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

Issue 2476663003: PlatformScreenOzone using DisplayManager (Closed)
Patch Set: Add missing data_dep. Created 3 years, 12 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 | « ui/display/manager/display_manager.h ('k') | no next file » | 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 "ui/display/manager/display_manager.h" 5 #include "ui/display/manager/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>
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 using std::vector; 129 using std::vector;
130 130
131 // static 131 // static
132 int64_t DisplayManager::kUnifiedDisplayId = -10; 132 int64_t DisplayManager::kUnifiedDisplayId = -10;
133 133
134 DisplayManager::DisplayManager(std::unique_ptr<Screen> screen) 134 DisplayManager::DisplayManager(std::unique_ptr<Screen> screen)
135 : screen_(std::move(screen)), 135 : screen_(std::move(screen)),
136 layout_store_(new DisplayLayoutStore), 136 layout_store_(new DisplayLayoutStore),
137 weak_ptr_factory_(this) { 137 weak_ptr_factory_(this) {
138 #if defined(OS_CHROMEOS) 138 #if defined(OS_CHROMEOS)
139 change_display_upon_host_resize_ = !base::SysInfo::IsRunningOnChromeOS(); 139 configure_displays_ = base::SysInfo::IsRunningOnChromeOS();
140 change_display_upon_host_resize_ = !configure_displays_;
140 unified_desktop_enabled_ = base::CommandLine::ForCurrentProcess()->HasSwitch( 141 unified_desktop_enabled_ = base::CommandLine::ForCurrentProcess()->HasSwitch(
141 ::switches::kEnableUnifiedDesktop); 142 ::switches::kEnableUnifiedDesktop);
142 #endif 143 #endif
143 } 144 }
144 145
145 DisplayManager::~DisplayManager() { 146 DisplayManager::~DisplayManager() {
146 #if defined(OS_CHROMEOS) 147 #if defined(OS_CHROMEOS)
147 // Reset the font params. 148 // Reset the font params.
148 gfx::SetFontRenderParamsDeviceScaleFactor(1.0f); 149 gfx::SetFontRenderParamsDeviceScaleFactor(1.0f);
149 #endif 150 #endif
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 } 374 }
374 display_info_list.push_back(info); 375 display_info_list.push_back(info);
375 } 376 }
376 if (display_property_changed) { 377 if (display_property_changed) {
377 AddMirrorDisplayInfoIfAny(&display_info_list); 378 AddMirrorDisplayInfoIfAny(&display_info_list);
378 UpdateDisplaysWith(display_info_list); 379 UpdateDisplaysWith(display_info_list);
379 } 380 }
380 if (resolution_changed && IsInUnifiedMode()) { 381 if (resolution_changed && IsInUnifiedMode()) {
381 ReconfigureDisplays(); 382 ReconfigureDisplays();
382 #if defined(OS_CHROMEOS) 383 #if defined(OS_CHROMEOS)
383 } else if (resolution_changed && base::SysInfo::IsRunningOnChromeOS()) { 384 } else if (resolution_changed && configure_displays_) {
384 delegate_->display_configurator()->OnConfigurationChanged(); 385 delegate_->display_configurator()->OnConfigurationChanged();
385 #endif 386 #endif
386 } 387 }
387 return resolution_changed || display_property_changed; 388 return resolution_changed || display_property_changed;
388 } 389 }
389 390
390 void DisplayManager::RegisterDisplayProperty( 391 void DisplayManager::RegisterDisplayProperty(
391 int64_t display_id, 392 int64_t display_id,
392 Display::Rotation rotation, 393 Display::Rotation rotation,
393 float ui_scale, 394 float ui_scale,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 void DisplayManager::SetColorCalibrationProfile( 488 void DisplayManager::SetColorCalibrationProfile(
488 int64_t display_id, 489 int64_t display_id,
489 ui::ColorCalibrationProfile profile) { 490 ui::ColorCalibrationProfile profile) {
490 #if defined(OS_CHROMEOS) 491 #if defined(OS_CHROMEOS)
491 if (!display_info_[display_id].IsColorProfileAvailable(profile)) 492 if (!display_info_[display_id].IsColorProfileAvailable(profile))
492 return; 493 return;
493 494
494 if (delegate_) 495 if (delegate_)
495 delegate_->PreDisplayConfigurationChange(false); 496 delegate_->PreDisplayConfigurationChange(false);
496 // Just sets color profile if it's not running on ChromeOS (like tests). 497 // Just sets color profile if it's not running on ChromeOS (like tests).
497 if (!base::SysInfo::IsRunningOnChromeOS() || 498 if (!configure_displays_ ||
498 delegate_->display_configurator()->SetColorCalibrationProfile(display_id, 499 delegate_->display_configurator()->SetColorCalibrationProfile(display_id,
499 profile)) { 500 profile)) {
500 display_info_[display_id].SetColorProfile(profile); 501 display_info_[display_id].SetColorProfile(profile);
501 UMA_HISTOGRAM_ENUMERATION("ChromeOS.Display.ColorProfile", profile, 502 UMA_HISTOGRAM_ENUMERATION("ChromeOS.Display.ColorProfile", profile,
502 ui::NUM_COLOR_PROFILES); 503 ui::NUM_COLOR_PROFILES);
503 } 504 }
504 if (delegate_) 505 if (delegate_)
505 delegate_->PostDisplayConfigurationChange(false); 506 delegate_->PostDisplayConfigurationChange(false);
506 #endif 507 #endif
507 } 508 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 // active again. 598 // active again.
598 Display::Rotation user_rotation = 599 Display::Rotation user_rotation =
599 display_info_[Display::InternalDisplayId()].GetRotation( 600 display_info_[Display::InternalDisplayId()].GetRotation(
600 Display::ROTATION_SOURCE_USER); 601 Display::ROTATION_SOURCE_USER);
601 display_info_[Display::InternalDisplayId()].SetRotation( 602 display_info_[Display::InternalDisplayId()].SetRotation(
602 user_rotation, Display::ROTATION_SOURCE_USER); 603 user_rotation, Display::ROTATION_SOURCE_USER);
603 } 604 }
604 } 605 }
605 606
606 #if defined(OS_CHROMEOS) 607 #if defined(OS_CHROMEOS)
607 if (!base::SysInfo::IsRunningOnChromeOS() && 608 if (!configure_displays_ && new_display_info_list.size() > 1) {
608 new_display_info_list.size() > 1) {
609 DisplayIdList list = GenerateDisplayIdList( 609 DisplayIdList list = GenerateDisplayIdList(
610 new_display_info_list.begin(), new_display_info_list.end(), 610 new_display_info_list.begin(), new_display_info_list.end(),
611 [](const ManagedDisplayInfo& info) { return info.id(); }); 611 [](const ManagedDisplayInfo& info) { return info.id(); });
612 612
613 const DisplayLayout& layout = 613 const DisplayLayout& layout =
614 layout_store_->GetRegisteredDisplayLayout(list); 614 layout_store_->GetRegisteredDisplayLayout(list);
615 // Mirror mode is set by DisplayConfigurator on the device. 615 // Mirror mode is set by DisplayConfigurator on the device.
616 // Emulate it when running on linux desktop. 616 // Emulate it when running on linux desktop.
617 if (layout.mirrored) 617 if (layout.mirrored)
618 SetMultiDisplayMode(MIRRORING); 618 SetMultiDisplayMode(MIRRORING);
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 return Display::HasInternalDisplay() ? Display::InternalDisplayId() 920 return Display::HasInternalDisplay() ? Display::InternalDisplayId()
921 : kInvalidDisplayId; 921 : kInvalidDisplayId;
922 } 922 }
923 923
924 void DisplayManager::SetMirrorMode(bool mirror) { 924 void DisplayManager::SetMirrorMode(bool mirror) {
925 // TODO(oshima): Enable mirror mode for 2> displays. crbug.com/589319. 925 // TODO(oshima): Enable mirror mode for 2> displays. crbug.com/589319.
926 if (num_connected_displays() != 2) 926 if (num_connected_displays() != 2)
927 return; 927 return;
928 928
929 #if defined(OS_CHROMEOS) 929 #if defined(OS_CHROMEOS)
930 if (base::SysInfo::IsRunningOnChromeOS()) { 930 if (configure_displays_) {
931 ui::MultipleDisplayState new_state = 931 ui::MultipleDisplayState new_state =
932 mirror ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR 932 mirror ? ui::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR
933 : ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; 933 : ui::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED;
934 delegate_->display_configurator()->SetDisplayMode(new_state); 934 delegate_->display_configurator()->SetDisplayMode(new_state);
935 return; 935 return;
936 } 936 }
937 #endif 937 #endif
938 multi_display_mode_ = 938 multi_display_mode_ =
939 mirror ? MIRRORING : current_default_multi_display_mode_; 939 mirror ? MIRRORING : current_default_multi_display_mode_;
940 ReconfigureDisplays(); 940 ReconfigureDisplays();
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1436 } 1436 }
1437 1437
1438 const Display& DisplayManager::GetSecondaryDisplay() const { 1438 const Display& DisplayManager::GetSecondaryDisplay() const {
1439 CHECK_LE(2U, GetNumDisplays()); 1439 CHECK_LE(2U, GetNumDisplays());
1440 return GetDisplayAt(0).id() == Screen::GetScreen()->GetPrimaryDisplay().id() 1440 return GetDisplayAt(0).id() == Screen::GetScreen()->GetPrimaryDisplay().id()
1441 ? GetDisplayAt(1) 1441 ? GetDisplayAt(1)
1442 : GetDisplayAt(0); 1442 : GetDisplayAt(0);
1443 } 1443 }
1444 1444
1445 } // namespace display 1445 } // namespace display
OLDNEW
« no previous file with comments | « ui/display/manager/display_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698