| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // The |Feedback| object keeps track of each instance of user feedback in a map | 5 // The |Feedback| object keeps track of each instance of user feedback in a map |
| 6 // |misspellings_|. This is a map from uint32_t hashes to |Misspelling| objects. | 6 // |misspellings_|. This is a map from uint32_t hashes to |Misspelling| objects. |
| 7 // | 7 // |
| 8 // Each misspelling should be present in only one renderer process. The | 8 // Each misspelling should be present in only one renderer process. The |
| 9 // |Feedback| objects keeps track of misspelling-renderer relationship in the | 9 // |Feedback| objects keeps track of misspelling-renderer relationship in the |
| 10 // |renderers_| map of renderer process identifiers to a set of hashes. | 10 // |renderers_| map of renderer process identifiers to a set of hashes. |
| 11 // | 11 // |
| 12 // When the user adds a misspelling to their custom dictionary, all of the | 12 // When the user adds a misspelling to their custom dictionary, all of the |
| 13 // |Misspelling| objects with the same misspelled string are updated. The | 13 // |Misspelling| objects with the same misspelled string are updated. The |
| 14 // |Feedback| object facilitates efficient access to these misspellings through | 14 // |Feedback| object facilitates efficient access to these misspellings through |
| 15 // a |text_| map of misspelled strings to a set of hashes. | 15 // a |text_| map of misspelled strings to a set of hashes. |
| 16 | 16 |
| 17 #include "chrome/browser/spellchecker/feedback.h" | 17 #include "components/spellcheck/browser/feedback.h" |
| 18 | 18 |
| 19 #include <algorithm> | 19 #include <algorithm> |
| 20 #include <iterator> | 20 #include <iterator> |
| 21 #include <limits> | 21 #include <limits> |
| 22 | 22 |
| 23 #include "base/logging.h" | 23 #include "base/logging.h" |
| 24 #include "base/stl_util.h" | 24 #include "base/stl_util.h" |
| 25 | 25 |
| 26 namespace spellcheck { | 26 namespace spellcheck { |
| 27 | 27 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 renderers_.clear(); | 184 renderers_.clear(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 const std::set<uint32_t>& Feedback::FindMisspellings( | 187 const std::set<uint32_t>& Feedback::FindMisspellings( |
| 188 const base::string16& misspelled_text) const { | 188 const base::string16& misspelled_text) const { |
| 189 const TextHashesMap::const_iterator text_it = text_.find(misspelled_text); | 189 const TextHashesMap::const_iterator text_it = text_.find(misspelled_text); |
| 190 return text_it == text_.end() ? empty_hash_collection_ : text_it->second; | 190 return text_it == text_.end() ? empty_hash_collection_ : text_it->second; |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace spellcheck | 193 } // namespace spellcheck |
| OLD | NEW |