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

Unified Diff: webkit/glue/webplugin_impl.cc

Issue 459003: Don't set referrers on outgoing plugin requests if the load_manually flag is ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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
« no previous file with comments | « webkit/glue/webplugin_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/webplugin_impl.cc
===================================================================
--- webkit/glue/webplugin_impl.cc (revision 33607)
+++ webkit/glue/webplugin_impl.cc (working copy)
@@ -479,7 +479,8 @@
bool is_file_data,
bool notify_needed,
intptr_t notify_data,
- const char* url) {
+ const char* url,
+ Referrer referrer_flag) {
// If there is no target, there is nothing to do
if (!target)
return NOT_ROUTED;
@@ -522,6 +523,8 @@
}
WebURLRequest request(complete_url);
+ SetReferrer(&request, referrer_flag);
+
request.setHTTPMethod(WebString::fromUTF8(method));
if (len > 0) {
if (!is_file_data) {
@@ -595,7 +598,7 @@
void WebPluginImpl::OnDownloadPluginSrcUrl() {
HandleURLRequestInternal("GET", false, NULL, 0, NULL, false, false,
plugin_url_.spec().c_str(), NULL, false,
- false);
+ DOCUMENT_URL);
}
WebPluginResourceClient* WebPluginImpl::GetClientFromLoader(
@@ -793,16 +796,18 @@
const char* buf, bool is_file_data,
bool notify, const char* url,
intptr_t notify_data, bool popups_allowed) {
+ // GetURL/PostURL requests initiated explicitly by plugins should specify the
+ // plugin SRC url as the referrer if it is available.
HandleURLRequestInternal(method, is_javascript_url, target, len, buf,
is_file_data, notify, url, notify_data,
- popups_allowed, true);
+ popups_allowed, PLUGIN_SRC);
}
void WebPluginImpl::HandleURLRequestInternal(
const char *method, bool is_javascript_url, const char* target,
unsigned int len, const char* buf, bool is_file_data, bool notify,
const char* url, intptr_t notify_data, bool popups_allowed,
- bool use_plugin_src_as_referrer) {
+ Referrer referrer_flag) {
// For this request, we either route the output to a frame
// because a target has been specified, or we handle the request
// here, i.e. by executing the script if it is a javascript url
@@ -812,7 +817,7 @@
// to the plugin's frame.
RoutingStatus routing_status =
RouteToFrame(method, is_javascript_url, target, len, buf, is_file_data,
- notify, notify_data, url);
+ notify, notify_data, url, referrer_flag);
if (routing_status == ROUTED)
return;
@@ -850,7 +855,7 @@
return;
InitiateHTTPRequest(resource_id, resource_client, method, buf, len,
- complete_url, NULL, use_plugin_src_as_referrer);
+ complete_url, NULL, referrer_flag);
}
}
@@ -865,7 +870,7 @@
int buf_len,
const GURL& url,
const char* range_info,
- bool use_plugin_src_as_referrer) {
+ Referrer referrer_flag) {
if (!client) {
NOTREACHED();
return false;
@@ -892,12 +897,7 @@
SetPostData(&info.request, buf, buf_len);
}
- // GetURL/PostURL requests initiated explicitly by plugins should specify the
- // plugin SRC url as the referrer if it is available.
- GURL referrer_url;
- if (use_plugin_src_as_referrer && !plugin_url_.spec().empty())
- referrer_url = plugin_url_;
- webframe_->setReferrerForRequest(info.request, referrer_url);
+ SetReferrer(&info.request, referrer_flag);
// Sets the routing id to associate the ResourceRequest with the RenderView.
webframe_->dispatchWillSendRequest(info.request);
@@ -930,7 +930,7 @@
resource_id, complete_url, notify_needed, notify_data, existing_stream);
InitiateHTTPRequest(
resource_id, resource_client, "GET", NULL, 0, complete_url, range_info,
- true);
+ load_manually_ ? NO_REFERRER : PLUGIN_SRC);
}
void WebPluginImpl::SetDeferResourceLoading(int resource_id, bool defer) {
@@ -1065,4 +1065,20 @@
method_factory_.RevokeAll();
}
+void WebPluginImpl::SetReferrer(WebKit::WebURLRequest* request,
+ Referrer referrer_flag) {
+ switch (referrer_flag) {
+ case DOCUMENT_URL:
+ webframe_->setReferrerForRequest(*request, GURL());
+ break;
+
+ case PLUGIN_SRC:
+ webframe_->setReferrerForRequest(*request, plugin_url_);
+ break;
+
+ default:
+ break;
+ }
+}
+
} // namespace webkit_glue
« no previous file with comments | « webkit/glue/webplugin_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698