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 if (CommandLine::ForCurrentProcess()->HasSwitch( | |
1109 switches::kEnableBrowserPluginForAllViewTypes)) | |
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 return container->element().shadowHost().tagName().equals( |
1124 WebKit::WebString::fromUTF8(kWebViewTagName))) { | 1128 WebKit::WebString::fromUTF8(kWebViewTagName)); |
darin (slow to review)
2013/03/18 17:30:48
nit: WebString has a using directive up top.
Charlie Reis
2013/03/18 17:33:13
Done.
| |
1125 return true; | |
1126 } else { | |
1127 return CommandLine::ForCurrentProcess()->HasSwitch( | |
1128 switches::kEnableBrowserPluginForAllViewTypes); | |
1129 } | |
1130 } | 1129 } |
1131 | 1130 |
1132 } // namespace chrome | 1131 } // namespace chrome |
OLD | NEW |