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

Unified Diff: chrome/renderer/chrome_content_renderer_client.cc

Issue 16296005: Split pnacl and nacl mime types (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: After (hopefully) last rebase. Created 7 years, 6 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
« no previous file with comments | « chrome/common/chrome_content_client.cc ('k') | chrome/test/data/nacl/exit_status/pm_exit_status_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/chrome_content_renderer_client.cc
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 52f9e705c0a9e1ab33d039d9e1fb710b0c31255c..6de2af162203c6a3221a8b1cf78da7ec6c1e6840 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -558,47 +558,14 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
break;
}
case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed: {
- const char* kNaClMimeType = "application/x-nacl";
- const bool is_nacl_mime_type = actual_mime_type == kNaClMimeType;
- const bool is_nacl_plugin =
- plugin.name ==
- ASCIIToUTF16(chrome::ChromeContentClient::kNaClPluginName);
- bool is_nacl_unrestricted;
- if (is_nacl_plugin) {
- is_nacl_unrestricted = CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableNaCl);
- } else {
- // If this is an external plugin that handles the NaCl mime type, we
- // allow Native Client, so Native Client's integration tests work.
- is_nacl_unrestricted = true;
- }
- if (is_nacl_plugin || is_nacl_mime_type) {
- GURL manifest_url;
- GURL app_url;
- if (is_nacl_mime_type) {
- // Normal NaCl embed. The app URL is the page URL.
- manifest_url = url;
- app_url = frame->top()->document().url();
- } else {
- // NaCl is being invoked as a content handler. Look up the NaCl
- // module using the MIME type. The app URL is the manifest URL.
- manifest_url = GetNaClContentHandlerURL(actual_mime_type, plugin);
- app_url = manifest_url;
- }
- const Extension* extension =
- g_current_client->extension_dispatcher_->extensions()->
- GetExtensionOrAppByURL(ExtensionURLInfo(manifest_url));
- if (!IsNaClAllowed(manifest_url,
- app_url,
- is_nacl_unrestricted,
- extension,
- &params)) {
+ const char* kPnaclMimeType = "application/x-pnacl";
+ if (actual_mime_type == kPnaclMimeType) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnablePnacl)) {
frame->addMessageToConsole(
WebConsoleMessage(
WebConsoleMessage::LevelError,
- "Only unpacked extensions and apps installed from the "
- "Chrome Web Store can load NaCl modules without enabling "
- "Native Client in about:flags."));
+ "Portable Native Client must be enabled in about:flags."));
placeholder = PluginPlaceholder::CreateBlockedPlugin(
render_view, frame, params, plugin, identifier, group_name,
IDR_BLOCKED_PLUGIN_HTML,
@@ -607,7 +574,60 @@ WebPlugin* ChromeContentRendererClient::CreatePlugin(
#else
l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name));
#endif
- break;
+ break;
+ }
+ } else {
+ const char* kNaClMimeType = "application/x-nacl";
+ const bool is_nacl_mime_type = actual_mime_type == kNaClMimeType;
+ const bool is_nacl_plugin =
+ plugin.name ==
+ ASCIIToUTF16(chrome::ChromeContentClient::kNaClPluginName);
+ bool is_nacl_unrestricted;
+ if (is_nacl_plugin) {
+ is_nacl_unrestricted = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableNaCl);
+ } else {
+ // If this is an external plugin that handles the NaCl mime type, we
+ // allow Native Client, so Native Client's integration tests work.
+ is_nacl_unrestricted = true;
+ }
+ if (is_nacl_plugin || is_nacl_mime_type) {
+ GURL manifest_url;
+ GURL app_url;
+ if (is_nacl_mime_type) {
+ // Normal NaCl embed. The app URL is the page URL.
+ manifest_url = url;
+ app_url = frame->top()->document().url();
+ } else {
+ // NaCl is being invoked as a content handler. Look up the NaCl
+ // module using the MIME type. The app URL is the manifest URL.
+ manifest_url = GetNaClContentHandlerURL(actual_mime_type, plugin);
+ app_url = manifest_url;
+ }
+ const Extension* extension =
+ g_current_client->extension_dispatcher_->extensions()->
+ GetExtensionOrAppByURL(ExtensionURLInfo(manifest_url));
+ if (!IsNaClAllowed(manifest_url,
+ app_url,
+ is_nacl_unrestricted,
+ extension,
+ &params)) {
+ frame->addMessageToConsole(
+ WebConsoleMessage(
+ WebConsoleMessage::LevelError,
+ "Only unpacked extensions and apps installed from the "
+ "Chrome Web Store can load NaCl modules without enabling "
+ "Native Client in about:flags."));
+ placeholder = PluginPlaceholder::CreateBlockedPlugin(
+ render_view, frame, params, plugin, identifier, group_name,
+ IDR_BLOCKED_PLUGIN_HTML,
+#if defined(OS_CHROMEOS)
+ l10n_util::GetStringUTF16(IDS_NACL_PLUGIN_BLOCKED));
+#else
+ l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name));
+#endif
+ break;
+ }
}
}
« no previous file with comments | « chrome/common/chrome_content_client.cc ('k') | chrome/test/data/nacl/exit_status/pm_exit_status_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698