| 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/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.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/shell.h" | 20 #include "content/shell/browser/shell.h" |
| 20 #include "content/shell/browser/shell_browser_context.h" | 21 #include "content/shell/browser/shell_browser_context.h" |
| 21 #include "content/shell/browser/shell_browser_main_parts.h" | 22 #include "content/shell/browser/shell_browser_main_parts.h" |
| 22 #include "content/shell/browser/shell_devtools_delegate.h" | 23 #include "content/shell/browser/shell_devtools_delegate.h" |
| 23 #include "content/shell/browser/shell_message_filter.h" | 24 #include "content/shell/browser/shell_message_filter.h" |
| 24 #include "content/shell/browser/shell_net_log.h" | 25 #include "content/shell/browser/shell_net_log.h" |
| 25 #include "content/shell/browser/shell_notification_manager.h" | 26 #include "content/shell/browser/shell_notification_manager.h" |
| 26 #include "content/shell/browser/shell_quota_permission_context.h" | 27 #include "content/shell/browser/shell_quota_permission_context.h" |
| 27 #include "content/shell/browser/shell_resource_dispatcher_host_delegate.h" | 28 #include "content/shell/browser/shell_resource_dispatcher_host_delegate.h" |
| 28 #include "content/shell/browser/shell_web_contents_view_delegate_creator.h" | 29 #include "content/shell/browser/shell_web_contents_view_delegate_creator.h" |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 164 } |
| 164 | 165 |
| 165 BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( | 166 BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( |
| 166 const MainFunctionParams& parameters) { | 167 const MainFunctionParams& parameters) { |
| 167 shell_browser_main_parts_ = new ShellBrowserMainParts(parameters); | 168 shell_browser_main_parts_ = new ShellBrowserMainParts(parameters); |
| 168 return shell_browser_main_parts_; | 169 return shell_browser_main_parts_; |
| 169 } | 170 } |
| 170 | 171 |
| 171 void ShellContentBrowserClient::RenderProcessWillLaunch( | 172 void ShellContentBrowserClient::RenderProcessWillLaunch( |
| 172 RenderProcessHost* host) { | 173 RenderProcessHost* host) { |
| 174 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kExposeIpcEcho)) |
| 175 host->AddFilter(new IPCEchoMessageFilter()); |
| 173 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 176 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 174 return; | 177 return; |
| 175 host->AddFilter(new ShellMessageFilter( | 178 host->AddFilter(new ShellMessageFilter( |
| 176 host->GetID(), | 179 host->GetID(), |
| 177 BrowserContext::GetDefaultStoragePartition(browser_context()) | 180 BrowserContext::GetDefaultStoragePartition(browser_context()) |
| 178 ->GetDatabaseTracker(), | 181 ->GetDatabaseTracker(), |
| 179 BrowserContext::GetDefaultStoragePartition(browser_context()) | 182 BrowserContext::GetDefaultStoragePartition(browser_context()) |
| 180 ->GetQuotaManager(), | 183 ->GetQuotaManager(), |
| 181 BrowserContext::GetDefaultStoragePartition(browser_context()) | 184 BrowserContext::GetDefaultStoragePartition(browser_context()) |
| 182 ->GetURLRequestContext())); | 185 ->GetURLRequestContext())); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( | 236 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( |
| 234 CommandLine* command_line, int child_process_id) { | 237 CommandLine* command_line, int child_process_id) { |
| 235 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 238 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 236 command_line->AppendSwitch(switches::kDumpRenderTree); | 239 command_line->AppendSwitch(switches::kDumpRenderTree); |
| 237 if (CommandLine::ForCurrentProcess()->HasSwitch( | 240 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 238 switches::kEnableFontAntialiasing)) | 241 switches::kEnableFontAntialiasing)) |
| 239 command_line->AppendSwitch(switches::kEnableFontAntialiasing); | 242 command_line->AppendSwitch(switches::kEnableFontAntialiasing); |
| 240 if (CommandLine::ForCurrentProcess()->HasSwitch( | 243 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 241 switches::kExposeInternalsForTesting)) | 244 switches::kExposeInternalsForTesting)) |
| 242 command_line->AppendSwitch(switches::kExposeInternalsForTesting); | 245 command_line->AppendSwitch(switches::kExposeInternalsForTesting); |
| 246 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 247 switches::kExposeIpcEcho)) |
| 248 command_line->AppendSwitch(switches::kExposeIpcEcho); |
| 243 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStableReleaseMode)) | 249 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kStableReleaseMode)) |
| 244 command_line->AppendSwitch(switches::kStableReleaseMode); | 250 command_line->AppendSwitch(switches::kStableReleaseMode); |
| 245 if (CommandLine::ForCurrentProcess()->HasSwitch( | 251 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 246 switches::kEnableCrashReporter)) { | 252 switches::kEnableCrashReporter)) { |
| 247 command_line->AppendSwitch(switches::kEnableCrashReporter); | 253 command_line->AppendSwitch(switches::kEnableCrashReporter); |
| 248 } | 254 } |
| 249 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kCrashDumpsDir)) { | 255 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kCrashDumpsDir)) { |
| 250 command_line->AppendSwitchPath( | 256 command_line->AppendSwitchPath( |
| 251 switches::kCrashDumpsDir, | 257 switches::kCrashDumpsDir, |
| 252 CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 258 CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 ShellBrowserContext* | 424 ShellBrowserContext* |
| 419 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( | 425 ShellContentBrowserClient::ShellBrowserContextForBrowserContext( |
| 420 BrowserContext* content_browser_context) { | 426 BrowserContext* content_browser_context) { |
| 421 if (content_browser_context == browser_context()) | 427 if (content_browser_context == browser_context()) |
| 422 return browser_context(); | 428 return browser_context(); |
| 423 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); | 429 DCHECK_EQ(content_browser_context, off_the_record_browser_context()); |
| 424 return off_the_record_browser_context(); | 430 return off_the_record_browser_context(); |
| 425 } | 431 } |
| 426 | 432 |
| 427 } // namespace content | 433 } // namespace content |
| OLD | NEW |