| 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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/profiles/incognito_helpers.h" | 9 #include "chrome/browser/profiles/incognito_helpers.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 SpellcheckService* spellcheck = new SpellcheckService(profile); | 64 SpellcheckService* spellcheck = new SpellcheckService(profile); |
| 65 | 65 |
| 66 // Instantiates Metrics object for spellchecking for use. | 66 // Instantiates Metrics object for spellchecking for use. |
| 67 spellcheck->StartRecordingMetrics( | 67 spellcheck->StartRecordingMetrics( |
| 68 profile->GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck)); | 68 profile->GetPrefs()->GetBoolean(prefs::kEnableContinuousSpellcheck)); |
| 69 | 69 |
| 70 return spellcheck; | 70 return spellcheck; |
| 71 } | 71 } |
| 72 | 72 |
| 73 void SpellcheckServiceFactory::RegisterUserPrefs( | 73 void SpellcheckServiceFactory::RegisterUserPrefs( |
| 74 PrefRegistrySyncable* user_prefs) { | 74 user_prefs::PrefRegistrySyncable* user_prefs) { |
| 75 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. | 75 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. |
| 76 user_prefs->RegisterLocalizedStringPref( | 76 user_prefs->RegisterLocalizedStringPref( |
| 77 prefs::kSpellCheckDictionary, | 77 prefs::kSpellCheckDictionary, |
| 78 IDS_SPELLCHECK_DICTIONARY, | 78 IDS_SPELLCHECK_DICTIONARY, |
| 79 PrefRegistrySyncable::UNSYNCABLE_PREF); | 79 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 80 user_prefs->RegisterBooleanPref(prefs::kSpellCheckConfirmDialogShown, | 80 user_prefs->RegisterBooleanPref( |
| 81 false, | 81 prefs::kSpellCheckConfirmDialogShown, |
| 82 PrefRegistrySyncable::UNSYNCABLE_PREF); | 82 false, |
| 83 user_prefs->RegisterBooleanPref(prefs::kSpellCheckUseSpellingService, | 83 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 84 false, | 84 user_prefs->RegisterBooleanPref( |
| 85 PrefRegistrySyncable::UNSYNCABLE_PREF); | 85 prefs::kSpellCheckUseSpellingService, |
| 86 user_prefs->RegisterBooleanPref(prefs::kEnableContinuousSpellcheck, | 86 false, |
| 87 true, | 87 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 88 PrefRegistrySyncable::SYNCABLE_PREF); | 88 user_prefs->RegisterBooleanPref( |
| 89 user_prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, | 89 prefs::kEnableContinuousSpellcheck, |
| 90 false, | 90 true, |
| 91 PrefRegistrySyncable::SYNCABLE_PREF); | 91 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 92 user_prefs->RegisterBooleanPref( |
| 93 prefs::kEnableAutoSpellCorrect, |
| 94 false, |
| 95 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
| 92 } | 96 } |
| 93 | 97 |
| 94 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse( | 98 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse( |
| 95 content::BrowserContext* context) const { | 99 content::BrowserContext* context) const { |
| 96 return chrome::GetBrowserContextRedirectedInIncognito(context); | 100 return chrome::GetBrowserContextRedirectedInIncognito(context); |
| 97 } | 101 } |
| 98 | 102 |
| 99 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const { | 103 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const { |
| 100 return true; | 104 return true; |
| 101 } | 105 } |
| OLD | NEW |