Chromium Code Reviews| Index: chrome/browser/content_settings/cookie_settings.cc |
| diff --git a/chrome/browser/content_settings/cookie_settings.cc b/chrome/browser/content_settings/cookie_settings.cc |
| index dd5d7888b564bf482286415c27cf4024b6c103f4..9321b7de166b9572e414cd521979bfff42e713b5 100644 |
| --- a/chrome/browser/content_settings/cookie_settings.cc |
| +++ b/chrome/browser/content_settings/cookie_settings.cc |
| @@ -15,6 +15,7 @@ |
| #include "chrome/common/chrome_switches.h" |
| #include "chrome/common/content_settings_pattern.h" |
| #include "chrome/common/pref_names.h" |
| +#include "chrome/common/url_constants.h" |
| #include "content/browser/user_metrics.h" |
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/notification_service.h" |
| @@ -39,6 +40,18 @@ bool IsAllowed(ContentSetting setting) { |
| setting == CONTENT_SETTING_SESSION_ONLY); |
| } |
| +// Keep the list of schemes in sync with |
| +// HostContentSettingsMap::ShouldAllowAllContent. |
|
Bernhard Bauer
2011/11/04 10:00:55
Couldn't we create a single method for this?
jochen (gone - plz use gerrit)
2011/11/04 10:59:09
Done.
|
| +bool ShouldAllowAllContent( |
|
Bernhard Bauer
2011/11/04 10:00:55
Nit: I think the first parameter fits on this line
|
| + const GURL& url, |
| + const GURL& first_party_url) { |
| + return url.SchemeIs(chrome::kChromeDevToolsScheme) || |
| + url.SchemeIs(chrome::kChromeInternalScheme) || |
| + url.SchemeIs(chrome::kChromeUIScheme) || |
| + (url.SchemeIs(chrome::kExtensionScheme) && |
| + first_party_url.SchemeIs(chrome::kExtensionScheme)); |
| +} |
| + |
| } // namespace |
| // |ProfileKeyedFactory| is the owner of the |ProfileKeyedService|s. This |
| @@ -200,11 +213,8 @@ ContentSetting CookieSettings::GetCookieSetting( |
| const GURL& url, |
| const GURL& first_party_url, |
| bool setting_cookie) const { |
| - if (HostContentSettingsMap::ShouldAllowAllContent( |
| - first_party_url, |
| - CONTENT_SETTINGS_TYPE_COOKIES)) { |
| + if (ShouldAllowAllContent(url, first_party_url)) |
| return CONTENT_SETTING_ALLOW; |
| - } |
| ContentSettingsPattern primary_pattern; |
| ContentSettingsPattern secondary_pattern; |
| @@ -218,7 +228,8 @@ ContentSetting CookieSettings::GetCookieSetting( |
| // by default, apply that rule. |
| if (primary_pattern == ContentSettingsPattern::Wildcard() && |
| secondary_pattern == ContentSettingsPattern::Wildcard() && |
| - ShouldBlockThirdPartyCookies()) { |
| + ShouldBlockThirdPartyCookies() && |
| + !first_party_url.SchemeIs(chrome::kExtensionScheme)) { |
| bool strict = CommandLine::ForCurrentProcess()->HasSwitch( |
| switches::kBlockReadingThirdPartyCookies); |
| net::StaticCookiePolicy policy(strict ? |