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/browser_context.h" | 17 #include "content/public/browser/browser_context.h" |
16 #include "content/public/browser/render_process_host.h" | 18 #include "content/public/browser/render_process_host.h" |
17 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
18 | 20 |
19 // static | 21 // static |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 // Instantiates Metrics object for spellchecking for use. | 64 // Instantiates Metrics object for spellchecking for use. |
63 spellcheck->StartRecordingMetrics( | 65 spellcheck->StartRecordingMetrics( |
64 prefs->GetBoolean(prefs::kEnableContinuousSpellcheck)); | 66 prefs->GetBoolean(prefs::kEnableContinuousSpellcheck)); |
65 | 67 |
66 return spellcheck; | 68 return spellcheck; |
67 } | 69 } |
68 | 70 |
69 void SpellcheckServiceFactory::RegisterProfilePrefs( | 71 void SpellcheckServiceFactory::RegisterProfilePrefs( |
70 user_prefs::PrefRegistrySyncable* user_prefs) { | 72 user_prefs::PrefRegistrySyncable* user_prefs) { |
71 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. | 73 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. |
72 user_prefs->RegisterStringPref( | 74 |
73 prefs::kSpellCheckDictionary, | 75 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
74 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY)); | 76 switches::kEnableMultilingualSpellChecker)) { |
Julius
2015/06/03 21:18:39
This should suffice for now but a TODO has been ad
| |
77 user_prefs->RegisterStringPref( | |
78 prefs::kSpellCheckDictionaries, | |
79 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY), | |
80 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
Julius
2015/06/03 21:18:39
This should suffice for now but a TODO has been ad
| |
81 } else { | |
82 user_prefs->RegisterStringPref( | |
83 prefs::kSpellCheckDictionary, | |
84 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY), | |
85 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | |
86 } | |
87 | |
75 user_prefs->RegisterBooleanPref(prefs::kSpellCheckUseSpellingService, false); | 88 user_prefs->RegisterBooleanPref(prefs::kSpellCheckUseSpellingService, false); |
76 user_prefs->RegisterBooleanPref( | 89 user_prefs->RegisterBooleanPref( |
77 prefs::kEnableContinuousSpellcheck, | 90 prefs::kEnableContinuousSpellcheck, |
78 true, | 91 true, |
79 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 92 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
80 user_prefs->RegisterBooleanPref( | 93 user_prefs->RegisterBooleanPref( |
81 prefs::kEnableAutoSpellCorrect, | 94 prefs::kEnableAutoSpellCorrect, |
82 false, | 95 false, |
83 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 96 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
84 } | 97 } |
85 | 98 |
86 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse( | 99 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse( |
87 content::BrowserContext* context) const { | 100 content::BrowserContext* context) const { |
88 return chrome::GetBrowserContextRedirectedInIncognito(context); | 101 return chrome::GetBrowserContextRedirectedInIncognito(context); |
89 } | 102 } |
90 | 103 |
91 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const { | 104 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const { |
92 return true; | 105 return true; |
93 } | 106 } |
OLD | NEW |