Index: ash/display/display_manager.cc |
diff --git a/ash/display/display_manager.cc b/ash/display/display_manager.cc |
index 9bb154e19089735fb0906fbb355c910ba4ccf108..776a352fb381004157b771424d169ce06e7721c5 100644 |
--- a/ash/display/display_manager.cc |
+++ b/ash/display/display_manager.cc |
@@ -452,12 +452,8 @@ void DisplayManager::SetDisplayResolution(int64 display_id, |
LOG(WARNING) << "Unsupported resolution was requested:" |
<< resolution.ToString(); |
return; |
- } else if (iter == resolutions.begin()) { |
- // The best resolution was set, so forget it. |
- resolutions_.erase(display_id); |
- } else { |
- resolutions_[display_id] = resolution; |
} |
+ resolutions_[display_id] = *iter; |
#if defined(OS_CHROMEOS) && defined(USE_X11) |
if (base::SysInfo::IsRunningOnChromeOS()) |
Shell::GetInstance()->output_configurator()->ScheduleConfigureOutputs(); |
@@ -469,7 +465,8 @@ void DisplayManager::RegisterDisplayProperty( |
gfx::Display::Rotation rotation, |
float ui_scale, |
const gfx::Insets* overscan_insets, |
- const gfx::Size& resolution_in_pixels) { |
+ const gfx::Size& resolution_in_pixels, |
+ float refresh_rate) { |
if (display_info_.find(display_id) == display_info_.end()) { |
display_info_[display_id] = |
DisplayInfo(display_id, std::string(""), false); |
@@ -481,18 +478,21 @@ void DisplayManager::RegisterDisplayProperty( |
display_info_[display_id].set_configured_ui_scale(ui_scale); |
if (overscan_insets) |
display_info_[display_id].SetOverscanInsets(*overscan_insets); |
- if (!resolution_in_pixels.IsEmpty()) |
- resolutions_[display_id] = resolution_in_pixels; |
+ if (!resolution_in_pixels.IsEmpty()) { |
+ resolutions_[display_id] = |
+ Resolution(resolution_in_pixels, refresh_rate, false); |
+ } |
} |
bool DisplayManager::GetSelectedResolutionForDisplayId( |
int64 id, |
- gfx::Size* resolution_out) const { |
- std::map<int64, gfx::Size>::const_iterator iter = |
- resolutions_.find(id); |
+ gfx::Size* resolution_out, |
+ float* refresh_rate_out) const { |
+ std::map<int64, Resolution>::const_iterator iter = resolutions_.find(id); |
if (iter == resolutions_.end()) |
return false; |
- *resolution_out = iter->second; |
+ *resolution_out = iter->second.size; |
+ *refresh_rate_out = iter->second.refresh_rate; |
return true; |
} |
@@ -575,10 +575,10 @@ void DisplayManager::OnNativeDisplaysChanged( |
resolutions.end(), |
ResolutionMatcher(resolution)); |
// Update the actual resolution selected as the resolution request may fail. |
- if (resolution_iter == resolutions.begin()) |
+ if (resolution_iter != resolutions.end()) |
+ resolutions_[iter->id()] = *resolution_iter; |
+ else |
resolutions_.erase(iter->id()); |
- else if (resolutions_.find(iter->id()) != resolutions_.end()) |
- resolutions_[iter->id()] = resolution; |
} |
if (HasInternalDisplay() && |
!internal_display_connected && |
@@ -659,7 +659,7 @@ void DisplayManager::UpdateDisplays( |
non_desktop_display_ = |
CreateDisplayFromDisplayInfoById(non_desktop_display_id); |
++new_info_iter; |
- // Remove existing external dispaly if it is going to be used as |
+ // Remove existing external display if it is going to be used as |
// non desktop. |
if (curr_iter != displays_.end() && |
curr_iter->id() == non_desktop_display_id) { |