| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_content_renderer_client.h" | 5 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/debug/crash_logging.h" | 8 #include "base/debug/crash_logging.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 return extension_dispatcher_->extensions()->GetByID(extension_id); | 464 return extension_dispatcher_->extensions()->GetByID(extension_id); |
| 465 } | 465 } |
| 466 | 466 |
| 467 bool ChromeContentRendererClient::OverrideCreatePlugin( | 467 bool ChromeContentRendererClient::OverrideCreatePlugin( |
| 468 content::RenderFrame* render_frame, | 468 content::RenderFrame* render_frame, |
| 469 WebFrame* frame, | 469 WebFrame* frame, |
| 470 const WebPluginParams& params, | 470 const WebPluginParams& params, |
| 471 WebPlugin** plugin) { | 471 WebPlugin** plugin) { |
| 472 std::string orig_mime_type = params.mimeType.utf8(); | 472 std::string orig_mime_type = params.mimeType.utf8(); |
| 473 if (orig_mime_type == content::kBrowserPluginMimeType) { | 473 if (orig_mime_type == content::kBrowserPluginMimeType) { |
| 474 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 475 switches::kEnableBrowserPluginForAllViewTypes)) | |
| 476 return false; | |
| 477 WebDocument document = frame->document(); | 474 WebDocument document = frame->document(); |
| 478 const Extension* extension = | 475 const Extension* extension = |
| 479 GetExtensionByOrigin(document.securityOrigin()); | 476 GetExtensionByOrigin(document.securityOrigin()); |
| 480 if (extension) { | 477 if (extension) { |
| 481 const extensions::APIPermission::ID perms[] = { | 478 const extensions::APIPermission::ID perms[] = { |
| 482 extensions::APIPermission::kWebView, | 479 extensions::APIPermission::kWebView, |
| 483 extensions::APIPermission::kAdView | 480 extensions::APIPermission::kAdView |
| 484 }; | 481 }; |
| 485 for (size_t i = 0; i < arraysize(perms); ++i) { | 482 for (size_t i = 0; i < arraysize(perms); ++i) { |
| 486 if (extension->HasAPIPermission(perms[i])) | 483 if (extension->HasAPIPermission(perms[i])) |
| (...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1362 } | 1359 } |
| 1363 | 1360 |
| 1364 blink::WebSpeechSynthesizer* | 1361 blink::WebSpeechSynthesizer* |
| 1365 ChromeContentRendererClient::OverrideSpeechSynthesizer( | 1362 ChromeContentRendererClient::OverrideSpeechSynthesizer( |
| 1366 blink::WebSpeechSynthesizerClient* client) { | 1363 blink::WebSpeechSynthesizerClient* client) { |
| 1367 return new TtsDispatcher(client); | 1364 return new TtsDispatcher(client); |
| 1368 } | 1365 } |
| 1369 | 1366 |
| 1370 bool ChromeContentRendererClient::AllowBrowserPlugin( | 1367 bool ChromeContentRendererClient::AllowBrowserPlugin( |
| 1371 blink::WebPluginContainer* container) { | 1368 blink::WebPluginContainer* container) { |
| 1372 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
| 1373 switches::kEnableBrowserPluginForAllViewTypes)) | |
| 1374 return true; | |
| 1375 | |
| 1376 // If this |BrowserPlugin| <object> in the |container| is not inside a | 1369 // If this |BrowserPlugin| <object> in the |container| is not inside a |
| 1377 // <webview>/<adview> shadowHost, we disable instantiating this plugin. This | 1370 // <webview>/<adview> shadowHost, we disable instantiating this plugin. This |
| 1378 // is to discourage and prevent developers from accidentally attaching | 1371 // is to discourage and prevent developers from accidentally attaching |
| 1379 // <object> directly in apps. | 1372 // <object> directly in apps. |
| 1380 // | 1373 // |
| 1381 // Note that this check below does *not* ensure any security, it is still | 1374 // Note that this check below does *not* ensure any security, it is still |
| 1382 // possible to bypass this check. | 1375 // possible to bypass this check. |
| 1383 // TODO(lazyboy): http://crbug.com/178663, Ensure we properly disallow | 1376 // TODO(lazyboy): http://crbug.com/178663, Ensure we properly disallow |
| 1384 // instantiating BrowserPlugin outside of the <webview>/<adview> shim. | 1377 // instantiating BrowserPlugin outside of the <webview>/<adview> shim. |
| 1385 if (container->element().isNull()) | 1378 if (container->element().isNull()) |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1435 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 1428 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 1436 return !command_line->HasSwitch(extensions::switches::kExtensionProcess); | 1429 return !command_line->HasSwitch(extensions::switches::kExtensionProcess); |
| 1437 } | 1430 } |
| 1438 | 1431 |
| 1439 blink::WebWorkerPermissionClientProxy* | 1432 blink::WebWorkerPermissionClientProxy* |
| 1440 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( | 1433 ChromeContentRendererClient::CreateWorkerPermissionClientProxy( |
| 1441 content::RenderFrame* render_frame, | 1434 content::RenderFrame* render_frame, |
| 1442 blink::WebFrame* frame) { | 1435 blink::WebFrame* frame) { |
| 1443 return new WorkerPermissionClientProxy(render_frame, frame); | 1436 return new WorkerPermissionClientProxy(render_frame, frame); |
| 1444 } | 1437 } |
| OLD | NEW |