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

Unified Diff: chrome/browser/host_content_settings_map.h

Issue 551225: Send a message to the renderers when content settings change. (Closed)
Patch Set: merge Created 10 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/host_content_settings_map.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/host_content_settings_map.h
diff --git a/chrome/browser/host_content_settings_map.h b/chrome/browser/host_content_settings_map.h
index 658225ae2d533bff735e1c73f0208514ba8f239a..509fa9dc206f097ea6db501d4113c5ace57a6dce 100644
--- a/chrome/browser/host_content_settings_map.h
+++ b/chrome/browser/host_content_settings_map.h
@@ -25,6 +25,22 @@ class Profile;
class HostContentSettingsMap
: public base::RefCountedThreadSafe<HostContentSettingsMap> {
public:
+ // Details for the CONTENT_SETTINGS_CHANGED notification. This is sent when
+ // content settings change for at least one host. If settings change for more
+ // than one host in one user interaction, this will usually send a single
+ // notification with a wildcard host field instead of one notification for
+ // each host.
+ class ContentSettingsDetails {
+ public:
+ ContentSettingsDetails(const std::string& host) : host_(host) {}
+ // The host whose settings have changed. Empty if many hosts are affected
+ // (e.g. if the default settings have changed).
+ const std::string& host() { return host_; }
+
+ private:
+ std::string host_;
+ };
+
typedef std::pair<std::string, ContentSetting> HostSettingPair;
typedef std::vector<HostSettingPair> SettingsForOneType;
@@ -114,6 +130,12 @@ class HostContentSettingsMap
// Returns true if |settings| consists entirely of CONTENT_SETTING_DEFAULT.
bool AllDefault(const ContentSettings& settings) const;
+ // Informs observers that content settings have changed. Make sure that
+ // |lock_| is not held when calling this, as listeners will usually call one
+ // of the GetSettings functions in response, which would then lead to a
+ // mutex deadlock.
+ void NotifyObservers(const std::string& host);
+
// The profile we're associated with.
Profile* profile_;
« no previous file with comments | « no previous file | chrome/browser/host_content_settings_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698