Index: chrome/browser/ui/webui/options/chromeos/display_options_handler.cc |
diff --git a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc |
index 528dc20fb5460e267990a71696be483af835476f..eff7e64532c5223d2f85391f608b847d5437d25f 100644 |
--- a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc |
+++ b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc |
@@ -54,11 +54,9 @@ |
return display_id; |
} |
-bool CompareDisplayMode(ash::internal::DisplayMode d1, |
- ash::internal::DisplayMode d2) { |
- if (d1.size.GetArea() == d2.size.GetArea()) |
- return d1.refresh_rate < d2.refresh_rate; |
- return d1.size.GetArea() < d2.size.GetArea(); |
+bool CompareResolution(ash::internal::Resolution r1, |
+ ash::internal::Resolution r2) { |
+ return r1.size.GetArea() < r2.size.GetArea(); |
} |
} // namespace |
@@ -189,7 +187,7 @@ |
js_display->SetBoolean("isInternal", display.IsInternal()); |
js_display->SetInteger("orientation", |
static_cast<int>(display_info.rotation())); |
- std::vector<ash::internal::DisplayMode> display_modes; |
+ std::vector<ash::internal::Resolution> resolutions; |
std::vector<float> ui_scales; |
if (display.IsInternal()) { |
ui_scales = DisplayManager::GetScalesForDisplay(display_info); |
@@ -204,21 +202,21 @@ |
for (size_t i = 0; i < ui_scales.size(); ++i) { |
gfx::SizeF new_size = base_size; |
new_size.Scale(ui_scales[i]); |
- display_modes.push_back(ash::internal::DisplayMode( |
- gfx::ToFlooredSize(new_size), -1.0f, false, false)); |
+ resolutions.push_back(ash::internal::Resolution( |
+ gfx::ToFlooredSize(new_size), false /* interlaced */)); |
} |
} else { |
- for (size_t i = 0; i < display_info.display_modes().size(); ++i) |
- display_modes.push_back(display_info.display_modes()[i]); |
+ for (size_t i = 0; i < display_info.resolutions().size(); ++i) |
+ resolutions.push_back(display_info.resolutions()[i]); |
} |
- std::sort(display_modes.begin(), display_modes.end(), CompareDisplayMode); |
+ std::sort(resolutions.begin(), resolutions.end(), CompareResolution); |
base::ListValue* js_resolutions = new base::ListValue(); |
gfx::Size current_size = display_info.bounds_in_native().size(); |
gfx::Insets current_overscan = display_info.GetOverscanInsetsInPixel(); |
- for (size_t i = 0; i < display_modes.size(); ++i) { |
+ for (size_t i = 0; i < resolutions.size(); ++i) { |
base::DictionaryValue* resolution_info = new base::DictionaryValue(); |
- gfx::Size resolution = display_modes[i].size; |
+ gfx::Size resolution = resolutions[i].size; |
if (!ui_scales.empty()) { |
resolution_info->SetDouble("scale", ui_scales[i]); |
if (ui_scales[i] == 1.0f) |
@@ -227,8 +225,8 @@ |
"selected", display_info.configured_ui_scale() == ui_scales[i]); |
} else { |
// Picks the largest one as the "best", which is the last element |
- // because |display_modes| is sorted by its area. |
- if (i == display_modes.size() - 1) |
+ // because |resolutions| is sorted by its area. |
+ if (i == resolutions.size() - 1) |
resolution_info->SetBoolean("isBest", true); |
resolution_info->SetBoolean("selected", (resolution == current_size)); |
resolution.Enlarge( |
@@ -236,10 +234,6 @@ |
} |
resolution_info->SetInteger("width", resolution.width()); |
resolution_info->SetInteger("height", resolution.height()); |
- if (display_modes[i].refresh_rate > 0.0f) { |
- resolution_info->SetDouble("refreshRate", |
- display_modes[i].refresh_rate); |
- } |
js_resolutions->Append(resolution_info); |
} |
js_display->Set("resolutions", js_resolutions); |
@@ -358,11 +352,11 @@ |
gfx::Size old_resolution = display_info.bounds_in_native().size(); |
bool has_new_resolution = false; |
bool has_old_resolution = false; |
- for (size_t i = 0; i < display_info.display_modes().size(); ++i) { |
- ash::internal::DisplayMode display_mode = display_info.display_modes()[i]; |
- if (display_mode.size == new_resolution) |
+ for (size_t i = 0; i < display_info.resolutions().size(); ++i) { |
+ ash::internal::Resolution resolution = display_info.resolutions()[i]; |
+ if (resolution.size == new_resolution) |
has_new_resolution = true; |
- if (display_mode.size == old_resolution) |
+ if (resolution.size == old_resolution) |
has_old_resolution = true; |
} |
if (!has_new_resolution) { |