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/public/common/content_constants.h" | 10 #include "content/public/common/content_constants.h" |
11 #include "content/public/common/content_switches.h" | 11 #include "content/public/common/content_switches.h" |
12 #include "content/public/renderer/render_view.h" | 12 #include "content/public/renderer/render_view.h" |
13 #include "content/public/test/layouttest_support.h" | 13 #include "content/public/test/layouttest_support.h" |
14 #include "content/shell/common/shell_switches.h" | 14 #include "content/shell/common/shell_switches.h" |
15 #include "content/shell/renderer/shell_render_process_observer.h" | 15 #include "content/shell/renderer/shell_render_process_observer.h" |
16 #include "content/shell/renderer/shell_render_view_observer.h" | 16 #include "content/shell/renderer/shell_render_view_observer.h" |
17 #include "content/shell/renderer/webkit_test_runner.h" | 17 #include "content/shell/renderer/webkit_test_runner.h" |
18 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" | 18 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" |
19 #include "third_party/WebKit/public/testing/WebTestInterfaces.h" | 19 #include "third_party/WebKit/public/testing/WebTestInterfaces.h" |
20 #include "third_party/WebKit/public/testing/WebTestProxy.h" | 20 #include "third_party/WebKit/public/testing/WebTestProxy.h" |
21 #include "third_party/WebKit/public/testing/WebTestRunner.h" | 21 #include "third_party/WebKit/public/testing/WebTestRunner.h" |
22 #include "third_party/WebKit/public/web/WebPluginParams.h" | 22 #include "third_party/WebKit/public/web/WebPluginParams.h" |
23 #include "third_party/WebKit/public/web/WebView.h" | 23 #include "third_party/WebKit/public/web/WebView.h" |
24 #include "v8/include/v8.h" | 24 #include "v8/include/v8.h" |
25 #include "webkit/mocks/mock_webhyphenator.h" | 25 #include "webkit/mocks/mock_webhyphenator.h" |
26 #include "webkit/support/mock_webclipboard_impl.h" | 26 #include "webkit/support/mock_webclipboard_impl.h" |
27 | 27 |
| 28 using WebKit::WebAudioDevice; |
28 using WebKit::WebClipboard; | 29 using WebKit::WebClipboard; |
29 using WebKit::WebFrame; | 30 using WebKit::WebFrame; |
30 using WebKit::WebHyphenator; | 31 using WebKit::WebHyphenator; |
31 using WebKit::WebMIDIAccessor; | 32 using WebKit::WebMIDIAccessor; |
32 using WebKit::WebMIDIAccessorClient; | 33 using WebKit::WebMIDIAccessorClient; |
33 using WebKit::WebMediaStreamCenter; | 34 using WebKit::WebMediaStreamCenter; |
34 using WebKit::WebMediaStreamCenterClient; | 35 using WebKit::WebMediaStreamCenterClient; |
35 using WebKit::WebPlugin; | 36 using WebKit::WebPlugin; |
36 using WebKit::WebPluginParams; | 37 using WebKit::WebPluginParams; |
37 using WebKit::WebRTCPeerConnectionHandler; | 38 using WebKit::WebRTCPeerConnectionHandler; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 } | 147 } |
147 | 148 |
148 WebMIDIAccessor* | 149 WebMIDIAccessor* |
149 ShellContentRendererClient::OverrideCreateMIDIAccessor( | 150 ShellContentRendererClient::OverrideCreateMIDIAccessor( |
150 WebMIDIAccessorClient* client) { | 151 WebMIDIAccessorClient* client) { |
151 WebTestInterfaces* interfaces = | 152 WebTestInterfaces* interfaces = |
152 ShellRenderProcessObserver::GetInstance()->test_interfaces(); | 153 ShellRenderProcessObserver::GetInstance()->test_interfaces(); |
153 return interfaces->createMIDIAccessor(client); | 154 return interfaces->createMIDIAccessor(client); |
154 } | 155 } |
155 | 156 |
| 157 WebAudioDevice* |
| 158 ShellContentRendererClient::OverrideCreateAudioDevice( |
| 159 double sample_rate) { |
| 160 WebTestInterfaces* interfaces = |
| 161 ShellRenderProcessObserver::GetInstance()->test_interfaces(); |
| 162 return interfaces->createAudioDevice(sample_rate); |
| 163 } |
| 164 |
156 WebClipboard* ShellContentRendererClient::OverrideWebClipboard() { | 165 WebClipboard* ShellContentRendererClient::OverrideWebClipboard() { |
157 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 166 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
158 return NULL; | 167 return NULL; |
159 if (!clipboard_) | 168 if (!clipboard_) |
160 clipboard_.reset(new MockWebClipboardImpl); | 169 clipboard_.reset(new MockWebClipboardImpl); |
161 return clipboard_.get(); | 170 return clipboard_.get(); |
162 } | 171 } |
163 | 172 |
164 WebHyphenator* ShellContentRendererClient::OverrideWebHyphenator() { | 173 WebHyphenator* ShellContentRendererClient::OverrideWebHyphenator() { |
165 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 174 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
(...skipping 28 matching lines...) Expand all Loading... |
194 if (CommandLine::ForCurrentProcess()->HasSwitch( | 203 if (CommandLine::ForCurrentProcess()->HasSwitch( |
195 switches::kEnableBrowserPluginForAllViewTypes)) { | 204 switches::kEnableBrowserPluginForAllViewTypes)) { |
196 // Allow BrowserPlugin if forced by command line flag. This is generally | 205 // Allow BrowserPlugin if forced by command line flag. This is generally |
197 // true for tests. | 206 // true for tests. |
198 return true; | 207 return true; |
199 } | 208 } |
200 return ContentRendererClient::AllowBrowserPlugin(container); | 209 return ContentRendererClient::AllowBrowserPlugin(container); |
201 } | 210 } |
202 | 211 |
203 } // namespace content | 212 } // namespace content |
OLD | NEW |