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/prefs/pref_member.h" | 7 #include "base/prefs/pref_member.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 void SpellcheckService::InitForRenderer(content::RenderProcessHost* process) { | 158 void SpellcheckService::InitForRenderer(content::RenderProcessHost* process) { |
159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
160 | 160 |
161 content::BrowserContext* context = process->GetBrowserContext(); | 161 content::BrowserContext* context = process->GetBrowserContext(); |
162 if (SpellcheckServiceFactory::GetForContext(context) != this) | 162 if (SpellcheckServiceFactory::GetForContext(context) != this) |
163 return; | 163 return; |
164 | 164 |
165 PrefService* prefs = user_prefs::UserPrefs::Get(context); | 165 PrefService* prefs = user_prefs::UserPrefs::Get(context); |
166 IPC::PlatformFileForTransit file = IPC::InvalidPlatformFileForTransit(); | 166 IPC::PlatformFileForTransit file = IPC::InvalidPlatformFileForTransit(); |
167 | 167 |
168 if (hunspell_dictionary_->GetDictionaryFile() != | 168 if (hunspell_dictionary_->GetDictionaryFile().IsValid()) { |
169 base::kInvalidPlatformFileValue) { | |
170 file = IPC::GetFileHandleForProcess( | 169 file = IPC::GetFileHandleForProcess( |
171 hunspell_dictionary_->GetDictionaryFile(), process->GetHandle(), false); | 170 hunspell_dictionary_->GetDictionaryFile().GetPlatformFile(), |
| 171 process->GetHandle(), false); |
172 } | 172 } |
173 | 173 |
174 process->Send(new SpellCheckMsg_Init( | 174 process->Send(new SpellCheckMsg_Init( |
175 file, | 175 file, |
176 custom_dictionary_->GetWords(), | 176 custom_dictionary_->GetWords(), |
177 hunspell_dictionary_->GetLanguage(), | 177 hunspell_dictionary_->GetLanguage(), |
178 prefs->GetBoolean(prefs::kEnableAutoSpellCorrect))); | 178 prefs->GetBoolean(prefs::kEnableAutoSpellCorrect))); |
179 process->Send(new SpellCheckMsg_EnableSpellCheck( | 179 process->Send(new SpellCheckMsg_EnableSpellCheck( |
180 prefs->GetBoolean(prefs::kEnableContinuousSpellcheck))); | 180 prefs->GetBoolean(prefs::kEnableContinuousSpellcheck))); |
181 } | 181 } |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } | 308 } |
309 | 309 |
310 void SpellcheckService::UpdateFeedbackSenderState() { | 310 void SpellcheckService::UpdateFeedbackSenderState() { |
311 if (SpellingServiceClient::IsAvailable( | 311 if (SpellingServiceClient::IsAvailable( |
312 context_, SpellingServiceClient::SPELLCHECK)) { | 312 context_, SpellingServiceClient::SPELLCHECK)) { |
313 feedback_sender_->StartFeedbackCollection(); | 313 feedback_sender_->StartFeedbackCollection(); |
314 } else { | 314 } else { |
315 feedback_sender_->StopFeedbackCollection(); | 315 feedback_sender_->StopFeedbackCollection(); |
316 } | 316 } |
317 } | 317 } |
OLD | NEW |