| 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_browser_main_parts.h" |
| 20 #include "content/shell/browser/layout_test/layout_test_resource_dispatcher_host
_delegate.h" | 21 #include "content/shell/browser/layout_test/layout_test_resource_dispatcher_host
_delegate.h" |
| 21 #include "content/shell/browser/shell.h" | 22 #include "content/shell/browser/shell.h" |
| 22 #include "content/shell/browser/shell_browser_context.h" | 23 #include "content/shell/browser/shell_browser_context.h" |
| 23 #include "content/shell/browser/shell_browser_main_parts.h" | 24 #include "content/shell/browser/shell_browser_main_parts.h" |
| 24 #include "content/shell/browser/shell_devtools_delegate.h" | 25 #include "content/shell/browser/shell_devtools_delegate.h" |
| 25 #include "content/shell/browser/shell_message_filter.h" | 26 #include "content/shell/browser/shell_message_filter.h" |
| 26 #include "content/shell/browser/shell_net_log.h" | 27 #include "content/shell/browser/shell_net_log.h" |
| 27 #include "content/shell/browser/shell_notification_manager.h" | 28 #include "content/shell/browser/shell_notification_manager.h" |
| 28 #include "content/shell/browser/shell_quota_permission_context.h" | 29 #include "content/shell/browser/shell_quota_permission_context.h" |
| 29 #include "content/shell/browser/shell_resource_dispatcher_host_delegate.h" | 30 #include "content/shell/browser/shell_resource_dispatcher_host_delegate.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 return NULL; | 159 return NULL; |
| 159 | 160 |
| 160 if (!shell_notification_manager_) | 161 if (!shell_notification_manager_) |
| 161 shell_notification_manager_.reset(new ShellNotificationManager()); | 162 shell_notification_manager_.reset(new ShellNotificationManager()); |
| 162 | 163 |
| 163 return shell_notification_manager_.get(); | 164 return shell_notification_manager_.get(); |
| 164 } | 165 } |
| 165 | 166 |
| 166 BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( | 167 BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( |
| 167 const MainFunctionParams& parameters) { | 168 const MainFunctionParams& parameters) { |
| 168 shell_browser_main_parts_ = new ShellBrowserMainParts(parameters); | 169 shell_browser_main_parts_ = |
| 170 CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree) |
| 171 ? new LayoutTestBrowserMainParts(parameters) |
| 172 : new ShellBrowserMainParts(parameters); |
| 169 return shell_browser_main_parts_; | 173 return shell_browser_main_parts_; |
| 170 } | 174 } |
| 171 | 175 |
| 172 void ShellContentBrowserClient::RenderProcessWillLaunch( | 176 void ShellContentBrowserClient::RenderProcessWillLaunch( |
| 173 RenderProcessHost* host) { | 177 RenderProcessHost* host) { |
| 174 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kExposeIpcEcho)) | 178 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kExposeIpcEcho)) |
| 175 host->AddFilter(new IPCEchoMessageFilter()); | 179 host->AddFilter(new IPCEchoMessageFilter()); |
| 176 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 180 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 177 return; | 181 return; |
| 178 host->AddFilter(new ShellMessageFilter( | 182 host->AddFilter(new ShellMessageFilter( |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 ShellBrowserContext* | 433 ShellBrowserContext* |
| 430 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( | 434 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( |
| 431 BrowserContext* content_browser_context) { | 435 BrowserContext* content_browser_context) { |
| 432 if (content_browser_context == browser_context()) | 436 if (content_browser_context == browser_context()) |
| 433 return browser_context(); | 437 return browser_context(); |
| 434 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); | 438 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); |
| 435 return off_the_record_browser_context(); | 439 return off_the_record_browser_context(); |
| 436 } | 440 } |
| 437 | 441 |
| 438 } // namespace content | 442 } // namespace content |
| OLD | NEW |