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 <set> | 7 #include <set> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 return; | 184 return; |
185 | 185 |
186 PrefService* prefs = user_prefs::UserPrefs::Get(context); | 186 PrefService* prefs = user_prefs::UserPrefs::Get(context); |
187 std::vector<SpellCheckBDictLanguage> bdict_languages; | 187 std::vector<SpellCheckBDictLanguage> bdict_languages; |
188 | 188 |
189 for (const auto& hunspell_dictionary : hunspell_dictionaries_) { | 189 for (const auto& hunspell_dictionary : hunspell_dictionaries_) { |
190 bdict_languages.push_back(SpellCheckBDictLanguage()); | 190 bdict_languages.push_back(SpellCheckBDictLanguage()); |
191 bdict_languages.back().language = hunspell_dictionary->GetLanguage(); | 191 bdict_languages.back().language = hunspell_dictionary->GetLanguage(); |
192 bdict_languages.back().file = | 192 bdict_languages.back().file = |
193 hunspell_dictionary->GetDictionaryFile().IsValid() | 193 hunspell_dictionary->GetDictionaryFile().IsValid() |
194 ? IPC::GetFileHandleForProcess( | 194 ? IPC::GetPlatformFileForTransit( |
195 hunspell_dictionary->GetDictionaryFile().GetPlatformFile(), | 195 hunspell_dictionary->GetDictionaryFile().GetPlatformFile(), |
196 process->GetHandle(), false) | 196 false) |
197 : IPC::InvalidPlatformFileForTransit(); | 197 : IPC::InvalidPlatformFileForTransit(); |
198 } | 198 } |
199 | 199 |
200 bool enabled = prefs->GetBoolean(prefs::kEnableContinuousSpellcheck) && | 200 bool enabled = prefs->GetBoolean(prefs::kEnableContinuousSpellcheck) && |
201 !bdict_languages.empty(); | 201 !bdict_languages.empty(); |
202 process->Send(new SpellCheckMsg_Init( | 202 process->Send(new SpellCheckMsg_Init( |
203 bdict_languages, | 203 bdict_languages, |
204 enabled ? custom_dictionary_->GetWords() : std::set<std::string>())); | 204 enabled ? custom_dictionary_->GetWords() : std::set<std::string>())); |
205 process->Send(new SpellCheckMsg_EnableSpellCheck(enabled)); | 205 process->Send(new SpellCheckMsg_EnableSpellCheck(enabled)); |
206 } | 206 } |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 chrome::spellcheck_common::GetISOLanguageCountryCodeFromLocale( | 372 chrome::spellcheck_common::GetISOLanguageCountryCodeFromLocale( |
373 feedback_language, &language_code, &country_code); | 373 feedback_language, &language_code, &country_code); |
374 feedback_sender_->OnLanguageCountryChange(language_code, country_code); | 374 feedback_sender_->OnLanguageCountryChange(language_code, country_code); |
375 if (SpellingServiceClient::IsAvailable( | 375 if (SpellingServiceClient::IsAvailable( |
376 context_, SpellingServiceClient::SPELLCHECK)) { | 376 context_, SpellingServiceClient::SPELLCHECK)) { |
377 feedback_sender_->StartFeedbackCollection(); | 377 feedback_sender_->StartFeedbackCollection(); |
378 } else { | 378 } else { |
379 feedback_sender_->StopFeedbackCollection(); | 379 feedback_sender_->StopFeedbackCollection(); |
380 } | 380 } |
381 } | 381 } |
OLD | NEW |