| 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/browser/spellchecker/spellcheck_service.h" | 5 #include "chrome/browser/spellchecker/spellcheck_service.h" |
| 6 | 6 |
| 7 #include "base/platform_file.h" | 7 #include "base/platform_file.h" |
| 8 #include "base/prefs/public/pref_member.h" | 8 #include "base/prefs/public/pref_member.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 profile_->GetPrefs()->GetString(prefs::kSpellCheckDictionary), | 222 profile_->GetPrefs()->GetString(prefs::kSpellCheckDictionary), |
| 223 profile_->GetRequestContext(), | 223 profile_->GetRequestContext(), |
| 224 this)); | 224 this)); |
| 225 hunspell_dictionary_->Load(); | 225 hunspell_dictionary_->Load(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void SpellcheckService::OnCustomDictionaryLoaded() { | 228 void SpellcheckService::OnCustomDictionaryLoaded() { |
| 229 InitForAllRenderers(); | 229 InitForAllRenderers(); |
| 230 } | 230 } |
| 231 | 231 |
| 232 void SpellcheckService::OnCustomDictionaryWordAdded(const std::string& word) { | 232 void SpellcheckService::OnCustomDictionaryWordsAdded( |
| 233 const chrome::spellcheck_common::WordList& words) { |
| 234 for (content::RenderProcessHost::iterator i( |
| 235 content::RenderProcessHost::AllHostsIterator()); |
| 236 !i.IsAtEnd(); i.Advance()) { |
| 237 i.GetCurrentValue()->Send(new SpellCheckMsg_WordsAdded(words)); |
| 238 } |
| 233 } | 239 } |
| 234 | 240 |
| 235 void SpellcheckService::OnCustomDictionaryWordRemoved(const std::string& word) { | 241 void SpellcheckService::OnCustomDictionaryWordsRemoved( |
| 242 const chrome::spellcheck_common::WordList& words) { |
| 243 for (content::RenderProcessHost::iterator i( |
| 244 content::RenderProcessHost::AllHostsIterator()); |
| 245 !i.IsAtEnd(); i.Advance()) { |
| 246 i.GetCurrentValue()->Send(new SpellCheckMsg_WordsRemoved(words)); |
| 247 } |
| 236 } | 248 } |
| 237 | 249 |
| 238 // static | 250 // static |
| 239 void SpellcheckService::AttachStatusEvent(base::WaitableEvent* status_event) { | 251 void SpellcheckService::AttachStatusEvent(base::WaitableEvent* status_event) { |
| 240 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 252 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 241 | 253 |
| 242 g_status_event = status_event; | 254 g_status_event = status_event; |
| 243 } | 255 } |
| 244 | 256 |
| 245 // static | 257 // static |
| 246 SpellcheckService::EventType SpellcheckService::WaitStatusEvent() { | 258 SpellcheckService::EventType SpellcheckService::WaitStatusEvent() { |
| 247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 259 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 248 | 260 |
| 249 if (g_status_event) | 261 if (g_status_event) |
| 250 g_status_event->Wait(); | 262 g_status_event->Wait(); |
| 251 return g_status_type; | 263 return g_status_type; |
| 252 } | 264 } |
| OLD | NEW |