| Index: chrome/renderer/chrome_ppapi_interfaces.cc
|
| ===================================================================
|
| --- chrome/renderer/chrome_ppapi_interfaces.cc (revision 133072)
|
| +++ chrome/renderer/chrome_ppapi_interfaces.cc (working copy)
|
| @@ -27,7 +27,26 @@
|
| #include "content/public/common/sandbox_init.h"
|
| #endif
|
|
|
| +#include "base/path_service.h"
|
| +#include "chrome/common/chrome_paths.h"
|
| +#include "content/public/browser/plugin_service.h"
|
| +#include "content/public/common/content_client.h"
|
| +#include "content/public/renderer/render_thread.h"
|
| +#include "content/public/renderer/render_view.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebElement.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginContainer.h"
|
| +#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
| +#include "webkit/plugins/ppapi/host_globals.h"
|
| +#include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
|
| +
|
| using content::RenderThread;
|
| +using webkit::ppapi::HostGlobals;
|
| +using webkit::ppapi::PluginInstance;
|
| +using WebKit::WebElement;
|
| +using WebKit::WebView;
|
|
|
| namespace chrome {
|
|
|
| @@ -38,10 +57,12 @@
|
| } // namespace
|
|
|
| // Launch NaCl's sel_ldr process.
|
| -bool LaunchSelLdr(const char* alleged_url, int socket_count,
|
| +bool LaunchSelLdr(PP_Instance instance,
|
| + const char* alleged_url, int socket_count,
|
| void* imc_handles, void* nacl_process_handle,
|
| int* nacl_process_id) {
|
| std::vector<nacl::FileDescriptor> sockets;
|
| + std::string ppapi_channel_name;
|
| base::ProcessHandle nacl_process;
|
| IPC::Message::Sender* sender = RenderThread::Get();
|
| if (sender == NULL) {
|
| @@ -52,6 +73,7 @@
|
| GURL(alleged_url),
|
| socket_count,
|
| &sockets,
|
| + &ppapi_channel_name,
|
| &nacl_process,
|
| reinterpret_cast<base::ProcessId*>(nacl_process_id)))) {
|
| return false;
|
| @@ -62,6 +84,21 @@
|
| nacl::ToNativeHandle(sockets[i]);
|
| }
|
| *static_cast<nacl::Handle*>(nacl_process_handle) = nacl_process;
|
| +
|
| + // Using the RenderView, establish the HostDispatcher for the PPAPI proxy.
|
| + webkit::ppapi::PluginInstance* plugin_instance =
|
| + content::GetHostGlobals()->GetInstance(instance);
|
| + if (!plugin_instance)
|
| + return false;
|
| + FilePath nacl_plugin_path;
|
| + if (!PathService::Get(chrome::FILE_NACL_PLUGIN, &nacl_plugin_path))
|
| + return false;
|
| +
|
| + WebView* view =
|
| + plugin_instance->container()->element().document().frame()->view();
|
| + content::RenderView* render_view = content::RenderView::FromWebView(view);
|
| + render_view->CreateHostDispatcher(
|
| + nacl_plugin_path, *nacl_process_id, nacl_process, ppapi_channel_name);
|
| return true;
|
| }
|
|
|
|
|