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

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

Issue 654653002: Enables the user to select multiple languages for spellchecking (UI) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments. Created 5 years, 10 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_factory.h" 5 #include "chrome/browser/spellchecker/spellcheck_factory.h"
6 6
7 #include "base/command_line.h"
7 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/profiles/incognito_helpers.h" 9 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "chrome/browser/spellchecker/spellcheck_service.h" 10 #include "chrome/browser/spellchecker/spellcheck_service.h"
11 #include "chrome/common/chrome_switches.h"
10 #include "chrome/common/pref_names.h" 12 #include "chrome/common/pref_names.h"
11 #include "chrome/grit/locale_settings.h" 13 #include "chrome/grit/locale_settings.h"
12 #include "components/keyed_service/content/browser_context_dependency_manager.h" 14 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 #include "components/pref_registry/pref_registry_syncable.h" 15 #include "components/pref_registry/pref_registry_syncable.h"
14 #include "components/user_prefs/user_prefs.h" 16 #include "components/user_prefs/user_prefs.h"
15 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
16 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
17 19
18 // static 20 // static
19 SpellcheckService* SpellcheckServiceFactory::GetForContext( 21 SpellcheckService* SpellcheckServiceFactory::GetForContext(
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 62
61 // Instantiates Metrics object for spellchecking for use. 63 // Instantiates Metrics object for spellchecking for use.
62 spellcheck->StartRecordingMetrics( 64 spellcheck->StartRecordingMetrics(
63 prefs->GetBoolean(prefs::kEnableContinuousSpellcheck)); 65 prefs->GetBoolean(prefs::kEnableContinuousSpellcheck));
64 66
65 return spellcheck; 67 return spellcheck;
66 } 68 }
67 69
68 void SpellcheckServiceFactory::RegisterProfilePrefs( 70 void SpellcheckServiceFactory::RegisterProfilePrefs(
69 user_prefs::PrefRegistrySyncable* user_prefs) { 71 user_prefs::PrefRegistrySyncable* user_prefs) {
70 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. 72
71 user_prefs->RegisterStringPref( 73 const base::CommandLine* command_line =
72 prefs::kSpellCheckDictionary, 74 base::CommandLine::ForCurrentProcess();
73 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY), 75
74 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 76 if (command_line->HasSwitch(switches::kEnableMultilingualSpellChecker)) {
77 user_prefs->RegisterStringPref(
78 prefs::kSpellCheckDictionaries,
79 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY),
80 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
81 } else {
82 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string.
please use gerrit instead 2015/02/24 23:38:38 This TODO applies to both clauses of the if statem
Klemen Forstnerič 2015/02/25 09:48:23 Done.
83 user_prefs->RegisterStringPref(
84 prefs::kSpellCheckDictionary,
85 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY),
86 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
87 }
88
75 user_prefs->RegisterBooleanPref( 89 user_prefs->RegisterBooleanPref(
76 prefs::kSpellCheckUseSpellingService, 90 prefs::kSpellCheckUseSpellingService,
77 false, 91 false,
78 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 92 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
79 user_prefs->RegisterBooleanPref( 93 user_prefs->RegisterBooleanPref(
80 prefs::kEnableContinuousSpellcheck, 94 prefs::kEnableContinuousSpellcheck,
81 true, 95 true,
82 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 96 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
83 user_prefs->RegisterBooleanPref( 97 user_prefs->RegisterBooleanPref(
84 prefs::kEnableAutoSpellCorrect, 98 prefs::kEnableAutoSpellCorrect,
85 false, 99 false,
86 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 100 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
87 } 101 }
88 102
89 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse( 103 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse(
90 content::BrowserContext* context) const { 104 content::BrowserContext* context) const {
91 return chrome::GetBrowserContextRedirectedInIncognito(context); 105 return chrome::GetBrowserContextRedirectedInIncognito(context);
92 } 106 }
93 107
94 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const { 108 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const {
95 return true; 109 return true;
96 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698