diff options
author | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 20:20:58 +0000 |
---|---|---|
committer | sidchat@google.com <sidchat@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-03 20:20:58 +0000 |
commit | 154a4338764560595dd49305a2343985f728c935 (patch) | |
tree | 4ba37d24a2f4980c27145af7c46cd5fdcf1f49a9 /chrome/browser/profile.cc | |
parent | 7822e018e5ebabeeb3e8ff46aa67a52b1b1c1cf8 (diff) | |
download | chromium_src-154a4338764560595dd49305a2343985f728c935.zip chromium_src-154a4338764560595dd49305a2343985f728c935.tar.gz chromium_src-154a4338764560595dd49305a2343985f728c935.tar.bz2 |
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
Diffstat (limited to 'chrome/browser/profile.cc')
-rw-r--r-- | chrome/browser/profile.cc | 12 |
1 files changed, 11 insertions, 1 deletions
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<PrefService>(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) { |