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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. |
71 user_prefs->RegisterStringPref( | 73 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
72 prefs::kSpellCheckDictionary, | 74 switches::kEnableMultilingualSpellChecker)) { |
groby-ooo-7-16
2015/03/03 17:54:34
How is preference migration handled? (I.e. what ha
| |
73 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY), | 75 user_prefs->RegisterStringPref( |
74 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 76 prefs::kSpellCheckDictionaries, |
77 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY), | |
78 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
79 } else { | |
80 user_prefs->RegisterStringPref( | |
81 prefs::kSpellCheckDictionary, | |
82 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY), | |
83 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
Dan Beam
2015/03/02 22:40:08
do these preferences need to be migrated?
groby-ooo-7-16
2015/03/03 17:54:34
Heh. That was off-screen when I asked :)
| |
84 } | |
85 | |
75 user_prefs->RegisterBooleanPref( | 86 user_prefs->RegisterBooleanPref( |
76 prefs::kSpellCheckUseSpellingService, | 87 prefs::kSpellCheckUseSpellingService, |
77 false, | 88 false, |
78 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 89 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
79 user_prefs->RegisterBooleanPref( | 90 user_prefs->RegisterBooleanPref( |
80 prefs::kEnableContinuousSpellcheck, | 91 prefs::kEnableContinuousSpellcheck, |
81 true, | 92 true, |
82 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 93 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
83 user_prefs->RegisterBooleanPref( | 94 user_prefs->RegisterBooleanPref( |
84 prefs::kEnableAutoSpellCorrect, | 95 prefs::kEnableAutoSpellCorrect, |
85 false, | 96 false, |
86 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 97 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
87 } | 98 } |
88 | 99 |
89 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse( | 100 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse( |
90 content::BrowserContext* context) const { | 101 content::BrowserContext* context) const { |
91 return chrome::GetBrowserContextRedirectedInIncognito(context); | 102 return chrome::GetBrowserContextRedirectedInIncognito(context); |
92 } | 103 } |
93 | 104 |
94 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const { | 105 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const { |
95 return true; | 106 return true; |
96 } | 107 } |
OLD | NEW |