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

Unified Diff: chrome/browser/ui/webui/options/chromeos/display_options_handler.cc

Issue 791873002: Cleanup: adopt C++11 range-based-for to simplify the code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 696c1f6720a2345ef17f7dc2d1dbc84fc0c416bc..4a5cd1e4b08d716eda093007017e6e3df7157fce 100644
--- a/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
+++ b/chrome/browser/ui/webui/options/chromeos/display_options_handler.cc
@@ -264,8 +264,7 @@ void DisplayOptionsHandler::SendDisplayInfo(
int64 primary_id = ash::Shell::GetScreen()->GetPrimaryDisplay().id();
base::ListValue js_displays;
- for (size_t i = 0; i < displays.size(); ++i) {
- const gfx::Display& display = displays[i];
+ for (const gfx::Display& display : displays) {
const ash::DisplayInfo& display_info =
display_manager->GetDisplayInfo(display.id());
const gfx::Rect& bounds = display.bounds();
@@ -283,20 +282,15 @@ void DisplayOptionsHandler::SendDisplayInfo(
static_cast<int>(display_info.rotation()));
base::ListValue* js_resolutions = new base::ListValue();
- const std::vector<ash::DisplayMode>& display_modes =
- display_info.display_modes();
- for (size_t i = 0; i < display_modes.size(); ++i) {
+ for (const ash::DisplayMode& display_mode : display_info.display_modes()) {
js_resolutions->Append(
- ConvertDisplayModeToValue(display.id(), display_modes[i]));
+ ConvertDisplayModeToValue(display.id(), display_mode));
}
js_display->Set("resolutions", js_resolutions);
js_display->SetInteger("colorProfile", display_info.color_profile());
base::ListValue* available_color_profiles = new base::ListValue();
- for (size_t i = 0;
- i < display_info.available_color_profiles().size(); ++i) {
- ui::ColorCalibrationProfile color_profile =
- display_info.available_color_profiles()[i];
+ for (const auto& color_profile : display_info.available_color_profiles()) {
const base::string16 profile_name = GetColorProfileName(color_profile);
if (profile_name.empty())
continue;
@@ -391,7 +385,7 @@ void DisplayOptionsHandler::HandleSetDisplayMode(const base::ListValue* args) {
if (display_id == gfx::Display::kInvalidDisplayID)
return;
- const base::DictionaryValue* mode_data = NULL;
+ const base::DictionaryValue* mode_data = nullptr;
if (!args->GetDictionary(1, &mode_data)) {
LOG(ERROR) << "Failed to get mode data";
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698