Commit d5a50340 authored by jochen@chromium.org's avatar jochen@chromium.org

Make the transfer request code path use full referrers

BUG=105028
TEST=none


Review URL: http://codereview.chromium.org/8801006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113038 0039d316-1c4b-4281-b951-d872f2087c98
parent 00227f26
......@@ -40,6 +40,7 @@ ResourceDispatcherHostRequestInfo* CreateRequestInfo(int request_id) {
new DummyResourceHandler(), content::PROCESS_TYPE_RENDERER, 0, 0, 0,
request_id, false, -1, false, -1, ResourceType::MAIN_FRAME,
content::PAGE_TRANSITION_LINK, 0, false, false, false,
WebKit::WebReferrerPolicyDefault,
content::MockResourceContext::GetInstance());
}
......
......@@ -40,6 +40,7 @@ ResourceDispatcherHostRequestInfo* CreateRequestInfo(int request_id) {
new DummyResourceHandler(), content::PROCESS_TYPE_RENDERER, 0, 0, 0,
request_id, false, -1, false, -1, ResourceType::MAIN_FRAME,
content::PAGE_TRANSITION_LINK, 0, false, false, false,
WebKit::WebReferrerPolicyDefault,
content::MockResourceContext::GetInstance());
}
......
......@@ -52,8 +52,8 @@ bool CrossesExtensionExtents(
void RequestTransferURLOnUIThread(int render_process_id,
int render_view_id,
GURL new_url,
GURL referrer,
const GURL& new_url,
const content::Referrer& referrer,
WindowOpenDisposition window_open_disposition,
int64 frame_id,
const GlobalRequestID& request_id) {
......@@ -67,7 +67,7 @@ void RequestTransferURLOnUIThread(int render_process_id,
return;
delegate->RequestTransferURL(
new_url, content::Referrer(referrer, WebKit::WebReferrerPolicyDefault),
new_url, referrer,
window_open_disposition, frame_id, request_id);
}
......@@ -124,8 +124,10 @@ bool TransferNavigationResourceHandler::OnRequestRedirected(
FROM_HERE,
base::Bind(&RequestTransferURLOnUIThread,
render_process_id, render_view_id,
new_url, GURL(request_->referrer()), CURRENT_TAB,
info->frame_id(), global_id));
new_url,
content::Referrer(GURL(request_->referrer()),
info->referrer_policy()),
CURRENT_TAB, info->frame_id(), global_id));
*defer = true;
return true;
......
......@@ -639,6 +639,7 @@ void ResourceDispatcherHost::BeginRequest(
false, // is download
ResourceType::IsFrame(request_data.resource_type), // allow_download
request_data.has_user_gesture,
request_data.referrer_policy,
&resource_context);
SetRequestInfo(request, extra_info); // Request takes ownership.
......@@ -808,6 +809,7 @@ ResourceDispatcherHostRequestInfo* ResourceDispatcherHost::CreateRequestInfo(
download, // is_download
download, // allow_download
false, // has_user_gesture
WebKit::WebReferrerPolicyDefault,
&context);
}
......
......@@ -26,6 +26,7 @@ ResourceDispatcherHostRequestInfo::ResourceDispatcherHostRequestInfo(
bool is_download,
bool allow_download,
bool has_user_gesture,
WebKit::WebReferrerPolicy referrer_policy,
const content::ResourceContext* context)
: resource_handler_(handler),
cross_site_handler_(NULL),
......@@ -49,6 +50,7 @@ ResourceDispatcherHostRequestInfo::ResourceDispatcherHostRequestInfo(
last_upload_position_(0),
waiting_for_upload_progress_ack_(false),
memory_cost_(0),
referrer_policy_(referrer_policy),
context_(context),
is_paused_(false),
called_on_response_started_(false),
......
......@@ -15,6 +15,7 @@
#include "content/public/common/process_type.h"
#include "net/base/load_states.h"
#include "net/url_request/url_request.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h"
#include "webkit/glue/resource_type.h"
class CrossSiteResourceHandler;
......@@ -53,6 +54,7 @@ class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData {
bool is_download,
bool allow_download,
bool has_user_gesture,
WebKit::WebReferrerPolicy referrer_policy,
const content::ResourceContext* context);
virtual ~ResourceDispatcherHostRequestInfo();
......@@ -183,6 +185,8 @@ class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData {
}
void set_requested_blob_data(webkit_blob::BlobData* data);
WebKit::WebReferrerPolicy referrer_policy() const { return referrer_policy_; }
const content::ResourceContext* context() const { return context_; }
private:
......@@ -243,6 +247,7 @@ class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData {
bool waiting_for_upload_progress_ack_;
int memory_cost_;
scoped_refptr<webkit_blob::BlobData> requested_blob_data_;
WebKit::WebReferrerPolicy referrer_policy_;
const content::ResourceContext* context_;
// "Private" data accessible only to ResourceDispatcherHost (use the
......
......@@ -81,6 +81,7 @@ static ResourceHostMsg_Request CreateResourceRequest(
request.method = std::string(method);
request.url = url;
request.first_party_for_cookies = url; // bypass third-party cookie blocking
request.referrer_policy = WebKit::WebReferrerPolicyDefault;
request.load_flags = 0;
request.origin_pid = 0;
request.resource_type = type;
......
......@@ -27,6 +27,7 @@ ResourceDispatcherHostRequestInfo* GetRequestInfo(int request_id) {
new DummyResourceHandler(), content::PROCESS_TYPE_RENDERER, 0, 0, 0,
request_id, false, -1, false, -1, ResourceType::MAIN_FRAME,
content::PAGE_TRANSITION_LINK, 0, false, false, false,
WebKit::WebReferrerPolicyDefault,
content::MockResourceContext::GetInstance());
}
......
......@@ -90,6 +90,7 @@ IPCResourceLoaderBridge::IPCResourceLoaderBridge(
request_.url = request_info.url;
request_.first_party_for_cookies = request_info.first_party_for_cookies;
request_.referrer = request_info.referrer;
request_.referrer_policy = request_info.referrer_policy;
request_.headers = request_info.headers;
request_.load_flags = request_info.load_flags;
request_.origin_pid = request_info.requestor_pid;
......
......@@ -10,6 +10,7 @@
#include "content/public/common/resource_response.h"
#include "ipc/ipc_message_macros.h"
#include "net/base/upload_data.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h"
#define IPC_MESSAGE_START ResourceMsgStart
#undef IPC_MESSAGE_EXPORT
......@@ -67,6 +68,9 @@ IPC_STRUCT_BEGIN(ResourceHostMsg_Request)
// The referrer to use (may be empty).
IPC_STRUCT_MEMBER(GURL, referrer)
// The referrer policy to use.
IPC_STRUCT_MEMBER(WebKit::WebReferrerPolicy, referrer_policy)
// Additional HTTP request headers.
IPC_STRUCT_MEMBER(std::string, headers)
......
......@@ -49,7 +49,8 @@ ResourceResponseInfo::~ResourceResponseInfo() {
}
ResourceLoaderBridge::RequestInfo::RequestInfo()
: load_flags(0),
: referrer_policy(WebKit::WebReferrerPolicyDefault),
load_flags(0),
requestor_pid(0),
request_type(ResourceType::MAIN_FRAME),
request_context(0),
......
......@@ -33,6 +33,7 @@
#include "net/base/host_port_pair.h"
#include "net/url_request/url_request_status.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLRequest.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebReferrerPolicy.h"
#include "webkit/glue/resource_type.h"
#include "webkit/glue/webkit_glue_export.h"
......@@ -217,6 +218,9 @@ class ResourceLoaderBridge {
// encoded as the url member.
GURL referrer;
// The referrer policy that applies to the referrer.
WebKit::WebReferrerPolicy referrer_policy;
// For HTTP(S) requests, the headers parameter can be a \r\n-delimited and
// \r\n-terminated list of MIME headers. They should be ASCII-encoded using
// the standard MIME header encoding rules. The headers parameter can also
......
......@@ -420,12 +420,12 @@ void WebURLLoaderImpl::Context::Start(
request_info.download_to_file = request.downloadToFile();
request_info.has_user_gesture = request.hasUserGesture();
request_info.extra_data = request.extraData();
bridge_.reset(platform->CreateResourceLoader(request_info));
if (request.extraData()) {
referrer_policy_ = static_cast<WebURLRequestExtraDataImpl*>(
request.extraData())->referrer_policy();
request_info.referrer_policy = referrer_policy_;
}
bridge_.reset(platform->CreateResourceLoader(request_info));
if (!request.httpBody().isNull()) {
// GET and HEAD requests shouldn't have http bodies.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment