summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-24 05:15:33 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-24 05:15:33 +0000
commit56df0084a737762dfc129a372d9a1d515085aa60 (patch)
tree752ae7992aadb60b046a97abb3c5319ad83af21c
parente66ef60da5e4a989f1afdd9f469cef449e8346be (diff)
downloadchromium_src-56df0084a737762dfc129a372d9a1d515085aa60.zip
chromium_src-56df0084a737762dfc129a372d9a1d515085aa60.tar.gz
chromium_src-56df0084a737762dfc129a372d9a1d515085aa60.tar.bz2
Hide knowledge of webkit::ppapi::Plugin from chrome. This is part of moving ppapi implementation from webkit/plugins/ppapi to content/renderer.
BUG=263054 R=bbudge@chromium.org Review URL: https://codereview.chromium.org/19828007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213350 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/renderer/DEPS1
-rw-r--r--chrome/renderer/chrome_content_renderer_client.cc1
-rw-r--r--chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc3
-rw-r--r--chrome/renderer/pepper/ppb_nacl_private_impl.cc54
-rw-r--r--content/public/renderer/renderer_ppapi_host.h16
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.cc36
-rw-r--r--content/renderer/pepper/pepper_plugin_delegate_impl.h22
-rw-r--r--content/renderer/pepper/renderer_ppapi_host_impl.cc28
-rw-r--r--ppapi/api/private/ppb_instance_private.idl17
-rw-r--r--ppapi/api/private/ppb_nacl_private.idl57
-rw-r--r--ppapi/c/private/ppb_instance_private.h25
-rw-r--r--ppapi/c/private/ppb_nacl_private.h43
-rw-r--r--ppapi/native_client/src/trusted/plugin/nacl_entry_points.h4
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.cc11
-rw-r--r--ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc2
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c12
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.cc12
-rw-r--r--webkit/plugins/ppapi/mock_plugin_delegate.h7
-rw-r--r--webkit/plugins/ppapi/plugin_delegate.h19
-rw-r--r--webkit/plugins/ppapi/plugin_module.cc16
-rw-r--r--webkit/plugins/ppapi/plugin_module.h19
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.cc43
-rw-r--r--webkit/plugins/ppapi/ppapi_plugin_instance.h23
23 files changed, 252 insertions, 219 deletions
diff --git a/chrome/renderer/DEPS b/chrome/renderer/DEPS
index b694243..12111d0 100644
--- a/chrome/renderer/DEPS
+++ b/chrome/renderer/DEPS
@@ -20,7 +20,6 @@ include_rules = [
"+webkit/renderer",
# TODO(jam): eliminate all of these. http://crbug.com/263054
- "!webkit/plugins/ppapi/plugin_module.h",
"!webkit/plugins/ppapi/ppapi_plugin_instance.h",
"!webkit/plugins/plugin_constants.h",
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 945f982..f0262c0 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -100,7 +100,6 @@
#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/webui/jstemplate_builder.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
#if defined(ENABLE_WEBRTC)
diff --git a/chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc b/chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc
index 8dcfade..85662db 100644
--- a/chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc
+++ b/chrome/renderer/pepper/pepper_flash_drm_renderer_host.cc
@@ -12,7 +12,6 @@
#include "ppapi/host/ppapi_host.h"
#include "ppapi/proxy/ppapi_messages.h"
#include "ppapi/proxy/ppb_file_ref_proxy.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
namespace chrome {
@@ -52,7 +51,7 @@ int32_t PepperFlashDRMRendererHost::OnGetVoucherFile(
if (!plugin_instance)
return PP_ERROR_FAILED;
- base::FilePath plugin_dir = plugin_instance->module()->path().DirName();
+ base::FilePath plugin_dir = plugin_instance->GetModulePath().DirName();
DCHECK(!plugin_dir.empty());
base::FilePath voucher_file = plugin_dir.Append(
base::FilePath(kVoucherFilename));
diff --git a/chrome/renderer/pepper/ppb_nacl_private_impl.cc b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
index fe1d7dd..ecf653a 100644
--- a/chrome/renderer/pepper/ppb_nacl_private_impl.cc
+++ b/chrome/renderer/pepper/ppb_nacl_private_impl.cc
@@ -24,6 +24,7 @@
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/private/pp_file_handle.h"
#include "ppapi/native_client/src/trusted/plugin/nacl_entry_points.h"
+#include "ppapi/shared_impl/ppapi_permissions.h"
#include "ppapi/shared_impl/ppapi_preferences.h"
#include "ppapi/shared_impl/var.h"
#include "ppapi/thunk/enter.h"
@@ -32,7 +33,6 @@
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebPluginContainer.h"
#include "third_party/WebKit/public/web/WebView.h"
-#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
namespace {
@@ -77,7 +77,7 @@ static int GetRoutingID(PP_Instance instance) {
}
// Launch NaCl's sel_ldr process.
-PP_NaClResult LaunchSelLdr(PP_Instance instance,
+PP_ExternalPluginResult LaunchSelLdr(PP_Instance instance,
const char* alleged_url,
PP_Bool uses_irt,
PP_Bool uses_ppapi,
@@ -98,7 +98,7 @@ PP_NaClResult LaunchSelLdr(PP_Instance instance,
if (uses_ppapi) {
routing_id = GetRoutingID(instance);
if (!routing_id)
- return PP_NACL_FAILED;
+ return PP_EXTERNAL_PLUGIN_FAILED;
}
InstanceInfo instance_info;
@@ -124,11 +124,11 @@ PP_NaClResult LaunchSelLdr(PP_Instance instance,
PP_ToBool(enable_exception_handling)),
&launch_result,
&error_message_string))) {
- return PP_NACL_FAILED;
+ return PP_EXTERNAL_PLUGIN_FAILED;
}
if (!error_message_string.empty()) {
*error_message = ppapi::StringVar::StringToPPVar(error_message_string);
- return PP_NACL_FAILED;
+ return PP_EXTERNAL_PLUGIN_FAILED;
}
result_socket = launch_result.imc_channel_handle;
instance_info.channel_handle = launch_result.ipc_channel_handle;
@@ -146,15 +146,15 @@ PP_NaClResult LaunchSelLdr(PP_Instance instance,
*(static_cast<NaClHandle*>(imc_handle)) =
nacl::ToNativeHandle(result_socket);
- return PP_NACL_OK;
+ return PP_EXTERNAL_PLUGIN_OK;
}
-PP_NaClResult StartPpapiProxy(PP_Instance instance) {
+PP_ExternalPluginResult StartPpapiProxy(PP_Instance instance) {
InstanceInfoMap& map = g_instance_info.Get();
InstanceInfoMap::iterator it = map.find(instance);
if (it == map.end()) {
DLOG(ERROR) << "Could not find instance ID";
- return PP_NACL_FAILED;
+ return PP_EXTERNAL_PLUGIN_FAILED;
}
InstanceInfo instance_info = it->second;
map.erase(it);
@@ -163,33 +163,15 @@ PP_NaClResult StartPpapiProxy(PP_Instance instance) {
webkit::ppapi::PluginInstance::Get(instance);
if (!plugin_instance) {
DLOG(ERROR) << "GetInstance() failed";
- return PP_NACL_ERROR_MODULE;
+ return PP_EXTERNAL_PLUGIN_ERROR_MODULE;
}
- // Create a new module for each instance of the NaCl plugin that is using
- // the IPC based out-of-process proxy. We can't use the existing module,
- // because it is configured for the in-process NaCl plugin, and we must
- // keep it that way to allow the page to create other instances.
- webkit::ppapi::PluginModule* plugin_module = plugin_instance->module();
- scoped_refptr<webkit::ppapi::PluginModule> nacl_plugin_module(
- plugin_module->CreateModuleForNaClInstance());
-
- content::RendererPpapiHost* renderer_ppapi_host =
- content::RendererPpapiHost::CreateExternalPluginModule(
- nacl_plugin_module,
- plugin_instance,
- base::FilePath().AppendASCII(instance_info.url.spec()),
- instance_info.permissions,
- instance_info.channel_handle,
- instance_info.plugin_pid,
- instance_info.plugin_child_id);
- if (!renderer_ppapi_host) {
- DLOG(ERROR) << "CreateExternalPluginModule() failed";
- return PP_NACL_ERROR_MODULE;
- }
-
- // Finally, switch the instance to the proxy.
- return nacl_plugin_module->InitAsProxiedNaCl(plugin_instance);
+ return plugin_instance->SwitchToOutOfProcessProxy(
+ base::FilePath().AppendASCII(instance_info.url.spec()),
+ instance_info.permissions,
+ instance_info.channel_handle,
+ instance_info.plugin_pid,
+ instance_info.plugin_child_id);
}
int UrandomFD(void) {
@@ -315,7 +297,7 @@ PP_Bool IsPnaclEnabled() {
CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnablePnacl));
}
-PP_NaClResult ReportNaClError(PP_Instance instance,
+PP_ExternalPluginResult ReportNaClError(PP_Instance instance,
PP_NaClError error_id) {
IPC::Sender* sender = content::RenderThread::Get();
@@ -325,9 +307,9 @@ PP_NaClResult ReportNaClError(PP_Instance instance,
// or is it safe to include the appropriate headers in
// render_messages.h?
GetRoutingID(instance), static_cast<int>(error_id)))) {
- return PP_NACL_FAILED;
+ return PP_EXTERNAL_PLUGIN_FAILED;
}
- return PP_NACL_OK;
+ return PP_EXTERNAL_PLUGIN_OK;
}
PP_FileHandle OpenNaClExecutable(PP_Instance instance,
diff --git a/content/public/renderer/renderer_ppapi_host.h b/content/public/renderer/renderer_ppapi_host.h
index 8d2e585..5b33f7b 100644
--- a/content/public/renderer/renderer_ppapi_host.h
+++ b/content/public/renderer/renderer_ppapi_host.h
@@ -22,12 +22,10 @@ class Point;
}
namespace IPC {
-struct ChannelHandle;
class Message;
}
namespace ppapi {
-class PpapiPermissions;
namespace host {
class PpapiHost;
}
@@ -54,20 +52,6 @@ class RenderView;
// There will be one of these objects in the renderer per plugin module.
class RendererPpapiHost {
public:
- // Creates a host and sets up an out-of-process proxy for an external plugin
- // module. |file_path| should identify the module. It is only used to report
- // failures to the renderer.
- // Returns a host if the external module is proxied successfully, otherwise
- // returns NULL.
- CONTENT_EXPORT static RendererPpapiHost* CreateExternalPluginModule(
- scoped_refptr<webkit::ppapi::PluginModule> plugin_module,
- webkit::ppapi::PluginInstance* plugin_instance,
- const base::FilePath& file_path,
- ppapi::PpapiPermissions permissions,
- const IPC::ChannelHandle& channel_handle,
- base::ProcessId plugin_pid,
- int plugin_child_id);
-
// Returns the RendererPpapiHost associated with the given PP_Instance,
// or NULL if the instance is invalid.
CONTENT_EXPORT static RendererPpapiHost* GetForPPInstance(
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.cc b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
index 588f875..bb9be65 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.cc
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.cc
@@ -429,24 +429,6 @@ PepperPluginDelegateImpl::CreatePepperPluginModule(
return module;
}
-RendererPpapiHost* PepperPluginDelegateImpl::CreateExternalPluginModule(
- scoped_refptr<webkit::ppapi::PluginModule> module,
- const base::FilePath& path,
- ppapi::PpapiPermissions permissions,
- const IPC::ChannelHandle& channel_handle,
- base::ProcessId peer_pid,
- int plugin_child_id) {
- // We don't call PepperPluginRegistry::AddLiveModule, as this module is
- // managed externally.
- return CreateOutOfProcessModule(module.get(),
- path,
- permissions,
- channel_handle,
- peer_pid,
- plugin_child_id,
- true); // is_external = true
-}
-
scoped_refptr<PepperBrokerImpl> PepperPluginDelegateImpl::CreateBroker(
webkit::ppapi::PluginModule* plugin_module) {
DCHECK(plugin_module);
@@ -1362,6 +1344,24 @@ void PepperPluginDelegateImpl::HandleDocumentLoad(
}
}
+RendererPpapiHost* PepperPluginDelegateImpl::CreateExternalPluginModule(
+ scoped_refptr<webkit::ppapi::PluginModule> module,
+ const base::FilePath& path,
+ ppapi::PpapiPermissions permissions,
+ const IPC::ChannelHandle& channel_handle,
+ base::ProcessId peer_pid,
+ int plugin_child_id) {
+ // We don't call PepperPluginRegistry::AddLiveModule, as this module is
+ // managed externally.
+ return CreateOutOfProcessModule(module.get(),
+ path,
+ permissions,
+ channel_handle,
+ peer_pid,
+ plugin_child_id,
+ true); // is_external = true
+}
+
base::SharedMemory* PepperPluginDelegateImpl::CreateAnonymousSharedMemory(
size_t size) {
return RenderThread::Get()->HostAllocateSharedMemoryBuffer(size).release();
diff --git a/content/renderer/pepper/pepper_plugin_delegate_impl.h b/content/renderer/pepper/pepper_plugin_delegate_impl.h
index 4f3da51..0489f87 100644
--- a/content/renderer/pepper/pepper_plugin_delegate_impl.h
+++ b/content/renderer/pepper/pepper_plugin_delegate_impl.h
@@ -30,14 +30,9 @@ namespace base {
class FilePath;
}
-namespace IPC {
-struct ChannelHandle;
-}
-
namespace ppapi {
class PepperFilePath;
class PPB_X509Certificate_Fields;
-class PpapiPermissions;
}
namespace webkit {
@@ -75,16 +70,6 @@ class PepperPluginDelegateImpl
return &pepper_browser_connection_;
}
- // Sets up the renderer host and out-of-process proxy for an external plugin
- // module. Returns the renderer host, or NULL if it couldn't be created.
- RendererPpapiHost* CreateExternalPluginModule(
- scoped_refptr<webkit::ppapi::PluginModule> module,
- const base::FilePath& path,
- ppapi::PpapiPermissions permissions,
- const IPC::ChannelHandle& channel_handle,
- base::ProcessId plugin_pid,
- int plugin_child_id);
-
// Removes broker from pending_connect_broker_ if present. Returns true if so.
bool StopWaitingForBrokerConnection(PepperBrokerImpl* broker);
@@ -335,6 +320,13 @@ class PepperPluginDelegateImpl
virtual void HandleDocumentLoad(
webkit::ppapi::PluginInstance* instance,
const WebKit::WebURLResponse& response) OVERRIDE;
+ virtual content::RendererPpapiHost* CreateExternalPluginModule(
+ scoped_refptr<webkit::ppapi::PluginModule> module,
+ const base::FilePath& path,
+ ::ppapi::PpapiPermissions permissions,
+ const IPC::ChannelHandle& channel_handle,
+ base::ProcessId plugin_pid,
+ int plugin_child_id) OVERRIDE;
// RenderViewObserver implementation.
virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
diff --git a/content/renderer/pepper/renderer_ppapi_host_impl.cc b/content/renderer/pepper/renderer_ppapi_host_impl.cc
index 314a0b2..fb430b4 100644
--- a/content/renderer/pepper/renderer_ppapi_host_impl.cc
+++ b/content/renderer/pepper/renderer_ppapi_host_impl.cc
@@ -34,34 +34,6 @@ using webkit::ppapi::PluginInstance;
using webkit::ppapi::PluginModule;
namespace content {
-
-// static
-CONTENT_EXPORT RendererPpapiHost*
-RendererPpapiHost::CreateExternalPluginModule(
- scoped_refptr<PluginModule> plugin_module,
- PluginInstance* plugin_instance,
- const base::FilePath& file_path,
- ppapi::PpapiPermissions permissions,
- const IPC::ChannelHandle& channel_handle,
- base::ProcessId plugin_pid,
- int plugin_child_id) {
- RendererPpapiHost* renderer_ppapi_host = NULL;
- // Since we're the embedder, we can make assumptions about the delegate on
- // the instance.
- PepperPluginDelegateImpl* pepper_plugin_delegate =
- static_cast<PepperPluginDelegateImpl*>(plugin_instance->delegate());
- if (pepper_plugin_delegate) {
- renderer_ppapi_host = pepper_plugin_delegate->CreateExternalPluginModule(
- plugin_module,
- file_path,
- permissions,
- channel_handle,
- plugin_pid,
- plugin_child_id);
- }
- return renderer_ppapi_host;
-}
-
// static
CONTENT_EXPORT RendererPpapiHost*
RendererPpapiHost::GetForPPInstance(PP_Instance instance) {
diff --git a/ppapi/api/private/ppb_instance_private.idl b/ppapi/api/private/ppb_instance_private.idl
index 25fe5a2..2ba9df3 100644
--- a/ppapi/api/private/ppb_instance_private.idl
+++ b/ppapi/api/private/ppb_instance_private.idl
@@ -16,6 +16,23 @@ label Chrome {
};
/**
+ * The <code>PP_ExternalPluginResult </code> enum contains result codes from
+ * launching an external plugin.
+ */
+[assert_size(4)]
+enum PP_ExternalPluginResult {
+ /** Successful external plugin call */
+ PP_EXTERNAL_PLUGIN_OK = 0,
+ /** Unspecified external plugin error */
+ PP_EXTERNAL_PLUGIN_FAILED = 1,
+ /** Error creating the module */
+ PP_EXTERNAL_PLUGIN_ERROR_MODULE = 2,
+ /** Error creating and initializing the instance */
+ PP_EXTERNAL_PLUGIN_ERROR_INSTANCE = 3
+};
+
+
+/**
* The PPB_Instance_Private interface contains functions available only to
* trusted plugin instances.
*
diff --git a/ppapi/api/private/ppb_nacl_private.idl b/ppapi/api/private/ppb_nacl_private.idl
index c420e74..9e4e898 100644
--- a/ppapi/api/private/ppb_nacl_private.idl
+++ b/ppapi/api/private/ppb_nacl_private.idl
@@ -8,23 +8,9 @@
#inline c
#include "ppapi/c/private/pp_file_handle.h"
+#include "ppapi/c/private/ppb_instance_private.h"
#endinl
-/**
- * The <code>PP_NaClResult</code> enum contains NaCl result codes.
- */
-[assert_size(4)]
-enum PP_NaClResult {
- /** Successful NaCl call */
- PP_NACL_OK = 0,
- /** Unspecified NaCl error */
- PP_NACL_FAILED = 1,
- /** Error creating the module */
- PP_NACL_ERROR_MODULE = 2,
- /** Error creating and initializing the instance */
- PP_NACL_ERROR_INSTANCE = 3
-};
-
/** NaCl-specific errors that should be reported to the user */
enum PP_NaClError {
/**
@@ -36,9 +22,9 @@ enum PP_NaClError {
/* PPB_NaCl_Private */
interface PPB_NaCl_Private {
- /* Launches NaCl's sel_ldr process. Returns PP_NACL_OK on success and
- * writes a NaClHandle to imc_handle. Returns PP_NACL_FAILED on failure.
- * The |enable_ppapi_dev| parameter controls whether GetInterface
+ /* Launches NaCl's sel_ldr process. Returns PP_EXTERNAL_PLUGIN_OK on success
+ * and writes a NaClHandle to imc_handle. Returns PP_EXTERNAL_PLUGIN_FAILED on
+ * failure. The |enable_ppapi_dev| parameter controls whether GetInterface
* returns 'Dev' interfaces to the NaCl plugin. The |uses_ppapi| flag
* indicates that the nexe run by sel_ldr will use the PPAPI APIs.
* This implies that LaunchSelLdr is run from the main thread. If a nexe
@@ -50,24 +36,25 @@ interface PPB_NaCl_Private {
* The |enable_exception_handling| flag indicates whether or not the nexe
* will be able to use hardware exception handling.
*/
- PP_NaClResult LaunchSelLdr([in] PP_Instance instance,
- [in] str_t alleged_url,
- [in] PP_Bool uses_irt,
- [in] PP_Bool uses_ppapi,
- [in] PP_Bool enable_ppapi_dev,
- [in] PP_Bool enable_dyncode_syscalls,
- [in] PP_Bool enable_exception_handling,
- [out] mem_t imc_handle,
- [out] PP_Var error_message);
+ PP_ExternalPluginResult LaunchSelLdr([in] PP_Instance instance,
+ [in] str_t alleged_url,
+ [in] PP_Bool uses_irt,
+ [in] PP_Bool uses_ppapi,
+ [in] PP_Bool enable_ppapi_dev,
+ [in] PP_Bool enable_dyncode_syscalls,
+ [in] PP_Bool enable_exception_handling,
+ [out] mem_t imc_handle,
+ [out] PP_Var error_message);
/* This function starts the IPC proxy so the nexe can communicate with the
- * browser. Returns PP_NACL_OK on success, otherwise a result code indicating
- * the failure. PP_NACL_FAILED is returned if LaunchSelLdr wasn't called with
- * the instance. PP_NACL_ERROR_MODULE is returned if the module can't be
- * initialized. PP_NACL_ERROR_INSTANCE is returned if the instance can't be
- * initialized. PP_NACL_USE_SRPC is returned if the plugin should use SRPC.
+ * browser. Returns PP_EXTERNAL_PLUGIN_OK on success, otherwise a result code
+ * indicating the failure. PP_EXTERNAL_PLUGIN_FAILED is returned if
+ * LaunchSelLdr wasn't called with the instance.
+ * PP_EXTERNAL_PLUGIN_ERROR_MODULE is returned if the module can't be
+ * initialized. PP_EXTERNAL_PLUGIN_ERROR_INSTANCE is returned if the instance
+ * can't be initialized.
*/
- PP_NaClResult StartPpapiProxy(PP_Instance instance);
+ PP_ExternalPluginResult StartPpapiProxy(PP_Instance instance);
/* On POSIX systems, this function returns the file descriptor of
* /dev/urandom. On non-POSIX systems, this function returns 0.
@@ -146,8 +133,8 @@ interface PPB_NaCl_Private {
PP_Bool IsPnaclEnabled();
/* Display a UI message to the user. */
- PP_NaClResult ReportNaClError([in] PP_Instance instance,
- [in] PP_NaClError message_id);
+ PP_ExternalPluginResult ReportNaClError([in] PP_Instance instance,
+ [in] PP_NaClError message_id);
/* Opens a NaCl executable file in the application's extension directory
* corresponding to the file URL and returns a file descriptor, or an invalid
diff --git a/ppapi/c/private/ppb_instance_private.h b/ppapi/c/private/ppb_instance_private.h
index 561374d..886613e 100644
--- a/ppapi/c/private/ppb_instance_private.h
+++ b/ppapi/c/private/ppb_instance_private.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_instance_private.idl modified Mon Oct 8 10:50:04 2012. */
+/* From private/ppb_instance_private.idl modified Tue Jul 23 13:19:04 2013. */
#ifndef PPAPI_C_PRIVATE_PPB_INSTANCE_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_INSTANCE_PRIVATE_H_
@@ -26,6 +26,29 @@
/**
+ * @addtogroup Enums
+ * @{
+ */
+/**
+ * The <code>PP_ExternalPluginResult </code> enum contains result codes from
+ * launching an external plugin.
+ */
+typedef enum {
+ /** Successful external plugin call */
+ PP_EXTERNAL_PLUGIN_OK = 0,
+ /** Unspecified external plugin error */
+ PP_EXTERNAL_PLUGIN_FAILED = 1,
+ /** Error creating the module */
+ PP_EXTERNAL_PLUGIN_ERROR_MODULE = 2,
+ /** Error creating and initializing the instance */
+ PP_EXTERNAL_PLUGIN_ERROR_INSTANCE = 3
+} PP_ExternalPluginResult;
+PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_ExternalPluginResult, 4);
+/**
+ * @}
+ */
+
+/**
* @addtogroup Interfaces
* @{
*/
diff --git a/ppapi/c/private/ppb_nacl_private.h b/ppapi/c/private/ppb_nacl_private.h
index 9648831..bab26c5 100644
--- a/ppapi/c/private/ppb_nacl_private.h
+++ b/ppapi/c/private/ppb_nacl_private.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* From private/ppb_nacl_private.idl modified Mon Jul 15 09:19:33 2013. */
+/* From private/ppb_nacl_private.idl modified Tue Jul 23 13:16:52 2013. */
#ifndef PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
#define PPAPI_C_PRIVATE_PPB_NACL_PRIVATE_H_
@@ -14,6 +14,7 @@
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_var.h"
+#include "ppapi/c/private/ppb_instance_private.h"
#define PPB_NACL_PRIVATE_INTERFACE_1_0 "PPB_NaCl_Private;1.0"
#define PPB_NACL_PRIVATE_INTERFACE PPB_NACL_PRIVATE_INTERFACE_1_0
@@ -25,26 +26,12 @@
#include "ppapi/c/private/pp_file_handle.h"
+#include "ppapi/c/private/ppb_instance_private.h"
/**
* @addtogroup Enums
* @{
*/
-/**
- * The <code>PP_NaClResult</code> enum contains NaCl result codes.
- */
-typedef enum {
- /** Successful NaCl call */
- PP_NACL_OK = 0,
- /** Unspecified NaCl error */
- PP_NACL_FAILED = 1,
- /** Error creating the module */
- PP_NACL_ERROR_MODULE = 2,
- /** Error creating and initializing the instance */
- PP_NACL_ERROR_INSTANCE = 3
-} PP_NaClResult;
-PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_NaClResult, 4);
-
/** NaCl-specific errors that should be reported to the user */
typedef enum {
/**
@@ -77,15 +64,15 @@ struct PPB_NaCl_Private_1_0 {
* The |enable_exception_handling| flag indicates whether or not the nexe
* will be able to use hardware exception handling.
*/
- PP_NaClResult (*LaunchSelLdr)(PP_Instance instance,
- const char* alleged_url,
- PP_Bool uses_irt,
- PP_Bool uses_ppapi,
- PP_Bool enable_ppapi_dev,
- PP_Bool enable_dyncode_syscalls,
- PP_Bool enable_exception_handling,
- void* imc_handle,
- struct PP_Var* error_message);
+ PP_ExternalPluginResult (*LaunchSelLdr)(PP_Instance instance,
+ const char* alleged_url,
+ PP_Bool uses_irt,
+ PP_Bool uses_ppapi,
+ PP_Bool enable_ppapi_dev,
+ PP_Bool enable_dyncode_syscalls,
+ PP_Bool enable_exception_handling,
+ void* imc_handle,
+ struct PP_Var* error_message);
/* This function starts the IPC proxy so the nexe can communicate with the
* browser. Returns PP_NACL_OK on success, otherwise a result code indicating
* the failure. PP_NACL_FAILED is returned if LaunchSelLdr wasn't called with
@@ -93,7 +80,7 @@ struct PPB_NaCl_Private_1_0 {
* initialized. PP_NACL_ERROR_INSTANCE is returned if the instance can't be
* initialized. PP_NACL_USE_SRPC is returned if the plugin should use SRPC.
*/
- PP_NaClResult (*StartPpapiProxy)(PP_Instance instance);
+ PP_ExternalPluginResult (*StartPpapiProxy)(PP_Instance instance);
/* On POSIX systems, this function returns the file descriptor of
* /dev/urandom. On non-POSIX systems, this function returns 0.
*/
@@ -162,8 +149,8 @@ struct PPB_NaCl_Private_1_0 {
*/
PP_Bool (*IsPnaclEnabled)(void);
/* Display a UI message to the user. */
- PP_NaClResult (*ReportNaClError)(PP_Instance instance,
- PP_NaClError message_id);
+ PP_ExternalPluginResult (*ReportNaClError)(PP_Instance instance,
+ PP_NaClError message_id);
/* Opens a NaCl executable file in the application's extension directory
* corresponding to the file URL and returns a file descriptor, or an invalid
* handle on failure. |metadata| is left unchanged on failure.
diff --git a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
index 33e4f77..4fd620d 100644
--- a/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
+++ b/ppapi/native_client/src/trusted/plugin/nacl_entry_points.h
@@ -14,9 +14,9 @@
#include "native_client/src/shared/imc/nacl_imc_c.h"
#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/private/ppb_nacl_private.h"
+#include "ppapi/c/private/ppb_instance_private.h"
-typedef PP_NaClResult (*LaunchNaClProcessFunc)(
+typedef PP_ExternalPluginResult (*LaunchNaClProcessFunc)(
PP_Instance instance,
const char* alleged_url,
PP_Bool uses_irt,
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index 09a0724..3c54c26 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -482,8 +482,9 @@ bool Plugin::LoadNaClModuleContinuationIntern(ErrorInfo* error_info) {
"could not initialize module.");
return false;
}
- PP_NaClResult ipc_result = nacl_interface_->StartPpapiProxy(pp_instance());
- if (ipc_result == PP_NACL_OK) {
+ PP_ExternalPluginResult ipc_result =
+ nacl_interface_->StartPpapiProxy(pp_instance());
+ if (ipc_result == PP_EXTERNAL_PLUGIN_OK) {
// Log the amound of time that has passed between the trusted plugin being
// initialized and the untrusted plugin being initialized. This is
// (roughly) the cost of using NaCl, in terms of startup time.
@@ -491,13 +492,13 @@ bool Plugin::LoadNaClModuleContinuationIntern(ErrorInfo* error_info) {
"NaCl.Perf.StartupTime.NaClOverhead",
static_cast<float>(NaClGetTimeOfDayMicroseconds() - init_time_)
/ NACL_MICROS_PER_MILLI);
- } else if (ipc_result == PP_NACL_ERROR_MODULE) {
+ } else if (ipc_result == PP_EXTERNAL_PLUGIN_ERROR_MODULE) {
NaClLog(LOG_ERROR, "LoadNaClModuleContinuationIntern: "
- "Got PP_NACL_ERROR_MODULE\n");
+ "Got PP_EXTERNAL_PLUGIN_ERROR_MODULE\n");
error_info->SetReport(ERROR_START_PROXY_MODULE,
"could not initialize module.");
return false;
- } else if (ipc_result == PP_NACL_ERROR_INSTANCE) {
+ } else if (ipc_result == PP_EXTERNAL_PLUGIN_ERROR_INSTANCE) {
error_info->SetReport(ERROR_START_PROXY_INSTANCE,
"could not create instance.");
return false;
diff --git a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
index bd68de5..2714eac 100644
--- a/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
+++ b/ppapi/native_client/src/trusted/plugin/sel_ldr_launcher_chrome.cc
@@ -38,7 +38,7 @@ bool SelLdrLauncherChrome::Start(PP_Instance instance,
PP_FromBool(enable_dyncode_syscalls),
PP_FromBool(enable_exception_handling),
&channel_,
- &var_error_message) != PP_NACL_OK) {
+ &var_error_message) != PP_EXTERNAL_PLUGIN_OK) {
pp::Var var_error_message_cpp(pp::PASS_REF, var_error_message);
if (var_error_message_cpp.is_string()) {
*error_message = var_error_message_cpp.AsString();
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index ec358bf..d543664 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -2743,12 +2743,12 @@ static void Pnacl_M13_PPB_Instance_Private_ExecuteScript(struct PP_Var* _struct_
/* Begin wrapper methods for PPB_NaCl_Private_1_0 */
-static PP_NaClResult Pnacl_M13_PPB_NaCl_Private_LaunchSelLdr(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, void* imc_handle, struct PP_Var* error_message) {
+static PP_ExternalPluginResult Pnacl_M13_PPB_NaCl_Private_LaunchSelLdr(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, void* imc_handle, struct PP_Var* error_message) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
return iface->LaunchSelLdr(instance, alleged_url, uses_irt, uses_ppapi, enable_ppapi_dev, enable_dyncode_syscalls, enable_exception_handling, imc_handle, error_message);
}
-static PP_NaClResult Pnacl_M13_PPB_NaCl_Private_StartPpapiProxy(PP_Instance instance) {
+static PP_ExternalPluginResult Pnacl_M13_PPB_NaCl_Private_StartPpapiProxy(PP_Instance instance) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
return iface->StartPpapiProxy(instance);
}
@@ -2798,7 +2798,7 @@ static PP_Bool Pnacl_M13_PPB_NaCl_Private_IsPnaclEnabled(void) {
return iface->IsPnaclEnabled();
}
-static PP_NaClResult Pnacl_M13_PPB_NaCl_Private_ReportNaClError(PP_Instance instance, PP_NaClError message_id) {
+static PP_ExternalPluginResult Pnacl_M13_PPB_NaCl_Private_ReportNaClError(PP_Instance instance, PP_NaClError message_id) {
const struct PPB_NaCl_Private_1_0 *iface = Pnacl_WrapperInfo_PPB_NaCl_Private_1_0.real_iface;
return iface->ReportNaClError(instance, message_id);
}
@@ -4567,8 +4567,8 @@ struct PPB_Instance_Private_0_1 Pnacl_Wrappers_PPB_Instance_Private_0_1 = {
};
struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = {
- .LaunchSelLdr = (PP_NaClResult (*)(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, void* imc_handle, struct PP_Var* error_message))&Pnacl_M13_PPB_NaCl_Private_LaunchSelLdr,
- .StartPpapiProxy = (PP_NaClResult (*)(PP_Instance instance))&Pnacl_M13_PPB_NaCl_Private_StartPpapiProxy,
+ .LaunchSelLdr = (PP_ExternalPluginResult (*)(PP_Instance instance, const char* alleged_url, PP_Bool uses_irt, PP_Bool uses_ppapi, PP_Bool enable_ppapi_dev, PP_Bool enable_dyncode_syscalls, PP_Bool enable_exception_handling, void* imc_handle, struct PP_Var* error_message))&Pnacl_M13_PPB_NaCl_Private_LaunchSelLdr,
+ .StartPpapiProxy = (PP_ExternalPluginResult (*)(PP_Instance instance))&Pnacl_M13_PPB_NaCl_Private_StartPpapiProxy,
.UrandomFD = (int32_t (*)(void))&Pnacl_M13_PPB_NaCl_Private_UrandomFD,
.Are3DInterfacesDisabled = (PP_Bool (*)(void))&Pnacl_M13_PPB_NaCl_Private_Are3DInterfacesDisabled,
.BrokerDuplicateHandle = (int32_t (*)(PP_FileHandle source_handle, uint32_t process_id, PP_FileHandle* target_handle, uint32_t desired_access, uint32_t options))&Pnacl_M13_PPB_NaCl_Private_BrokerDuplicateHandle,
@@ -4578,7 +4578,7 @@ struct PPB_NaCl_Private_1_0 Pnacl_Wrappers_PPB_NaCl_Private_1_0 = {
.ReportTranslationFinished = (void (*)(PP_Instance instance))&Pnacl_M13_PPB_NaCl_Private_ReportTranslationFinished,
.IsOffTheRecord = (PP_Bool (*)(void))&Pnacl_M13_PPB_NaCl_Private_IsOffTheRecord,
.IsPnaclEnabled = (PP_Bool (*)(void))&Pnacl_M13_PPB_NaCl_Private_IsPnaclEnabled,
- .ReportNaClError = (PP_NaClResult (*)(PP_Instance instance, PP_NaClError message_id))&Pnacl_M13_PPB_NaCl_Private_ReportNaClError,
+ .ReportNaClError = (PP_ExternalPluginResult (*)(PP_Instance instance, PP_NaClError message_id))&Pnacl_M13_PPB_NaCl_Private_ReportNaClError,
.OpenNaClExecutable = (PP_FileHandle (*)(PP_Instance instance, const char* file_url, uint64_t* file_token_lo, uint64_t* file_token_hi))&Pnacl_M13_PPB_NaCl_Private_OpenNaClExecutable
};
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.cc b/webkit/plugins/ppapi/mock_plugin_delegate.cc
index 80cea1b..f28f6d2 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.cc
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.cc
@@ -7,10 +7,12 @@
#include "base/logging.h"
#include "base/message_loop/message_loop_proxy.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/ppapi_permissions.h"
#include "ppapi/shared_impl/ppapi_preferences.h"
#include "third_party/WebKit/public/platform/WebGamepads.h"
#include "webkit/plugins/ppapi/mock_platform_image_2d.h"
#include "webkit/plugins/ppapi/plugin_delegate.h"
+#include "webkit/plugins/ppapi/plugin_module.h"
#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
namespace webkit {
@@ -409,5 +411,15 @@ void MockPluginDelegate::HandleDocumentLoad(
const WebKit::WebURLResponse& response) {
}
+content::RendererPpapiHost* MockPluginDelegate::CreateExternalPluginModule(
+ scoped_refptr<PluginModule> module,
+ const base::FilePath& path,
+ ::ppapi::PpapiPermissions permissions,
+ const IPC::ChannelHandle& channel_handle,
+ base::ProcessId plugin_pid,
+ int plugin_child_id) {
+ return NULL;
+}
+
} // namespace ppapi
} // namespace webkit
diff --git a/webkit/plugins/ppapi/mock_plugin_delegate.h b/webkit/plugins/ppapi/mock_plugin_delegate.h
index f6e1586..3a65949 100644
--- a/webkit/plugins/ppapi/mock_plugin_delegate.h
+++ b/webkit/plugins/ppapi/mock_plugin_delegate.h
@@ -182,6 +182,13 @@ class MockPluginDelegate : public PluginDelegate {
virtual bool IsRunningInProcess(PP_Instance instance) const;
virtual void HandleDocumentLoad(PluginInstance* instance,
const WebKit::WebURLResponse& response);
+ virtual content::RendererPpapiHost* CreateExternalPluginModule(
+ scoped_refptr<PluginModule> module,
+ const base::FilePath& path,
+ ::ppapi::PpapiPermissions permissions,
+ const IPC::ChannelHandle& channel_handle,
+ base::ProcessId plugin_pid,
+ int plugin_child_id);
};
} // namespace ppapi
diff --git a/webkit/plugins/ppapi/plugin_delegate.h b/webkit/plugins/ppapi/plugin_delegate.h
index 292d0e4..59f31f2 100644
--- a/webkit/plugins/ppapi/plugin_delegate.h
+++ b/webkit/plugins/ppapi/plugin_delegate.h
@@ -44,6 +44,10 @@ class SkCanvas;
class TransportDIB;
struct PP_NetAddress_Private;
+namespace IPC {
+struct ChannelHandle;
+}
+
namespace WebKit {
class WebGraphicsContext3D;
}
@@ -53,6 +57,10 @@ class MessageLoopProxy;
class Time;
}
+namespace content {
+class RendererPpapiHost;
+}
+
namespace fileapi {
struct DirectoryEntry;
}
@@ -68,6 +76,7 @@ struct Mailbox;
namespace ppapi {
class PepperFilePath;
+class PpapiPermissions;
class PPB_X509Certificate_Fields;
class SocketOptionData;
struct DeviceRefData;
@@ -685,6 +694,16 @@ class PluginDelegate {
// loader using set_document_loader.
virtual void HandleDocumentLoad(PluginInstance* instance,
const WebKit::WebURLResponse& response) = 0;
+
+ // Sets up the renderer host and out-of-process proxy for an external plugin
+ // module. Returns the renderer host, or NULL if it couldn't be created.
+ virtual content::RendererPpapiHost* CreateExternalPluginModule(
+ scoped_refptr<PluginModule> module,
+ const base::FilePath& path,
+ ::ppapi::PpapiPermissions permissions,
+ const IPC::ChannelHandle& channel_handle,
+ base::ProcessId plugin_pid,
+ int plugin_child_id) = 0;
};
} // namespace ppapi
diff --git a/webkit/plugins/ppapi/plugin_module.cc b/webkit/plugins/ppapi/plugin_module.cc
index 88c234f..dddabcc 100644
--- a/webkit/plugins/ppapi/plugin_module.cc
+++ b/webkit/plugins/ppapi/plugin_module.cc
@@ -480,27 +480,29 @@ void PluginModule::InitAsProxied(
out_of_process_proxy_.reset(out_of_process_proxy);
}
-scoped_refptr<PluginModule> PluginModule::CreateModuleForNaClInstance() {
+scoped_refptr<PluginModule>
+ PluginModule::CreateModuleForExternalPluginInstance() {
// Create a new module, but don't set the lifetime delegate. This isn't a
// plugin in the usual sense, so it isn't tracked by the browser.
- scoped_refptr<PluginModule> nacl_module(
+ scoped_refptr<PluginModule> external_plugin_module(
new PluginModule(name_,
path_,
NULL, // no lifetime_delegate
permissions_));
- return nacl_module;
+ return external_plugin_module;
}
-PP_NaClResult PluginModule::InitAsProxiedNaCl(PluginInstance* instance) {
+PP_ExternalPluginResult PluginModule::InitAsProxiedExternalPlugin(
+ PluginInstance* instance) {
DCHECK(out_of_process_proxy_.get());
// InitAsProxied (for the trusted/out-of-process case) initializes only the
// module, and one or more instances are added later. In this case, the
// PluginInstance was already created as in-process, so we missed the proxy
// AddInstance step and must do it now.
out_of_process_proxy_->AddInstance(instance->pp_instance());
- // In NaCl, we need to tell the instance to reset itself as proxied. This will
- // clear cached interface pointers and send DidCreate (etc) to the plugin
- // side of the proxy.
+ // For external plugins, we need to tell the instance to reset itself as
+ // proxied. This will clear cached interface pointers and send DidCreate (etc)
+ // to the plugin side of the proxy.
return instance->ResetAsProxied(this);
}
diff --git a/webkit/plugins/ppapi/plugin_module.h b/webkit/plugins/ppapi/plugin_module.h
index e58785c..fe8f62e 100644
--- a/webkit/plugins/ppapi/plugin_module.h
+++ b/webkit/plugins/ppapi/plugin_module.h
@@ -21,7 +21,7 @@
#include "ppapi/c/pp_module.h"
#include "ppapi/c/ppb.h"
#include "ppapi/c/ppb_core.h"
-#include "ppapi/c/private/ppb_nacl_private.h"
+#include "ppapi/c/private/ppb_instance_private.h"
#include "ppapi/shared_impl/ppapi_permissions.h"
#include "webkit/plugins/ppapi/plugin_delegate.h"
#include "webkit/plugins/webkit_plugins_export.h"
@@ -117,15 +117,16 @@ class WEBKIT_PLUGINS_EXPORT PluginModule :
// ownership of the given pointer, even in the failure case.
void InitAsProxied(PluginDelegate::OutOfProcessProxy* out_of_process_proxy);
- // Creates a new module for a NaCl instance that will be using the IPC proxy.
- // We can't use the existing module, or new instances of the plugin can't
- // be created.
- scoped_refptr<PluginModule> CreateModuleForNaClInstance();
+ // Creates a new module for an external plugin instance that will be using the
+ // IPC proxy. We can't use the existing module, or new instances of the plugin
+ // can't be created.
+ scoped_refptr<PluginModule> CreateModuleForExternalPluginInstance();
- // Initializes the NaCl module for the out of process proxy. InitAsProxied
- // must be called before calling InitAsProxiedNaCl. Returns a NaCl result code
- // indicating whether the proxy started successfully or there was an error.
- PP_NaClResult InitAsProxiedNaCl(PluginInstance* instance);
+ // Initializes the external plugin module for the out of process proxy.
+ // InitAsProxied must be called before calling InitAsProxiedExternalPlugin.
+ // Returns a result code indicating whether the proxy started successfully or
+ // there was an error.
+ PP_ExternalPluginResult InitAsProxiedExternalPlugin(PluginInstance* instance);
bool IsProxied() const;
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
index c03a730..3cc6b7f 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc
@@ -31,6 +31,7 @@
#include "ppapi/c/ppp_messaging.h"
#include "ppapi/c/ppp_mouse_lock.h"
#include "ppapi/c/private/ppp_instance_private.h"
+#include "ppapi/shared_impl/ppapi_permissions.h"
#include "ppapi/shared_impl/ppapi_preferences.h"
#include "ppapi/shared_impl/ppb_gamepad_shared.h"
#include "ppapi/shared_impl/ppb_input_event_shared.h"
@@ -2458,7 +2459,7 @@ PP_Var PluginInstance::GetPluginInstanceURL(
components);
}
-PP_NaClResult PluginInstance::ResetAsProxied(
+PP_ExternalPluginResult PluginInstance::ResetAsProxied(
scoped_refptr<PluginModule> module) {
// Save the original module and switch over to the new one now that this
// plugin is using the IPC-based proxy.
@@ -2481,7 +2482,7 @@ PP_NaClResult PluginInstance::ResetAsProxied(
// While this could be a failure to implement the interface in the NaCl
// module, it is more likely that the NaCl process has crashed. Either
// way, report that module initialization failed.
- return PP_NACL_ERROR_MODULE;
+ return PP_EXTERNAL_PLUGIN_ERROR_MODULE;
}
instance_interface_.reset(ppp_instance_combined);
@@ -2504,7 +2505,7 @@ PP_NaClResult PluginInstance::ResetAsProxied(
scoped_ptr<const char*[]> argv_array(StringVectorToArgArray(argv_));
if (!instance_interface_->DidCreate(pp_instance(), argn_.size(),
argn_array.get(), argv_array.get()))
- return PP_NACL_ERROR_INSTANCE;
+ return PP_EXTERNAL_PLUGIN_ERROR_INSTANCE;
message_channel_->StopQueueingJavaScriptMessages();
// Clear sent_initial_did_change_view_ and cancel any pending DidChangeView
@@ -2526,7 +2527,7 @@ PP_NaClResult PluginInstance::ResetAsProxied(
nacl_document_loader_.reset(NULL);
}
- return PP_NACL_OK;
+ return PP_EXTERNAL_PLUGIN_OK;
}
bool PluginInstance::IsValidInstanceOf(PluginModule* module) {
@@ -2592,6 +2593,40 @@ PP_Resource PluginInstance::CreateImage(gfx::ImageSkia* source_image,
return image_data->GetReference();
}
+base::FilePath PluginInstance::GetModulePath() {
+ return module_->path();
+}
+
+PP_ExternalPluginResult PluginInstance::SwitchToOutOfProcessProxy(
+ const base::FilePath& file_path,
+ ::ppapi::PpapiPermissions permissions,
+ const IPC::ChannelHandle& channel_handle,
+ base::ProcessId plugin_pid,
+ int plugin_child_id) {
+ // Create a new module for each instance of the external plugin that is using
+ // the IPC based out-of-process proxy. We can't use the existing module,
+ // because it is configured for the in-process plugin, and we must keep it
+ // that way to allow the page to create other instances.
+ scoped_refptr<webkit::ppapi::PluginModule> external_plugin_module(
+ module_->CreateModuleForExternalPluginInstance());
+
+ content::RendererPpapiHost* renderer_ppapi_host =
+ delegate_->CreateExternalPluginModule(
+ external_plugin_module,
+ file_path,
+ permissions,
+ channel_handle,
+ plugin_pid,
+ plugin_child_id);
+ if (!renderer_ppapi_host) {
+ DLOG(ERROR) << "CreateExternalPluginModule() failed";
+ return PP_EXTERNAL_PLUGIN_ERROR_MODULE;
+ }
+
+ // Finally, switch the instance to the proxy.
+ return external_plugin_module->InitAsProxiedExternalPlugin(this);
+}
+
void PluginInstance::DoSetCursor(WebCursorInfo* cursor) {
cursor_.reset(cursor);
if (fullscreen_container_) {
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h
index d610901..11bde42 100644
--- a/webkit/plugins/ppapi/ppapi_plugin_instance.h
+++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h
@@ -35,7 +35,6 @@
#include "ppapi/c/ppp_messaging.h"
#include "ppapi/c/ppp_mouse_lock.h"
#include "ppapi/c/private/ppb_content_decryptor_private.h"
-#include "ppapi/c/private/ppb_nacl_private.h"
#include "ppapi/c/private/ppp_instance_private.h"
#include "ppapi/shared_impl/ppb_instance_shared.h"
#include "ppapi/shared_impl/ppb_view_shared.h"
@@ -63,6 +62,10 @@ struct _NPP;
class SkBitmap;
class TransportDIB;
+namespace IPC {
+struct ChannelHandle;
+}
+
namespace WebKit {
class WebInputEvent;
class WebLayer;
@@ -89,6 +92,7 @@ class ImageSkia;
}
namespace ppapi {
+class PpapiPermissions;
class Resource;
class VarTracker;
struct InputEventData;
@@ -497,9 +501,9 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
// Reset this instance as proxied. Assigns the instance a new module, resets
// cached interfaces to point to the out-of-process proxy and re-sends
// DidCreate, DidChangeView, and HandleDocumentLoad (if necessary).
- // This should be used only when switching a trusted NaCl in-process instance
- // to an untrusted NaCl out-of-process instance.
- PP_NaClResult ResetAsProxied(scoped_refptr<PluginModule> module);
+ // This should be used only when switching an in-process instance to an
+ // external out-of-process instance.
+ PP_ExternalPluginResult ResetAsProxied(scoped_refptr<PluginModule> module);
// Checks whether this is a valid instance of the given module. After calling
// ResetAsProxied above, a NaCl plugin instance's module changes, so external
@@ -528,6 +532,17 @@ class WEBKIT_PLUGINS_EXPORT PluginInstance :
// Creates a PPB_ImageData given a Skia image.
PP_Resource CreateImage(gfx::ImageSkia* source_image, float scale);
+ // Returns the location of this module.
+ base::FilePath GetModulePath();
+
+ // Switches this instance with one that uses the out of process IPC proxy.
+ PP_ExternalPluginResult SwitchToOutOfProcessProxy(
+ const base::FilePath& file_path,
+ ::ppapi::PpapiPermissions permissions,
+ const IPC::ChannelHandle& channel_handle,
+ base::ProcessId plugin_pid,
+ int plugin_child_id);
+
private:
friend class PpapiUnittest;