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

Unified Diff: chrome/browser/spellchecker/spellcheck_profile.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head for commit Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/spellchecker/spellcheck_profile.cc
diff --git a/chrome/browser/spellchecker/spellcheck_profile.cc b/chrome/browser/spellchecker/spellcheck_profile.cc
index 09375c500934736cf4772b506808d4b5d1d90db3..256251a02753187c86c9391349a6277ec09a73bc 100644
--- a/chrome/browser/spellchecker/spellcheck_profile.cc
+++ b/chrome/browser/spellchecker/spellcheck_profile.cc
@@ -112,26 +112,19 @@ void SpellCheckProfile::Shutdown() {
profile_ = NULL;
}
-void SpellCheckProfile::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- switch (type) {
- case chrome::NOTIFICATION_PREF_CHANGED: {
- std::string* pref_name_in = content::Details<std::string>(details).ptr();
- PrefService* prefs = content::Source<PrefService>(source).ptr();
- DCHECK(pref_name_in && prefs);
- if (*pref_name_in == prefs::kSpellCheckDictionary ||
- *pref_name_in == prefs::kEnableSpellCheck) {
- ReinitializeSpellCheckHost(true);
- } else if (*pref_name_in == prefs::kEnableAutoSpellCorrect) {
- bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect);
- for (content::RenderProcessHost::iterator i(
- content::RenderProcessHost::AllHostsIterator());
- !i.IsAtEnd(); i.Advance()) {
- content::RenderProcessHost* process = i.GetCurrentValue();
- process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled));
- }
- }
+void SpellCheckProfile::OnPreferenceChanged(PrefServiceBase* prefs,
+ const std::string& pref_name_in) {
+ DCHECK(prefs);
+ if (pref_name_in == prefs::kSpellCheckDictionary ||
+ pref_name_in == prefs::kEnableSpellCheck) {
+ ReinitializeSpellCheckHost(true);
+ } else if (pref_name_in == prefs::kEnableAutoSpellCorrect) {
+ bool enabled = prefs->GetBoolean(prefs::kEnableAutoSpellCorrect);
+ for (content::RenderProcessHost::iterator i(
+ content::RenderProcessHost::AllHostsIterator());
+ !i.IsAtEnd(); i.Advance()) {
+ content::RenderProcessHost* process = i.GetCurrentValue();
+ process->Send(new SpellCheckMsg_EnableAutoSpellCorrect(enabled));
}
}
}
« no previous file with comments | « chrome/browser/spellchecker/spellcheck_profile.h ('k') | chrome/browser/sync/credential_cache_service_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698