| Index: chrome/renderer/spellchecker/hunspell_engine.cc
|
| diff --git a/chrome/renderer/spellchecker/hunspell_engine.cc b/chrome/renderer/spellchecker/hunspell_engine.cc
|
| index 9b352d5c88b76ef4c0022d383acdc6a2c099d73f..71a14d2d5228c9cb54f5f0eceb92a77bdf98ed91 100644
|
| --- a/chrome/renderer/spellchecker/hunspell_engine.cc
|
| +++ b/chrome/renderer/spellchecker/hunspell_engine.cc
|
| @@ -56,10 +56,9 @@ void HunspellEngine::InitializeHunspell() {
|
| new Hunspell(bdict_file_->data(), bdict_file_->length()));
|
|
|
| // Add custom words to Hunspell.
|
| - for (std::vector<std::string>::iterator it = custom_words_.begin();
|
| - it != custom_words_.end(); ++it) {
|
| + chrome::spellcheck_common::WordList::iterator it;
|
| + for (it = custom_words_.begin(); it != custom_words_.end(); ++it)
|
| AddWordToHunspell(*it);
|
| - }
|
|
|
| DHISTOGRAM_TIMES("Spellcheck.InitTime",
|
| base::Histogram::DebugNow() - debug_start_time);
|
| @@ -73,6 +72,11 @@ void HunspellEngine::AddWordToHunspell(const std::string& word) {
|
| hunspell_->add(word.c_str());
|
| }
|
|
|
| +void HunspellEngine::RemoveWordFromHunspell(const std::string& word) {
|
| + if (!word.empty() && word.length() < MAXWORDLEN)
|
| + hunspell_->remove(word.c_str());
|
| +}
|
| +
|
| bool HunspellEngine::CheckSpelling(const string16& word_to_check, int tag) {
|
| bool word_correct = false;
|
| std::string word_to_check_utf8(UTF16ToUTF8(word_to_check));
|
| @@ -124,6 +128,17 @@ void HunspellEngine::OnWordAdded(const std::string& word) {
|
| }
|
| }
|
|
|
| +void HunspellEngine::OnWordRemoved(const std::string& word) {
|
| + if (!hunspell_.get()) {
|
| + chrome::spellcheck_common::WordList::iterator it = std::find(
|
| + custom_words_.begin(), custom_words_.end(), word);
|
| + if (it != custom_words_.end())
|
| + custom_words_.erase(it);
|
| + } else {
|
| + RemoveWordFromHunspell(word);
|
| + }
|
| +}
|
| +
|
| bool HunspellEngine::InitializeIfNeeded() {
|
| if (!initialized_ && !dictionary_requested_) {
|
| // RenderThread will not exist in test.
|
|
|