Index: trunk/src/chrome/renderer/chrome_content_renderer_client.cc |
=================================================================== |
--- trunk/src/chrome/renderer/chrome_content_renderer_client.cc (revision 205338) |
+++ trunk/src/chrome/renderer/chrome_content_renderer_client.cc (working copy) |
@@ -558,14 +558,47 @@ |
break; |
} |
case ChromeViewHostMsg_GetPluginInfo_Status::kAllowed: { |
- const char* kPnaclMimeType = "application/x-pnacl"; |
- if (actual_mime_type == kPnaclMimeType) { |
- if (!CommandLine::ForCurrentProcess()->HasSwitch( |
- switches::kEnablePnacl)) { |
+ 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, |
- "Portable Native Client must be enabled in about:flags.")); |
+ "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, |
@@ -574,61 +607,8 @@ |
#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; |
- } |
- } |
} |
// Delay loading plugins if prerendering. |