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

Unified Diff: chrome/renderer/render_view.cc

Issue 3057025: Altered the logic that determines when NaCl is enabled. Previously, we requi... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 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/renderer/render_process_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/render_view.cc
===================================================================
--- chrome/renderer/render_view.cc (revision 54347)
+++ chrome/renderer/render_view.cc (working copy)
@@ -3247,8 +3247,28 @@
}
// Check for Native Client modules.
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalNaCl)) {
- if (mime_type == "application/x-nacl-srpc") {
+ if (mime_type == "application/x-nacl-srpc") {
+ // NaCl is only permitted when we're in an extension/application with the
+ // appropriate permission, or when explicitly enabled on the command line.
+
+ // TODO(cbiffle): need browser test for this before M7 (bug 45881)
+ GURL main_frame_url(webview()->mainFrame()->url());
+ const std::string &extension_id =
+ RenderThread::current()->GetExtensionIdByURL(main_frame_url);
+ bool in_ext = extension_id != "";
+ bool explicit_enable =
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalNaCl);
+
+ if (in_ext) {
+ if (ExtensionProcessBindings::HasPermission(extension_id,
+ Extension::kNativeClientPermission)) {
+ in_process_plugin = true;
+ use_pepper_host = true;
+ } else {
+ // Disable NaCl for apps lacking the permission, even with the flag.
+ return NULL;
+ }
+ } else if (explicit_enable) {
in_process_plugin = true;
use_pepper_host = true;
}
« no previous file with comments | « chrome/renderer/render_process_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698