Index: chrome/browser/content_settings/host_content_settings_map.cc |
diff --git a/chrome/browser/content_settings/host_content_settings_map.cc b/chrome/browser/content_settings/host_content_settings_map.cc |
index 5d76b9234afc5b96080add137f629207b33df1c1..2526622fe4d47c2c9afad7e4e1718ec76352bf27 100644 |
--- a/chrome/browser/content_settings/host_content_settings_map.cc |
+++ b/chrome/browser/content_settings/host_content_settings_map.cc |
@@ -37,18 +37,6 @@ |
namespace { |
-// Returns true if we should allow all content types for this URL. This is |
-// true for various internal objects like chrome:// URLs, so UI and other |
-// things users think of as "not webpages" don't break. |
-bool ShouldAllowAllContent(const GURL& url, ContentSettingsType content_type) { |
- if (content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) |
- return false; |
- return url.SchemeIs(chrome::kChromeDevToolsScheme) || |
- url.SchemeIs(chrome::kChromeInternalScheme) || |
- url.SchemeIs(chrome::kChromeUIScheme) || |
- url.SchemeIs(chrome::kExtensionScheme); |
-} |
- |
typedef std::vector<content_settings::Rule> Rules; |
typedef std::pair<std::string, std::string> StringPair; |
@@ -201,53 +189,6 @@ ContentSettings HostContentSettingsMap::GetDefaultContentSettings() const { |
return output; |
} |
-ContentSetting HostContentSettingsMap::GetCookieContentSetting( |
- const GURL& url, |
- const GURL& first_party_url, |
- bool setting_cookie) const { |
- if (ShouldAllowAllContent(first_party_url, CONTENT_SETTINGS_TYPE_COOKIES)) |
- return CONTENT_SETTING_ALLOW; |
- |
- // First get any host-specific settings. |
- scoped_ptr<base::Value> value; |
- for (ConstProviderIterator provider = content_settings_providers_.begin(); |
- provider != content_settings_providers_.end(); |
- ++provider) { |
- if (provider->first == DEFAULT_PROVIDER) |
- continue; |
- |
- value.reset(content_settings::GetContentSettingValueAndPatterns( |
- provider->second, url, first_party_url, CONTENT_SETTINGS_TYPE_COOKIES, |
- std::string(), is_off_the_record_, NULL, NULL)); |
- if (value.get()) |
- break; |
- } |
- |
- // If no explicit exception has been made and third-party cookies are blocked |
- // by default, apply that rule. |
- if (!value.get() && BlockThirdPartyCookies()) { |
- bool strict = CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kBlockReadingThirdPartyCookies); |
- net::StaticCookiePolicy policy(strict ? |
- net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES : |
- net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES); |
- int rv; |
- if (setting_cookie) |
- rv = policy.CanSetCookie(url, first_party_url); |
- else |
- rv = policy.CanGetCookies(url, first_party_url); |
- DCHECK_NE(net::ERR_IO_PENDING, rv); |
- if (rv != net::OK) |
- return CONTENT_SETTING_BLOCK; |
- } |
- |
- // If no other policy has changed the setting, use the default. |
- if (value.get()) |
- return content_settings::ValueToContentSetting(value.get()); |
- |
- return GetDefaultContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, NULL); |
-} |
- |
ContentSetting HostContentSettingsMap::GetContentSetting( |
const GURL& primary_url, |
const GURL& secondary_url, |
@@ -266,7 +207,6 @@ base::Value* HostContentSettingsMap::GetContentSettingValue( |
const std::string& resource_identifier, |
ContentSettingsPattern* primary_pattern, |
ContentSettingsPattern* secondary_pattern) const { |
- DCHECK_NE(CONTENT_SETTINGS_TYPE_COOKIES, content_type); |
DCHECK(content_settings::SupportsResourceIdentifier(content_type) || |
resource_identifier.empty()); |
@@ -290,8 +230,7 @@ base::Value* HostContentSettingsMap::GetContentSettingValue( |
} |
ContentSettings HostContentSettingsMap::GetContentSettings( |
- const GURL& primary_url, |
- const GURL& secondary_url) const { |
+ const GURL& primary_url) const { |
ContentSettings output; |
// If we require a resource identifier, set the content settings to default, |
// otherwise make the defaults explicit. Values for content type |
@@ -299,15 +238,9 @@ ContentSettings HostContentSettingsMap::GetContentSettings( |
// |ContentSetting|. So we ignore them here. |
for (int j = 0; j < CONTENT_SETTINGS_NUM_TYPES; ++j) { |
ContentSettingsType type = ContentSettingsType(j); |
- if (type == CONTENT_SETTINGS_TYPE_COOKIES) { |
- output.settings[j] = GetCookieContentSetting( |
- primary_url, secondary_url, false); |
- } else if (!ContentTypeHasCompoundValue(type)) { |
+ if (!ContentTypeHasCompoundValue(type)) { |
output.settings[j] = GetContentSetting( |
- primary_url, |
- secondary_url, |
- ContentSettingsType(j), |
- std::string()); |
+ primary_url, primary_url, ContentSettingsType(j), std::string()); |
} |
} |
return output; |
@@ -568,3 +501,14 @@ void HostContentSettingsMap::AddSettingsForOneType( |
incognito)); |
} |
} |
+ |
+bool HostContentSettingsMap::ShouldAllowAllContent( |
+ const GURL& url, |
+ ContentSettingsType content_type) { |
+ if (content_type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) |
+ return false; |
+ return url.SchemeIs(chrome::kChromeDevToolsScheme) || |
+ url.SchemeIs(chrome::kChromeInternalScheme) || |
+ url.SchemeIs(chrome::kChromeUIScheme) || |
+ url.SchemeIs(chrome::kExtensionScheme); |
+} |