Chromium Code Reviews| 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/app/shell_main_delegate.h" | 5 #include "content/shell/app/shell_main_delegate.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/cpu.h" | 9 #include "base/cpu.h" |
| 10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/lazy_instance.h" | 12 #include "base/lazy_instance.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 15 #include "cc/base/switches.h" | 15 #include "cc/base/switches.h" |
| 16 #include "content/public/browser/browser_main_runner.h" | 16 #include "content/public/browser/browser_main_runner.h" |
| 17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
| 18 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
| 19 #include "content/public/test/layouttest_support.h" | 19 #include "content/public/test/layouttest_support.h" |
| 20 #include "content/shell/app/shell_crash_reporter_client.h" | 20 #include "content/shell/app/shell_crash_reporter_client.h" |
| 21 #include "content/shell/app/webkit_test_platform_support.h" | 21 #include "content/shell/app/webkit_test_platform_support.h" |
| 22 #include "content/shell/browser/layout_test/layout_test_browser_main.h" | |
| 22 #include "content/shell/browser/shell_browser_main.h" | 23 #include "content/shell/browser/shell_browser_main.h" |
| 23 #include "content/shell/browser/shell_content_browser_client.h" | 24 #include "content/shell/browser/shell_content_browser_client.h" |
| 24 #include "content/shell/common/shell_switches.h" | 25 #include "content/shell/common/shell_switches.h" |
| 25 #include "content/shell/renderer/layout_test/layout_test_content_renderer_client .h" | 26 #include "content/shell/renderer/layout_test/layout_test_content_renderer_client .h" |
| 26 #include "content/shell/renderer/shell_content_renderer_client.h" | 27 #include "content/shell/renderer/shell_content_renderer_client.h" |
| 27 #include "media/base/media_switches.h" | 28 #include "media/base/media_switches.h" |
| 28 #include "net/cookies/cookie_monster.h" | 29 #include "net/cookies/cookie_monster.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 30 #include "ui/base/ui_base_paths.h" | 31 #include "ui/base/ui_base_paths.h" |
| 31 #include "ui/base/ui_base_switches.h" | 32 #include "ui/base/ui_base_switches.h" |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 if (!process_type.empty()) | 245 if (!process_type.empty()) |
| 245 return -1; | 246 return -1; |
| 246 | 247 |
| 247 #if !defined(OS_ANDROID) | 248 #if !defined(OS_ANDROID) |
| 248 // Android stores the BrowserMainRunner instance as a scoped member pointer | 249 // Android stores the BrowserMainRunner instance as a scoped member pointer |
| 249 // on the ShellMainDelegate class because of different object lifetime. | 250 // on the ShellMainDelegate class because of different object lifetime. |
| 250 scoped_ptr<BrowserMainRunner> browser_runner_; | 251 scoped_ptr<BrowserMainRunner> browser_runner_; |
| 251 #endif | 252 #endif |
| 252 | 253 |
| 253 browser_runner_.reset(BrowserMainRunner::Create()); | 254 browser_runner_.reset(BrowserMainRunner::Create()); |
| 254 return ShellBrowserMain(main_function_params, browser_runner_); | 255 CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 256 return command_line.HasSwitch(switches::kDumpRenderTree) | |
| 257 ? LayoutTestBrowserMain(main_function_params, browser_runner_) | |
| 258 : ShellBrowserMain(main_function_params, browser_runner_); | |
|
jochen (gone - plz use gerrit)
2014/10/14 14:52:24
can the else part be inlined? the ShellBrowserMain
| |
| 255 } | 259 } |
| 256 | 260 |
| 257 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 261 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
| 258 void ShellMainDelegate::ZygoteForked() { | 262 void ShellMainDelegate::ZygoteForked() { |
| 259 if (CommandLine::ForCurrentProcess()->HasSwitch( | 263 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 260 switches::kEnableCrashReporter)) { | 264 switches::kEnableCrashReporter)) { |
| 261 std::string process_type = | 265 std::string process_type = |
| 262 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 266 CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 263 switches::kProcessType); | 267 switches::kProcessType); |
| 264 breakpad::InitCrashReporter(process_type); | 268 breakpad::InitCrashReporter(process_type); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 | 313 |
| 310 ContentRendererClient* ShellMainDelegate::CreateContentRendererClient() { | 314 ContentRendererClient* ShellMainDelegate::CreateContentRendererClient() { |
| 311 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) | 315 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kDumpRenderTree)) |
| 312 renderer_client_.reset(new LayoutTestContentRendererClient); | 316 renderer_client_.reset(new LayoutTestContentRendererClient); |
| 313 else | 317 else |
| 314 renderer_client_.reset(new ShellContentRendererClient); | 318 renderer_client_.reset(new ShellContentRendererClient); |
| 315 return renderer_client_.get(); | 319 return renderer_client_.get(); |
| 316 } | 320 } |
| 317 | 321 |
| 318 } // namespace content | 322 } // namespace content |
| OLD | NEW |