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

Unified Diff: chrome/browser/content_settings/content_settings_policy_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: "remove commented code" 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_policy_provider.cc
diff --git a/chrome/browser/content_settings/content_settings_policy_provider.cc b/chrome/browser/content_settings/content_settings_policy_provider.cc
index a13ca7724a898b9690856df2a28af3a53cf49f33..b1197d601948ade93cae05904423a2944a768f84 100644
--- a/chrome/browser/content_settings/content_settings_policy_provider.cc
+++ b/chrome/browser/content_settings/content_settings_policy_provider.cc
@@ -17,7 +17,6 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
#include "content/browser/browser_thread.h"
-#include "content/common/notification_details.h"
#include "content/common/notification_service.h"
#include "content/common/notification_source.h"
#include "webkit/plugins/npapi/plugin_group.h"
@@ -277,12 +276,12 @@ void PolicyProvider::RegisterUserPrefs(PrefService* prefs) {
PrefService::UNSYNCABLE_PREF);
}
-PolicyProvider::PolicyProvider(HostContentSettingsMap* map,
+PolicyProvider::PolicyProvider(Observer* observer,
PrefService* prefs,
DefaultProviderInterface* default_provider)
- : host_content_settings_map_(map),
- prefs_(prefs),
+ : prefs_(prefs),
default_provider_(default_provider) {
+ AddObserver(observer);
ReadManagedContentSettings(false);
pref_change_registrar_.Init(prefs_);
@@ -428,22 +427,11 @@ void PolicyProvider::ClearAllContentSettingsRules(
void PolicyProvider::ShutdownOnUIThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ RemoveAllObservers();
if (!prefs_)
return;
pref_change_registrar_.RemoveAll();
prefs_ = NULL;
- host_content_settings_map_ = NULL;
-}
-
-void PolicyProvider::NotifyObservers(
- const ContentSettingsDetails& details) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (host_content_settings_map_ == NULL)
- return;
- NotificationService::current()->Notify(
- chrome::NOTIFICATION_CONTENT_SETTINGS_CHANGED,
- Source<HostContentSettingsMap>(host_content_settings_map_),
- Details<const ContentSettingsDetails>(&details));
}
void PolicyProvider::Observe(int type,
@@ -466,11 +454,10 @@ void PolicyProvider::Observe(int type,
*name == prefs::kManagedPopupsAllowedForUrls ||
*name == prefs::kManagedPopupsBlockedForUrls) {
ReadManagedContentSettings(true);
- 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";

Powered by Google App Engine
This is Rietveld 408576698