Chromium Code Reviews| Index: extensions/shell/browser/shell_content_browser_client.cc |
| diff --git a/extensions/shell/browser/shell_content_browser_client.cc b/extensions/shell/browser/shell_content_browser_client.cc |
| index 328fb8783aae20ff24fc5bb84e5ea4dacc4a984f..ca7a7f76c7523e1773a0e6c8ea43e77340fda0a6 100644 |
| --- a/extensions/shell/browser/shell_content_browser_client.cc |
| +++ b/extensions/shell/browser/shell_content_browser_client.cc |
| @@ -24,6 +24,19 @@ |
| #include "extensions/shell/browser/shell_extension_system.h" |
| #include "url/gurl.h" |
| +#if !defined(DISABLE_NACL) |
| +//JAMES do we need all these? |
| +#include "components/nacl/browser/nacl_browser.h" |
| +#include "components/nacl/browser/nacl_host_message_filter.h" |
| +#include "components/nacl/browser/nacl_process_host.h" |
| +#include "components/nacl/common/nacl_process_type.h" |
| +#include "components/nacl/common/nacl_switches.h" |
| +#include "content/public/browser/browser_child_process_host.h" |
| +#include "content/public/browser/child_process_data.h" |
| +#endif |
| + |
| +using base::CommandLine; |
| +using content::BrowserContext; |
| using content::BrowserThread; |
| namespace extensions { |
| @@ -63,8 +76,18 @@ content::BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( |
| void ShellContentBrowserClient::RenderProcessWillLaunch( |
| content::RenderProcessHost* host) { |
| int render_process_id = host->GetID(); |
| - host->AddFilter(new ExtensionMessageFilter( |
| - render_process_id, browser_main_parts_->browser_context())); |
| + BrowserContext* browser_context = browser_main_parts_->browser_context(); |
| + host->AddFilter( |
| + new ExtensionMessageFilter(render_process_id, browser_context)); |
| + // PluginInfoMessageFilter is not required because app_shell does not have |
| + // the concept of disabled plugins. |
| +#if !defined(DISABLE_NACL) |
| + host->AddFilter(new nacl::NaClHostMessageFilter( |
| + render_process_id, |
| + browser_context->IsOffTheRecord(), |
| + browser_context->GetPath(), |
| + browser_context->GetRequestContextForRenderProcess(render_process_id))); |
| +#endif |
| } |
| bool ShellContentBrowserClient::ShouldUseProcessPerSite( |
| @@ -167,13 +190,36 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches( |
| std::string process_type = |
| command_line->GetSwitchValueASCII(::switches::kProcessType); |
| if (process_type == ::switches::kRendererProcess) { |
| - // TODO(jamescook): Should we check here if the process is in the extension |
| - // service process map, or can we assume all renderers are extension |
| - // renderers? |
| - command_line->AppendSwitch(switches::kExtensionProcess); |
| + AppendRendererSwitches(command_line); |
| + } else if (process_type == ::switches::kZygoteProcess) { |
| + AppendZygoteSwitches(command_line); |
| } |
| } |
| +void ShellContentBrowserClient::DidCreatePpapiPlugin( |
| + content::BrowserPpapiHost* browser_host) { |
| + // TODO(jamescook): Does this need a PepperHostFactory filter? |
|
teravest
2014/08/12 15:48:31
I don't think you need to do anything for DidCreat
James Cook
2014/08/12 18:17:06
Removed.
|
| +} |
| + |
| +content::BrowserPpapiHost* |
| + ShellContentBrowserClient::GetExternalBrowserPpapiHost( |
| + int plugin_process_id) { |
| +#if !defined(DISABLE_NACL) |
| + content::BrowserChildProcessHostIterator iter(PROCESS_TYPE_NACL_LOADER); |
| + while (!iter.Done()) { |
| + nacl::NaClProcessHost* host = static_cast<nacl::NaClProcessHost*>( |
| + iter.GetDelegate()); |
| + if (host->process() && |
| + host->process()->GetData().id == plugin_process_id) { |
| + // Found the plugin. |
| + return host->browser_ppapi_host(); |
| + } |
| + ++iter; |
| + } |
| +#endif |
| + return NULL; |
| +} |
| + |
| void ShellContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( |
| std::vector<std::string>* additional_allowed_schemes) { |
| ContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( |
| @@ -181,6 +227,38 @@ void ShellContentBrowserClient::GetAdditionalAllowedSchemesForFileSystem( |
| additional_allowed_schemes->push_back(kExtensionScheme); |
| } |
| +void ShellContentBrowserClient::AppendRendererSwitches( |
| + CommandLine* command_line) { |
| + // TODO(jamescook): Should we check here if the process is in the extension |
| + // service process map, or can we assume all renderers are extension |
| + // renderers? |
| + command_line->AppendSwitch(switches::kExtensionProcess); |
| + |
| +#if !defined(DISABLE_NACL) |
| + // TODO(jamescook): What about kAllowNaClFileHandleAPI? |
|
teravest
2014/08/12 15:48:31
You'd only need kAllowNaClFileHandleAPI for Reques
James Cook
2014/08/12 18:17:06
Removed.
|
| + static const char* const kSwitchNames[] = { |
| + ::switches::kEnableNaClDebug, |
| + ::switches::kEnableNaClNonSfiMode, |
| + }; |
| + command_line->CopySwitchesFrom(*CommandLine::ForCurrentProcess(), |
| + kSwitchNames, |
| + arraysize(kSwitchNames)); |
| +#endif // !defined(DISABLE_NACL) |
| +} |
| + |
| +void ShellContentBrowserClient::AppendZygoteSwitches( |
| + CommandLine* command_line) { |
| +#if !defined(DISABLE_NACL) |
| + static const char* const kSwitchNames[] = { |
| + ::switches::kEnableNaClNonSfiMode, |
| + ::switches::kNaClDangerousNoSandboxNonSfi, |
| + }; |
| + command_line->CopySwitchesFrom(*CommandLine::ForCurrentProcess(), |
| + kSwitchNames, |
| + arraysize(kSwitchNames)); |
| +#endif // !defined(DISABLE_NACL) |
| +} |
| + |
| const Extension* ShellContentBrowserClient::GetExtension( |
| content::SiteInstance* site_instance) { |
| ExtensionRegistry* registry = |