Chromium Code Reviews| Index: chrome/browser/spellchecker/feedback.cc |
| diff --git a/chrome/browser/spellchecker/feedback.cc b/chrome/browser/spellchecker/feedback.cc |
| index 17bc4b7e60b46b9e14e6ea4a13f20c11c2e1aa01..d6ccafa79703e21b755bf2fd69f78716a9fe4c61 100644 |
| --- a/chrome/browser/spellchecker/feedback.cc |
| +++ b/chrome/browser/spellchecker/feedback.cc |
| @@ -1,4 +1,4 @@ |
| -// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Copyright 2013 The Chromium Authors. All rights reserved. |
|
groby-ooo-7-16
2016/02/09 20:20:26
Let's not touch the copyright stuff - see below.
Kevin Bailey
2016/02/09 22:26:39
Done.
|
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| // |
| @@ -35,7 +35,7 @@ Feedback::~Feedback() {} |
| Misspelling* Feedback::GetMisspelling(uint32_t hash) { |
| HashMisspellingMap::iterator misspelling_it = misspellings_.find(hash); |
| if (misspelling_it == misspellings_.end()) |
| - return NULL; |
| + return nullptr; |
| return &misspelling_it->second; |
| } |
| @@ -49,12 +49,11 @@ void Feedback::FinalizeRemovedMisspellings( |
| HashCollection& renderer_hashes = renderer_it->second; |
| HashCollection remaining_hashes(remaining_markers.begin(), |
| remaining_markers.end()); |
| - std::vector<uint32_t> removed_hashes = |
| - base::STLSetDifference<std::vector<uint32_t>>(renderer_hashes, |
| - remaining_hashes); |
| - for (std::vector<uint32_t>::const_iterator hash_it = removed_hashes.begin(); |
| - hash_it != removed_hashes.end(); ++hash_it) { |
| - HashMisspellingMap::iterator misspelling_it = misspellings_.find(*hash_it); |
| + std::vector<HashCollection::value_type> removed_hashes = |
| + base::STLSetDifference<std::vector<HashCollection::value_type>>( |
| + renderer_hashes, remaining_hashes); |
| + for (auto hash : removed_hashes) { |
| + HashMisspellingMap::iterator misspelling_it = misspellings_.find(hash); |
| if (misspelling_it != misspellings_.end() && |
| !misspelling_it->second.action.IsFinal()) { |
| misspelling_it->second.action.Finalize(); |
| @@ -157,29 +156,24 @@ bool Feedback::Empty() const { |
| std::vector<int> Feedback::GetRendersWithMisspellings() const { |
| std::vector<int> renderers_with_misspellings; |
| - for (RendererHashesMap::const_iterator renderer_it = renderers_.begin(); |
| - renderer_it != renderers_.end(); ++renderer_it) { |
| - if (!renderer_it->second.empty()) |
| - renderers_with_misspellings.push_back(renderer_it->first); |
| + for (const auto& renderer : renderers_) { |
| + if (!renderer.second.empty()) |
| + renderers_with_misspellings.push_back(renderer.first); |
| } |
| return renderers_with_misspellings; |
| } |
| void Feedback::FinalizeAllMisspellings() { |
| - for (HashMisspellingMap::iterator misspelling_it = misspellings_.begin(); |
| - misspelling_it != misspellings_.end(); ++misspelling_it) { |
| - if (!misspelling_it->second.action.IsFinal()) |
| - misspelling_it->second.action.Finalize(); |
| + for (auto& misspelling : misspellings_) { |
| + if (!misspelling.second.action.IsFinal()) |
| + misspelling.second.action.Finalize(); |
| } |
| } |
| std::vector<Misspelling> Feedback::GetAllMisspellings() const { |
| std::vector<Misspelling> all_misspellings; |
| - for (HashMisspellingMap::const_iterator misspelling_it = |
| - misspellings_.begin(); |
| - misspelling_it != misspellings_.end(); ++misspelling_it) { |
| - all_misspellings.push_back(misspelling_it->second); |
| - } |
| + for (const auto& misspelling : misspellings_) |
| + all_misspellings.push_back(misspelling.second); |
| return all_misspellings; |
| } |