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 "content/shell/renderer/shell_content_renderer_client.h" | 5 #include "content/shell/renderer/shell_content_renderer_client.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
10 #include "content/common/sandbox_win.h" | 10 #include "content/common/sandbox_win.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 ShellRenderProcessObserver::GetInstance()->test_delegate(); | 111 ShellRenderProcessObserver::GetInstance()->test_delegate(); |
112 if (delegate == static_cast<WebTestDelegate*>(test_runner)) | 112 if (delegate == static_cast<WebTestDelegate*>(test_runner)) |
113 ShellRenderProcessObserver::GetInstance()->SetMainWindow(render_view); | 113 ShellRenderProcessObserver::GetInstance()->SetMainWindow(render_view); |
114 } | 114 } |
115 | 115 |
116 bool ShellContentRendererClient::OverrideCreatePlugin( | 116 bool ShellContentRendererClient::OverrideCreatePlugin( |
117 RenderFrame* render_frame, | 117 RenderFrame* render_frame, |
118 WebLocalFrame* frame, | 118 WebLocalFrame* frame, |
119 const WebPluginParams& params, | 119 const WebPluginParams& params, |
120 WebPlugin** plugin) { | 120 WebPlugin** plugin) { |
121 std::string mime_type = params.mimeType.utf8(); | |
122 if (mime_type == content::kBrowserPluginMimeType) { | |
123 // Allow browser plugin in content_shell only if it is forced by flag. | |
124 // Returning true here disables the plugin. | |
125 return !CommandLine::ForCurrentProcess()->HasSwitch( | |
126 switches::kEnableBrowserPluginForAllViewTypes); | |
127 } | |
128 return false; | 121 return false; |
129 } | 122 } |
130 | 123 |
131 WebMediaStreamCenter* | 124 WebMediaStreamCenter* |
132 ShellContentRendererClient::OverrideCreateWebMediaStreamCenter( | 125 ShellContentRendererClient::OverrideCreateWebMediaStreamCenter( |
133 WebMediaStreamCenterClient* client) { | 126 WebMediaStreamCenterClient* client) { |
134 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 127 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
135 return NULL; | 128 return NULL; |
136 #if defined(ENABLE_WEBRTC) | 129 #if defined(ENABLE_WEBRTC) |
137 WebTestInterfaces* interfaces = | 130 WebTestInterfaces* interfaces = |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 if (!ShellRenderProcessObserver::GetInstance()->test_delegate()) | 189 if (!ShellRenderProcessObserver::GetInstance()->test_delegate()) |
197 ShellRenderProcessObserver::GetInstance()->SetTestDelegate(test_runner); | 190 ShellRenderProcessObserver::GetInstance()->SetTestDelegate(test_runner); |
198 proxy->setInterfaces( | 191 proxy->setInterfaces( |
199 ShellRenderProcessObserver::GetInstance()->test_interfaces()); | 192 ShellRenderProcessObserver::GetInstance()->test_interfaces()); |
200 test_runner->proxy()->setDelegate( | 193 test_runner->proxy()->setDelegate( |
201 ShellRenderProcessObserver::GetInstance()->test_delegate()); | 194 ShellRenderProcessObserver::GetInstance()->test_delegate()); |
202 } | 195 } |
203 | 196 |
204 bool ShellContentRendererClient::AllowBrowserPlugin( | 197 bool ShellContentRendererClient::AllowBrowserPlugin( |
205 blink::WebPluginContainer* container) { | 198 blink::WebPluginContainer* container) { |
206 if (CommandLine::ForCurrentProcess()->HasSwitch( | 199 return true; |
207 switches::kEnableBrowserPluginForAllViewTypes)) { | |
208 // Allow BrowserPlugin if forced by command line flag. This is generally | |
209 // true for tests. | |
210 return true; | |
211 } | |
212 return ContentRendererClient::AllowBrowserPlugin(container); | |
213 } | 200 } |
214 | 201 |
215 } // namespace content | 202 } // namespace content |
OLD | NEW |