Commit b982d511 authored by thestig@chromium.org's avatar thestig@chromium.org

Cleanup: Use base::CommandLine in remoting/

Review URL: https://codereview.chromium.org/290173011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272455 0039d316-1c4b-4281-b951-d872f2087c98
parent dd70f2bf
...@@ -46,7 +46,7 @@ static void LoadNative(JNIEnv* env, jclass clazz, jobject context) { ...@@ -46,7 +46,7 @@ static void LoadNative(JNIEnv* env, jclass clazz, jobject context) {
// runtime API keys have been specified by the environment. Unfortunately, we // runtime API keys have been specified by the environment. Unfortunately, we
// neither launch Chromium nor have a command line, so we need to prevent // neither launch Chromium nor have a command line, so we need to prevent
// them from DCHECKing out when they go looking. // them from DCHECKing out when they go looking.
CommandLine::Init(0, NULL); base::CommandLine::Init(0, NULL);
// Create the singleton now so that the Chromoting threads will be set up. // Create the singleton now so that the Chromoting threads will be set up.
remoting::ChromotingJniRuntime::GetInstance(); remoting::ChromotingJniRuntime::GetInstance();
......
...@@ -259,7 +259,8 @@ void DaemonProcess::CrashNetworkProcess( ...@@ -259,7 +259,8 @@ void DaemonProcess::CrashNetworkProcess(
void DaemonProcess::Initialize() { void DaemonProcess::Initialize() {
DCHECK(caller_task_runner()->BelongsToCurrentThread()); DCHECK(caller_task_runner()->BelongsToCurrentThread());
const CommandLine* command_line = CommandLine::ForCurrentProcess(); const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
// Get the name of the host configuration file. // Get the name of the host configuration file.
base::FilePath default_config_dir = remoting::GetConfigDir(); base::FilePath default_config_dir = remoting::GetConfigDir();
base::FilePath config_path = default_config_dir.Append( base::FilePath config_path = default_config_dir.Append(
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
namespace remoting { namespace remoting {
int DesktopProcessMain() { int DesktopProcessMain() {
const CommandLine* command_line = CommandLine::ForCurrentProcess(); const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
std::string channel_name = std::string channel_name =
command_line->GetSwitchValueASCII(kDaemonPipeSwitchName); command_line->GetSwitchValueASCII(kDaemonPipeSwitchName);
......
...@@ -160,9 +160,9 @@ DesktopResizerLinux::DesktopResizerLinux() ...@@ -160,9 +160,9 @@ DesktopResizerLinux::DesktopResizerLinux()
: display_(XOpenDisplay(NULL)), : display_(XOpenDisplay(NULL)),
screen_(DefaultScreen(display_)), screen_(DefaultScreen(display_)),
root_(RootWindow(display_, screen_)), root_(RootWindow(display_, screen_)),
exact_resize_(CommandLine::ForCurrentProcess()-> exact_resize_(base::CommandLine::ForCurrentProcess()->
HasSwitch("server-supports-exact-resize")) { HasSwitch("server-supports-exact-resize")) {
XRRSelectInput (display_, root_, RRScreenChangeNotifyMask); XRRSelectInput(display_, root_, RRScreenChangeNotifyMask);
} }
DesktopResizerLinux::~DesktopResizerLinux() { DesktopResizerLinux::~DesktopResizerLinux() {
......
...@@ -86,27 +86,30 @@ void Usage(const base::FilePath& program_name) { ...@@ -86,27 +86,30 @@ void Usage(const base::FilePath& program_name) {
// Runs the binary specified by the command line, elevated. // Runs the binary specified by the command line, elevated.
int RunElevated() { int RunElevated() {
const CommandLine::SwitchMap& switches = const base::CommandLine::SwitchMap& switches =
CommandLine::ForCurrentProcess()->GetSwitches(); base::CommandLine::ForCurrentProcess()->GetSwitches();
CommandLine::StringVector args = CommandLine::ForCurrentProcess()->GetArgs(); base::CommandLine::StringVector args =
base::CommandLine::ForCurrentProcess()->GetArgs();
// Create the child process command line by copying switches from the current // Create the child process command line by copying switches from the current
// command line. // command line.
CommandLine command_line(CommandLine::NO_PROGRAM); base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
for (CommandLine::SwitchMap::const_iterator i = switches.begin(); for (base::CommandLine::SwitchMap::const_iterator i = switches.begin();
i != switches.end(); ++i) { i != switches.end(); ++i) {
if (i->first != kElevateSwitchName) if (i->first != kElevateSwitchName)
command_line.AppendSwitchNative(i->first, i->second); command_line.AppendSwitchNative(i->first, i->second);
} }
for (CommandLine::StringVector::const_iterator i = args.begin(); for (base::CommandLine::StringVector::const_iterator i = args.begin();
i != args.end(); ++i) { i != args.end(); ++i) {
command_line.AppendArgNative(*i); command_line.AppendArgNative(*i);
} }
// Get the name of the binary to launch. // Get the name of the binary to launch.
base::FilePath binary = base::FilePath binary =
CommandLine::ForCurrentProcess()->GetSwitchValuePath(kElevateSwitchName); base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
CommandLine::StringType parameters = command_line.GetCommandLineString(); kElevateSwitchName);
base::CommandLine::StringType parameters =
command_line.GetCommandLineString();
// Launch the child process requesting elevation. // Launch the child process requesting elevation.
SHELLEXECUTEINFO info; SHELLEXECUTEINFO info;
...@@ -157,7 +160,7 @@ int HostMain(int argc, char** argv) { ...@@ -157,7 +160,7 @@ int HostMain(int argc, char** argv) {
base::mac::ScopedNSAutoreleasePool pool; base::mac::ScopedNSAutoreleasePool pool;
#endif #endif
CommandLine::Init(argc, argv); base::CommandLine::Init(argc, argv);
// Initialize Breakpad as early as possible. On Mac the command-line needs to // Initialize Breakpad as early as possible. On Mac the command-line needs to
// be initialized first, so that the preference for crash-reporting can be // be initialized first, so that the preference for crash-reporting can be
...@@ -184,7 +187,8 @@ int HostMain(int argc, char** argv) { ...@@ -184,7 +187,8 @@ int HostMain(int argc, char** argv) {
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
// Parse the command line. // Parse the command line.
const CommandLine* command_line = CommandLine::ForCurrentProcess(); const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(kHelpSwitchName) || if (command_line->HasSwitch(kHelpSwitchName) ||
command_line->HasSwitch(kQuestionSwitchName)) { command_line->HasSwitch(kQuestionSwitchName)) {
Usage(command_line->GetProgram()); Usage(command_line->GetProgram());
......
...@@ -131,7 +131,7 @@ int It2MeNativeMessagingHostMain(int argc, char** argv) { ...@@ -131,7 +131,7 @@ int It2MeNativeMessagingHostMain(int argc, char** argv) {
// This object instance is required by Chrome code (such as MessageLoop). // This object instance is required by Chrome code (such as MessageLoop).
base::AtExitManager exit_manager; base::AtExitManager exit_manager;
CommandLine::Init(argc, argv); base::CommandLine::Init(argc, argv);
remoting::InitHostLogging(); remoting::InitHostLogging();
return StartIt2MeNativeMessagingHost(); return StartIt2MeNativeMessagingHost();
......
...@@ -371,7 +371,7 @@ void InitializePlugin() { ...@@ -371,7 +371,7 @@ void InitializePlugin() {
g_at_exit_manager = new base::AtExitManager; g_at_exit_manager = new base::AtExitManager;
// Init an empty command line for common objects that use it. // Init an empty command line for common objects that use it.
CommandLine::Init(0, NULL); base::CommandLine::Init(0, NULL);
if (remoting::LoadResources("")) { if (remoting::LoadResources("")) {
g_ui_name = new std::string( g_ui_name = new std::string(
...@@ -449,7 +449,7 @@ NPError GetValue(NPP instance, NPPVariable variable, void* value) { ...@@ -449,7 +449,7 @@ NPError GetValue(NPP instance, NPPVariable variable, void* value) {
// NP_GetValue() can be called before NP_Initialize(). // NP_GetValue() can be called before NP_Initialize().
InitializePlugin(); InitializePlugin();
switch(variable) { switch (variable) {
default: default:
VLOG(2) << "GetValue - default " << variable; VLOG(2) << "GetValue - default " << variable;
return NPERR_GENERIC_ERROR; return NPERR_GENERIC_ERROR;
...@@ -533,10 +533,10 @@ EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnetscape_funcs ...@@ -533,10 +533,10 @@ EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnetscape_funcs
VLOG(2) << "NP_Initialize"; VLOG(2) << "NP_Initialize";
InitializePlugin(); InitializePlugin();
if(npnetscape_funcs == NULL) if (npnetscape_funcs == NULL)
return NPERR_INVALID_FUNCTABLE_ERROR; return NPERR_INVALID_FUNCTABLE_ERROR;
if(((npnetscape_funcs->version & 0xff00) >> 8) > NP_VERSION_MAJOR) if (((npnetscape_funcs->version & 0xff00) >> 8) > NP_VERSION_MAJOR)
return NPERR_INCOMPATIBLE_VERSION_ERROR; return NPERR_INCOMPATIBLE_VERSION_ERROR;
g_npnetscape_funcs = npnetscape_funcs; g_npnetscape_funcs = npnetscape_funcs;
......
...@@ -209,7 +209,7 @@ class HostProcess ...@@ -209,7 +209,7 @@ class HostProcess
// Initializes IPC control channel and config file path from |cmd_line|. // Initializes IPC control channel and config file path from |cmd_line|.
// Called on the UI thread. // Called on the UI thread.
bool InitWithCommandLine(const CommandLine* cmd_line); bool InitWithCommandLine(const base::CommandLine* cmd_line);
// Called on the UI thread to start monitoring the configuration file. // Called on the UI thread to start monitoring the configuration file.
void StartWatchingConfigChanges(); void StartWatchingConfigChanges();
...@@ -361,7 +361,7 @@ HostProcess::~HostProcess() { ...@@ -361,7 +361,7 @@ HostProcess::~HostProcess() {
task_runner->DeleteSoon(FROM_HERE, context_.release()); task_runner->DeleteSoon(FROM_HERE, context_.release());
} }
bool HostProcess::InitWithCommandLine(const CommandLine* cmd_line) { bool HostProcess::InitWithCommandLine(const base::CommandLine* cmd_line) {
#if defined(REMOTING_MULTI_PROCESS) #if defined(REMOTING_MULTI_PROCESS)
// Parse the handle value and convert it to a handle/file descriptor. // Parse the handle value and convert it to a handle/file descriptor.
std::string channel_name = std::string channel_name =
...@@ -631,7 +631,7 @@ void HostProcess::OnChannelError() { ...@@ -631,7 +631,7 @@ void HostProcess::OnChannelError() {
void HostProcess::StartOnUiThread() { void HostProcess::StartOnUiThread() {
DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); DCHECK(context_->ui_task_runner()->BelongsToCurrentThread());
if (!InitWithCommandLine(CommandLine::ForCurrentProcess())) { if (!InitWithCommandLine(base::CommandLine::ForCurrentProcess())) {
// Shutdown the host if the command line is invalid. // Shutdown the host if the command line is invalid.
context_->network_task_runner()->PostTask( context_->network_task_runner()->PostTask(
FROM_HERE, base::Bind(&HostProcess::ShutdownHost, this, FROM_HERE, base::Bind(&HostProcess::ShutdownHost, this,
...@@ -642,14 +642,14 @@ void HostProcess::StartOnUiThread() { ...@@ -642,14 +642,14 @@ void HostProcess::StartOnUiThread() {
#if defined(OS_LINUX) #if defined(OS_LINUX)
// If an audio pipe is specific on the command-line then initialize // If an audio pipe is specific on the command-line then initialize
// AudioCapturerLinux to capture from it. // AudioCapturerLinux to capture from it.
base::FilePath audio_pipe_name = CommandLine::ForCurrentProcess()-> base::FilePath audio_pipe_name = base::CommandLine::ForCurrentProcess()->
GetSwitchValuePath(kAudioPipeSwitchName); GetSwitchValuePath(kAudioPipeSwitchName);
if (!audio_pipe_name.empty()) { if (!audio_pipe_name.empty()) {
remoting::AudioCapturerLinux::InitializePipeReader( remoting::AudioCapturerLinux::InitializePipeReader(
context_->audio_task_runner(), audio_pipe_name); context_->audio_task_runner(), audio_pipe_name);
} }
base::FilePath gnubby_socket_name = CommandLine::ForCurrentProcess()-> base::FilePath gnubby_socket_name = base::CommandLine::ForCurrentProcess()->
GetSwitchValuePath(kAuthSocknameSwitchName); GetSwitchValuePath(kAuthSocknameSwitchName);
if (!gnubby_socket_name.empty()) if (!gnubby_socket_name.empty())
remoting::GnubbyAuthHandler::SetGnubbySocketName(gnubby_socket_name); remoting::GnubbyAuthHandler::SetGnubbySocketName(gnubby_socket_name);
......
...@@ -33,7 +33,7 @@ ServiceUrls::ServiceUrls() ...@@ -33,7 +33,7 @@ ServiceUrls::ServiceUrls()
directory_bot_jid_(kDirectoryBotJid) { directory_bot_jid_(kDirectoryBotJid) {
#if !defined(NDEBUG) #if !defined(NDEBUG)
// Allow debug builds to override urls via command line. // Allow debug builds to override urls via command line.
CommandLine* command_line = CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
CHECK(command_line); CHECK(command_line);
if (command_line->HasSwitch(kDirectoryBaseUrlSwitch)) { if (command_line->HasSwitch(kDirectoryBaseUrlSwitch)) {
directory_base_url_ = command_line->GetSwitchValueASCII( directory_base_url_ = command_line->GetSwitchValueASCII(
......
...@@ -85,7 +85,7 @@ bool RunHostScriptWithTimeout( ...@@ -85,7 +85,7 @@ bool RunHostScriptWithTimeout(
LOG(ERROR) << "GetScriptPath() failed."; LOG(ERROR) << "GetScriptPath() failed.";
return false; return false;
} }
CommandLine command_line(script_path); base::CommandLine command_line(script_path);
for (unsigned int i = 0; i < args.size(); ++i) { for (unsigned int i = 0; i < args.size(); ++i) {
command_line.AppendArg(args[i]); command_line.AppendArg(args[i]);
} }
...@@ -132,7 +132,7 @@ DaemonController::State DaemonControllerDelegateLinux::GetState() { ...@@ -132,7 +132,7 @@ DaemonController::State DaemonControllerDelegateLinux::GetState() {
if (!GetScriptPath(&script_path)) { if (!GetScriptPath(&script_path)) {
return DaemonController::STATE_NOT_IMPLEMENTED; return DaemonController::STATE_NOT_IMPLEMENTED;
} }
CommandLine command_line(script_path); base::CommandLine command_line(script_path);
command_line.AppendArg("--get-status"); command_line.AppendArg("--get-status");
std::string status; std::string status;
...@@ -182,7 +182,7 @@ scoped_ptr<base::DictionaryValue> DaemonControllerDelegateLinux::GetConfig() { ...@@ -182,7 +182,7 @@ scoped_ptr<base::DictionaryValue> DaemonControllerDelegateLinux::GetConfig() {
result->SetString(kXmppLoginConfigPath, value); result->SetString(kXmppLoginConfigPath, value);
} }
} else { } else {
result.reset(); // Return NULL in case of error. result.reset(); // Return NULL in case of error.
} }
} }
...@@ -282,7 +282,7 @@ std::string DaemonControllerDelegateLinux::GetVersion() { ...@@ -282,7 +282,7 @@ std::string DaemonControllerDelegateLinux::GetVersion() {
if (!GetScriptPath(&script_path)) { if (!GetScriptPath(&script_path)) {
return std::string(); return std::string();
} }
CommandLine command_line(script_path); base::CommandLine command_line(script_path);
command_line.AppendArg("--host-version"); command_line.AppendArg("--host-version");
std::string version; std::string version;
......
...@@ -592,30 +592,33 @@ void Me2MeNativeMessagingHost::EnsureElevatedHostCreated() { ...@@ -592,30 +592,33 @@ void Me2MeNativeMessagingHost::EnsureElevatedHostCreated() {
return; return;
} }
const CommandLine* current_command_line = CommandLine::ForCurrentProcess(); const base::CommandLine* current_command_line =
const CommandLine::SwitchMap& switches = current_command_line->GetSwitches(); base::CommandLine::ForCurrentProcess();
CommandLine::StringVector args = current_command_line->GetArgs(); const base::CommandLine::SwitchMap& switches =
current_command_line->GetSwitches();
base::CommandLine::StringVector args = current_command_line->GetArgs();
// Create the child process command line by copying switches from the current // Create the child process command line by copying switches from the current
// command line. // command line.
CommandLine command_line(CommandLine::NO_PROGRAM); base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
command_line.AppendSwitch(kElevatingSwitchName); command_line.AppendSwitch(kElevatingSwitchName);
command_line.AppendSwitchASCII(kInputSwitchName, input_pipe_name); command_line.AppendSwitchASCII(kInputSwitchName, input_pipe_name);
command_line.AppendSwitchASCII(kOutputSwitchName, output_pipe_name); command_line.AppendSwitchASCII(kOutputSwitchName, output_pipe_name);
DCHECK(!current_command_line->HasSwitch(kElevatingSwitchName)); DCHECK(!current_command_line->HasSwitch(kElevatingSwitchName));
for (CommandLine::SwitchMap::const_iterator i = switches.begin(); for (base::CommandLine::SwitchMap::const_iterator i = switches.begin();
i != switches.end(); ++i) { i != switches.end(); ++i) {
command_line.AppendSwitchNative(i->first, i->second); command_line.AppendSwitchNative(i->first, i->second);
} }
for (CommandLine::StringVector::const_iterator i = args.begin(); for (base::CommandLine::StringVector::const_iterator i = args.begin();
i != args.end(); ++i) { i != args.end(); ++i) {
command_line.AppendArgNative(*i); command_line.AppendArgNative(*i);
} }
// Get the name of the binary to launch. // Get the name of the binary to launch.
base::FilePath binary = current_command_line->GetProgram(); base::FilePath binary = current_command_line->GetProgram();
CommandLine::StringType parameters = command_line.GetCommandLineString(); base::CommandLine::StringType parameters =
command_line.GetCommandLineString();
// Launch the child process requesting elevation. // Launch the child process requesting elevation.
SHELLEXECUTEINFO info; SHELLEXECUTEINFO info;
......
...@@ -93,7 +93,8 @@ int StartMe2MeNativeMessagingHost() { ...@@ -93,7 +93,8 @@ int StartMe2MeNativeMessagingHost() {
// Pass handle of the native view to the controller so that the UAC prompts // Pass handle of the native view to the controller so that the UAC prompts
// are focused properly. // are focused properly.
const CommandLine* command_line = CommandLine::ForCurrentProcess(); const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
int64 native_view_handle = 0; int64 native_view_handle = 0;
if (command_line->HasSwitch(kParentWindowSwitchName)) { if (command_line->HasSwitch(kParentWindowSwitchName)) {
std::string native_view = std::string native_view =
...@@ -254,7 +255,7 @@ int Me2MeNativeMessagingHostMain(int argc, char** argv) { ...@@ -254,7 +255,7 @@ int Me2MeNativeMessagingHostMain(int argc, char** argv) {
// This object instance is required by Chrome code (such as MessageLoop). // This object instance is required by Chrome code (such as MessageLoop).
base::AtExitManager exit_manager; base::AtExitManager exit_manager;
CommandLine::Init(argc, argv); base::CommandLine::Init(argc, argv);
remoting::InitHostLogging(); remoting::InitHostLogging();
return StartMe2MeNativeMessagingHost(); return StartMe2MeNativeMessagingHost();
......
...@@ -86,8 +86,9 @@ void OnDone(HostStarter::Result result) { ...@@ -86,8 +86,9 @@ void OnDone(HostStarter::Result result) {
int main(int argc, char** argv) { int main(int argc, char** argv) {
// google_apis::GetOAuth2ClientID/Secret need a static CommandLine. // google_apis::GetOAuth2ClientID/Secret need a static CommandLine.
CommandLine::Init(argc, argv); base::CommandLine::Init(argc, argv);
const CommandLine* command_line = CommandLine::ForCurrentProcess(); const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
std::string host_name = command_line->GetSwitchValueASCII("name"); std::string host_name = command_line->GetSwitchValueASCII("name");
std::string host_pin = command_line->GetSwitchValueASCII("pin"); std::string host_pin = command_line->GetSwitchValueASCII("pin");
......
...@@ -21,7 +21,7 @@ bool GetUsageStatsConsent(bool* allowed, bool* set_by_policy) { ...@@ -21,7 +21,7 @@ bool GetUsageStatsConsent(bool* allowed, bool* set_by_policy) {
// Normally, the ConfigFileWatcher class would be used for retrieving config // Normally, the ConfigFileWatcher class would be used for retrieving config
// settings, but this code needs to execute before Breakpad is initialised, // settings, but this code needs to execute before Breakpad is initialised,
// which itself should happen as early as possible during startup. // which itself should happen as early as possible during startup.
CommandLine* command_line = CommandLine::ForCurrentProcess(); base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(kHostConfigSwitchName)) { if (command_line->HasSwitch(kHostConfigSwitchName)) {
base::FilePath config_file_path = base::FilePath config_file_path =
command_line->GetSwitchValuePath(kHostConfigSwitchName); command_line->GetSwitchValuePath(kHostConfigSwitchName);
......
...@@ -65,8 +65,8 @@ HostService* HostService::GetInstance() { ...@@ -65,8 +65,8 @@ HostService* HostService::GetInstance() {
return Singleton<HostService>::get(); return Singleton<HostService>::get();
} }
bool HostService::InitWithCommandLine(const CommandLine* command_line) { bool HostService::InitWithCommandLine(const base::CommandLine* command_line) {
CommandLine::StringVector args = command_line->GetArgs(); base::CommandLine::StringVector args = command_line->GetArgs();
if (!args.empty()) { if (!args.empty()) {
LOG(ERROR) << "No positional parameters expected."; LOG(ERROR) << "No positional parameters expected.";
return false; return false;
...@@ -433,11 +433,11 @@ VOID WINAPI HostService::ServiceMain(DWORD argc, WCHAR* argv[]) { ...@@ -433,11 +433,11 @@ VOID WINAPI HostService::ServiceMain(DWORD argc, WCHAR* argv[]) {
int DaemonProcessMain() { int DaemonProcessMain() {
HostService* service = HostService::GetInstance(); HostService* service = HostService::GetInstance();
if (!service->InitWithCommandLine(CommandLine::ForCurrentProcess())) { if (!service->InitWithCommandLine(base::CommandLine::ForCurrentProcess())) {
return kUsageExitCode; return kUsageExitCode;
} }
return service->Run(); return service->Run();
} }
} // namespace remoting } // namespace remoting
...@@ -287,7 +287,7 @@ bool ReceiveCreateProcessResponse( ...@@ -287,7 +287,7 @@ bool ReceiveCreateProcessResponse(
bool SendCreateProcessRequest( bool SendCreateProcessRequest(
HANDLE pipe, HANDLE pipe,
const base::FilePath::StringType& application_name, const base::FilePath::StringType& application_name,
const CommandLine::StringType& command_line, const base::CommandLine::StringType& command_line,
DWORD creation_flags, DWORD creation_flags,
const base::char16* desktop_name) { const base::char16* desktop_name) {
// |CreateProcessRequest| structure passes the same parameters to // |CreateProcessRequest| structure passes the same parameters to
...@@ -370,11 +370,10 @@ bool SendCreateProcessRequest( ...@@ -370,11 +370,10 @@ bool SendCreateProcessRequest(
bool CreateRemoteSessionProcess( bool CreateRemoteSessionProcess(
uint32 session_id, uint32 session_id,
const base::FilePath::StringType& application_name, const base::FilePath::StringType& application_name,
const CommandLine::StringType& command_line, const base::CommandLine::StringType& command_line,
DWORD creation_flags, DWORD creation_flags,
const base::char16* desktop_name, const base::char16* desktop_name,
PROCESS_INFORMATION* process_information_out) PROCESS_INFORMATION* process_information_out) {
{
DCHECK_LT(base::win::GetVersion(), base::win::VERSION_VISTA); DCHECK_LT(base::win::GetVersion(), base::win::VERSION_VISTA);
base::win::ScopedHandle pipe; base::win::ScopedHandle pipe;
...@@ -399,7 +398,7 @@ bool CreateRemoteSessionProcess( ...@@ -399,7 +398,7 @@ bool CreateRemoteSessionProcess(
return true; return true;
} }
} // namespace } // namespace
namespace remoting { namespace remoting {
...@@ -448,7 +447,7 @@ bool CreateSessionToken(uint32 session_id, ScopedHandle* token_out) { ...@@ -448,7 +447,7 @@ bool CreateSessionToken(uint32 session_id, ScopedHandle* token_out) {
} }
bool LaunchProcessWithToken(const base::FilePath& binary, bool LaunchProcessWithToken(const base::FilePath& binary,
const CommandLine::StringType& command_line, const base::CommandLine::StringType& command_line,
HANDLE user_token, HANDLE user_token,
SECURITY_ATTRIBUTES* process_attributes, SECURITY_ATTRIBUTES* process_attributes,
SECURITY_ATTRIBUTES* thread_attributes, SECURITY_ATTRIBUTES* thread_attributes,
...@@ -521,4 +520,4 @@ bool LaunchProcessWithToken(const base::FilePath& binary, ...@@ -521,4 +520,4 @@ bool LaunchProcessWithToken(const base::FilePath& binary,
return true; return true;
} }
} // namespace remoting } // namespace remoting
...@@ -291,7 +291,7 @@ void UnprivilegedProcessDelegate::LaunchProcess( ...@@ -291,7 +291,7 @@ void UnprivilegedProcessDelegate::LaunchProcess(
"%d", reinterpret_cast<ULONG_PTR>(client.Get())); "%d", reinterpret_cast<ULONG_PTR>(client.Get()));
// Pass the IPC channel via the command line. // Pass the IPC channel via the command line.
CommandLine command_line(target_command_->argv()); base::CommandLine command_line(target_command_->argv());
command_line.AppendSwitchASCII(kDaemonPipeSwitchName, pipe_handle); command_line.AppendSwitchASCII(kDaemonPipeSwitchName, pipe_handle);
// Create our own window station and desktop accessible by |logon_sid|. // Create our own window station and desktop accessible by |logon_sid|.
...@@ -418,4 +418,4 @@ void UnprivilegedProcessDelegate::ReportProcessLaunched( ...@@ -418,4 +418,4 @@ void UnprivilegedProcessDelegate::ReportProcessLaunched(
event_handler_->OnProcessLaunched(limited_handle.Pass()); event_handler_->OnProcessLaunched(limited_handle.Pass());
} }
} // namespace remoting } // namespace remoting
...@@ -348,7 +348,7 @@ void WtsSessionProcessDelegate::Core::DoLaunchProcess() { ...@@ -348,7 +348,7 @@ void WtsSessionProcessDelegate::Core::DoLaunchProcess() {
DCHECK(!pipe_.IsValid()); DCHECK(!pipe_.IsValid());
DCHECK(!worker_process_.IsValid()); DCHECK(!worker_process_.IsValid());
CommandLine command_line(target_command_->argv()); base::CommandLine command_line(target_command_->argv());
if (launch_elevated_) { if (launch_elevated_) {
// The job object is not ready. Retry starting the host process later. // The job object is not ready. Retry starting the host process later.
if (!job_.IsValid()) { if (!job_.IsValid()) {
...@@ -564,4 +564,4 @@ void WtsSessionProcessDelegate::KillProcess() { ...@@ -564,4 +564,4 @@ void WtsSessionProcessDelegate::KillProcess() {
core_->KillProcess(); core_->KillProcess();
} }
} // namespace remoting } // namespace remoting
...@@ -34,20 +34,21 @@ void usage(const char* program_name) { ...@@ -34,20 +34,21 @@ void usage(const char* program_name) {
} // namespace } // namespace
int main(int argc, char** argv) { int main(int argc, char** argv) {
CommandLine::Init(argc, argv); base::CommandLine::Init(argc, argv);
base::AtExitManager exit_manager; base::AtExitManager exit_manager;
remoting::InitHostLogging(); remoting::InitHostLogging();
const CommandLine* command_line = CommandLine::ForCurrentProcess(); const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(kHelpSwitchName) || if (command_line->HasSwitch(kHelpSwitchName) ||
command_line->HasSwitch(kQuestionSwitchName)) { command_line->HasSwitch(kQuestionSwitchName)) {
usage(argv[0]); usage(argv[0]);
return kSuccessExitCode; return kSuccessExitCode;
} }
CommandLine::StringVector args = command_line->GetArgs(); base::CommandLine::StringVector args = command_line->GetArgs();
if (args.size() != 1) { if (args.size() != 1) {
usage(argv[0]); usage(argv[0]);
return kUsageExitCode; return kUsageExitCode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment