| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/renderer/render_view.h" | 5 #include "chrome/renderer/render_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 3229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3240 } else { | 3240 } else { |
| 3241 FilePath internal_pdf_path; | 3241 FilePath internal_pdf_path; |
| 3242 PathService::Get(chrome::FILE_PDF_PLUGIN, &internal_pdf_path); | 3242 PathService::Get(chrome::FILE_PDF_PLUGIN, &internal_pdf_path); |
| 3243 if (file_path == internal_pdf_path) { | 3243 if (file_path == internal_pdf_path) { |
| 3244 in_process_plugin = true; | 3244 in_process_plugin = true; |
| 3245 use_pepper_host = true; | 3245 use_pepper_host = true; |
| 3246 } | 3246 } |
| 3247 } | 3247 } |
| 3248 | 3248 |
| 3249 // Check for Native Client modules. | 3249 // Check for Native Client modules. |
| 3250 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalNaCl)) { | 3250 if (mime_type == "application/x-nacl-srpc") { |
| 3251 if (mime_type == "application/x-nacl-srpc") { | 3251 // NaCl is only permitted when we're in an extension/application with the |
| 3252 // appropriate permission, or when explicitly enabled on the command line. |
| 3253 |
| 3254 // TODO(cbiffle): need browser test for this before M7 (bug 45881) |
| 3255 GURL main_frame_url(webview()->mainFrame()->url()); |
| 3256 const std::string &extension_id = |
| 3257 RenderThread::current()->GetExtensionIdByURL(main_frame_url); |
| 3258 bool in_ext = extension_id != ""; |
| 3259 bool explicit_enable = |
| 3260 CommandLine::ForCurrentProcess()->HasSwitch(switches::kInternalNaCl); |
| 3261 |
| 3262 if (in_ext) { |
| 3263 if (ExtensionProcessBindings::HasPermission(extension_id, |
| 3264 Extension::kNativeClientPermission)) { |
| 3265 in_process_plugin = true; |
| 3266 use_pepper_host = true; |
| 3267 } else { |
| 3268 // Disable NaCl for apps lacking the permission, even with the flag. |
| 3269 return NULL; |
| 3270 } |
| 3271 } else if (explicit_enable) { |
| 3252 in_process_plugin = true; | 3272 in_process_plugin = true; |
| 3253 use_pepper_host = true; | 3273 use_pepper_host = true; |
| 3254 } | 3274 } |
| 3255 } | 3275 } |
| 3256 | 3276 |
| 3257 if (in_process_plugin) { | 3277 if (in_process_plugin) { |
| 3258 if (use_pepper_host) { | 3278 if (use_pepper_host) { |
| 3259 WebPluginDelegatePepper* pepper_plugin = | 3279 WebPluginDelegatePepper* pepper_plugin = |
| 3260 WebPluginDelegatePepper::Create(file_path, mime_type, AsWeakPtr()); | 3280 WebPluginDelegatePepper::Create(file_path, mime_type, AsWeakPtr()); |
| 3261 if (!pepper_plugin) | 3281 if (!pepper_plugin) |
| (...skipping 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5215 // the origins of the two domains are different. This can be treated as a | 5235 // the origins of the two domains are different. This can be treated as a |
| 5216 // top level navigation and routed back to the host. | 5236 // top level navigation and routed back to the host. |
| 5217 WebKit::WebFrame* opener = frame->opener(); | 5237 WebKit::WebFrame* opener = frame->opener(); |
| 5218 if (opener) { | 5238 if (opener) { |
| 5219 if (url.GetOrigin() != GURL(opener->url()).GetOrigin()) | 5239 if (url.GetOrigin() != GURL(opener->url()).GetOrigin()) |
| 5220 return true; | 5240 return true; |
| 5221 } | 5241 } |
| 5222 } | 5242 } |
| 5223 return false; | 5243 return false; |
| 5224 } | 5244 } |
| OLD | NEW |