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

Unified Diff: chrome/browser/safe_browsing/safe_browsing_tab_observer.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge LKGR. Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/safe_browsing_tab_observer.cc
diff --git a/chrome/browser/safe_browsing/safe_browsing_tab_observer.cc b/chrome/browser/safe_browsing/safe_browsing_tab_observer.cc
index 60444aec807caa37cdb1a2667d7603df7f95ed6a..06d4ca13518108496cdbecf9deb5040e514b1b7d 100644
--- a/chrome/browser/safe_browsing/safe_browsing_tab_observer.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_tab_observer.cc
@@ -55,26 +55,16 @@ SafeBrowsingTabObserver::~SafeBrowsingTabObserver() {
////////////////////////////////////////////////////////////////////////////////
// content::NotificationObserver overrides
-void SafeBrowsingTabObserver::Observe(
- int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- switch (type) {
- case chrome::NOTIFICATION_PREF_CHANGED: {
- Profile* profile =
- Profile::FromBrowserContext(web_contents_->GetBrowserContext());
- std::string* pref_name = content::Details<std::string>(details).ptr();
- DCHECK(content::Source<PrefService>(source).ptr() ==
- profile->GetPrefs());
- if (*pref_name == prefs::kSafeBrowsingEnabled) {
- UpdateSafebrowsingDetectionHost();
- } else {
- NOTREACHED() << "unexpected pref change notification" << *pref_name;
- }
- break;
- }
- default:
- NOTREACHED();
+void SafeBrowsingTabObserver::OnPreferenceChanged(
+ PrefServiceBase* service,
+ const std::string& pref_name) {
+ Profile* profile =
+ Profile::FromBrowserContext(web_contents_->GetBrowserContext());
+ DCHECK(service == profile->GetPrefs());
+ if (pref_name == prefs::kSafeBrowsingEnabled) {
+ UpdateSafebrowsingDetectionHost();
+ } else {
+ NOTREACHED() << "unexpected pref change notification" << pref_name;
}
}

Powered by Google App Engine
This is Rietveld 408576698