Modernize to C++11: Use for-range loop.
This commit is contained in:
parent
3bdeac98bf
commit
55b3f1936f
17 changed files with 66 additions and 71 deletions
|
@ -241,10 +241,10 @@ void OnGetBackend(disk_cache::Backend** backend_ptr,
|
|||
} else if (action == Session::CacheAction::STATS) {
|
||||
base::StringPairs stats;
|
||||
(*backend_ptr)->GetStats(&stats);
|
||||
for (size_t i = 0; i < stats.size(); ++i) {
|
||||
if (stats[i].first == "Current size") {
|
||||
for (auto& stat : stats) {
|
||||
if (stat.first == "Current size") {
|
||||
int current_size;
|
||||
base::StringToInt(stats[i].second, ¤t_size);
|
||||
base::StringToInt(stat.second, ¤t_size);
|
||||
RunCallbackInUI(callback, current_size);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -685,10 +685,10 @@ void WebContents::TitleWasSet(content::NavigationEntry* entry,
|
|||
void WebContents::DidUpdateFaviconURL(
|
||||
const std::vector<content::FaviconURL>& urls) {
|
||||
std::set<GURL> unique_urls;
|
||||
for (auto iter = urls.begin(); iter != urls.end(); ++iter) {
|
||||
if (iter->icon_type != content::FaviconURL::FAVICON)
|
||||
for (const auto& iter : urls) {
|
||||
if (iter.icon_type != content::FaviconURL::FAVICON)
|
||||
continue;
|
||||
const GURL& url = iter->icon_url;
|
||||
const GURL& url = iter.icon_url;
|
||||
if (url.is_valid())
|
||||
unique_urls.insert(url);
|
||||
}
|
||||
|
|
|
@ -435,8 +435,8 @@ void CommonWebContentsDelegate::DevToolsRequestFileSystems() {
|
|||
}
|
||||
|
||||
base::ListValue file_system_value;
|
||||
for (size_t i = 0; i < file_systems.size(); ++i)
|
||||
file_system_value.Append(CreateFileSystemValue(file_systems[i]));
|
||||
for (auto& file_system : file_systems)
|
||||
file_system_value.Append(CreateFileSystemValue(file_system));
|
||||
web_contents_->CallClientFunction("DevToolsAPI.fileSystemsLoaded",
|
||||
&file_system_value, nullptr, nullptr);
|
||||
}
|
||||
|
@ -610,8 +610,8 @@ void CommonWebContentsDelegate::OnDevToolsSearchCompleted(
|
|||
const std::string& file_system_path,
|
||||
const std::vector<std::string>& file_paths) {
|
||||
base::ListValue file_paths_value;
|
||||
for (auto it(file_paths.begin()); it != file_paths.end(); ++it) {
|
||||
file_paths_value.AppendString(*it);
|
||||
for (const auto& file_path : file_paths) {
|
||||
file_paths_value.AppendString(file_path);
|
||||
}
|
||||
base::FundamentalValue request_id_value(request_id);
|
||||
base::StringValue file_system_path_value(file_system_path);
|
||||
|
|
|
@ -30,9 +30,9 @@ bool StringToAccelerator(const std::string& shortcut,
|
|||
// Now, parse it into an accelerator.
|
||||
int modifiers = ui::EF_NONE;
|
||||
ui::KeyboardCode key = ui::VKEY_UNKNOWN;
|
||||
for (size_t i = 0; i < tokens.size(); i++) {
|
||||
for (auto& token : tokens) {
|
||||
bool shifted = false;
|
||||
ui::KeyboardCode code = atom::KeyboardCodeFromStr(tokens[i], &shifted);
|
||||
ui::KeyboardCode code = atom::KeyboardCodeFromStr(token, &shifted);
|
||||
if (shifted)
|
||||
modifiers |= ui::EF_SHIFT_DOWN;
|
||||
switch (code) {
|
||||
|
|
|
@ -70,8 +70,8 @@ void WindowList::RemoveObserver(WindowListObserver* observer) {
|
|||
// static
|
||||
void WindowList::CloseAllWindows() {
|
||||
WindowVector windows = GetInstance()->windows_;
|
||||
for (size_t i = 0; i < windows.size(); ++i)
|
||||
windows[i]->Close();
|
||||
for (auto& window : windows)
|
||||
window->Close();
|
||||
}
|
||||
|
||||
WindowList::WindowList() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue