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_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 Loading... | |
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) { |
72 | |
73 const base::CommandLine* command_line = | |
74 base::CommandLine::ForCurrentProcess(); | |
75 if (command_line->HasSwitch(switches::kEnableMultilingualSpellChecker)) { | |
76 user_prefs->RegisterStringPref( | |
77 prefs::kSpellCheckDictionaries, | |
78 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY), | |
79 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
80 } | |
81 | |
70 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. | 82 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. |
71 user_prefs->RegisterStringPref( | 83 user_prefs->RegisterStringPref( |
72 prefs::kSpellCheckDictionary, | 84 prefs::kSpellCheckDictionary, |
please use gerrit instead
2015/02/23 18:51:47
No need to register kSpellCheckDictionary pref whe
Klemen Forstnerič
2015/02/24 21:57:45
Done. Do I also create a separate IDS_SPELLCHECK_D
please use gerrit instead
2015/02/24 23:38:38
Let's use the new IDS_SPELLCHECK_DICTIONARIES, bec
Klemen Forstnerič
2015/02/25 10:00:00
I agree, I will make the change.
| |
73 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY), | 85 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY), |
74 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 86 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
75 user_prefs->RegisterBooleanPref( | 87 user_prefs->RegisterBooleanPref( |
76 prefs::kSpellCheckUseSpellingService, | 88 prefs::kSpellCheckUseSpellingService, |
77 false, | 89 false, |
78 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 90 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
79 user_prefs->RegisterBooleanPref( | 91 user_prefs->RegisterBooleanPref( |
80 prefs::kEnableContinuousSpellcheck, | 92 prefs::kEnableContinuousSpellcheck, |
81 true, | 93 true, |
82 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 94 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
83 user_prefs->RegisterBooleanPref( | 95 user_prefs->RegisterBooleanPref( |
84 prefs::kEnableAutoSpellCorrect, | 96 prefs::kEnableAutoSpellCorrect, |
85 false, | 97 false, |
86 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 98 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
87 } | 99 } |
88 | 100 |
89 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse( | 101 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse( |
90 content::BrowserContext* context) const { | 102 content::BrowserContext* context) const { |
91 return chrome::GetBrowserContextRedirectedInIncognito(context); | 103 return chrome::GetBrowserContextRedirectedInIncognito(context); |
92 } | 104 } |
93 | 105 |
94 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const { | 106 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const { |
95 return true; | 107 return true; |
96 } | 108 } |
OLD | NEW |