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" | |
please use gerrit instead
2015/06/06 01:42:12
Unused include.
There's an OK-ish tool to detect
Julius
2015/06/12 20:10:14
Done.
| |
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" | |
please use gerrit instead
2015/06/06 01:42:12
Unused include.
Julius
2015/06/12 20:10:14
Done.
| |
10 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
13 #include "chrome/common/spellcheck_common.h" | |
11 #include "chrome/grit/locale_settings.h" | 14 #include "chrome/grit/locale_settings.h" |
12 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
13 #include "components/pref_registry/pref_registry_syncable.h" | 16 #include "components/pref_registry/pref_registry_syncable.h" |
14 #include "components/user_prefs/user_prefs.h" | 17 #include "components/user_prefs/user_prefs.h" |
15 #include "content/public/browser/browser_context.h" | 18 #include "content/public/browser/browser_context.h" |
16 #include "content/public/browser/render_process_host.h" | 19 #include "content/public/browser/render_process_host.h" |
17 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
18 | 21 |
19 // static | 22 // static |
20 SpellcheckService* SpellcheckServiceFactory::GetForContext( | 23 SpellcheckService* SpellcheckServiceFactory::GetForContext( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 // Instantiates Metrics object for spellchecking for use. | 65 // Instantiates Metrics object for spellchecking for use. |
63 spellcheck->StartRecordingMetrics( | 66 spellcheck->StartRecordingMetrics( |
64 prefs->GetBoolean(prefs::kEnableContinuousSpellcheck)); | 67 prefs->GetBoolean(prefs::kEnableContinuousSpellcheck)); |
65 | 68 |
66 return spellcheck; | 69 return spellcheck; |
67 } | 70 } |
68 | 71 |
69 void SpellcheckServiceFactory::RegisterProfilePrefs( | 72 void SpellcheckServiceFactory::RegisterProfilePrefs( |
70 user_prefs::PrefRegistrySyncable* user_prefs) { | 73 user_prefs::PrefRegistrySyncable* user_prefs) { |
71 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. | 74 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. |
72 user_prefs->RegisterStringPref( | 75 |
73 prefs::kSpellCheckDictionary, | 76 // TODO(juliusa): Implement preference migration between multilingual |
74 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY)); | 77 // spellchecking and single-language spellchecking. |
78 if (chrome::spellcheck_common::MultilingualSpellcheckIsEnabled()) { | |
79 user_prefs->RegisterStringPref( | |
80 prefs::kSpellCheckDictionaries, | |
81 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY), | |
82 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | |
83 } else { | |
84 user_prefs->RegisterStringPref( | |
85 prefs::kSpellCheckDictionary, | |
86 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY), | |
87 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | |
88 } | |
89 | |
75 user_prefs->RegisterBooleanPref(prefs::kSpellCheckUseSpellingService, false); | 90 user_prefs->RegisterBooleanPref(prefs::kSpellCheckUseSpellingService, false); |
76 user_prefs->RegisterBooleanPref( | 91 user_prefs->RegisterBooleanPref( |
77 prefs::kEnableContinuousSpellcheck, | 92 prefs::kEnableContinuousSpellcheck, |
78 true, | 93 true, |
79 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 94 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
80 user_prefs->RegisterBooleanPref( | 95 user_prefs->RegisterBooleanPref( |
81 prefs::kEnableAutoSpellCorrect, | 96 prefs::kEnableAutoSpellCorrect, |
82 false, | 97 false, |
83 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 98 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
84 } | 99 } |
85 | 100 |
86 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse( | 101 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse( |
87 content::BrowserContext* context) const { | 102 content::BrowserContext* context) const { |
88 return chrome::GetBrowserContextRedirectedInIncognito(context); | 103 return chrome::GetBrowserContextRedirectedInIncognito(context); |
89 } | 104 } |
90 | 105 |
91 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const { | 106 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const { |
92 return true; | 107 return true; |
93 } | 108 } |
OLD | NEW |