summaryrefslogtreecommitdiffstats
path: root/webkit/glue
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 02:27:34 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-18 02:27:34 +0000
commit041b0bbba0efec8bd026aee1165e4be697cbf8ce (patch)
tree8c9ee6806d964c45252a56f911f3c43491a38fc4 /webkit/glue
parent4eb0ece6c4b380e6af418ab15beda8c13ed08817 (diff)
downloadchromium_src-041b0bbba0efec8bd026aee1165e4be697cbf8ce.zip
chromium_src-041b0bbba0efec8bd026aee1165e4be697cbf8ce.tar.gz
chromium_src-041b0bbba0efec8bd026aee1165e4be697cbf8ce.tar.bz2
Use an explicit boolean has_new_first_party_for_cookies instead
of an empty, invalid URL to indicate whether the first party for cookies URL needs changing when following a redirect. R=eroman BUG=25133 TEST=none Review URL: http://codereview.chromium.org/405011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32260 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue')
-rw-r--r--webkit/glue/media/buffered_data_source.cc4
-rw-r--r--webkit/glue/media/buffered_data_source.h1
-rw-r--r--webkit/glue/media/simple_data_source.cc4
-rw-r--r--webkit/glue/media/simple_data_source.h1
-rw-r--r--webkit/glue/resource_loader_bridge.h16
-rw-r--r--webkit/glue/weburlloader_impl.cc3
6 files changed, 19 insertions, 10 deletions
diff --git a/webkit/glue/media/buffered_data_source.cc b/webkit/glue/media/buffered_data_source.cc
index 3d2c73f..cfc2d7c 100644
--- a/webkit/glue/media/buffered_data_source.cc
+++ b/webkit/glue/media/buffered_data_source.cc
@@ -231,12 +231,14 @@ int64 BufferedResourceLoader::GetBufferedLastBytePosition() {
bool BufferedResourceLoader::OnReceivedRedirect(
const GURL& new_url,
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies) {
DCHECK(bridge_.get());
// Save the new URL.
url_ = new_url;
- *new_first_party_for_cookies = GURL();
+ // TODO(wtc): should we return a new first party for cookies URL?
+ *has_new_first_party_for_cookies = false;
// The load may have been stopped and |start_callback| is destroyed.
// In this case we shouldn't do anything.
diff --git a/webkit/glue/media/buffered_data_source.h b/webkit/glue/media/buffered_data_source.h
index 627f84d..0972c2d 100644
--- a/webkit/glue/media/buffered_data_source.h
+++ b/webkit/glue/media/buffered_data_source.h
@@ -110,6 +110,7 @@ class BufferedResourceLoader :
virtual bool OnReceivedRedirect(
const GURL& new_url,
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies);
virtual void OnReceivedResponse(
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
diff --git a/webkit/glue/media/simple_data_source.cc b/webkit/glue/media/simple_data_source.cc
index ed2a594..57b294a 100644
--- a/webkit/glue/media/simple_data_source.cc
+++ b/webkit/glue/media/simple_data_source.cc
@@ -123,9 +123,11 @@ void SimpleDataSource::OnUploadProgress(uint64 position, uint64 size) {}
bool SimpleDataSource::OnReceivedRedirect(
const GURL& new_url,
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies) {
SetURL(new_url);
- *new_first_party_for_cookies = GURL();
+ // TODO(wtc): should we return a new first party for cookies URL?
+ *has_new_first_party_for_cookies = false;
return true;
}
diff --git a/webkit/glue/media/simple_data_source.h b/webkit/glue/media/simple_data_source.h
index 3aac41b..10bbb7d 100644
--- a/webkit/glue/media/simple_data_source.h
+++ b/webkit/glue/media/simple_data_source.h
@@ -56,6 +56,7 @@ class SimpleDataSource : public media::DataSource,
virtual bool OnReceivedRedirect(
const GURL& new_url,
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies);
virtual void OnReceivedResponse(
const webkit_glue::ResourceLoaderBridge::ResponseInfo& info,
diff --git a/webkit/glue/resource_loader_bridge.h b/webkit/glue/resource_loader_bridge.h
index 48f5129..aac2331 100644
--- a/webkit/glue/resource_loader_bridge.h
+++ b/webkit/glue/resource_loader_bridge.h
@@ -110,13 +110,13 @@ class ResourceLoaderBridge {
// Called when a redirect occurs. The implementation may return false to
// suppress the redirect. The given ResponseInfo provides complete
// information about the redirect, and new_url is the URL that will be
- // loaded if this method returns true. If this method returns true, it
- // stores in *new_first_party_for_cookies the new URL that should be
- // consulted for the third-party cookie blocking policy. If the cookie
- // policy URL doesn't need changing, it stores an empty, invalid URL in
- // *new_first_party_for_cookies.
+ // loaded if this method returns true. If this method returns true, the
+ // output parameter *has_new_first_party_for_cookies indicates whether the
+ // output parameter *new_first_party_for_cookies contains the new URL that
+ // should be consulted for the third-party cookie blocking policy.
virtual bool OnReceivedRedirect(const GURL& new_url,
const ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies) = 0;
// Called when response headers are available (after all redirects have
@@ -158,8 +158,8 @@ class ResourceLoaderBridge {
// the standard MIME header encoding rules. The headers parameter can also
// be null if no extra request headers need to be set.
//
- // policy_url is the URL of the document in the top-level window, which may be
- // checked by the third-party cookie blocking policy.
+ // first_party_for_cookies is the URL of the document in the top-level
+ // window, which may be checked by the third-party cookie blocking policy.
//
// load_flags is composed of the values defined in url_request_load_flags.h
//
@@ -173,7 +173,7 @@ class ResourceLoaderBridge {
// frame's network context.
static ResourceLoaderBridge* Create(const std::string& method,
const GURL& url,
- const GURL& policy_url,
+ const GURL& first_party_for_cookies,
const GURL& referrer,
const std::string& frame_origin,
const std::string& main_frame_origin,
diff --git a/webkit/glue/weburlloader_impl.cc b/webkit/glue/weburlloader_impl.cc
index 7683014..7a85214 100644
--- a/webkit/glue/weburlloader_impl.cc
+++ b/webkit/glue/weburlloader_impl.cc
@@ -211,6 +211,7 @@ class WebURLLoaderImpl::Context : public base::RefCounted<Context>,
virtual bool OnReceivedRedirect(
const GURL& new_url,
const ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies);
virtual void OnReceivedResponse(
const ResourceLoaderBridge::ResponseInfo& info, bool content_filtered);
@@ -391,6 +392,7 @@ void WebURLLoaderImpl::Context::OnUploadProgress(uint64 position, uint64 size) {
bool WebURLLoaderImpl::Context::OnReceivedRedirect(
const GURL& new_url,
const ResourceLoaderBridge::ResponseInfo& info,
+ bool* has_new_first_party_for_cookies,
GURL* new_first_party_for_cookies) {
if (!client_)
return false;
@@ -408,6 +410,7 @@ bool WebURLLoaderImpl::Context::OnReceivedRedirect(
client_->willSendRequest(loader_, new_request, response);
request_ = new_request;
+ *has_new_first_party_for_cookies = true;
*new_first_party_for_cookies = request_.firstPartyForCookies();
// Only follow the redirect if WebKit left the URL unmodified.