Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 #include <sstream> | 6 #include <sstream> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 23 #include "headless/app/headless_shell_switches.h" | 23 #include "headless/app/headless_shell_switches.h" |
| 24 #include "headless/public/headless_devtools_target.h" | 24 #include "headless/public/headless_devtools_target.h" |
| 25 #include "headless/public/util/deterministic_http_protocol_handler.h" | 25 #include "headless/public/util/deterministic_http_protocol_handler.h" |
| 26 #include "net/base/io_buffer.h" | 26 #include "net/base/io_buffer.h" |
| 27 #include "net/base/ip_address.h" | 27 #include "net/base/ip_address.h" |
| 28 #include "net/base/net_errors.h" | 28 #include "net/base/net_errors.h" |
| 29 #include "net/http/http_util.h" | 29 #include "net/http/http_util.h" |
| 30 #include "ui/gfx/geometry/size.h" | 30 #include "ui/gfx/geometry/size.h" |
| 31 | 31 |
| 32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
| 33 #include "components/crash/content/app/crash_switches.h" | |
| 34 #include "components/crash/content/app/run_as_crashpad_handler_win.h" | |
| 33 #include "sandbox/win/src/sandbox_types.h" | 35 #include "sandbox/win/src/sandbox_types.h" |
| 34 #endif | 36 #endif |
| 35 | 37 |
| 36 namespace headless { | 38 namespace headless { |
| 37 namespace { | 39 namespace { |
| 38 // Address where to listen to incoming DevTools connections. | 40 // Address where to listen to incoming DevTools connections. |
| 39 const char kDevToolsHttpServerAddress[] = "127.0.0.1"; | 41 const char kDevToolsHttpServerAddress[] = "127.0.0.1"; |
| 40 // Default file name for screenshot. Can be overriden by "--screenshot" switch. | 42 // Default file name for screenshot. Can be overriden by "--screenshot" switch. |
| 41 const char kDefaultScreenshotFileName[] = "screenshot.png"; | 43 const char kDefaultScreenshotFileName[] = "screenshot.png"; |
| 42 // Default file name for pdf. Can be overriden by "--print-to-pdf" switch. | 44 // Default file name for pdf. Can be overriden by "--print-to-pdf" switch. |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 498 LOG(ERROR) << "Virtual time budget is disabled " | 500 LOG(ERROR) << "Virtual time budget is disabled " |
| 499 << "when remote debugging is enabled."; | 501 << "when remote debugging is enabled."; |
| 500 return false; | 502 return false; |
| 501 } | 503 } |
| 502 return true; | 504 return true; |
| 503 } | 505 } |
| 504 | 506 |
| 505 #if defined(OS_WIN) | 507 #if defined(OS_WIN) |
| 506 int HeadlessShellMain(HINSTANCE instance, | 508 int HeadlessShellMain(HINSTANCE instance, |
| 507 sandbox::SandboxInterfaceInfo* sandbox_info) { | 509 sandbox::SandboxInterfaceInfo* sandbox_info) { |
| 510 base::CommandLine::Init(0, nullptr); | |
| 511 std::string process_type = | |
| 512 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | |
| 513 ::switches::kProcessType); | |
| 514 if (process_type == crash_reporter::switches::kCrashpadHandler) { | |
| 515 return crash_reporter::RunAsCrashpadHandler( | |
| 516 *base::CommandLine::ForCurrentProcess(), ::switches::kProcessType); | |
| 517 } | |
| 518 | |
| 508 RunChildProcessIfNeeded(instance, sandbox_info); | 519 RunChildProcessIfNeeded(instance, sandbox_info); |
| 509 HeadlessBrowser::Options::Builder builder(0, nullptr); | 520 HeadlessBrowser::Options::Builder builder(0, nullptr); |
| 510 builder.SetInstance(instance); | 521 builder.SetInstance(instance); |
| 511 builder.SetSandboxInfo(std::move(sandbox_info)); | 522 builder.SetSandboxInfo(std::move(sandbox_info)); |
| 512 #else | 523 #else |
| 513 int HeadlessShellMain(int argc, const char** argv) { | 524 int HeadlessShellMain(int argc, const char** argv) { |
| 514 RunChildProcessIfNeeded(argc, argv); | 525 RunChildProcessIfNeeded(argc, argv); |
|
Eric Seckler
2017/04/24 09:06:14
I'd have expected a call to base::CommandLine::Ini
Sami
2017/04/24 19:04:28
That's probably due to this patch:
https://codere
| |
| 515 HeadlessBrowser::Options::Builder builder(argc, argv); | 526 HeadlessBrowser::Options::Builder builder(argc, argv); |
| 516 #endif // defined(OS_WIN) | 527 #endif // defined(OS_WIN) |
| 517 HeadlessShell shell; | 528 HeadlessShell shell; |
| 518 | 529 |
| 519 // Enable devtools if requested. | 530 // Enable devtools if requested. |
| 520 const base::CommandLine& command_line( | 531 const base::CommandLine& command_line( |
| 521 *base::CommandLine::ForCurrentProcess()); | 532 *base::CommandLine::ForCurrentProcess()); |
| 522 if (!ValidateCommandLine(command_line)) | 533 if (!ValidateCommandLine(command_line)) |
| 523 return EXIT_FAILURE; | 534 return EXIT_FAILURE; |
| 524 | 535 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 612 | 623 |
| 613 int HeadlessShellMain(const content::ContentMainParams& params) { | 624 int HeadlessShellMain(const content::ContentMainParams& params) { |
| 614 #if defined(OS_WIN) | 625 #if defined(OS_WIN) |
| 615 return HeadlessShellMain(params.instance, params.sandbox_info); | 626 return HeadlessShellMain(params.instance, params.sandbox_info); |
| 616 #else | 627 #else |
| 617 return HeadlessShellMain(params.argc, params.argv); | 628 return HeadlessShellMain(params.argc, params.argv); |
| 618 #endif | 629 #endif |
| 619 } | 630 } |
| 620 | 631 |
| 621 } // namespace headless | 632 } // namespace headless |
| OLD | NEW |