diff options
author | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-23 18:11:10 +0000 |
---|---|---|
committer | abarth@chromium.org <abarth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-23 18:11:10 +0000 |
commit | cfd7332188b64787a9cb2b110957c0eb60b806a8 (patch) | |
tree | bd5072b446490dc3266dff44a627416f54404eb8 /net | |
parent | d62c805ec92a9e00bfd97fc5a4d35103a8e89380 (diff) | |
download | chromium_src-cfd7332188b64787a9cb2b110957c0eb60b806a8.zip chromium_src-cfd7332188b64787a9cb2b110957c0eb60b806a8.tar.gz chromium_src-cfd7332188b64787a9cb2b110957c0eb60b806a8.tar.bz2 |
Rename |policy_url| to |first_party_for_cookies|. This now matches the WebKit name for this piece of data.
R=jackson
BUG=None
TEST=No behavior change
Review URL: http://codereview.chromium.org/115743
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16843 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/cookie_policy.cc | 14 | ||||
-rw-r--r-- | net/base/cookie_policy.h | 14 | ||||
-rw-r--r-- | net/url_request/url_request.cc | 5 | ||||
-rw-r--r-- | net/url_request/url_request.h | 8 | ||||
-rw-r--r-- | net/url_request/url_request_http_job.cc | 8 |
5 files changed, 27 insertions, 22 deletions
diff --git a/net/base/cookie_policy.cc b/net/base/cookie_policy.cc index d18db63..0092d8a 100644 --- a/net/base/cookie_policy.cc +++ b/net/base/cookie_policy.cc @@ -10,7 +10,8 @@ namespace net { -bool CookiePolicy::CanGetCookies(const GURL& url, const GURL& policy_url) { +bool CookiePolicy::CanGetCookies(const GURL& url, + const GURL& first_party_for_cookies) { switch (type_) { case CookiePolicy::ALLOW_ALL_COOKIES: return true; @@ -24,15 +25,16 @@ bool CookiePolicy::CanGetCookies(const GURL& url, const GURL& policy_url) { } } -bool CookiePolicy::CanSetCookie(const GURL& url, const GURL& policy_url) { +bool CookiePolicy::CanSetCookie(const GURL& url, + const GURL& first_party_for_cookies) { switch (type_) { case CookiePolicy::ALLOW_ALL_COOKIES: return true; case CookiePolicy::BLOCK_THIRD_PARTY_COOKIES: - if (policy_url.is_empty()) - return true; // Empty policy URL should indicate a first-party request - return net::RegistryControlledDomainService::SameDomainOrHost(url, - policy_url); + if (first_party_for_cookies.is_empty()) + return true; // Empty first-party URL indicates a first-party request. + return net::RegistryControlledDomainService::SameDomainOrHost( + url, first_party_for_cookies); case CookiePolicy::BLOCK_ALL_COOKIES: return false; default: diff --git a/net/base/cookie_policy.h b/net/base/cookie_policy.h index 89d490b..4c01705 100644 --- a/net/base/cookie_policy.h +++ b/net/base/cookie_policy.h @@ -15,17 +15,17 @@ namespace net { class CookiePolicy { public: // Consult the user's third-party cookie blocking preferences to determine - // whether the URL's cookies can be read if the top-level window is policy_url - bool CanGetCookies(const GURL& url, const GURL& policy_url); + // whether the URL's cookies can be read. + bool CanGetCookies(const GURL& url, const GURL& first_party_for_cookies); // Consult the user's third-party cookie blocking preferences to determine - // whether the URL's cookies can be set if the top-level window is policy_url - bool CanSetCookie(const GURL& url, const GURL& policy_url); + // whether the URL's cookies can be set. + bool CanSetCookie(const GURL& url, const GURL& first_party_for_cookies); enum Type { - ALLOW_ALL_COOKIES = 0, // do not perform any cookie blocking - BLOCK_THIRD_PARTY_COOKIES, // prevent third-party cookies from being sent - BLOCK_ALL_COOKIES // disable cookies + ALLOW_ALL_COOKIES = 0, // Do not perform any cookie blocking. + BLOCK_THIRD_PARTY_COOKIES, // Prevent third-party cookies from being set. + BLOCK_ALL_COOKIES // Disable cookies. }; static bool ValidType(int32 type) { diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc index 45043e9..ebfc376 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -221,9 +221,10 @@ bool URLRequest::IsHandledURL(const GURL& url) { return IsHandledProtocol(url.scheme()); } -void URLRequest::set_policy_url(const GURL& policy_url) { +void URLRequest::set_first_party_for_cookies( + const GURL& first_party_for_cookies) { DCHECK(!is_pending_); - policy_url_ = policy_url; + first_party_for_cookies_ = first_party_for_cookies; } void URLRequest::set_method(const std::string& method) { diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h index b9863b1..bb4e18a 100644 --- a/net/url_request/url_request.h +++ b/net/url_request/url_request.h @@ -226,8 +226,10 @@ class URLRequest { // The URL that should be consulted for the third-party cookie blocking // policy. - const GURL& policy_url() const { return policy_url_; } - void set_policy_url(const GURL& policy_url); + const GURL& first_party_for_cookies() const { + return first_party_for_cookies_; + } + void set_first_party_for_cookies(const GURL& first_party_for_cookies); // The request method, as an uppercase string. "GET" is the default value. // The request method may only be changed before Start() is called and @@ -505,7 +507,7 @@ class URLRequest { scoped_refptr<net::UploadData> upload_; GURL url_; GURL original_url_; - GURL policy_url_; + GURL first_party_for_cookies_; std::string method_; // "GET", "POST", etc. Should be all uppercase. std::string referrer_; std::string extra_request_headers_; diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc index eff2344..85cb219 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc @@ -502,8 +502,8 @@ void URLRequestHttpJob::NotifyHeadersComplete() { if (!(request_info_.load_flags & net::LOAD_DO_NOT_SAVE_COOKIES)) { URLRequestContext* ctx = request_->context(); if (ctx && ctx->cookie_store() && - ctx->cookie_policy()->CanSetCookie(request_->url(), - request_->policy_url())) { + ctx->cookie_policy()->CanSetCookie( + request_->url(), request_->first_party_for_cookies())) { FetchResponseCookies(); net::CookieMonster::CookieOptions options; options.set_include_httponly(); @@ -654,8 +654,8 @@ std::string URLRequestHttpJob::AssembleRequestCookies() { if (context) { // Add in the cookie header. TODO might we need more than one header? if (context->cookie_store() && - context->cookie_policy()->CanGetCookies(request_->url(), - request_->policy_url())) { + context->cookie_policy()->CanGetCookies( + request_->url(), request_->first_party_for_cookies())) { net::CookieMonster::CookieOptions options; options.set_include_httponly(); std::string cookies = request_->context()->cookie_store()-> |