summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/child/npapi/plugin_url_fetcher.cc2
-rw-r--r--content/child/npapi/plugin_url_fetcher.h7
-rw-r--r--content/child/npapi/webplugin_delegate.h3
-rw-r--r--content/child/npapi/webplugin_delegate_impl.cc2
-rw-r--r--content/child/npapi/webplugin_delegate_impl.h2
-rw-r--r--content/child/plugin_messages.h1
-rw-r--r--content/child/request_info.cc3
-rw-r--r--content/child/request_info.h9
-rw-r--r--content/child/resource_dispatcher.cc12
-rw-r--r--content/child/resource_dispatcher_unittest.cc2
-rw-r--r--content/child/web_url_loader_impl.cc5
-rw-r--r--content/plugin/webplugin_delegate_stub.cc2
-rw-r--r--content/renderer/npapi/webplugin_delegate_proxy.cc5
-rw-r--r--content/renderer/npapi/webplugin_delegate_proxy.h2
-rw-r--r--content/renderer/npapi/webplugin_impl.cc15
-rw-r--r--content/renderer/npapi/webplugin_impl.h12
16 files changed, 42 insertions, 42 deletions
diff --git a/content/child/npapi/plugin_url_fetcher.cc b/content/child/npapi/plugin_url_fetcher.cc
index ff3e798..c7db56c 100644
--- a/content/child/npapi/plugin_url_fetcher.cc
+++ b/content/child/npapi/plugin_url_fetcher.cc
@@ -83,7 +83,7 @@ PluginURLFetcher::PluginURLFetcher(PluginStreamUrl* plugin_stream,
const std::string& method,
const char* buf,
unsigned int len,
- const GURL& referrer,
+ const Referrer& referrer,
const std::string& range,
bool notify_redirects,
bool is_plugin_src_load,
diff --git a/content/child/npapi/plugin_url_fetcher.h b/content/child/npapi/plugin_url_fetcher.h
index 57eb5a5..ace77ff 100644
--- a/content/child/npapi/plugin_url_fetcher.h
+++ b/content/child/npapi/plugin_url_fetcher.h
@@ -9,6 +9,7 @@
#include "base/memory/scoped_ptr.h"
#include "content/public/child/request_peer.h"
+#include "content/public/common/referrer.h"
#include "url/gurl.h"
namespace content {
@@ -25,7 +26,7 @@ class PluginURLFetcher : public RequestPeer {
const std::string& method,
const char* buf,
unsigned int len,
- const GURL& referrer,
+ const Referrer& referrer,
const std::string& range,
bool notify_redirects,
bool is_plugin_src_load,
@@ -43,7 +44,7 @@ class PluginURLFetcher : public RequestPeer {
void URLRedirectResponse(bool allow);
GURL first_party_for_cookies() { return first_party_for_cookies_; }
- GURL referrer() { return referrer_; }
+ Referrer referrer() { return referrer_; }
int origin_pid() { return origin_pid_; }
int render_frame_id() { return render_frame_id_; }
int render_view_id() { return render_view_id_; }
@@ -72,7 +73,7 @@ class PluginURLFetcher : public RequestPeer {
PluginStreamUrl* plugin_stream_;
GURL url_;
GURL first_party_for_cookies_;
- GURL referrer_;
+ Referrer referrer_;
bool notify_redirects_;
bool is_plugin_src_load_;
int origin_pid_;
diff --git a/content/child/npapi/webplugin_delegate.h b/content/child/npapi/webplugin_delegate.h
index eaef885..8f13c8d 100644
--- a/content/child/npapi/webplugin_delegate.h
+++ b/content/child/npapi/webplugin_delegate.h
@@ -28,6 +28,7 @@ class Rect;
namespace content {
+struct Referrer;
class WebPluginResourceClient;
// This is the interface that a plugin implementation needs to provide.
@@ -138,7 +139,7 @@ class WebPluginDelegate {
const std::string& method,
const char* buf,
unsigned int len,
- const GURL& referrer,
+ const Referrer& referrer,
bool notify_redirects,
bool is_plugin_src_load,
int origin_pid,
diff --git a/content/child/npapi/webplugin_delegate_impl.cc b/content/child/npapi/webplugin_delegate_impl.cc
index e53cbc3..4041db4 100644
--- a/content/child/npapi/webplugin_delegate_impl.cc
+++ b/content/child/npapi/webplugin_delegate_impl.cc
@@ -311,7 +311,7 @@ void WebPluginDelegateImpl::FetchURL(unsigned long resource_id,
const std::string& method,
const char* buf,
unsigned int len,
- const GURL& referrer,
+ const Referrer& referrer,
bool notify_redirects,
bool is_plugin_src_load,
int origin_pid,
diff --git a/content/child/npapi/webplugin_delegate_impl.h b/content/child/npapi/webplugin_delegate_impl.h
index e37a651..efafa81 100644
--- a/content/child/npapi/webplugin_delegate_impl.h
+++ b/content/child/npapi/webplugin_delegate_impl.h
@@ -121,7 +121,7 @@ class WebPluginDelegateImpl : public WebPluginDelegate {
const std::string& method,
const char* buf,
unsigned int len,
- const GURL& referrer,
+ const Referrer& referrer,
bool notify_redirects,
bool is_plugin_src_load,
int origin_pid,
diff --git a/content/child/plugin_messages.h b/content/child/plugin_messages.h
index 2e17c98..d2ea4d9 100644
--- a/content/child/plugin_messages.h
+++ b/content/child/plugin_messages.h
@@ -61,6 +61,7 @@ IPC_STRUCT_BEGIN(PluginMsg_FetchURL_Params)
IPC_STRUCT_MEMBER(std::string, method)
IPC_STRUCT_MEMBER(std::vector<char>, post_data)
IPC_STRUCT_MEMBER(GURL, referrer)
+ IPC_STRUCT_MEMBER(blink::WebReferrerPolicy, referrer_policy)
IPC_STRUCT_MEMBER(bool, notify_redirect)
IPC_STRUCT_MEMBER(bool, is_plugin_src_load)
IPC_STRUCT_MEMBER(int, render_frame_id)
diff --git a/content/child/request_info.cc b/content/child/request_info.cc
index e52f2aa..7752081 100644
--- a/content/child/request_info.cc
+++ b/content/child/request_info.cc
@@ -7,8 +7,7 @@
namespace content {
RequestInfo::RequestInfo()
- : referrer_policy(blink::WebReferrerPolicyDefault),
- load_flags(0),
+ : load_flags(0),
requestor_pid(0),
request_type(RESOURCE_TYPE_MAIN_FRAME),
fetch_request_context_type(REQUEST_CONTEXT_TYPE_UNSPECIFIED),
diff --git a/content/child/request_info.h b/content/child/request_info.h
index 6861741..e66a26b 100644
--- a/content/child/request_info.h
+++ b/content/child/request_info.h
@@ -11,6 +11,7 @@
#include "content/common/content_export.h"
#include "content/common/service_worker/service_worker_types.h"
+#include "content/public/common/referrer.h"
#include "content/public/common/request_context_frame_type.h"
#include "content/public/common/request_context_type.h"
#include "content/public/common/resource_type.h"
@@ -36,12 +37,8 @@ struct CONTENT_EXPORT RequestInfo {
// third-party cookie blocking policy.
GURL first_party_for_cookies;
- // Optional parameter, a URL with similar constraints in how it must be
- // encoded as the url member.
- GURL referrer;
-
- // The referrer policy that applies to the referrer.
- blink::WebReferrerPolicy referrer_policy;
+ // Optional parameter, the referrer to use for the request for the url member.
+ Referrer referrer;
// 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
diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc
index ea91f95..0e8bd36 100644
--- a/content/child/resource_dispatcher.cc
+++ b/content/child/resource_dispatcher.cc
@@ -116,8 +116,8 @@ IPCResourceLoaderBridge::IPCResourceLoaderBridge(
request_.method = request_info.method;
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_.referrer = request_info.referrer.url;
+ 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;
@@ -135,17 +135,17 @@ IPCResourceLoaderBridge::IPCResourceLoaderBridge(
request_.enable_load_timing = request_info.enable_load_timing;
request_.enable_upload_progress = request_info.enable_upload_progress;
- if ((request_info.referrer_policy == blink::WebReferrerPolicyDefault ||
- request_info.referrer_policy ==
+ if ((request_info.referrer.policy == blink::WebReferrerPolicyDefault ||
+ request_info.referrer.policy ==
blink::WebReferrerPolicyNoReferrerWhenDowngrade) &&
- request_info.referrer.SchemeIsSecure() &&
+ request_info.referrer.url.SchemeIsSecure() &&
!request_info.url.SchemeIsSecure()) {
// Debug code for crbug.com/422871
base::debug::DumpWithoutCrashing();
DLOG(FATAL) << "Trying to send secure referrer for insecure request "
<< "without an appropriate referrer policy.\n"
<< "URL = " << request_info.url << "\n"
- << "Referrer = " << request_info.referrer;
+ << "Referrer = " << request_info.referrer.url;
}
const RequestExtraData kEmptyData;
diff --git a/content/child/resource_dispatcher_unittest.cc b/content/child/resource_dispatcher_unittest.cc
index 434433e..f0201c8 100644
--- a/content/child/resource_dispatcher_unittest.cc
+++ b/content/child/resource_dispatcher_unittest.cc
@@ -322,7 +322,7 @@ class ResourceDispatcherTest : public testing::Test, public IPC::Sender {
request_info.method = "GET";
request_info.url = GURL(kTestPageUrl);
request_info.first_party_for_cookies = GURL(kTestPageUrl);
- request_info.referrer = GURL();
+ request_info.referrer = Referrer();
request_info.headers = std::string();
request_info.load_flags = 0;
request_info.requestor_pid = 0;
diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc
index bd6fe10..e3b7727 100644
--- a/content/child/web_url_loader_impl.cc
+++ b/content/child/web_url_loader_impl.cc
@@ -460,7 +460,8 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
request_info.method = method;
request_info.url = url;
request_info.first_party_for_cookies = request.firstPartyForCookies();
- request_info.referrer = referrer_url;
+ referrer_policy_ = request.referrerPolicy();
+ request_info.referrer = Referrer(referrer_url, referrer_policy_);
request_info.headers = GetWebURLRequestHeaders(request);
request_info.load_flags = GetLoadFlagsForWebURLRequest(request);
request_info.enable_load_timing = true;
@@ -482,8 +483,6 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request,
request_info.fetch_request_context_type = GetRequestContextType(request);
request_info.fetch_frame_type = GetRequestContextFrameType(request);
request_info.extra_data = request.extraData();
- referrer_policy_ = request.referrerPolicy();
- request_info.referrer_policy = request.referrerPolicy();
bridge_.reset(resource_dispatcher_->CreateBridge(request_info));
if (!request.httpBody().isNull()) {
diff --git a/content/plugin/webplugin_delegate_stub.cc b/content/plugin/webplugin_delegate_stub.cc
index 81267b5..21d8112 100644
--- a/content/plugin/webplugin_delegate_stub.cc
+++ b/content/plugin/webplugin_delegate_stub.cc
@@ -438,7 +438,7 @@ void WebPluginDelegateStub::OnFetchURL(
params.method,
data,
static_cast<unsigned int>(params.post_data.size()),
- params.referrer,
+ Referrer(params.referrer, params.referrer_policy),
params.notify_redirect,
params.is_plugin_src_load,
channel_->renderer_id(),
diff --git a/content/renderer/npapi/webplugin_delegate_proxy.cc b/content/renderer/npapi/webplugin_delegate_proxy.cc
index 3576b19..b1f5d74 100644
--- a/content/renderer/npapi/webplugin_delegate_proxy.cc
+++ b/content/renderer/npapi/webplugin_delegate_proxy.cc
@@ -1121,7 +1121,7 @@ void WebPluginDelegateProxy::FetchURL(unsigned long resource_id,
const std::string& method,
const char* buf,
unsigned int len,
- const GURL& referrer,
+ const Referrer& referrer,
bool notify_redirects,
bool is_plugin_src_load,
int origin_pid,
@@ -1137,7 +1137,8 @@ void WebPluginDelegateProxy::FetchURL(unsigned long resource_id,
params.post_data.resize(len);
memcpy(&params.post_data.front(), buf, len);
}
- params.referrer = referrer;
+ params.referrer = referrer.url;
+ params.referrer_policy = referrer.policy;
params.notify_redirect = notify_redirects;
params.is_plugin_src_load = is_plugin_src_load;
params.render_frame_id = render_frame_id;
diff --git a/content/renderer/npapi/webplugin_delegate_proxy.h b/content/renderer/npapi/webplugin_delegate_proxy.h
index 5b8c62c..2a308de 100644
--- a/content/renderer/npapi/webplugin_delegate_proxy.h
+++ b/content/renderer/npapi/webplugin_delegate_proxy.h
@@ -137,7 +137,7 @@ class WebPluginDelegateProxy
const std::string& method,
const char* buf,
unsigned int len,
- const GURL& referrer,
+ const Referrer& referrer,
bool notify_redirects,
bool is_plugin_src_load,
int origin_pid,
diff --git a/content/renderer/npapi/webplugin_impl.cc b/content/renderer/npapi/webplugin_impl.cc
index 4370dec..2c75d42 100644
--- a/content/renderer/npapi/webplugin_impl.cc
+++ b/content/renderer/npapi/webplugin_impl.cc
@@ -650,7 +650,7 @@ bool WebPluginImpl::SetPostData(WebURLRequest* request,
return rv;
}
-bool WebPluginImpl::IsValidUrl(const GURL& url, Referrer referrer_flag) {
+bool WebPluginImpl::IsValidUrl(const GURL& url, ReferrerValue referrer_flag) {
if (referrer_flag == PLUGIN_SRC &&
mime_type_ == kFlashPluginSwfMimeType &&
url.GetOrigin() != plugin_url_.GetOrigin()) {
@@ -682,7 +682,7 @@ WebPluginImpl::RoutingStatus WebPluginImpl::RouteToFrame(
const char* buf,
unsigned int len,
int notify_id,
- Referrer referrer_flag) {
+ ReferrerValue referrer_flag) {
// If there is no target, there is nothing to do
if (!target)
return NOT_ROUTED;
@@ -1161,7 +1161,7 @@ void WebPluginImpl::HandleURLRequestInternal(const char* url,
unsigned int len,
int notify_id,
bool popups_allowed,
- Referrer referrer_flag,
+ ReferrerValue referrer_flag,
bool notify_redirects,
bool is_plugin_src_load) {
// For this request, we either route the output to a frame
@@ -1233,8 +1233,9 @@ void WebPluginImpl::HandleURLRequestInternal(const char* url,
// WebFrameImpl::setReferrerForRequest does.
WebURLRequest request(complete_url);
SetReferrer(&request, referrer_flag);
- GURL referrer(
- request.httpHeaderField(WebString::fromUTF8("Referer")).utf8());
+ Referrer referrer(
+ GURL(request.httpHeaderField(WebString::fromUTF8("Referer"))),
+ request.referrerPolicy());
GURL first_party_for_cookies = webframe_->document().firstPartyForCookies();
delegate_->FetchURL(resource_id, notify_id, complete_url,
@@ -1269,7 +1270,7 @@ bool WebPluginImpl::InitiateHTTPRequest(unsigned long resource_id,
const char* buf,
int buf_len,
const char* range_info,
- Referrer referrer_flag,
+ ReferrerValue referrer_flag,
bool notify_redirects,
bool is_plugin_src_load) {
if (!client) {
@@ -1520,7 +1521,7 @@ void WebPluginImpl::TearDownPluginInstance(
}
void WebPluginImpl::SetReferrer(blink::WebURLRequest* request,
- Referrer referrer_flag) {
+ ReferrerValue referrer_flag) {
switch (referrer_flag) {
case DOCUMENT_URL:
webframe_->setReferrerForRequest(*request, GURL());
diff --git a/content/renderer/npapi/webplugin_impl.h b/content/renderer/npapi/webplugin_impl.h
index 6115d08..4f73da4 100644
--- a/content/renderer/npapi/webplugin_impl.h
+++ b/content/renderer/npapi/webplugin_impl.h
@@ -155,7 +155,7 @@ class WebPluginImpl : public WebPlugin,
// Determines the referrer value sent along with outgoing HTTP requests
// issued by plugins.
- enum Referrer {
+ enum ReferrerValue {
PLUGIN_SRC,
DOCUMENT_URL,
NO_REFERRER
@@ -172,7 +172,7 @@ class WebPluginImpl : public WebPlugin,
const char* buf,
unsigned int len,
int notify_id,
- Referrer referrer_flag);
+ ReferrerValue referrer_flag);
// Returns the next avaiable resource id. Returns 0 if the operation fails.
// It may fail if the page has already been closed.
@@ -187,7 +187,7 @@ class WebPluginImpl : public WebPlugin,
const char* buf,
int len,
const char* range_info,
- Referrer referrer_flag,
+ ReferrerValue referrer_flag,
bool notify_redirects,
bool check_mixed_scripting);
@@ -242,7 +242,7 @@ class WebPluginImpl : public WebPlugin,
unsigned int len,
int notify_id,
bool popups_allowed,
- Referrer referrer_flag,
+ ReferrerValue referrer_flag,
bool notify_redirects,
bool check_mixed_scripting);
@@ -260,10 +260,10 @@ class WebPluginImpl : public WebPlugin,
ClientInfo* GetClientInfoFromLoader(blink::WebURLLoader* loader);
// Helper function to set the referrer on the request passed in.
- void SetReferrer(blink::WebURLRequest* request, Referrer referrer_flag);
+ void SetReferrer(blink::WebURLRequest* request, ReferrerValue referrer_flag);
// Check for invalid chars like @, ;, \ before the first / (in path).
- bool IsValidUrl(const GURL& url, Referrer referrer_flag);
+ bool IsValidUrl(const GURL& url, ReferrerValue referrer_flag);
std::vector<ClientInfo> clients_;