Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(214)

Side by Side Diff: content/shell/renderer/shell_content_renderer_client.cc

Issue 595943002: WebTestInterfaces class to chromium c++ style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: resolved comments Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/shell/BUILD.gn ('k') | content/shell/renderer/shell_render_frame_observer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/web_cache/renderer/web_cache_render_process_observer.h" 10 #include "components/web_cache/renderer/web_cache_render_process_observer.h"
11 #include "content/common/sandbox_win.h" 11 #include "content/common/sandbox_win.h"
12 #include "content/public/common/content_constants.h" 12 #include "content/public/common/content_constants.h"
13 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
14 #include "content/public/renderer/render_thread.h" 14 #include "content/public/renderer/render_thread.h"
15 #include "content/public/renderer/render_view.h" 15 #include "content/public/renderer/render_view.h"
16 #include "content/public/test/layouttest_support.h" 16 #include "content/public/test/layouttest_support.h"
17 #include "content/shell/common/shell_switches.h" 17 #include "content/shell/common/shell_switches.h"
18 #include "content/shell/common/webkit_test_helpers.h" 18 #include "content/shell/common/webkit_test_helpers.h"
19 #include "content/shell/renderer/shell_render_frame_observer.h" 19 #include "content/shell/renderer/shell_render_frame_observer.h"
20 #include "content/shell/renderer/shell_render_process_observer.h" 20 #include "content/shell/renderer/shell_render_process_observer.h"
21 #include "content/shell/renderer/shell_render_view_observer.h" 21 #include "content/shell/renderer/shell_render_view_observer.h"
22 #include "content/shell/renderer/test_runner/WebTestInterfaces.h"
23 #include "content/shell/renderer/test_runner/mock_credential_manager_client.h" 22 #include "content/shell/renderer/test_runner/mock_credential_manager_client.h"
23 #include "content/shell/renderer/test_runner/web_test_interfaces.h"
24 #include "content/shell/renderer/test_runner/web_test_proxy.h" 24 #include "content/shell/renderer/test_runner/web_test_proxy.h"
25 #include "content/shell/renderer/webkit_test_runner.h" 25 #include "content/shell/renderer/webkit_test_runner.h"
26 #include "content/test/mock_webclipboard_impl.h" 26 #include "content/test/mock_webclipboard_impl.h"
27 #include "ppapi/shared_impl/ppapi_switches.h" 27 #include "ppapi/shared_impl/ppapi_switches.h"
28 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h" 28 #include "third_party/WebKit/public/platform/WebMediaStreamCenter.h"
29 #include "third_party/WebKit/public/web/WebPluginParams.h" 29 #include "third_party/WebKit/public/web/WebPluginParams.h"
30 #include "third_party/WebKit/public/web/WebView.h" 30 #include "third_party/WebKit/public/web/WebView.h"
31 #include "v8/include/v8.h" 31 #include "v8/include/v8.h"
32 32
33 #if defined(OS_WIN) 33 #if defined(OS_WIN)
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 130
131 WebMediaStreamCenter* 131 WebMediaStreamCenter*
132 ShellContentRendererClient::OverrideCreateWebMediaStreamCenter( 132 ShellContentRendererClient::OverrideCreateWebMediaStreamCenter(
133 WebMediaStreamCenterClient* client) { 133 WebMediaStreamCenterClient* client) {
134 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) 134 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
135 return NULL; 135 return NULL;
136 #if defined(ENABLE_WEBRTC) 136 #if defined(ENABLE_WEBRTC)
137 WebTestInterfaces* interfaces = 137 WebTestInterfaces* interfaces =
138 ShellRenderProcessObserver::GetInstance()->test_interfaces(); 138 ShellRenderProcessObserver::GetInstance()->test_interfaces();
139 return interfaces->createMediaStreamCenter(client); 139 return interfaces->CreateMediaStreamCenter(client);
140 #else 140 #else
141 return NULL; 141 return NULL;
142 #endif 142 #endif
143 } 143 }
144 144
145 WebRTCPeerConnectionHandler* 145 WebRTCPeerConnectionHandler*
146 ShellContentRendererClient::OverrideCreateWebRTCPeerConnectionHandler( 146 ShellContentRendererClient::OverrideCreateWebRTCPeerConnectionHandler(
147 WebRTCPeerConnectionHandlerClient* client) { 147 WebRTCPeerConnectionHandlerClient* client) {
148 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) 148 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
149 return NULL; 149 return NULL;
150 #if defined(ENABLE_WEBRTC) 150 #if defined(ENABLE_WEBRTC)
151 WebTestInterfaces* interfaces = 151 WebTestInterfaces* interfaces =
152 ShellRenderProcessObserver::GetInstance()->test_interfaces(); 152 ShellRenderProcessObserver::GetInstance()->test_interfaces();
153 return interfaces->createWebRTCPeerConnectionHandler(client); 153 return interfaces->CreateWebRTCPeerConnectionHandler(client);
154 #else 154 #else
155 return NULL; 155 return NULL;
156 #endif 156 #endif
157 } 157 }
158 158
159 WebMIDIAccessor* 159 WebMIDIAccessor*
160 ShellContentRendererClient::OverrideCreateMIDIAccessor( 160 ShellContentRendererClient::OverrideCreateMIDIAccessor(
161 WebMIDIAccessorClient* client) { 161 WebMIDIAccessorClient* client) {
162 WebTestInterfaces* interfaces = 162 WebTestInterfaces* interfaces =
163 ShellRenderProcessObserver::GetInstance()->test_interfaces(); 163 ShellRenderProcessObserver::GetInstance()->test_interfaces();
164 return interfaces->createMIDIAccessor(client); 164 return interfaces->CreateMIDIAccessor(client);
165 } 165 }
166 166
167 WebAudioDevice* 167 WebAudioDevice*
168 ShellContentRendererClient::OverrideCreateAudioDevice( 168 ShellContentRendererClient::OverrideCreateAudioDevice(
169 double sample_rate) { 169 double sample_rate) {
170 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) 170 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
171 return NULL; 171 return NULL;
172 WebTestInterfaces* interfaces = 172 WebTestInterfaces* interfaces =
173 ShellRenderProcessObserver::GetInstance()->test_interfaces(); 173 ShellRenderProcessObserver::GetInstance()->test_interfaces();
174 return interfaces->createAudioDevice(sample_rate); 174 return interfaces->CreateAudioDevice(sample_rate);
175 } 175 }
176 176
177 WebClipboard* ShellContentRendererClient::OverrideWebClipboard() { 177 WebClipboard* ShellContentRendererClient::OverrideWebClipboard() {
178 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) 178 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
179 return NULL; 179 return NULL;
180 if (!clipboard_) 180 if (!clipboard_)
181 clipboard_.reset(new MockWebClipboardImpl); 181 clipboard_.reset(new MockWebClipboardImpl);
182 return clipboard_.get(); 182 return clipboard_.get();
183 } 183 }
184 184
185 WebThemeEngine* ShellContentRendererClient::OverrideThemeEngine() { 185 WebThemeEngine* ShellContentRendererClient::OverrideThemeEngine() {
186 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) 186 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree))
187 return NULL; 187 return NULL;
188 return ShellRenderProcessObserver::GetInstance()->test_interfaces() 188 return ShellRenderProcessObserver::GetInstance()
189 ->themeEngine(); 189 ->test_interfaces()
190 ->ThemeEngine();
190 } 191 }
191 192
192 void ShellContentRendererClient::WebTestProxyCreated(RenderView* render_view, 193 void ShellContentRendererClient::WebTestProxyCreated(RenderView* render_view,
193 WebTestProxyBase* proxy) { 194 WebTestProxyBase* proxy) {
194 WebKitTestRunner* test_runner = new WebKitTestRunner(render_view); 195 WebKitTestRunner* test_runner = new WebKitTestRunner(render_view);
195 test_runner->set_proxy(proxy); 196 test_runner->set_proxy(proxy);
196 if (!ShellRenderProcessObserver::GetInstance()->test_delegate()) 197 if (!ShellRenderProcessObserver::GetInstance()->test_delegate())
197 ShellRenderProcessObserver::GetInstance()->SetTestDelegate(test_runner); 198 ShellRenderProcessObserver::GetInstance()->SetTestDelegate(test_runner);
198 proxy->SetInterfaces( 199 proxy->SetInterfaces(
199 ShellRenderProcessObserver::GetInstance()->test_interfaces()); 200 ShellRenderProcessObserver::GetInstance()->test_interfaces());
(...skipping 12 matching lines...) Expand all
212 return CommandLine::ForCurrentProcess()->HasSwitch( 213 return CommandLine::ForCurrentProcess()->HasSwitch(
213 switches::kEnablePepperTesting); 214 switches::kEnablePepperTesting);
214 } 215 }
215 216
216 bool ShellContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() { 217 bool ShellContentRendererClient::IsPluginAllowedToUseDevChannelAPIs() {
217 return CommandLine::ForCurrentProcess()->HasSwitch( 218 return CommandLine::ForCurrentProcess()->HasSwitch(
218 switches::kEnablePepperTesting); 219 switches::kEnablePepperTesting);
219 } 220 }
220 221
221 } // namespace content 222 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/BUILD.gn ('k') | content/shell/renderer/shell_render_frame_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698