| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/renderer/spellchecker/custom_dictionary_engine.h" | 5 #include "chrome/renderer/spellchecker/custom_dictionary_engine.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 |
| 7 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 8 | 10 |
| 9 CustomDictionaryEngine::CustomDictionaryEngine() { | 11 CustomDictionaryEngine::CustomDictionaryEngine() { |
| 10 } | 12 } |
| 11 | 13 |
| 12 CustomDictionaryEngine::~CustomDictionaryEngine() { | 14 CustomDictionaryEngine::~CustomDictionaryEngine() { |
| 13 } | 15 } |
| 14 | 16 |
| 15 void CustomDictionaryEngine::Init(const std::set<std::string>& custom_words) { | 17 void CustomDictionaryEngine::Init(const std::set<std::string>& custom_words) { |
| 16 // SpellingMenuOberver calls UTF16ToUTF8(word) to convert words for storage, | 18 // SpellingMenuOberver calls UTF16ToUTF8(word) to convert words for storage, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 36 int misspelling_start, | 38 int misspelling_start, |
| 37 int misspelling_len) { | 39 int misspelling_len) { |
| 38 // The text to be checked is empty on OSX(async) right now. | 40 // The text to be checked is empty on OSX(async) right now. |
| 39 // TODO(groby): Fix as part of async hook-up. (http://crbug.com/178241) | 41 // TODO(groby): Fix as part of async hook-up. (http://crbug.com/178241) |
| 40 return | 42 return |
| 41 misspelling_start >= 0 && | 43 misspelling_start >= 0 && |
| 42 misspelling_len > 0 && | 44 misspelling_len > 0 && |
| 43 size_t(misspelling_start + misspelling_len) <= text.length() && | 45 size_t(misspelling_start + misspelling_len) <= text.length() && |
| 44 dictionary_.count(text.substr(misspelling_start, misspelling_len)) > 0; | 46 dictionary_.count(text.substr(misspelling_start, misspelling_len)) > 0; |
| 45 } | 47 } |
| OLD | NEW |