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

Unified Diff: content/renderer/pepper/pepper_plugin_delegate_impl.cc

Issue 10544089: Implement the file chooser as a new resource "host" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
Index: content/renderer/pepper/pepper_plugin_delegate_impl.cc
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
index a67a0e0703fe735bca655c3fd48504d78ff6ee43..d5d7a6b3ccd93f1eafbb398a2f1bd8a8032381c2 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -41,6 +41,8 @@
#include "content/renderer/media/pepper_platform_video_decoder_impl.h"
#include "content/renderer/p2p/p2p_transport_impl.h"
#include "content/renderer/p2p/socket_dispatcher.h"
+#include "content/renderer/pepper/content_instance_glue_impl.h"
+#include "content/renderer/pepper/content_renderer_pepper_host_factory.h"
#include "content/renderer/pepper/pepper_broker_impl.h"
#include "content/renderer/pepper/pepper_device_enumeration_event_handler.h"
#include "content/renderer/pepper/pepper_hung_plugin_filter.h"
@@ -63,6 +65,7 @@
#include "ppapi/c/dev/pp_video_dev.h"
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_flash.h"
+#include "ppapi/host/ppapi_host.h"
#include "ppapi/proxy/host_dispatcher.h"
#include "ppapi/proxy/pepper_file_messages.h"
#include "ppapi/proxy/ppapi_messages.h"
@@ -75,8 +78,6 @@
#include "ppapi/thunk/ppb_tcp_server_socket_private_api.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebCursorInfo.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserCompletion.h"
-#include "third_party/WebKit/Source/WebKit/chromium/public/WebFileChooserParams.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
@@ -105,13 +106,20 @@ namespace {
class HostDispatcherWrapper
: public webkit::ppapi::PluginDelegate::OutOfProcessProxy {
public:
- HostDispatcherWrapper() {}
+ HostDispatcherWrapper(RenderViewImpl* rv,
+ webkit::ppapi::PluginModule* module,
+ const ppapi::PpapiPermissions& perms)
+ : render_view_(rv),
+ module_(module),
+ instance_glue_(module),
+ host_factory_(rv, perms, &instance_glue_) {
+ }
virtual ~HostDispatcherWrapper() {}
bool Init(const IPC::ChannelHandle& channel_handle,
- PP_Module pp_module,
PP_GetInterface_Func local_get_interface,
const ppapi::Preferences& preferences,
+ const ppapi::PpapiPermissions& permissions,
PepperHungPluginFilter* filter) {
if (channel_handle.name.empty())
return false;
@@ -124,7 +132,11 @@ class HostDispatcherWrapper
dispatcher_delegate_.reset(new PepperProxyChannelDelegateImpl);
dispatcher_.reset(new ppapi::proxy::HostDispatcher(
- pp_module, local_get_interface, filter));
+ module_->pp_module(), local_get_interface, filter));
+
+ host_.reset(new ppapi::host::PpapiHost(dispatcher_.get(), &host_factory_,
+ permissions));
+ dispatcher_->AddFilter(host_.get());
if (!dispatcher_->InitHostWithChannel(dispatcher_delegate_.get(),
channel_handle,
@@ -151,6 +163,13 @@ class HostDispatcherWrapper
}
private:
+ RenderViewImpl* render_view_;
+ webkit::ppapi::PluginModule* module_;
+ ContentInstanceGlueImpl instance_glue_;
+ ContentRendererPepperHostFactory host_factory_;
+
+ scoped_ptr<ppapi::host::PpapiHost> host_;
+
scoped_ptr<ppapi::proxy::HostDispatcher> dispatcher_;
scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_;
};
@@ -261,12 +280,13 @@ PepperPluginDelegateImpl::CreatePepperPluginModule(
PepperPluginRegistry::GetInstance(),
permissions);
PepperPluginRegistry::GetInstance()->AddLiveModule(path, module);
- scoped_ptr<HostDispatcherWrapper> dispatcher(new HostDispatcherWrapper);
+ scoped_ptr<HostDispatcherWrapper> dispatcher(
+ new HostDispatcherWrapper(render_view_, module, permissions));
if (!dispatcher->Init(
channel_handle,
- module->pp_module(),
webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(),
GetPreferences(),
+ permissions,
hung_filter.get()))
return scoped_refptr<webkit::ppapi::PluginModule>();
module->InitAsProxied(dispatcher.release());
@@ -284,6 +304,8 @@ scoped_refptr<webkit::ppapi::PluginModule>
if (module)
return module;
+ ppapi::PpapiPermissions permissions;
+
FilePath path(kBrowserPluginPath);
scoped_refptr<PepperHungPluginFilter> hung_filter(
new PepperHungPluginFilter(path,
@@ -294,15 +316,16 @@ scoped_refptr<webkit::ppapi::PluginModule>
module = new webkit::ppapi::PluginModule(kBrowserPluginName,
path,
registry,
- ppapi::PpapiPermissions());
+ permissions);
RenderThreadImpl::current()->browser_plugin_registry()->AddModule(
guest_process_id, module);
- scoped_ptr<HostDispatcherWrapper> dispatcher(new HostDispatcherWrapper);
+ scoped_ptr<HostDispatcherWrapper> dispatcher(
+ new HostDispatcherWrapper(render_view_, module, permissions));
if (!dispatcher->Init(
channel_handle,
- module->pp_module(),
webkit::ppapi::PluginModule::GetLocalGetInterfaceFunc(),
GetPreferences(),
+ permissions,
hung_filter.get()))
return scoped_refptr<webkit::ppapi::PluginModule>();
module->InitAsProxied(dispatcher.release());
@@ -722,12 +745,6 @@ PepperPluginDelegateImpl::ConnectToBroker(
return broker;
}
-bool PepperPluginDelegateImpl::RunFileChooser(
- const WebKit::WebFileChooserParams& params,
- WebKit::WebFileChooserCompletion* chooser_completion) {
- return render_view_->runFileChooser(params, chooser_completion);
-}
-
bool PepperPluginDelegateImpl::AsyncOpenFile(
const FilePath& path,
int flags,

Powered by Google App Engine
This is Rietveld 408576698