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