| 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::OnCustomDictionaryChanged( |
| 233 } | 233 const SpellcheckCustomDictionary::Change* dictionary_change) { |
| 234 | 234 DCHECK(dictionary_change); |
| 235 void SpellcheckService::OnCustomDictionaryWordRemoved(const std::string& word) { | 235 for (content::RenderProcessHost::iterator i( |
| 236 content::RenderProcessHost::AllHostsIterator()); |
| 237 !i.IsAtEnd(); i.Advance()) { |
| 238 i.GetCurrentValue()->Send(new SpellCheckMsg_WordsAddedRemoved( |
| 239 dictionary_change->to_add(), |
| 240 dictionary_change->to_remove())); |
| 241 } |
| 236 } | 242 } |
| 237 | 243 |
| 238 // static | 244 // static |
| 239 void SpellcheckService::AttachStatusEvent(base::WaitableEvent* status_event) { | 245 void SpellcheckService::AttachStatusEvent(base::WaitableEvent* status_event) { |
| 240 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 246 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 241 | 247 |
| 242 g_status_event = status_event; | 248 g_status_event = status_event; |
| 243 } | 249 } |
| 244 | 250 |
| 245 // static | 251 // static |
| 246 SpellcheckService::EventType SpellcheckService::WaitStatusEvent() { | 252 SpellcheckService::EventType SpellcheckService::WaitStatusEvent() { |
| 247 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 253 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 248 | 254 |
| 249 if (g_status_event) | 255 if (g_status_event) |
| 250 g_status_event->Wait(); | 256 g_status_event->Wait(); |
| 251 return g_status_type; | 257 return g_status_type; |
| 252 } | 258 } |
| OLD | NEW |