| 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/string_split.h" | 8 #include "base/string_split.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "chrome/browser/api/prefs/pref_member.h" | 10 #include "chrome/browser/api/prefs/pref_member.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Remove pref observers | 72 // Remove pref observers |
| 73 pref_change_registrar_.RemoveAll(); | 73 pref_change_registrar_.RemoveAll(); |
| 74 } | 74 } |
| 75 | 75 |
| 76 // static | 76 // static |
| 77 int SpellcheckService::GetSpellCheckLanguages( | 77 int SpellcheckService::GetSpellCheckLanguages( |
| 78 Profile* profile, | 78 Profile* profile, |
| 79 std::vector<std::string>* languages) { | 79 std::vector<std::string>* languages) { |
| 80 StringPrefMember accept_languages_pref; | 80 StringPrefMember accept_languages_pref; |
| 81 StringPrefMember dictionary_language_pref; | 81 StringPrefMember dictionary_language_pref; |
| 82 accept_languages_pref.Init(prefs::kAcceptLanguages, profile->GetPrefs(), | 82 accept_languages_pref.Init(prefs::kAcceptLanguages, profile->GetPrefs()); |
| 83 NULL); | |
| 84 dictionary_language_pref.Init(prefs::kSpellCheckDictionary, | 83 dictionary_language_pref.Init(prefs::kSpellCheckDictionary, |
| 85 profile->GetPrefs(), NULL); | 84 profile->GetPrefs()); |
| 86 std::string dictionary_language = dictionary_language_pref.GetValue(); | 85 std::string dictionary_language = dictionary_language_pref.GetValue(); |
| 87 | 86 |
| 88 // Now scan through the list of accept languages, and find possible mappings | 87 // Now scan through the list of accept languages, and find possible mappings |
| 89 // from this list to the existing list of spell check languages. | 88 // from this list to the existing list of spell check languages. |
| 90 std::vector<std::string> accept_languages; | 89 std::vector<std::string> accept_languages; |
| 91 | 90 |
| 92 #if defined(OS_MACOSX) | 91 #if defined(OS_MACOSX) |
| 93 if (spellcheck_mac::SpellCheckerAvailable()) | 92 if (spellcheck_mac::SpellCheckerAvailable()) |
| 94 spellcheck_mac::GetAvailableLanguages(&accept_languages); | 93 spellcheck_mac::GetAvailableLanguages(&accept_languages); |
| 95 else | 94 else |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 } | 235 } |
| 237 | 236 |
| 238 // static | 237 // static |
| 239 SpellcheckService::EventType SpellcheckService::WaitStatusEvent() { | 238 SpellcheckService::EventType SpellcheckService::WaitStatusEvent() { |
| 240 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 239 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 241 | 240 |
| 242 if (g_status_event) | 241 if (g_status_event) |
| 243 g_status_event->Wait(); | 242 g_status_event->Wait(); |
| 244 return g_status_type; | 243 return g_status_type; |
| 245 } | 244 } |
| OLD | NEW |