From 154a4338764560595dd49305a2343985f728c935 Mon Sep 17 00:00:00 2001 From: "sidchat@google.com" Date: Wed, 3 Jun 2009 20:20:58 +0000 Subject: UI Support for Auto Spell Correct. Currently, it is still under the command line flag --auto-spell-correct, which means that this UI support will appear only when the command line flag is enabled.BUG=www.crbug.com/13102TEST=enable this feature through the command line flag --auto-spell-correct and then use the Languages Options menu check box to toggle this feature on/off - test by typing "teh" in a text box. Review URL: http://codereview.chromium.org/119002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@17528 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/profile.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'chrome/browser/profile.cc') diff --git a/chrome/browser/profile.cc b/chrome/browser/profile.cc index c859c02..513eb28 100644 --- a/chrome/browser/profile.cc +++ b/chrome/browser/profile.cc @@ -70,6 +70,7 @@ void Profile::RegisterUserPrefs(PrefService* prefs) { prefs->RegisterLocalizedStringPref(prefs::kSpellCheckDictionary, IDS_SPELLCHECK_DICTIONARY); prefs->RegisterBooleanPref(prefs::kEnableSpellCheck, true); + prefs->RegisterBooleanPref(prefs::kEnableAutoSpellCorrect, true); prefs->RegisterBooleanPref(prefs::kEnableUserScripts, false); prefs->RegisterStringPref(prefs::kCurrentThemeID, L""); prefs->RegisterDictionaryPref(prefs::kCurrentThemeImages); @@ -406,6 +407,7 @@ ProfileImpl::ProfileImpl(const FilePath& path) PrefService* prefs = GetPrefs(); prefs->AddPrefObserver(prefs::kSpellCheckDictionary, this); prefs->AddPrefObserver(prefs::kEnableSpellCheck, this); + prefs->AddPrefObserver(prefs::kEnableAutoSpellCorrect, this); #ifdef CHROME_PERSONALIZATION if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisableP13n)) @@ -477,6 +479,7 @@ ProfileImpl::~ProfileImpl() { PrefService* prefs = GetPrefs(); prefs->RemovePrefObserver(prefs::kSpellCheckDictionary, this); prefs->RemovePrefObserver(prefs::kEnableSpellCheck, this); + prefs->RemovePrefObserver(prefs::kEnableAutoSpellCorrect, this); #ifdef CHROME_PERSONALIZATION personalization_.reset(); @@ -924,6 +927,12 @@ void ProfileImpl::InitializeSpellChecker(bool need_to_broadcast) { spellchecker_ = NULL; } + // Set auto spell correct status for spellchecker. + if (spellchecker_) { + spellchecker_->EnableAutoSpellCorrect( + prefs->GetBoolean(prefs::kEnableAutoSpellCorrect)); + } + if (need_to_broadcast && io_thread) { // Notify resource message filters. SpellcheckerReinitializedDetails scoped_spellchecker; scoped_spellchecker.spellchecker = spellchecker_; @@ -971,7 +980,8 @@ void ProfileImpl::Observe(NotificationType type, PrefService* prefs = Source(source).ptr(); DCHECK(pref_name_in && prefs); if (*pref_name_in == prefs::kSpellCheckDictionary || - *pref_name_in == prefs::kEnableSpellCheck) { + *pref_name_in == prefs::kEnableSpellCheck || + *pref_name_in == prefs::kEnableAutoSpellCorrect) { InitializeSpellChecker(true); } } else if (NotificationType::THEME_INSTALLED == type) { -- cgit v1.1