#include "headless/public/headless_shell.h"
#include <memory>
#include "base/base_switches.h"
#include "base/check_deref.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/task/thread_pool.h"
#include "base/version_info/version_info.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "content/public/app/content_main.h"
#include "content/public/common/content_switches.h"
#include "headless/lib/browser/headless_browser_impl.h"
#include "headless/lib/browser/headless_web_contents_impl.h"
#include "headless/lib/headless_content_main_delegate.h"
#include "headless/public/headless_browser.h"
#include "headless/public/headless_browser_context.h"
#include "headless/public/headless_web_contents.h"
#include "headless/public/switches.h"
#include "net/base/filename_util.h"
#include "url/gurl.h"
#if BUILDFLAG(IS_MAC)
#include "components/os_crypt/sync/os_crypt_switches.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "base/strings/utf_string_conversions.h"
#include "components/crash/core/app/crash_switches.h"
#include "components/crash/core/app/run_as_crashpad_handler_win.h"
#include "sandbox/win/src/sandbox_types.h"
#endif
#if defined(HEADLESS_USE_POLICY)
#include "components/headless/policy/headless_mode_policy.h"
#endif
#if defined(HEADLESS_ENABLE_COMMANDS)
#include "components/headless/command_handler/headless_command_handler.h"
#endif
namespace headless {
namespace {
#if BUILDFLAG(IS_WIN)
const wchar_t kAboutBlank[] = L"about:blank";
#else
const char kAboutBlank[] = …;
#endif
GURL ConvertArgumentToURL(const base::CommandLine::StringType& arg) { … }
class HeadlessShell { … };
void HeadlessShell::OnBrowserStart(HeadlessBrowser* browser) { … }
#if defined(HEADLESS_ENABLE_COMMANDS)
void HeadlessShell::OnProcessCommandsDone(
HeadlessCommandHandler::Result result) { … }
#endif
void HeadlessShell::ShutdownSoon() { … }
void HeadlessShell::Shutdown() { … }
void HeadlessChildMain(content::ContentMainParams params) { … }
int HeadlessBrowserMain(content::ContentMainParams params) { … }
}
int HeadlessShellMain(content::ContentMainParams params) { … }
}