diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-16 01:38:11 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-16 01:39:20 +0000 |
commit | e0ff1aa695ce0a987ea073ef9e144577cceb33f1 (patch) | |
tree | 5c4e539b4b298e89e6459f45510435cecf0ac0fe /extensions/shell/renderer | |
parent | 8c264f9ff1658480979b89265cd37cee72883c6f (diff) | |
download | chromium_src-e0ff1aa695ce0a987ea073ef9e144577cceb33f1.zip chromium_src-e0ff1aa695ce0a987ea073ef9e144577cceb33f1.tar.gz chromium_src-e0ff1aa695ce0a987ea073ef9e144577cceb33f1.tar.bz2 |
Add NaCl support to app_shell
Perform NaCl initialization during app_shell's startup path similar to
how Chrome initializes it.
* Refactor some of the lazy background page impulse code into ProcessManager so it can be shared with Chrome
BUG=400577
TEST=manual tests of app_shell, existing ProcessManager unit tests and browser tests
Review URL: https://codereview.chromium.org/437503004
Cr-Commit-Position: refs/heads/master@{#290082}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290082 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'extensions/shell/renderer')
-rw-r--r-- | extensions/shell/renderer/DEPS | 4 | ||||
-rw-r--r-- | extensions/shell/renderer/shell_content_renderer_client.cc | 53 | ||||
-rw-r--r-- | extensions/shell/renderer/shell_content_renderer_client.h | 10 |
3 files changed, 65 insertions, 2 deletions
diff --git a/extensions/shell/renderer/DEPS b/extensions/shell/renderer/DEPS index baafcac..bf14c1d 100644 --- a/extensions/shell/renderer/DEPS +++ b/extensions/shell/renderer/DEPS @@ -1,7 +1,9 @@ include_rules = [ # Only allow includes the renderer can use. + "+components/nacl/common", + "+components/nacl/renderer", "+content/public/renderer", - + "+ppapi", "+third_party/WebKit/public", "+v8/include", ] diff --git a/extensions/shell/renderer/shell_content_renderer_client.cc b/extensions/shell/renderer/shell_content_renderer_client.cc index c7a9be6..b6f8ed7 100644 --- a/extensions/shell/renderer/shell_content_renderer_client.cc +++ b/extensions/shell/renderer/shell_content_renderer_client.cc @@ -16,6 +16,13 @@ #include "extensions/shell/renderer/shell_extensions_renderer_client.h" #include "extensions/shell/renderer/shell_renderer_main_delegate.h" +#if !defined(DISABLE_NACL) +#include "components/nacl/common/nacl_constants.h" +#include "components/nacl/renderer/nacl_helper.h" +#include "components/nacl/renderer/ppb_nacl_private_impl.h" +#include "ppapi/c/private/ppb_nacl_private.h" +#endif + using blink::WebFrame; using blink::WebString; using content::RenderThread; @@ -93,8 +100,15 @@ void ShellContentRendererClient::RenderThreadStarted() { void ShellContentRendererClient::RenderFrameCreated( content::RenderFrame* render_frame) { - // ShellFrameHelper destroyes itself when the RenderFrame is destroyed. + // ShellFrameHelper destroys itself when the RenderFrame is destroyed. new ShellFrameHelper(render_frame, extension_dispatcher_.get()); + + // TODO(jamescook): Do we need to add a new PepperHelper(render_frame) here? + // It doesn't seem necessary for either Pepper or NaCl. + // http://crbug.com/403004 +#if !defined(DISABLE_NACL) + new nacl::NaClHelper(render_frame); +#endif } void ShellContentRendererClient::RenderViewCreated( @@ -104,6 +118,22 @@ void ShellContentRendererClient::RenderViewCreated( delegate_->OnViewCreated(render_view); } +bool ShellContentRendererClient::OverrideCreatePlugin( + content::RenderFrame* render_frame, + blink::WebLocalFrame* frame, + const blink::WebPluginParams& params, + blink::WebPlugin** plugin) { + // Allow the content module to create the plugin. + return false; +} + +blink::WebPlugin* ShellContentRendererClient::CreatePluginReplacement( + content::RenderFrame* render_frame, + const base::FilePath& plugin_path) { + // Don't provide a custom "failed to load" plugin. + return NULL; +} + bool ShellContentRendererClient::WillSendRequest( blink::WebFrame* frame, content::PageTransition transition_type, @@ -123,6 +153,27 @@ void ShellContentRendererClient::DidCreateScriptContext( frame, context, extension_group, world_id); } +const void* ShellContentRendererClient::CreatePPAPIInterface( + const std::string& interface_name) { +#if !defined(DISABLE_NACL) + if (interface_name == PPB_NACL_PRIVATE_INTERFACE) + return nacl::GetNaClPrivateInterface(); +#endif + return NULL; +} + +bool ShellContentRendererClient::IsExternalPepperPlugin( + const std::string& module_name) { +#if !defined(DISABLE_NACL) + // TODO(bbudge) remove this when the trusted NaCl plugin has been removed. + // We must defer certain plugin events for NaCl instances since we switch + // from the in-process to the out-of-process proxy after instantiating them. + return module_name == nacl::kNaClPluginName; +#else + return false; +#endif +} + bool ShellContentRendererClient::ShouldEnableSiteIsolationPolicy() const { // Extension renderers don't need site isolation. return false; diff --git a/extensions/shell/renderer/shell_content_renderer_client.h b/extensions/shell/renderer/shell_content_renderer_client.h index e7a1fbc..f40233c 100644 --- a/extensions/shell/renderer/shell_content_renderer_client.h +++ b/extensions/shell/renderer/shell_content_renderer_client.h @@ -29,6 +29,13 @@ class ShellContentRendererClient : public content::ContentRendererClient { virtual void RenderThreadStarted() OVERRIDE; virtual void RenderFrameCreated(content::RenderFrame* render_frame) OVERRIDE; virtual void RenderViewCreated(content::RenderView* render_view) OVERRIDE; + virtual bool OverrideCreatePlugin(content::RenderFrame* render_frame, + blink::WebLocalFrame* frame, + const blink::WebPluginParams& params, + blink::WebPlugin** plugin) OVERRIDE; + virtual blink::WebPlugin* CreatePluginReplacement( + content::RenderFrame* render_frame, + const base::FilePath& plugin_path) OVERRIDE; virtual bool WillSendRequest(blink::WebFrame* frame, content::PageTransition transition_type, const GURL& url, @@ -38,6 +45,9 @@ class ShellContentRendererClient : public content::ContentRendererClient { v8::Handle<v8::Context> context, int extension_group, int world_id) OVERRIDE; + virtual const void* CreatePPAPIInterface( + const std::string& interface_name) OVERRIDE; + virtual bool IsExternalPepperPlugin(const std::string& module_name) OVERRIDE; virtual bool ShouldEnableSiteIsolationPolicy() const OVERRIDE; private: |