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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1098 | 1098 |
1099 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( | 1099 void ChromeContentRendererClient::RegisterPPAPIInterfaceFactories( |
1100 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { | 1100 webkit::ppapi::PpapiInterfaceFactoryManager* factory_manager) { |
1101 #if defined(ENABLE_PLUGINS) | 1101 #if defined(ENABLE_PLUGINS) |
1102 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); | 1102 factory_manager->RegisterFactory(ChromePPAPIInterfaceFactory); |
1103 #endif | 1103 #endif |
1104 } | 1104 } |
1105 | 1105 |
1106 bool ChromeContentRendererClient::AllowBrowserPlugin( | 1106 bool ChromeContentRendererClient::AllowBrowserPlugin( |
1107 WebKit::WebPluginContainer* container) const { | 1107 WebKit::WebPluginContainer* container) const { |
1108 // Always allow the BrowserPlugin in the site-per-process prototype. | |
1109 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)) | |
1110 return true; | |
1111 | |
1108 // If this |BrowserPlugin| <object> in the |container| is not inside a | 1112 // If this |BrowserPlugin| <object> in the |container| is not inside a |
1109 // <webview> shadowHost, we disable instantiating this plugin. This is to | 1113 // <webview> shadowHost, we disable instantiating this plugin. This is to |
1110 // discourage and prevent developers from accidentally attaching <object> | 1114 // discourage and prevent developers from accidentally attaching <object> |
1111 // directly in apps. | 1115 // directly in apps. |
1112 // | 1116 // |
1113 // Note that this check below does *not* ensure any security, it is still | 1117 // Note that this check below does *not* ensure any security, it is still |
1114 // possible to bypass this check. | 1118 // possible to bypass this check. |
1115 // TODO(lazyboy): http://crbug.com/178663, Ensure we properly disallow | 1119 // TODO(lazyboy): http://crbug.com/178663, Ensure we properly disallow |
1116 // instantiating BrowserPlugin outside of the <webview> shim. | 1120 // instantiating BrowserPlugin outside of the <webview> shim. |
1117 if (container->element().isNull()) | 1121 if (container->element().isNull()) |
1118 return false; | 1122 return false; |
1119 | 1123 |
1120 if (container->element().shadowHost().isNull()) | 1124 if (container->element().shadowHost().isNull()) |
1121 return false; | 1125 return false; |
1122 | 1126 |
1123 if (container->element().shadowHost().tagName().equals( | 1127 if (container->element().shadowHost().tagName().equals( |
1124 WebKit::WebString::fromUTF8(kWebViewTagName))) { | 1128 WebKit::WebString::fromUTF8(kWebViewTagName))) { |
1125 return true; | 1129 return true; |
1126 } else { | 1130 } else { |
1127 return CommandLine::ForCurrentProcess()->HasSwitch( | 1131 return CommandLine::ForCurrentProcess()->HasSwitch( |
Fady Samuel
2013/03/18 14:41:15
While you're at it, could you please move this swi
Charlie Reis
2013/03/18 17:17:41
Ah! Just doing that move would be sufficient, act
| |
1128 switches::kEnableBrowserPluginForAllViewTypes); | 1132 switches::kEnableBrowserPluginForAllViewTypes); |
1129 } | 1133 } |
1130 } | 1134 } |
1131 | 1135 |
1132 } // namespace chrome | 1136 } // namespace chrome |
OLD | NEW |