summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-07 15:39:55 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-07 15:39:55 +0000
commit2799c02a46d0d8d2726f19c8b100ff67504a7349 (patch)
tree184426e3ce12615457a274e62ab3abcdf2152d81
parent2fa7c5c06d6fd30d23af3e71942d18d91eaf9b58 (diff)
downloadchromium_src-2799c02a46d0d8d2726f19c8b100ff67504a7349.zip
chromium_src-2799c02a46d0d8d2726f19c8b100ff67504a7349.tar.gz
chromium_src-2799c02a46d0d8d2726f19c8b100ff67504a7349.tar.bz2
Amit, please review everything.
jam, please review changes to the plugin create channel IPCs. mpcomplete, please review changes to chrome_plugin_host.cc ChromeFrame needs to intercept URL requests issued directly by plugins like gears to ensure that they get routed through the host browser network stack. We decide whether or not a request is to be handled based on the renderer process id and the render view id (routing id), which get passed in the ViewHostMsg_RequestResource IPC. If this request is issued by Gears then the routing id comes in as MSG_ROUTING_NONE, which causes the request to go through the chrome network stack. Fix is to pass the host render view id to the plugin in the PluginMsg_Init IPC. The plugin already receives the renderer process id. Both these ids now come back in the ViewHostMsg_RequestResource IPC. This fixes an issue with wave when rendered in full tab mode in ChromeFrame, where dropping a file into a wave would cause the renderer to hang. Fixes bug http://code.google.com/p/chromium/issues/detail?id=23992 Bug=23992 Review URL: http://codereview.chromium.org/370007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31387 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/automation/url_request_automation_job.cc10
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host.cc13
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_request_info.cc8
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_request_info.h15
-rw-r--r--chrome/common/plugin_messages.h7
-rw-r--r--chrome/common/render_messages.h19
-rw-r--r--chrome/common/resource_dispatcher.cc31
-rw-r--r--chrome/common/resource_dispatcher.h4
-rw-r--r--chrome/common/resource_dispatcher_unittest.cc2
-rw-r--r--chrome/plugin/chrome_plugin_host.cc24
-rw-r--r--chrome/plugin/webplugin_delegate_stub.cc3
-rw-r--r--chrome/plugin/webplugin_proxy.cc4
-rw-r--r--chrome/plugin/webplugin_proxy.h11
-rw-r--r--chrome/renderer/renderer_glue.cc2
14 files changed, 130 insertions, 23 deletions
diff --git a/chrome/browser/automation/url_request_automation_job.cc b/chrome/browser/automation/url_request_automation_job.cc
index ead7aab..fdd680f 100644
--- a/chrome/browser/automation/url_request_automation_job.cc
+++ b/chrome/browser/automation/url_request_automation_job.cc
@@ -92,9 +92,17 @@ URLRequestJob* URLRequestAutomationJob::Factory(URLRequest* request,
ResourceDispatcherHostRequestInfo* request_info =
ResourceDispatcherHost::InfoForRequest(request);
if (request_info) {
+ int child_id = request_info->child_id();
+ int route_id = request_info->route_id();
+
+ if (request_info->process_type() == ChildProcessInfo::PLUGIN_PROCESS) {
+ child_id = request_info->host_renderer_id();
+ route_id = request_info->host_render_view_id();
+ }
+
AutomationResourceMessageFilter::AutomationDetails details;
if (AutomationResourceMessageFilter::LookupRegisteredRenderView(
- request_info->child_id(), request_info->route_id(), &details)) {
+ child_id, route_id, &details)) {
URLRequestAutomationJob* job = new URLRequestAutomationJob(request,
details.tab_handle, request_info->request_id(), details.filter);
return job;
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index 8f51253..7ab4a67 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -600,7 +600,9 @@ void ResourceDispatcherHost::BeginRequest(
request_data.resource_type,
upload_size,
false, // is download
- ResourceType::IsFrame(request_data.resource_type)); // allow_download
+ ResourceType::IsFrame(request_data.resource_type), // allow_download
+ request_data.host_renderer_id,
+ request_data.host_render_view_id);
SetRequestInfo(request, extra_info); // Request takes ownership.
chrome_browser_net::SetOriginProcessUniqueIDForRequest(
request_data.origin_child_id, request);
@@ -753,7 +755,9 @@ void ResourceDispatcherHost::BeginDownload(const GURL& url,
ResourceType::SUB_RESOURCE,
0, // upload_size
true, // is_download
- true); // allow_download
+ true, // allow_download
+ -1, // Host renderer id
+ -1); // Host render view id
SetRequestInfo(request, extra_info); // Request takes ownership.
chrome_browser_net::SetOriginProcessUniqueIDForRequest(child_id, request);
@@ -809,7 +813,10 @@ void ResourceDispatcherHost::BeginSaveFile(const GURL& url,
ResourceType::SUB_RESOURCE,
0, // upload_size
false, // is_download
- false); // allow_download
+ false, // allow_download
+ -1, // Host renderer id
+ -1); // Host render view id
+
SetRequestInfo(request, extra_info); // Request takes ownership.
chrome_browser_net::SetOriginProcessUniqueIDForRequest(child_id, request);
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_request_info.cc b/chrome/browser/renderer_host/resource_dispatcher_host_request_info.cc
index bd488e7..23ba684 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_request_info.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_request_info.cc
@@ -17,7 +17,9 @@ ResourceDispatcherHostRequestInfo::ResourceDispatcherHostRequestInfo(
ResourceType::Type resource_type,
uint64 upload_size,
bool is_download,
- bool allow_download)
+ bool allow_download,
+ int host_renderer_id,
+ int host_render_view_id)
: resource_handler_(handler),
cross_site_handler_(NULL),
login_handler_(NULL),
@@ -42,7 +44,9 @@ ResourceDispatcherHostRequestInfo::ResourceDispatcherHostRequestInfo(
is_paused_(false),
called_on_response_started_(false),
has_started_reading_(false),
- paused_read_bytes_(0) {
+ paused_read_bytes_(0),
+ host_renderer_id_(host_renderer_id),
+ host_render_view_id_(host_render_view_id) {
}
ResourceDispatcherHostRequestInfo::~ResourceDispatcherHostRequestInfo() {
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_request_info.h b/chrome/browser/renderer_host/resource_dispatcher_host_request_info.h
index 7ceb760..affd32d 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_request_info.h
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_request_info.h
@@ -37,7 +37,9 @@ class ResourceDispatcherHostRequestInfo : public URLRequest::UserData {
ResourceType::Type resource_type,
uint64 upload_size,
bool is_download,
- bool allow_download);
+ bool allow_download,
+ int host_renderer_id,
+ int host_render_view_id);
virtual ~ResourceDispatcherHostRequestInfo();
// Top-level ResourceHandler servicing this request.
@@ -157,6 +159,9 @@ class ResourceDispatcherHostRequestInfo : public URLRequest::UserData {
int memory_cost() const { return memory_cost_; }
void set_memory_cost(int cost) { memory_cost_ = cost; }
+ int host_renderer_id() const { return host_renderer_id_; }
+ int host_render_view_id() const { return host_render_view_id_; }
+
private:
friend class ResourceDispatcherHost;
@@ -219,6 +224,14 @@ class ResourceDispatcherHostRequestInfo : public URLRequest::UserData {
bool has_started_reading_;
int paused_read_bytes_;
+ // The following two members are specified if the request is initiated by
+ // a plugin like Gears.
+
+ // Contains the id of the host renderer.
+ int host_renderer_id_;
+ // Contains the id of the host render view.
+ int host_render_view_id_;
+
DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostRequestInfo);
};
diff --git a/chrome/common/plugin_messages.h b/chrome/common/plugin_messages.h
index 60984d0..6ce53b8 100644
--- a/chrome/common/plugin_messages.h
+++ b/chrome/common/plugin_messages.h
@@ -38,6 +38,7 @@ struct PluginMsg_Init_Params {
std::vector<std::string> arg_names;
std::vector<std::string> arg_values;
bool load_manually;
+ int host_render_view_routing_id;
};
struct PluginHostMsg_URLRequest_Params {
@@ -121,6 +122,7 @@ struct ParamTraits<PluginMsg_Init_Params> {
WriteParam(m, p.arg_names);
WriteParam(m, p.arg_values);
WriteParam(m, p.load_manually);
+ WriteParam(m, p.host_render_view_routing_id);
}
static bool Read(const Message* m, void** iter, param_type* p) {
return ReadParam(m, iter, &p->containing_window) &&
@@ -128,7 +130,8 @@ struct ParamTraits<PluginMsg_Init_Params> {
ReadParam(m, iter, &p->page_url) &&
ReadParam(m, iter, &p->arg_names) &&
ReadParam(m, iter, &p->arg_values) &&
- ReadParam(m, iter, &p->load_manually);
+ ReadParam(m, iter, &p->load_manually) &&
+ ReadParam(m, iter, &p->host_render_view_routing_id);
}
static void Log(const param_type& p, std::wstring* l) {
l->append(L"(");
@@ -143,6 +146,8 @@ struct ParamTraits<PluginMsg_Init_Params> {
LogParam(p.arg_values, l);
l->append(L", ");
LogParam(p.load_manually, l);
+ l->append(L", ");
+ LogParam(p.host_render_view_routing_id, l);
l->append(L")");
}
};
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index 3409a3d..3ce88e8 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -340,6 +340,15 @@ struct ViewHostMsg_Resource_Request {
// Optional upload data (may be null).
scoped_refptr<net::UploadData> upload_data;
+
+ // The following two members are specified if the request is initiated by
+ // a plugin like Gears.
+
+ // Contains the id of the host renderer.
+ int host_renderer_id;
+
+ // Contains the id of the host render view.
+ int host_render_view_id;
};
// Parameters for a render request.
@@ -1255,6 +1264,8 @@ struct ParamTraits<ViewHostMsg_Resource_Request> {
WriteParam(m, p.request_context);
WriteParam(m, p.appcache_host_id);
WriteParam(m, p.upload_data);
+ WriteParam(m, p.host_renderer_id);
+ WriteParam(m, p.host_render_view_id);
}
static bool Read(const Message* m, void** iter, param_type* r) {
return
@@ -1270,7 +1281,9 @@ struct ParamTraits<ViewHostMsg_Resource_Request> {
ReadParam(m, iter, &r->resource_type) &&
ReadParam(m, iter, &r->request_context) &&
ReadParam(m, iter, &r->appcache_host_id) &&
- ReadParam(m, iter, &r->upload_data);
+ ReadParam(m, iter, &r->upload_data) &&
+ ReadParam(m, iter, &r->host_renderer_id) &&
+ ReadParam(m, iter, &r->host_render_view_id);
}
static void Log(const param_type& p, std::wstring* l) {
l->append(L"(");
@@ -1293,6 +1306,10 @@ struct ParamTraits<ViewHostMsg_Resource_Request> {
LogParam(p.request_context, l);
l->append(L", ");
LogParam(p.appcache_host_id, l);
+ l->append(L", ");
+ LogParam(p.host_renderer_id, l);
+ l->append(L", ");
+ LogParam(p.host_render_view_id, l);
l->append(L")");
}
};
diff --git a/chrome/common/resource_dispatcher.cc b/chrome/common/resource_dispatcher.cc
index de66f9d..a55237d 100644
--- a/chrome/common/resource_dispatcher.cc
+++ b/chrome/common/resource_dispatcher.cc
@@ -56,7 +56,9 @@ class IPCResourceLoaderBridge : public ResourceLoaderBridge {
ResourceType::Type resource_type,
uint32 request_context,
int appcache_host_id,
- int routing_id);
+ int routing_id,
+ int host_renderer_id,
+ int host_render_view_id);
virtual ~IPCResourceLoaderBridge();
// ResourceLoaderBridge
@@ -94,6 +96,15 @@ class IPCResourceLoaderBridge : public ResourceLoaderBridge {
// indicates the URL of this resource request for help debugging
std::string url_;
#endif
+
+ // The following two members are specified if the request is initiated by
+ // a plugin like Gears.
+
+ // Contains the id of the host renderer.
+ int host_renderer_id_;
+
+ // Contains the id of the host render view.
+ int host_render_view_id_;
};
IPCResourceLoaderBridge::IPCResourceLoaderBridge(
@@ -110,11 +121,15 @@ IPCResourceLoaderBridge::IPCResourceLoaderBridge(
ResourceType::Type resource_type,
uint32 request_context,
int appcache_host_id,
- int routing_id)
+ int routing_id,
+ int host_renderer_id,
+ int host_render_view_id)
: peer_(NULL),
dispatcher_(dispatcher),
request_id_(-1),
- routing_id_(routing_id) {
+ routing_id_(routing_id),
+ host_renderer_id_(host_renderer_id),
+ host_render_view_id_(host_render_view_id) {
DCHECK(dispatcher_) << "no resource dispatcher";
request_.method = method;
request_.url = url;
@@ -128,6 +143,8 @@ IPCResourceLoaderBridge::IPCResourceLoaderBridge(
request_.resource_type = resource_type;
request_.request_context = request_context;
request_.appcache_host_id = appcache_host_id;
+ request_.host_renderer_id = host_renderer_id_;
+ request_.host_render_view_id = host_render_view_id_;
#ifdef LOG_RESOURCE_REQUESTS
url_ = url.possibly_invalid_spec();
@@ -566,7 +583,9 @@ webkit_glue::ResourceLoaderBridge* ResourceDispatcher::CreateBridge(
ResourceType::Type resource_type,
uint32 request_context,
int appcache_host_id,
- int route_id) {
+ int route_id,
+ int host_renderer_id,
+ int host_render_view_id) {
return new webkit_glue::IPCResourceLoaderBridge(this, method, url,
first_party_for_cookies,
referrer, frame_origin,
@@ -575,7 +594,9 @@ webkit_glue::ResourceLoaderBridge* ResourceDispatcher::CreateBridge(
resource_type,
request_context,
appcache_host_id,
- route_id);
+ route_id,
+ host_renderer_id,
+ host_render_view_id);
}
bool ResourceDispatcher::IsResourceDispatcherMessage(
diff --git a/chrome/common/resource_dispatcher.h b/chrome/common/resource_dispatcher.h
index d5747a2..7a93024 100644
--- a/chrome/common/resource_dispatcher.h
+++ b/chrome/common/resource_dispatcher.h
@@ -46,7 +46,9 @@ class ResourceDispatcher {
ResourceType::Type resource_type,
uint32 request_context /* used for plugin->browser requests */,
int appcache_host_id,
- int routing_id);
+ int routing_id,
+ int host_renderer_id,
+ int host_render_view_id);
// Adds a request from the pending_requests_ list, returning the new
// requests' ID
diff --git a/chrome/common/resource_dispatcher_unittest.cc b/chrome/common/resource_dispatcher_unittest.cc
index bfdbad5..b8503ce 100644
--- a/chrome/common/resource_dispatcher_unittest.cc
+++ b/chrome/common/resource_dispatcher_unittest.cc
@@ -147,7 +147,7 @@ class ResourceDispatcherTest : public testing::Test,
ResourceLoaderBridge* bridge = dispatcher_->CreateBridge(
"GET", GURL(test_page_url), GURL(test_page_url), GURL(), "null",
"null", std::string(), 0, 0, ResourceType::SUB_RESOURCE, 0,
- appcache::kNoHostId, MSG_ROUTING_CONTROL);
+ appcache::kNoHostId, MSG_ROUTING_CONTROL, -1, -1);
return bridge;
}
diff --git a/chrome/plugin/chrome_plugin_host.cc b/chrome/plugin/chrome_plugin_host.cc
index f8b1b8f..6c3e71a 100644
--- a/chrome/plugin/chrome_plugin_host.cc
+++ b/chrome/plugin/chrome_plugin_host.cc
@@ -146,7 +146,7 @@ class PluginRequestHandlerProxy
upload_content_.back().SetToFilePathRange(filepath, offset, length);
}
- CPError Start() {
+ CPError Start(int renderer_id, int render_view_id) {
bridge_.reset(
PluginThread::current()->resource_dispatcher()->CreateBridge(
cprequest_->method,
@@ -161,7 +161,9 @@ class PluginRequestHandlerProxy
ResourceType::OBJECT,
cprequest_->context,
appcache::kNoHostId,
- MSG_ROUTING_CONTROL));
+ MSG_ROUTING_CONTROL,
+ renderer_id,
+ render_view_id));
if (!bridge_.get())
return CPERR_FAILURE;
@@ -493,7 +495,23 @@ CPError STDCALL CPR_StartRequest(CPRequest* request) {
PluginRequestHandlerProxy* handler =
PluginRequestHandlerProxy::FromCPRequest(request);
CHECK(handler);
- return handler->Start();
+
+ int renderer_id = -1;
+ int render_view_id = -1;
+
+ WebPluginProxy* webplugin = WebPluginProxy::FromCPBrowsingContext(
+ request->context);
+ if (webplugin) {
+ renderer_id = webplugin->GetRendererId();
+ if (renderer_id == -1)
+ return CPERR_FAILURE;
+
+ render_view_id = webplugin->host_render_view_routing_id();
+ if (render_view_id == -1)
+ return CPERR_FAILURE;
+ }
+
+ return handler->Start(renderer_id, render_view_id);
}
void STDCALL CPR_EndRequest(CPRequest* request, CPError reason) {
diff --git a/chrome/plugin/webplugin_delegate_stub.cc b/chrome/plugin/webplugin_delegate_stub.cc
index d2a583d..ac19f31 100644
--- a/chrome/plugin/webplugin_delegate_stub.cc
+++ b/chrome/plugin/webplugin_delegate_stub.cc
@@ -154,7 +154,8 @@ void WebPluginDelegateStub::OnInit(const PluginMsg_Init_Params& params,
#endif
webplugin_ = new WebPluginProxy(
- channel_, instance_id_, page_url_, params.containing_window);
+ channel_, instance_id_, page_url_, params.containing_window,
+ params.host_render_view_routing_id);
delegate_ = WebPluginDelegateImpl::Create(path, mime_type_, parent);
if (delegate_) {
webplugin_->set_delegate(delegate_);
diff --git a/chrome/plugin/webplugin_proxy.cc b/chrome/plugin/webplugin_proxy.cc
index df02104..ab5326f 100644
--- a/chrome/plugin/webplugin_proxy.cc
+++ b/chrome/plugin/webplugin_proxy.cc
@@ -43,7 +43,8 @@ WebPluginProxy::WebPluginProxy(
PluginChannel* channel,
int route_id,
const GURL& page_url,
- gfx::NativeViewId containing_window)
+ gfx::NativeViewId containing_window,
+ int host_render_view_routing_id)
: channel_(channel),
route_id_(route_id),
cp_browsing_context_(0),
@@ -53,6 +54,7 @@ WebPluginProxy::WebPluginProxy(
waiting_for_paint_(false),
containing_window_(containing_window),
page_url_(page_url),
+ host_render_view_routing_id_(host_render_view_routing_id),
ALLOW_THIS_IN_INITIALIZER_LIST(runnable_method_factory_(this)) {
}
diff --git a/chrome/plugin/webplugin_proxy.h b/chrome/plugin/webplugin_proxy.h
index f75bd20..fbf88f6 100644
--- a/chrome/plugin/webplugin_proxy.h
+++ b/chrome/plugin/webplugin_proxy.h
@@ -34,7 +34,8 @@ class WebPluginProxy : public webkit_glue::WebPlugin {
WebPluginProxy(PluginChannel* channel,
int route_id,
const GURL& page_url,
- gfx::NativeViewId containing_window);
+ gfx::NativeViewId containing_window,
+ int host_render_view_routing_id);
~WebPluginProxy();
void set_delegate(WebPluginDelegateImpl* d) { delegate_ = d; }
@@ -85,6 +86,11 @@ class WebPluginProxy : public webkit_glue::WebPlugin {
// Returns the id of the renderer that contains this plugin.
int GetRendererId();
+ // Returns the id of the associated render view.
+ int host_render_view_routing_id() const {
+ return host_render_view_routing_id_;
+ }
+
// For windowless plugins, paints the given rectangle into the local buffer.
void Paint(const gfx::Rect& rect);
@@ -168,6 +174,9 @@ class WebPluginProxy : public webkit_glue::WebPlugin {
#endif
+ // Contains the routing id of the host render view.
+ int host_render_view_routing_id_;
+
ScopedRunnableMethodFactory<WebPluginProxy> runnable_method_factory_;
};
diff --git a/chrome/renderer/renderer_glue.cc b/chrome/renderer/renderer_glue.cc
index e7a5a36..d922467 100644
--- a/chrome/renderer/renderer_glue.cc
+++ b/chrome/renderer/renderer_glue.cc
@@ -234,7 +234,7 @@ ResourceLoaderBridge* ResourceLoaderBridge::Create(
return dispatch->CreateBridge(method, url, first_party_for_cookies, referrer,
frame_origin, main_frame_origin, headers,
load_flags, origin_pid, resource_type, 0,
- appcache_host_id, routing_id);
+ appcache_host_id, routing_id, -1 , -1);
}
// static factory function