diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/content_setting_bubble_model.cc | 12 | ||||
-rw-r--r-- | chrome/browser/cookies_tree_model.cc | 7 | ||||
-rw-r--r-- | chrome/browser/host_content_settings_map.cc | 12 | ||||
-rw-r--r-- | chrome/browser/host_content_settings_map.h | 7 |
4 files changed, 28 insertions, 10 deletions
diff --git a/chrome/browser/content_setting_bubble_model.cc b/chrome/browser/content_setting_bubble_model.cc index 6fc78e1..6d8b902 100644 --- a/chrome/browser/content_setting_bubble_model.cc +++ b/chrome/browser/content_setting_bubble_model.cc @@ -166,16 +166,8 @@ class ContentSettingSingleRadioGroup : public ContentSettingTitleAndLinkModel { } virtual void OnRadioClicked(int radio_index) { - // Make sure there is no entry that would override the pattern we are about - // to insert for exactly this URL. - profile()->GetHostContentSettingsMap()->SetContentSetting( - HostContentSettingsMap::Pattern::FromURLNoWildcard( - bubble_content().radio_group.url), - content_type(), - CONTENT_SETTING_DEFAULT); - profile()->GetHostContentSettingsMap()->SetContentSetting( - HostContentSettingsMap::Pattern::FromURL( - bubble_content().radio_group.url), + profile()->GetHostContentSettingsMap()->AddExceptionForURL( + bubble_content().radio_group.url, content_type(), radio_index == 0 ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); } diff --git a/chrome/browser/cookies_tree_model.cc b/chrome/browser/cookies_tree_model.cc index 239a36d..a51d2cb 100644 --- a/chrome/browser/cookies_tree_model.cc +++ b/chrome/browser/cookies_tree_model.cc @@ -237,6 +237,13 @@ CookieTreeAppCachesNode* CookieTreeOriginNode::GetOrCreateAppCachesNode() { return appcaches_child_; } +void CookieTreeOriginNode::CreateContentException() { +// profile_->GetHostContentSettingsMap()->AddExceptionForURL( +// , +// CONTENT_, +// radio_index == 0 ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK); +} + /////////////////////////////////////////////////////////////////////////////// // CookieTreeCookiesNode, public: diff --git a/chrome/browser/host_content_settings_map.cc b/chrome/browser/host_content_settings_map.cc index 611b645..8742238 100644 --- a/chrome/browser/host_content_settings_map.cc +++ b/chrome/browser/host_content_settings_map.cc @@ -406,6 +406,18 @@ void HostContentSettingsMap::SetContentSetting(const Pattern& pattern, NotifyObservers(ContentSettingsDetails(pattern)); } +void HostContentSettingsMap::AddExceptionForURL( + const GURL& url, + ContentSettingsType content_type, + ContentSetting setting) { + // Make sure there is no entry that would override the pattern we are about + // to insert for exactly this URL. + SetContentSetting(Pattern::FromURLNoWildcard(url), + content_type, + CONTENT_SETTING_DEFAULT); + SetContentSetting(Pattern::FromURL(url), content_type, setting); +} + void HostContentSettingsMap::ClearSettingsForOneType( ContentSettingsType content_type) { DCHECK(kTypeNames[content_type] != NULL); // Don't call this for Geolocation. diff --git a/chrome/browser/host_content_settings_map.h b/chrome/browser/host_content_settings_map.h index 876fa713..fc38afc 100644 --- a/chrome/browser/host_content_settings_map.h +++ b/chrome/browser/host_content_settings_map.h @@ -142,6 +142,13 @@ class HostContentSettingsMap ContentSettingsType content_type, ContentSetting setting); + // Convenience method to add a content setting for a given URL, making sure + // that there is no setting overriding it. + // This should only be called on the UI thread. + void AddExceptionForURL(const GURL& url, + ContentSettingsType content_type, + ContentSetting setting); + // Clears all host-specific settings for one content type. // // This should only be called on the UI thread. |