| OLD | NEW |
| 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 <cmath> | 7 #include <cmath> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 std::vector<DisplayMode>::const_iterator iter = | 448 std::vector<DisplayMode>::const_iterator iter = |
| 449 std::find_if(modes.begin(), modes.end(), DisplayModeMatcher(resolution)); | 449 std::find_if(modes.begin(), modes.end(), DisplayModeMatcher(resolution)); |
| 450 if (iter == modes.end()) { | 450 if (iter == modes.end()) { |
| 451 LOG(WARNING) << "Unsupported resolution was requested:" | 451 LOG(WARNING) << "Unsupported resolution was requested:" |
| 452 << resolution.ToString(); | 452 << resolution.ToString(); |
| 453 return; | 453 return; |
| 454 } | 454 } |
| 455 display_modes_[display_id] = *iter; | 455 display_modes_[display_id] = *iter; |
| 456 #if defined(OS_CHROMEOS) | 456 #if defined(OS_CHROMEOS) |
| 457 if (base::SysInfo::IsRunningOnChromeOS()) | 457 if (base::SysInfo::IsRunningOnChromeOS()) |
| 458 Shell::GetInstance()->output_configurator()->OnConfigurationChanged(); | 458 Shell::GetInstance()->display_configurator()->OnConfigurationChanged(); |
| 459 #endif | 459 #endif |
| 460 } | 460 } |
| 461 | 461 |
| 462 void DisplayManager::RegisterDisplayProperty( | 462 void DisplayManager::RegisterDisplayProperty( |
| 463 int64 display_id, | 463 int64 display_id, |
| 464 gfx::Display::Rotation rotation, | 464 gfx::Display::Rotation rotation, |
| 465 float ui_scale, | 465 float ui_scale, |
| 466 const gfx::Insets* overscan_insets, | 466 const gfx::Insets* overscan_insets, |
| 467 const gfx::Size& resolution_in_pixels, | 467 const gfx::Size& resolution_in_pixels, |
| 468 ui::ColorCalibrationProfile color_profile) { | 468 ui::ColorCalibrationProfile color_profile) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 int64 display_id, | 508 int64 display_id, |
| 509 ui::ColorCalibrationProfile profile) { | 509 ui::ColorCalibrationProfile profile) { |
| 510 #if defined(OS_CHROMEOS) | 510 #if defined(OS_CHROMEOS) |
| 511 if (!display_info_[display_id].IsColorProfileAvailable(profile)) | 511 if (!display_info_[display_id].IsColorProfileAvailable(profile)) |
| 512 return; | 512 return; |
| 513 | 513 |
| 514 if (delegate_) | 514 if (delegate_) |
| 515 delegate_->PreDisplayConfigurationChange(false); | 515 delegate_->PreDisplayConfigurationChange(false); |
| 516 // Just sets color profile if it's not running on ChromeOS (like tests). | 516 // Just sets color profile if it's not running on ChromeOS (like tests). |
| 517 if (!base::SysInfo::IsRunningOnChromeOS() || | 517 if (!base::SysInfo::IsRunningOnChromeOS() || |
| 518 Shell::GetInstance()->output_configurator()->SetColorCalibrationProfile( | 518 Shell::GetInstance()->display_configurator()->SetColorCalibrationProfile( |
| 519 display_id, profile)) { | 519 display_id, profile)) { |
| 520 display_info_[display_id].SetColorProfile(profile); | 520 display_info_[display_id].SetColorProfile(profile); |
| 521 UMA_HISTOGRAM_ENUMERATION( | 521 UMA_HISTOGRAM_ENUMERATION( |
| 522 "ChromeOS.Display.ColorProfile", profile, ui::NUM_COLOR_PROFILES); | 522 "ChromeOS.Display.ColorProfile", profile, ui::NUM_COLOR_PROFILES); |
| 523 } | 523 } |
| 524 if (delegate_) | 524 if (delegate_) |
| 525 delegate_->PostDisplayConfigurationChange(); | 525 delegate_->PostDisplayConfigurationChange(); |
| 526 #endif | 526 #endif |
| 527 } | 527 } |
| 528 | 528 |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 } | 859 } |
| 860 | 860 |
| 861 void DisplayManager::SetMirrorMode(bool mirrored) { | 861 void DisplayManager::SetMirrorMode(bool mirrored) { |
| 862 if (num_connected_displays() <= 1) | 862 if (num_connected_displays() <= 1) |
| 863 return; | 863 return; |
| 864 | 864 |
| 865 #if defined(OS_CHROMEOS) | 865 #if defined(OS_CHROMEOS) |
| 866 if (base::SysInfo::IsRunningOnChromeOS()) { | 866 if (base::SysInfo::IsRunningOnChromeOS()) { |
| 867 ui::OutputState new_state = mirrored ? ui::OUTPUT_STATE_DUAL_MIRROR : | 867 ui::OutputState new_state = mirrored ? ui::OUTPUT_STATE_DUAL_MIRROR : |
| 868 ui::OUTPUT_STATE_DUAL_EXTENDED; | 868 ui::OUTPUT_STATE_DUAL_EXTENDED; |
| 869 Shell::GetInstance()->output_configurator()->SetDisplayMode(new_state); | 869 Shell::GetInstance()->display_configurator()->SetDisplayMode(new_state); |
| 870 return; | 870 return; |
| 871 } | 871 } |
| 872 #endif | 872 #endif |
| 873 // This is fallback path to emulate mirroroing on desktop. | 873 // This is fallback path to emulate mirroroing on desktop. |
| 874 SetSecondDisplayMode(mirrored ? MIRRORING : EXTENDED); | 874 SetSecondDisplayMode(mirrored ? MIRRORING : EXTENDED); |
| 875 DisplayInfoList display_info_list; | 875 DisplayInfoList display_info_list; |
| 876 int count = 0; | 876 int count = 0; |
| 877 for (std::map<int64, DisplayInfo>::const_iterator iter = | 877 for (std::map<int64, DisplayInfo>::const_iterator iter = |
| 878 display_info_.begin(); | 878 display_info_.begin(); |
| 879 count < 2; ++iter, ++count) { | 879 count < 2; ++iter, ++count) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 997 } | 997 } |
| 998 display_info_[new_info.id()].UpdateDisplaySize(); | 998 display_info_[new_info.id()].UpdateDisplaySize(); |
| 999 | 999 |
| 1000 OnDisplayInfoUpdated(display_info_[new_info.id()]); | 1000 OnDisplayInfoUpdated(display_info_[new_info.id()]); |
| 1001 } | 1001 } |
| 1002 | 1002 |
| 1003 void DisplayManager::OnDisplayInfoUpdated(const DisplayInfo& display_info) { | 1003 void DisplayManager::OnDisplayInfoUpdated(const DisplayInfo& display_info) { |
| 1004 #if defined(OS_CHROMEOS) | 1004 #if defined(OS_CHROMEOS) |
| 1005 ui::ColorCalibrationProfile color_profile = display_info.color_profile(); | 1005 ui::ColorCalibrationProfile color_profile = display_info.color_profile(); |
| 1006 if (color_profile != ui::COLOR_PROFILE_STANDARD) { | 1006 if (color_profile != ui::COLOR_PROFILE_STANDARD) { |
| 1007 Shell::GetInstance()->output_configurator()->SetColorCalibrationProfile( | 1007 Shell::GetInstance()->display_configurator()->SetColorCalibrationProfile( |
| 1008 display_info.id(), color_profile); | 1008 display_info.id(), color_profile); |
| 1009 } | 1009 } |
| 1010 #endif | 1010 #endif |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 gfx::Display DisplayManager::CreateDisplayFromDisplayInfoById(int64 id) { | 1013 gfx::Display DisplayManager::CreateDisplayFromDisplayInfoById(int64 id) { |
| 1014 DCHECK(display_info_.find(id) != display_info_.end()); | 1014 DCHECK(display_info_.find(id) != display_info_.end()); |
| 1015 const DisplayInfo& display_info = display_info_[id]; | 1015 const DisplayInfo& display_info = display_info_[id]; |
| 1016 | 1016 |
| 1017 gfx::Display new_display(display_info.id()); | 1017 gfx::Display new_display(display_info.id()); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 new_secondary_origin.Offset(-secondary_bounds.width(), offset); | 1110 new_secondary_origin.Offset(-secondary_bounds.width(), offset); |
| 1111 break; | 1111 break; |
| 1112 } | 1112 } |
| 1113 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); | 1113 gfx::Insets insets = secondary_display->GetWorkAreaInsets(); |
| 1114 secondary_display->set_bounds( | 1114 secondary_display->set_bounds( |
| 1115 gfx::Rect(new_secondary_origin, secondary_bounds.size())); | 1115 gfx::Rect(new_secondary_origin, secondary_bounds.size())); |
| 1116 secondary_display->UpdateWorkAreaFromInsets(insets); | 1116 secondary_display->UpdateWorkAreaFromInsets(insets); |
| 1117 } | 1117 } |
| 1118 | 1118 |
| 1119 } // namespace ash | 1119 } // namespace ash |
| OLD | NEW |