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

Unified Diff: chrome/browser/net/chrome_cookie_policy.cc

Issue 6207005: Clarify wording around blocking 3rd party cookies and add lab to block reading of 3rd party cookies (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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
Index: chrome/browser/net/chrome_cookie_policy.cc
diff --git a/chrome/browser/net/chrome_cookie_policy.cc b/chrome/browser/net/chrome_cookie_policy.cc
index 88ff6069f0e865388cfc52e5e07eb507952bd9d8..dbd74d448d242053a72df036a0b031b1c9426903 100644
--- a/chrome/browser/net/chrome_cookie_policy.cc
+++ b/chrome/browser/net/chrome_cookie_policy.cc
@@ -4,10 +4,12 @@
#include "chrome/browser/net/chrome_cookie_policy.h"
+#include "base/command_line.h"
#include "base/string_util.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
+#include "chrome/common/chrome_switches.h"
#include "net/base/net_errors.h"
#include "net/base/static_cookie_policy.h"
@@ -20,6 +22,8 @@ static const size_t kMaxCompletionsPerHost = 10000;
ChromeCookiePolicy::ChromeCookiePolicy(HostContentSettingsMap* map)
: host_content_settings_map_(map) {
+ strict_third_party_blocking_ = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kBlockReadingThirdPartyCookies);
}
ChromeCookiePolicy::~ChromeCookiePolicy() {
@@ -32,8 +36,9 @@ int ChromeCookiePolicy::CanGetCookies(const GURL& url,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (host_content_settings_map_->BlockThirdPartyCookies()) {
- net::StaticCookiePolicy policy(
- net::StaticCookiePolicy::BLOCK_THIRD_PARTY_COOKIES);
+ net::StaticCookiePolicy policy(strict_third_party_blocking_ ?
+ net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES :
+ net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES);
int rv = policy.CanGetCookies(url, first_party, NULL);
if (rv != net::OK)
return rv;
@@ -69,8 +74,9 @@ int ChromeCookiePolicy::CanSetCookie(const GURL& url,
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (host_content_settings_map_->BlockThirdPartyCookies()) {
- net::StaticCookiePolicy policy(
- net::StaticCookiePolicy::BLOCK_THIRD_PARTY_COOKIES);
+ net::StaticCookiePolicy policy(strict_third_party_blocking_ ?
+ net::StaticCookiePolicy::BLOCK_ALL_THIRD_PARTY_COOKIES :
+ net::StaticCookiePolicy::BLOCK_SETTING_THIRD_PARTY_COOKIES);
int rv = policy.CanSetCookie(url, first_party, cookie_line, NULL);
if (rv != net::OK)
return rv;

Powered by Google App Engine
This is Rietveld 408576698