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

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

Issue 121523002: [Spellcheck] Unify dictionary handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/pref_member.h" 8 #include "base/prefs/pref_member.h"
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 content::BrowserContext* context = process->GetBrowserContext(); 162 content::BrowserContext* context = process->GetBrowserContext();
163 if (SpellcheckServiceFactory::GetForContext(context) != this) 163 if (SpellcheckServiceFactory::GetForContext(context) != this)
164 return; 164 return;
165 165
166 PrefService* prefs = user_prefs::UserPrefs::Get(context); 166 PrefService* prefs = user_prefs::UserPrefs::Get(context);
167 IPC::PlatformFileForTransit file = IPC::InvalidPlatformFileForTransit(); 167 IPC::PlatformFileForTransit file = IPC::InvalidPlatformFileForTransit();
168 168
169 if (hunspell_dictionary_->GetDictionaryFile() != 169 if (hunspell_dictionary_->GetDictionaryFile() !=
170 base::kInvalidPlatformFileValue) { 170 base::kInvalidPlatformFileValue) {
171 #if defined(OS_POSIX) 171 file = IPC::GetFileHandleForProcess(
172 file = base::FileDescriptor(hunspell_dictionary_->GetDictionaryFile(), 172 hunspell_dictionary_->GetDictionaryFile(), process->GetHandle(), false);
please use gerrit instead 2013/12/30 17:21:24 DHCECK(file != base::kInvalidPlatformFileValue)
groby-ooo-7-16 2014/01/02 17:48:44 Which error is this supposed to catch?
please use gerrit instead 2014/01/02 17:54:25 This would catch ::DuplicateHandle() returning fal
groby-ooo-7-16 2014/01/02 19:15:28 Technically, DCHECK should document invalid states
173 false);
174 #elif defined(OS_WIN)
175 BOOL ok = ::DuplicateHandle(::GetCurrentProcess(),
176 hunspell_dictionary_->GetDictionaryFile(),
177 process->GetHandle(),
178 &file,
179 0,
180 false,
181 DUPLICATE_SAME_ACCESS);
182 DCHECK(ok) << ::GetLastError();
183 #endif
184 } 173 }
185 174
186 process->Send(new SpellCheckMsg_Init( 175 process->Send(new SpellCheckMsg_Init(
187 file, 176 file,
188 custom_dictionary_->GetWords(), 177 custom_dictionary_->GetWords(),
189 hunspell_dictionary_->GetLanguage(), 178 hunspell_dictionary_->GetLanguage(),
190 prefs->GetBoolean(prefs::kEnableAutoSpellCorrect))); 179 prefs->GetBoolean(prefs::kEnableAutoSpellCorrect)));
191 process->Send(new SpellCheckMsg_EnableSpellCheck( 180 process->Send(new SpellCheckMsg_EnableSpellCheck(
192 prefs->GetBoolean(prefs::kEnableContinuousSpellcheck))); 181 prefs->GetBoolean(prefs::kEnableContinuousSpellcheck)));
193 } 182 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 } 309 }
321 310
322 void SpellcheckService::UpdateFeedbackSenderState() { 311 void SpellcheckService::UpdateFeedbackSenderState() {
323 if (SpellingServiceClient::IsAvailable( 312 if (SpellingServiceClient::IsAvailable(
324 context_, SpellingServiceClient::SPELLCHECK)) { 313 context_, SpellingServiceClient::SPELLCHECK)) {
325 feedback_sender_->StartFeedbackCollection(); 314 feedback_sender_->StartFeedbackCollection();
326 } else { 315 } else {
327 feedback_sender_->StopFeedbackCollection(); 316 feedback_sender_->StopFeedbackCollection();
328 } 317 }
329 } 318 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698