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/shell_content_renderer_client.h" | 5 #include "content/shell/shell_content_renderer_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/public/common/content_constants.h" | |
9 #include "content/public/common/content_switches.h" | |
8 #include "content/shell/shell_render_process_observer.h" | 10 #include "content/shell/shell_render_process_observer.h" |
9 #include "content/shell/shell_switches.h" | 11 #include "content/shell/shell_switches.h" |
10 #include "content/shell/webkit_test_runner.h" | 12 #include "content/shell/webkit_test_runner.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" | |
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | |
11 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
12 | 16 |
13 namespace content { | 17 namespace content { |
14 | 18 |
15 ShellContentRendererClient::ShellContentRendererClient() { | 19 ShellContentRendererClient::ShellContentRendererClient() { |
16 } | 20 } |
17 | 21 |
18 ShellContentRendererClient::~ShellContentRendererClient() { | 22 ShellContentRendererClient::~ShellContentRendererClient() { |
19 } | 23 } |
20 | 24 |
21 void ShellContentRendererClient::RenderThreadStarted() { | 25 void ShellContentRendererClient::RenderThreadStarted() { |
22 shell_observer_.reset(new ShellRenderProcessObserver()); | 26 shell_observer_.reset(new ShellRenderProcessObserver()); |
23 } | 27 } |
24 | 28 |
25 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { | 29 void ShellContentRendererClient::RenderViewCreated(RenderView* render_view) { |
26 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 30 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
27 return; | 31 return; |
28 | 32 |
29 new WebKitTestRunner(render_view); | 33 new WebKitTestRunner(render_view); |
30 } | 34 } |
31 | 35 |
36 bool ShellContentRendererClient::OverrideCreatePlugin( | |
37 RenderView* render_view, | |
38 WebKit::WebFrame* frame, | |
39 const WebKit::WebPluginParams& params, | |
40 WebKit::WebPlugin** plugin) { | |
41 std::string mime_type = params.mimeType.utf8(); | |
42 if (mime_type == content::kBrowserPluginMimeType) { | |
43 // Allow browser plugin in content_shell only if it is forced by flag. | |
Charlie Reis
2012/10/08 16:47:20
The behavior of this API isn't immediately obvious
lazyboy
2012/10/08 19:23:57
Done.
| |
44 return !CommandLine::ForCurrentProcess()->HasSwitch( | |
45 switches::kEnableBrowserPluginForAllViewTypes); | |
46 } | |
47 return false; | |
48 } | |
49 | |
32 } // namespace content | 50 } // namespace content |
OLD | NEW |