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

Unified Diff: chrome/browser/content_settings/cookie_settings.cc

Issue 8462003: Exempt chrome-extension:// from third-party cookie rules, but not from regular content settings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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/content_settings/cookie_settings_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ?
« no previous file with comments | « no previous file | chrome/browser/content_settings/cookie_settings_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698