Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: chrome/browser/spellchecker/spellcheck_factory.cc

Issue 1156473007: Enables the user to select multiple languages for spellchecking (UI) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed some bugs and handled the spelling service. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/profiles/incognito_helpers.h" 8 #include "chrome/browser/profiles/incognito_helpers.h"
9 #include "chrome/browser/spellchecker/spellcheck_service.h" 9 #include "chrome/browser/spellchecker/spellcheck_service.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
11 #include "chrome/common/spellcheck_common.h"
11 #include "chrome/grit/locale_settings.h" 12 #include "chrome/grit/locale_settings.h"
12 #include "components/keyed_service/content/browser_context_dependency_manager.h" 13 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 #include "components/pref_registry/pref_registry_syncable.h" 14 #include "components/pref_registry/pref_registry_syncable.h"
14 #include "components/user_prefs/user_prefs.h" 15 #include "components/user_prefs/user_prefs.h"
15 #include "content/public/browser/browser_context.h" 16 #include "content/public/browser/browser_context.h"
16 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
17 #include "ui/base/l10n/l10n_util.h" 18 #include "ui/base/l10n/l10n_util.h"
18 19
19 // static 20 // static
20 SpellcheckService* SpellcheckServiceFactory::GetForContext( 21 SpellcheckService* SpellcheckServiceFactory::GetForContext(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // Instantiates Metrics object for spellchecking for use. 63 // Instantiates Metrics object for spellchecking for use.
63 spellcheck->StartRecordingMetrics( 64 spellcheck->StartRecordingMetrics(
64 prefs->GetBoolean(prefs::kEnableContinuousSpellcheck)); 65 prefs->GetBoolean(prefs::kEnableContinuousSpellcheck));
65 66
66 return spellcheck; 67 return spellcheck;
67 } 68 }
68 69
69 void SpellcheckServiceFactory::RegisterProfilePrefs( 70 void SpellcheckServiceFactory::RegisterProfilePrefs(
70 user_prefs::PrefRegistrySyncable* user_prefs) { 71 user_prefs::PrefRegistrySyncable* user_prefs) {
71 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string. 72 // TODO(estade): IDS_SPELLCHECK_DICTIONARY should be an ASCII string.
72 user_prefs->RegisterStringPref( 73
73 prefs::kSpellCheckDictionary, 74 if (chrome::spellcheck_common::IsMultilingualSpellcheckEnabled()) {
74 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY)); 75 user_prefs->RegisterStringPref(
76 prefs::kSpellCheckDictionaries,
77 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY));
78 } else {
79 user_prefs->RegisterStringPref(
80 prefs::kSpellCheckDictionary,
81 l10n_util::GetStringUTF8(IDS_SPELLCHECK_DICTIONARY));
82 }
75 user_prefs->RegisterBooleanPref(prefs::kSpellCheckUseSpellingService, false); 83 user_prefs->RegisterBooleanPref(prefs::kSpellCheckUseSpellingService, false);
76 user_prefs->RegisterBooleanPref( 84 user_prefs->RegisterBooleanPref(
77 prefs::kEnableContinuousSpellcheck, 85 prefs::kEnableContinuousSpellcheck,
78 true, 86 true,
79 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 87 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
80 user_prefs->RegisterBooleanPref( 88 user_prefs->RegisterBooleanPref(
81 prefs::kEnableAutoSpellCorrect, 89 prefs::kEnableAutoSpellCorrect,
82 false, 90 false,
83 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); 91 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
84 } 92 }
85 93
86 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse( 94 content::BrowserContext* SpellcheckServiceFactory::GetBrowserContextToUse(
87 content::BrowserContext* context) const { 95 content::BrowserContext* context) const {
88 return chrome::GetBrowserContextRedirectedInIncognito(context); 96 return chrome::GetBrowserContextRedirectedInIncognito(context);
89 } 97 }
90 98
91 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const { 99 bool SpellcheckServiceFactory::ServiceIsNULLWhileTesting() const {
92 return true; 100 return true;
93 } 101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698