Index: ash/display/display_change_observer_chromeos.cc |
diff --git a/ash/display/display_change_observer_chromeos.cc b/ash/display/display_change_observer_chromeos.cc |
index 7c5780ec639259df80a29f85ee6698482fa9985f..7da0c679c611d06455605b909ace4fa054da1f71 100644 |
--- a/ash/display/display_change_observer_chromeos.cc |
+++ b/ash/display/display_change_observer_chromeos.cc |
@@ -41,7 +41,9 @@ const float kInchInMm = 25.4f; |
// one comes first. |
struct ResolutionSorter { |
bool operator()(const Resolution& a, const Resolution& b) { |
- return a.size.width() * a.size.height() > b.size.width() * b.size.height(); |
+ if (a.size.GetArea() == b.size.GetArea()) |
+ return (a.refresh_rate > b.refresh_rate); |
+ return (a.size.GetArea() > b.size.GetArea()); |
} |
}; |
@@ -58,6 +60,7 @@ std::vector<Resolution> DisplayChangeObserver::GetResolutionList( |
const OutputConfigurator::ModeInfo& mode_info = it->second; |
const std::pair<int, int> size(mode_info.width, mode_info.height); |
const Resolution resolution(gfx::Size(mode_info.width, mode_info.height), |
+ mode_info.refresh_rate, |
mode_info.interlaced); |
// Add the resolution if it isn't already present and override interlaced |
@@ -104,10 +107,14 @@ chromeos::OutputState DisplayChangeObserver::GetStateForDisplayIds( |
bool DisplayChangeObserver::GetResolutionForDisplayId(int64 display_id, |
int* width, |
- int* height) const { |
+ int* height, |
+ float* refresh_rate) |
+ const { |
gfx::Size resolution; |
- if (!Shell::GetInstance()->display_manager()-> |
- GetSelectedResolutionForDisplayId(display_id, &resolution)) { |
+ if (!Shell::GetInstance() |
+ ->display_manager() |
+ ->GetSelectedResolutionForDisplayId( |
+ display_id, &resolution, refresh_rate)) { |
return false; |
} |
@@ -145,9 +152,7 @@ void DisplayChangeObserver::OnDisplayModeChanged( |
gfx::Rect display_bounds( |
output.x, output.y, mode_info->width, mode_info->height); |
- std::vector<Resolution> resolutions; |
- if (output.type != chromeos::OUTPUT_TYPE_INTERNAL) |
- resolutions = GetResolutionList(output); |
+ std::vector<Resolution> resolutions = GetResolutionList(output); |
std::string name = output.type == chromeos::OUTPUT_TYPE_INTERNAL ? |
l10n_util::GetStringUTF8(IDS_ASH_INTERNAL_DISPLAY_NAME) : |