#include "remoting/host/setup/start_host_main.h"
#include <stddef.h>
#include <stdio.h>
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/message_loop/message_pump_type.h"
#include "base/notreached.h"
#include "base/run_loop.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/task/single_thread_task_executor.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
#include "mojo/core/embedder/embedder.h"
#include "net/url_request/url_request_context_getter.h"
#include "remoting/base/breakpad.h"
#include "remoting/base/logging.h"
#include "remoting/base/url_request_context_getter.h"
#include "remoting/host/setup/cloud_host_starter.h"
#include "remoting/host/setup/corp_host_starter.h"
#include "remoting/host/setup/host_starter.h"
#include "remoting/host/setup/oauth_host_starter.h"
#include "remoting/host/setup/pin_validator.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/transitional_url_loader_factory_owner.h"
#if BUILDFLAG(IS_POSIX)
#include <termios.h>
#include <unistd.h>
#endif
#if BUILDFLAG(IS_LINUX)
#include "remoting/host/setup/daemon_controller_delegate_linux.h"
#include "remoting/host/setup/start_host_as_root.h"
#endif
#if BUILDFLAG(IS_WIN)
#include <windows.h>
#include "base/process/process_info.h"
#endif
namespace remoting {
namespace {
constexpr char kPinSwitchName[] = …;
constexpr char kAuthCodeSwitchName[] = …;
constexpr char kRedirectUrlSwitchName[] = …;
constexpr char kHostOwnerSwitchName[] = …;
constexpr char kCorpUserSwitchName[] = …;
constexpr char kCloudUserSwitchName[] = …;
constexpr char kCloudApiKeySwitchName[] = …;
constexpr char kNameSwitchName[] = …;
constexpr char kDisplayNameSwitchName[] = …;
constexpr char kDisableCrashReportingSwitchName[] = …;
constexpr char kInvalidPinErrorMessage[] = …;
bool g_started = …;
base::SingleThreadTaskExecutor* g_main_thread_task_executor = …;
base::RunLoop* g_active_run_loop = …;
void PrintDefaultHelpMessage(const char* process_name) { … }
void PrintCorpUserHelpMessage(const char* process_name) { … }
void PrintCloudUserHelpMessage(const char* process_name) { … }
void SetEcho(bool echo) { … }
std::string ReadString(bool no_echo) { … }
void OnDone(HostStarter::Result result) { … }
bool InitializeParamsForOAuthFlow(HostStarter::Params& params,
const base::CommandLine* command_line) { … }
bool InitializeCorpMachineParams(HostStarter::Params& params,
const base::CommandLine* command_line) { … }
bool InitializeCloudMachineParams(HostStarter::Params& params,
const base::CommandLine* command_line) { … }
}
int StartHostMain(int argc, char** argv) { … }
}