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

Unified Diff: extensions/shell/browser/shell_content_browser_client.cc

Issue 437503004: Add NaCl support to app_shell (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (nacl-init) rebase Created 6 years, 4 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: 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..df84fcb0292ede390370d33c043d3d699336794b 100644
--- a/extensions/shell/browser/shell_content_browser_client.cc
+++ b/extensions/shell/browser/shell_content_browser_client.cc
@@ -24,6 +24,18 @@
#include "extensions/shell/browser/shell_extension_system.h"
#include "url/gurl.h"
+#if !defined(DISABLE_NACL)
+#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 +75,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(
@@ -166,12 +188,26 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
int child_process_id) {
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);
+ if (process_type == ::switches::kRendererProcess)
+ AppendRendererSwitches(command_line);
+}
+
+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(
@@ -181,6 +217,25 @@ 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)
+ // NOTE: app_shell does not support ARC or non-SFI mode, so does not pass
Mark Seaborn 2014/08/14 21:00:35 Nit: You don't need to mention "ARC" here, just no
James Cook 2014/08/14 21:53:40 Done.
+ // through those switches either here or for the zygote process.
+ static const char* const kSwitchNames[] = {
+ ::switches::kEnableNaClDebug,
+ };
+ command_line->CopySwitchesFrom(*CommandLine::ForCurrentProcess(),
+ kSwitchNames,
+ arraysize(kSwitchNames));
+#endif // !defined(DISABLE_NACL)
+}
+
const Extension* ShellContentBrowserClient::GetExtension(
content::SiteInstance* site_instance) {
ExtensionRegistry* registry =
« no previous file with comments | « extensions/shell/browser/shell_content_browser_client.h ('k') | extensions/shell/browser/shell_nacl_browser_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698