OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/shell_content_browser_client.h" | 5 #include "content/shell/browser/shell_content_browser_client.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "content/public/browser/render_process_host.h" | 13 #include "content/public/browser/render_process_host.h" |
14 #include "content/public/browser/resource_dispatcher_host.h" | 14 #include "content/public/browser/resource_dispatcher_host.h" |
15 #include "content/public/browser/storage_partition.h" | 15 #include "content/public/browser/storage_partition.h" |
16 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
17 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
18 #include "content/public/common/web_preferences.h" | 18 #include "content/public/common/web_preferences.h" |
19 #include "content/shell/browser/ipc_echo_message_filter.h" | 19 #include "content/shell/browser/ipc_echo_message_filter.h" |
| 20 #include "content/shell/browser/layout_test/layout_test_resource_dispatcher_host
_delegate.h" |
20 #include "content/shell/browser/shell.h" | 21 #include "content/shell/browser/shell.h" |
21 #include "content/shell/browser/shell_browser_context.h" | 22 #include "content/shell/browser/shell_browser_context.h" |
22 #include "content/shell/browser/shell_browser_main_parts.h" | 23 #include "content/shell/browser/shell_browser_main_parts.h" |
23 #include "content/shell/browser/shell_devtools_delegate.h" | 24 #include "content/shell/browser/shell_devtools_delegate.h" |
24 #include "content/shell/browser/shell_message_filter.h" | 25 #include "content/shell/browser/shell_message_filter.h" |
25 #include "content/shell/browser/shell_net_log.h" | 26 #include "content/shell/browser/shell_net_log.h" |
26 #include "content/shell/browser/shell_notification_manager.h" | 27 #include "content/shell/browser/shell_notification_manager.h" |
27 #include "content/shell/browser/shell_quota_permission_context.h" | 28 #include "content/shell/browser/shell_quota_permission_context.h" |
28 #include "content/shell/browser/shell_resource_dispatcher_host_delegate.h" | 29 #include "content/shell/browser/shell_resource_dispatcher_host_delegate.h" |
29 #include "content/shell/browser/shell_web_contents_view_delegate_creator.h" | 30 #include "content/shell/browser/shell_web_contents_view_delegate_creator.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 RenderViewHost* render_view_host, | 278 RenderViewHost* render_view_host, |
278 const GURL& url, | 279 const GURL& url, |
279 WebPreferences* prefs) { | 280 WebPreferences* prefs) { |
280 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 281 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
281 return; | 282 return; |
282 WebKitTestController::Get()->OverrideWebkitPrefs(prefs); | 283 WebKitTestController::Get()->OverrideWebkitPrefs(prefs); |
283 } | 284 } |
284 | 285 |
285 void ShellContentBrowserClient::ResourceDispatcherHostCreated() { | 286 void ShellContentBrowserClient::ResourceDispatcherHostCreated() { |
286 resource_dispatcher_host_delegate_.reset( | 287 resource_dispatcher_host_delegate_.reset( |
287 new ShellResourceDispatcherHostDelegate()); | 288 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree) |
| 289 ? new LayoutTestResourceDispatcherHostDelegate |
| 290 : new ShellResourceDispatcherHostDelegate); |
288 ResourceDispatcherHost::Get()->SetDelegate( | 291 ResourceDispatcherHost::Get()->SetDelegate( |
289 resource_dispatcher_host_delegate_.get()); | 292 resource_dispatcher_host_delegate_.get()); |
290 } | 293 } |
291 | 294 |
292 std::string ShellContentBrowserClient::GetDefaultDownloadName() { | 295 std::string ShellContentBrowserClient::GetDefaultDownloadName() { |
293 return "download"; | 296 return "download"; |
294 } | 297 } |
295 | 298 |
296 WebContentsViewDelegate* ShellContentBrowserClient::GetWebContentsViewDelegate( | 299 WebContentsViewDelegate* ShellContentBrowserClient::GetWebContentsViewDelegate( |
297 WebContents* web_contents) { | 300 WebContents* web_contents) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 ShellBrowserContext* | 429 ShellBrowserContext* |
427 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( | 430 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( |
428 BrowserContext* content_browser_context) { | 431 BrowserContext* content_browser_context) { |
429 if (content_browser_context == browser_context()) | 432 if (content_browser_context == browser_context()) |
430 return browser_context(); | 433 return browser_context(); |
431 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); | 434 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); |
432 return off_the_record_browser_context(); | 435 return off_the_record_browser_context(); |
433 } | 436 } |
434 | 437 |
435 } // namespace content | 438 } // namespace content |
OLD | NEW |