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

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 ec8057ddbdd56ed900ef686130045b13e1305eda..f66b4b3623e5e19165e46da40f0d8d1570cbe8bf 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -41,10 +41,12 @@
#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_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"
#include "content/renderer/pepper/pepper_in_process_resource_creation.h"
+#include "content/renderer/pepper/pepper_instance_state_accessor.h"
#include "content/renderer/pepper/pepper_platform_audio_input_impl.h"
#include "content/renderer/pepper/pepper_platform_audio_output_impl.h"
#include "content/renderer/pepper/pepper_platform_context_3d_impl.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,19 @@ namespace {
class HostDispatcherWrapper
: public webkit::ppapi::PluginDelegate::OutOfProcessProxy {
public:
- HostDispatcherWrapper() {}
+ HostDispatcherWrapper(RenderViewImpl* rv,
+ webkit::ppapi::PluginModule* module,
+ const ppapi::PpapiPermissions& perms)
+ : module_(module),
+ instance_state_(module),
+ host_factory_(rv, perms, &instance_state_) {
+ }
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 +131,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 +162,12 @@ class HostDispatcherWrapper
}
private:
+ webkit::ppapi::PluginModule* module_;
+ PepperInstanceStateAccessorImpl instance_state_;
+ ContentRendererPepperHostFactory host_factory_;
+
+ scoped_ptr<ppapi::host::PpapiHost> host_;
+
scoped_ptr<ppapi::proxy::HostDispatcher> dispatcher_;
scoped_ptr<ppapi::proxy::ProxyChannel::Delegate> dispatcher_delegate_;
};
@@ -325,12 +342,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());
@@ -348,6 +366,8 @@ scoped_refptr<webkit::ppapi::PluginModule>
if (module)
return module;
+ ppapi::PpapiPermissions permissions;
+
FilePath path(kBrowserPluginPath);
scoped_refptr<PepperHungPluginFilter> hung_filter(
new PepperHungPluginFilter(path,
@@ -358,15 +378,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());
@@ -786,12 +807,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