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