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