Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/browser/spellchecker/spellcheck_service.cc

Issue 11445002: Sync user's custom spellcheck dictionary (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add server-side size limit tests Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698