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

Unified Diff: trunk/src/chrome/renderer/chrome_content_renderer_client.cc

Issue 15709012: Revert 205329 "Split pnacl and nacl mime types" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: 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
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,
+ &params)) {
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,
- &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;
- }
- }
}
// Delay loading plugins if prerendering.
« no previous file with comments | « trunk/src/chrome/common/chrome_content_client.cc ('k') | trunk/src/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