diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-11 19:13:03 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-11 19:13:03 +0000 |
commit | 01cb1991150f05ffb77a43e98005661671a0aff0 (patch) | |
tree | c61b5e8446110c284eed4812ce511d5117853a9e /content/renderer/npapi/webplugin_delegate_proxy.cc | |
parent | 35179be6fcd7cf9cb4db346e266621aab6941c14 (diff) | |
download | chromium_src-01cb1991150f05ffb77a43e98005661671a0aff0.zip chromium_src-01cb1991150f05ffb77a43e98005661671a0aff0.tar.gz chromium_src-01cb1991150f05ffb77a43e98005661671a0aff0.tar.bz2 |
Load NPAPI plugin resources through the browser process directly instead of going through the renderer. This is needed because when we have site isolation enabled we won't trust the renderer to fetch urls from arbitrary origins, which is something that NPAPI plugins can do.
In a followup I'll implement range requests.
For now this is behind the --direct-npapi-requests flag.
BUG=286074
R=ananta@chromium.org, jschuh@chromium.org
Review URL: https://codereview.chromium.org/23503043
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@222602 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/npapi/webplugin_delegate_proxy.cc')
-rw-r--r-- | content/renderer/npapi/webplugin_delegate_proxy.cc | 53 |
1 files changed, 41 insertions, 12 deletions
diff --git a/content/renderer/npapi/webplugin_delegate_proxy.cc b/content/renderer/npapi/webplugin_delegate_proxy.cc index de133d5..cf34bee 100644 --- a/content/renderer/npapi/webplugin_delegate_proxy.cc +++ b/content/renderer/npapi/webplugin_delegate_proxy.cc @@ -28,13 +28,13 @@ #include "content/child/npapi/npobject_proxy.h" #include "content/child/npapi/npobject_stub.h" #include "content/child/npapi/npobject_util.h" -#include "content/child/npapi/webplugin.h" #include "content/child/npapi/webplugin_resource_client.h" #include "content/child/plugin_messages.h" #include "content/common/content_constants_internal.h" #include "content/common/view_messages.h" #include "content/public/renderer/content_renderer_client.h" #include "content/renderer/npapi/plugin_channel_host.h" +#include "content/renderer/npapi/webplugin_impl.h" #include "content/renderer/render_thread_impl.h" #include "content/renderer/render_view_impl.h" #include "content/renderer/sad_plugin.h" @@ -201,10 +201,11 @@ class ResourceClientProxy : public WebPluginResourceClient { } // namespace WebPluginDelegateProxy::WebPluginDelegateProxy( + WebPluginImpl* plugin, const std::string& mime_type, const base::WeakPtr<RenderViewImpl>& render_view) : render_view_(render_view), - plugin_(NULL), + plugin_(plugin), uses_shared_bitmaps_(false), #if defined(OS_MACOSX) uses_compositor_(false), @@ -284,7 +285,6 @@ bool WebPluginDelegateProxy::Initialize( const GURL& url, const std::vector<std::string>& arg_names, const std::vector<std::string>& arg_values, - WebPlugin* plugin, bool load_manually) { // TODO(shess): Attempt to work around http://crbug.com/97285 and // http://crbug.com/141055 by retrying the connection. Reports seem @@ -373,8 +373,6 @@ bool WebPluginDelegateProxy::Initialize( params.host_render_view_routing_id = render_view_->routing_id(); params.load_manually = load_manually; - plugin_ = plugin; - result = false; Send(new PluginMsg_Init(instance_id_, params, &transparent_, &result)); @@ -440,10 +438,6 @@ bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(WebPluginDelegateProxy, msg) IPC_MESSAGE_HANDLER(PluginHostMsg_SetWindow, OnSetWindow) -#if defined(OS_WIN) - IPC_MESSAGE_HANDLER(PluginHostMsg_SetWindowlessData, OnSetWindowlessData) - IPC_MESSAGE_HANDLER(PluginHostMsg_NotifyIMEStatus, OnNotifyIMEStatus) -#endif IPC_MESSAGE_HANDLER(PluginHostMsg_CancelResource, OnCancelResource) IPC_MESSAGE_HANDLER(PluginHostMsg_InvalidateRect, OnInvalidateRect) IPC_MESSAGE_HANDLER(PluginHostMsg_GetWindowScriptNPObject, @@ -458,7 +452,14 @@ bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { OnInitiateHTTPRangeRequest) IPC_MESSAGE_HANDLER(PluginHostMsg_DeferResourceLoading, OnDeferResourceLoading) - + IPC_MESSAGE_HANDLER(PluginHostMsg_URLRedirectResponse, + OnURLRedirectResponse) + IPC_MESSAGE_HANDLER(PluginHostMsg_CheckIfRunInsecureContent, + OnCheckIfRunInsecureContent) +#if defined(OS_WIN) + IPC_MESSAGE_HANDLER(PluginHostMsg_SetWindowlessData, OnSetWindowlessData) + IPC_MESSAGE_HANDLER(PluginHostMsg_NotifyIMEStatus, OnNotifyIMEStatus) +#endif #if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(PluginHostMsg_FocusChanged, OnFocusChanged); @@ -471,8 +472,6 @@ bool WebPluginDelegateProxy::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(PluginHostMsg_AcceleratedPluginSwappedIOSurface, OnAcceleratedPluginSwappedIOSurface) #endif - IPC_MESSAGE_HANDLER(PluginHostMsg_URLRedirectResponse, - OnURLRedirectResponse) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() DCHECK(handled); @@ -1119,6 +1118,31 @@ WebPluginResourceClient* WebPluginDelegateProxy::CreateSeekableResourceClient( return proxy; } +void WebPluginDelegateProxy::FetchURL(unsigned long resource_id, + int notify_id, + const GURL& url, + const GURL& first_party_for_cookies, + const std::string& method, + const std::string& post_data, + const GURL& referrer, + bool notify_redirects, + bool is_plugin_src_load, + int origin_pid, + int render_view_id) { + PluginMsg_FetchURL_Params params; + params.resource_id = resource_id; + params.notify_id = notify_id; + params.url = url; + params.first_party_for_cookies = first_party_for_cookies; + params.method = method; + params.post_data = post_data; + params.referrer = referrer; + params.notify_redirect = notify_redirects; + params.is_plugin_src_load = is_plugin_src_load; + params.render_view_id = render_view_id; + Send(new PluginMsg_FetchURL(instance_id_, params)); +} + #if defined(OS_MACOSX) void WebPluginDelegateProxy::OnFocusChanged(bool focused) { if (render_view_) @@ -1204,4 +1228,9 @@ void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, plugin_->URLRedirectResponse(allow, resource_id); } +void WebPluginDelegateProxy::OnCheckIfRunInsecureContent(const GURL& url, + bool* result) { + *result = plugin_->CheckIfRunInsecureContent(url); +} + } // namespace content |