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 092b48f31556f817437b63433476946a3354578c..a11e63347a8ee969c8ce3c283667314af019af20 100644 |
--- a/chrome/renderer/chrome_content_renderer_client.cc |
+++ b/chrome/renderer/chrome_content_renderer_client.cc |
@@ -557,56 +557,67 @@ 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); |
+ const char* kPnaclMimeType = "application/x-pnacl"; |
+ if (actual_mime_type == kPnaclMimeType) { |
+ // If the params somehow contain '@dev', remove it. |
jvoung (off chromium)
2013/06/04 22:27:25
Where do the @dev params come from?
Should we add
sehr
2013/06/06 22:03:45
The @dev parameters are added for nacl content han
|
+ WebString dev_attribute = WebString::fromUTF8("@dev"); |
+ size_t attribute_count = params.attributeNames.size(); |
+ for (size_t i = 0; i < attribute_count; ++i) { |
jvoung (off chromium)
2013/06/07 16:14:46
Also, if you want to allow PNaCl without --enable-
|
+ if (params.attributeNames[i].equals(dev_attribute)) |
+ params.attributeNames[i] = WebString(); |
+ } |
} 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(); |
+ 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 { |
- // 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; |
+ // 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; |
} |
- 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 (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)); |
+ l10n_util::GetStringUTF16(IDS_NACL_PLUGIN_BLOCKED)); |
#else |
- l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name)); |
+ l10n_util::GetStringFUTF16(IDS_PLUGIN_BLOCKED, group_name)); |
#endif |
- break; |
+ break; |
+ } |
} |
} |