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

Unified Diff: webkit/glue/webplugin_impl.cc

Issue 7871: This fixes http://code.google.com/p/chromium/issues/detail?id=3585, which is ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years, 2 months 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 3852)
+++ webkit/glue/webplugin_impl.cc (working copy)
@@ -258,7 +258,8 @@
WebFrameImpl *frame,
WebPluginDelegate* delegate,
bool load_manually) {
- WebPluginImpl* webplugin = new WebPluginImpl(element, frame, delegate, url);
+ WebPluginImpl* webplugin = new WebPluginImpl(element, frame, delegate, url,
+ load_manually);
if (!delegate->Initialize(url, argn, argv, argc, webplugin, load_manually)) {
delegate->PluginDestroyed();
@@ -275,7 +276,8 @@
WebPluginImpl::WebPluginImpl(WebCore::Element* element,
WebFrameImpl* webframe,
WebPluginDelegate* delegate,
- const GURL& plugin_url)
+ const GURL& plugin_url,
+ bool load_manually)
: windowless_(false),
window_(NULL),
element_(element),
@@ -285,7 +287,9 @@
visible_(false),
received_first_paint_notification_(false),
widget_(NULL),
- plugin_url_(plugin_url) {
+ plugin_url_(plugin_url),
+ load_manually_(load_manually),
+ first_geometry_update_(true) {
}
WebPluginImpl::~WebPluginImpl() {
@@ -645,6 +649,18 @@
force_geometry_update_ = false;
delegate_->FlushGeometryUpdates();
}
+
+ // Initiate a download on the plugin url. This should be done for the
+ // first update geometry sequence.
+ if (first_geometry_update_) {
+ first_geometry_update_ = false;
+ // An empty url corresponds to an EMBED tag with no src attribute.
+ if (!load_manually_ && plugin_url_.is_valid()) {
+ HandleURLRequestInternal("GET", false, NULL, 0, NULL, false, false,
+ plugin_url_.spec().c_str(), NULL, false,
+ false);
+ }
+ }
}
void WebPluginImpl::paint(WebCore::GraphicsContext* gc,
@@ -1104,6 +1120,16 @@
const char* buf, bool is_file_data,
bool notify, const char* url,
void* notify_data, bool popups_allowed) {
+ HandleURLRequestInternal(method, is_javascript_url, target, len, buf,
+ is_file_data, notify, url, notify_data,
+ popups_allowed, true);
+}
+
+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, void* notify_data, bool popups_allowed,
+ bool use_plugin_src_as_referrer) {
// 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
@@ -1153,7 +1179,8 @@
}
InitiateHTTPRequest(resource_id, resource_client, method, buf, len,
- GURL(complete_url_string), NULL);
+ GURL(complete_url_string), NULL,
+ use_plugin_src_as_referrer);
}
}
@@ -1167,7 +1194,8 @@
const char* method, const char* buf,
int buf_len,
const GURL& url,
- const char* range_info) {
+ const char* range_info,
+ bool use_plugin_src_as_referrer) {
if (!client) {
NOTREACHED();
return false;
@@ -1188,12 +1216,12 @@
info.request.addHTTPHeaderField("Range", range_info);
WebCore::String referrer;
- // If the plugin is instantiated without a SRC URL, then use the
- // containing frame URL as the referrer.
- if (plugin_url_.spec().empty()) {
+ // GetURL/PostURL requests initiated explicitly by plugins should specify the
+ // plugin SRC url as the referrer if it is available.
+ if (use_plugin_src_as_referrer && !plugin_url_.spec().empty()) {
+ referrer = webkit_glue::StdStringToString(plugin_url_.spec());
+ } else {
referrer = frame()->loader()->outgoingReferrer();
- } else {
- referrer = webkit_glue::StdStringToString(plugin_url_.spec());
}
if (!WebCore::FrameLoader::shouldHideReferrer(kurl, referrer))
@@ -1233,7 +1261,7 @@
notify_needed, notify_data,
existing_stream);
InitiateHTTPRequest(resource_id, resource_client, "GET", NULL, 0,
- GURL(complete_url_string), range_info);
+ GURL(complete_url_string), range_info, true);
}
void WebPluginImpl::HandleHttpMultipartResponse(
« 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