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

Unified Diff: chrome/browser/content_settings/content_settings_pref_provider.cc

Issue 7344008: Make the hcsm and its providers communicate via an observer interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 5 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/content_settings/content_settings_pref_provider.cc
diff --git a/chrome/browser/content_settings/content_settings_pref_provider.cc b/chrome/browser/content_settings/content_settings_pref_provider.cc
index e6c7c90fc9c84d76dba6edd87736e93321e246c6..1db3c4a370c266b7e0b701583a791db138915e7a 100644
--- a/chrome/browser/content_settings/content_settings_pref_provider.cc
+++ b/chrome/browser/content_settings/content_settings_pref_provider.cc
@@ -24,7 +24,6 @@
#include "chrome/common/pref_names.h"
#include "content/browser/browser_thread.h"
#include "content/browser/user_metrics.h"
-#include "content/common/notification_details.h"
#include "content/common/notification_service.h"
#include "content/common/notification_source.h"
#include "googleurl/src/gurl.h"
@@ -384,11 +383,9 @@ void PrefProvider::RegisterUserPrefs(PrefService* prefs) {
PrefService::UNSYNCABLE_PREF);
}
-PrefProvider::PrefProvider(HostContentSettingsMap* map,
- PrefService* prefs,
+PrefProvider::PrefProvider(PrefService* prefs,
bool incognito)
: prefs_(prefs),
- host_content_settings_map_(map),
is_incognito_(incognito),
updating_preferences_(false) {
DCHECK(prefs_);
@@ -520,9 +517,8 @@ void PrefProvider::SetContentSetting(
setting);
}
- ContentSettingsDetails details(
+ NotifyObservers(
primary_pattern, secondary_pattern, content_type, resource_identifier);
- NotifyObservers(details);
}
void PrefProvider::ClearAllContentSettingsRules(
@@ -554,19 +550,17 @@ void PrefProvider::ClearAllContentSettingsRules(
}
}
- ContentSettingsDetails details(
- ContentSettingsPattern(),
- ContentSettingsPattern(),
- content_type,
- std::string());
- NotifyObservers(details);
+ NotifyObservers(ContentSettingsPattern(),
+ ContentSettingsPattern(),
+ content_type,
+ std::string());
}
void PrefProvider::Observe(
int type,
const NotificationSource& source,
const NotificationDetails& details) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (type == chrome::NOTIFICATION_PREF_CHANGED) {
DCHECK_EQ(prefs_, Source<PrefService>(source).ptr());
@@ -586,11 +580,10 @@ void PrefProvider::Observe(
return;
}
- ContentSettingsDetails details(ContentSettingsPattern(),
- ContentSettingsPattern(),
- CONTENT_SETTINGS_TYPE_DEFAULT,
- std::string());
- NotifyObservers(details);
+ NotifyObservers(ContentSettingsPattern(),
+ ContentSettingsPattern(),
+ CONTENT_SETTINGS_TYPE_DEFAULT,
+ std::string());
} else {
NOTREACHED() << "Unexpected notification";
}
@@ -897,22 +890,12 @@ void PrefProvider::CanonicalizeContentSettingsExceptions(
}
}
-void PrefProvider::NotifyObservers(
- const ContentSettingsDetails& details) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(host_content_settings_map_);
- NotificationService::current()->Notify(
- chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED,
- Source<HostContentSettingsMap>(host_content_settings_map_),
- Details<const ContentSettingsDetails>(&details));
-}
-
void PrefProvider::ShutdownOnUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(prefs_);
+ RemoveAllObservers();
pref_change_registrar_.RemoveAll();
prefs_ = NULL;
- host_content_settings_map_ = NULL;
}
void PrefProvider::MigrateObsoletePerhostPref() {

Powered by Google App Engine
This is Rietveld 408576698