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, |
- ¶ms)) { |
+ 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, |
+ ¶ms)) { |
+ 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; |
+ } |
} |
} |