| 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" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // If CheckLayoutSystemDeps succeeds, we don't exit early. Instead we | 134 // If CheckLayoutSystemDeps succeeds, we don't exit early. Instead we |
| 135 // continue and try to load the fonts in BlinkTestPlatformInitialize | 135 // continue and try to load the fonts in BlinkTestPlatformInitialize |
| 136 // below, and then try to bring up the rest of the content module. | 136 // below, and then try to bring up the rest of the content module. |
| 137 if (!CheckLayoutSystemDeps()) { | 137 if (!CheckLayoutSystemDeps()) { |
| 138 if (exit_code) | 138 if (exit_code) |
| 139 *exit_code = 1; | 139 *exit_code = 1; |
| 140 return true; | 140 return true; |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 | 143 |
| 144 // "dump-render-tree" has been renamed to "run-layout-test", but the old | 144 if (command_line.HasSwitch(switches::kDumpRenderTree)) { |
| 145 // flag name is still used in some places, so this check will remain until | |
| 146 // it is phased out entirely. | |
| 147 if (command_line.HasSwitch(switches::kDumpRenderTree)) | |
| 148 command_line.AppendSwitch(switches::kRunLayoutTest); | |
| 149 | |
| 150 if (command_line.HasSwitch(switches::kRunLayoutTest)) { | |
| 151 EnableBrowserLayoutTestMode(); | 145 EnableBrowserLayoutTestMode(); |
| 152 | 146 |
| 153 command_line.AppendSwitch(switches::kProcessPerTab); | 147 command_line.AppendSwitch(switches::kProcessPerTab); |
| 154 command_line.AppendSwitch(switches::kEnableLogging); | 148 command_line.AppendSwitch(switches::kEnableLogging); |
| 155 command_line.AppendSwitch(switches::kAllowFileAccessFromFiles); | 149 command_line.AppendSwitch(switches::kAllowFileAccessFromFiles); |
| 156 command_line.AppendSwitchASCII(switches::kUseGL, | 150 command_line.AppendSwitchASCII(switches::kUseGL, |
| 157 gfx::kGLImplementationOSMesaName); | 151 gfx::kGLImplementationOSMesaName); |
| 158 command_line.AppendSwitch(switches::kSkipGpuDataLoading); | 152 command_line.AppendSwitch(switches::kSkipGpuDataLoading); |
| 159 command_line.AppendSwitchASCII(switches::kTouchEvents, | 153 command_line.AppendSwitchASCII(switches::kTouchEvents, |
| 160 switches::kTouchEventsEnabled); | 154 switches::kTouchEventsEnabled); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 return -1; | 255 return -1; |
| 262 | 256 |
| 263 #if !defined(OS_ANDROID) | 257 #if !defined(OS_ANDROID) |
| 264 // Android stores the BrowserMainRunner instance as a scoped member pointer | 258 // Android stores the BrowserMainRunner instance as a scoped member pointer |
| 265 // on the ShellMainDelegate class because of different object lifetime. | 259 // on the ShellMainDelegate class because of different object lifetime. |
| 266 scoped_ptr<BrowserMainRunner> browser_runner_; | 260 scoped_ptr<BrowserMainRunner> browser_runner_; |
| 267 #endif | 261 #endif |
| 268 | 262 |
| 269 browser_runner_.reset(BrowserMainRunner::Create()); | 263 browser_runner_.reset(BrowserMainRunner::Create()); |
| 270 base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); | 264 base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); |
| 271 return command_line.HasSwitch(switches::kRunLayoutTest) || | 265 return command_line.HasSwitch(switches::kDumpRenderTree) || |
| 272 command_line.HasSwitch(switches::kCheckLayoutTestSysDeps) | 266 command_line.HasSwitch(switches::kCheckLayoutTestSysDeps) |
| 273 ? LayoutTestBrowserMain(main_function_params, browser_runner_) | 267 ? LayoutTestBrowserMain(main_function_params, browser_runner_) |
| 274 : ShellBrowserMain(main_function_params, browser_runner_); | 268 : ShellBrowserMain(main_function_params, browser_runner_); |
| 275 } | 269 } |
| 276 | 270 |
| 277 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) | 271 #if defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) |
| 278 void ShellMainDelegate::ZygoteForked() { | 272 void ShellMainDelegate::ZygoteForked() { |
| 279 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 273 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 280 switches::kEnableCrashReporter)) { | 274 switches::kEnableCrashReporter)) { |
| 281 std::string process_type = | 275 std::string process_type = |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 PathService::Get(base::DIR_MODULE, &pak_dir); | 311 PathService::Get(base::DIR_MODULE, &pak_dir); |
| 318 #endif | 312 #endif |
| 319 | 313 |
| 320 pak_file = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")); | 314 pak_file = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")); |
| 321 #endif | 315 #endif |
| 322 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); | 316 ui::ResourceBundle::InitSharedInstanceWithPakPath(pak_file); |
| 323 } | 317 } |
| 324 | 318 |
| 325 ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { | 319 ContentBrowserClient* ShellMainDelegate::CreateContentBrowserClient() { |
| 326 browser_client_.reset(base::CommandLine::ForCurrentProcess()->HasSwitch( | 320 browser_client_.reset(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 327 switches::kRunLayoutTest) | 321 switches::kDumpRenderTree) |
| 328 ? new LayoutTestContentBrowserClient | 322 ? new LayoutTestContentBrowserClient |
| 329 : new ShellContentBrowserClient); | 323 : new ShellContentBrowserClient); |
| 330 | 324 |
| 331 return browser_client_.get(); | 325 return browser_client_.get(); |
| 332 } | 326 } |
| 333 | 327 |
| 334 ContentRendererClient* ShellMainDelegate::CreateContentRendererClient() { | 328 ContentRendererClient* ShellMainDelegate::CreateContentRendererClient() { |
| 335 renderer_client_.reset(base::CommandLine::ForCurrentProcess()->HasSwitch( | 329 renderer_client_.reset(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 336 switches::kRunLayoutTest) | 330 switches::kDumpRenderTree) |
| 337 ? new LayoutTestContentRendererClient | 331 ? new LayoutTestContentRendererClient |
| 338 : new ShellContentRendererClient); | 332 : new ShellContentRendererClient); |
| 339 | 333 |
| 340 return renderer_client_.get(); | 334 return renderer_client_.get(); |
| 341 } | 335 } |
| 342 | 336 |
| 343 } // namespace content | 337 } // namespace content |
| OLD | NEW |