diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-23 09:42:02 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-23 09:42:02 +0000 |
commit | b982d511111aa49f84d5056d31326b1d07658118 (patch) | |
tree | 7d2e5ae9560a2067ba8c04439d5b601363c1b90a /remoting/host | |
parent | dd70f2bff37f477c0fb113930ca4a68de8a336e1 (diff) | |
download | chromium_src-b982d511111aa49f84d5056d31326b1d07658118.zip chromium_src-b982d511111aa49f84d5056d31326b1d07658118.tar.gz chromium_src-b982d511111aa49f84d5056d31326b1d07658118.tar.bz2 |
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
Diffstat (limited to 'remoting/host')
-rw-r--r-- | remoting/host/daemon_process.cc | 3 | ||||
-rw-r--r-- | remoting/host/desktop_process_main.cc | 3 | ||||
-rw-r--r-- | remoting/host/desktop_resizer_linux.cc | 4 | ||||
-rw-r--r-- | remoting/host/host_main.cc | 24 | ||||
-rw-r--r-- | remoting/host/it2me/it2me_native_messaging_host_main.cc | 2 | ||||
-rw-r--r-- | remoting/host/plugin/host_plugin.cc | 8 | ||||
-rw-r--r-- | remoting/host/remoting_me2me_host.cc | 10 | ||||
-rw-r--r-- | remoting/host/service_urls.cc | 2 | ||||
-rw-r--r-- | remoting/host/setup/daemon_controller_delegate_linux.cc | 8 | ||||
-rw-r--r-- | remoting/host/setup/me2me_native_messaging_host.cc | 17 | ||||
-rw-r--r-- | remoting/host/setup/me2me_native_messaging_host_main.cc | 5 | ||||
-rw-r--r-- | remoting/host/setup/start_host.cc | 5 | ||||
-rw-r--r-- | remoting/host/usage_stats_consent_mac.cc | 2 | ||||
-rw-r--r-- | remoting/host/win/host_service.cc | 8 | ||||
-rw-r--r-- | remoting/host/win/launch_process_with_token.cc | 13 | ||||
-rw-r--r-- | remoting/host/win/unprivileged_process_delegate.cc | 4 | ||||
-rw-r--r-- | remoting/host/win/wts_session_process_delegate.cc | 4 |
17 files changed, 66 insertions, 56 deletions
diff --git a/remoting/host/daemon_process.cc b/remoting/host/daemon_process.cc index 5ec1e8f..9d4ae11 100644 --- a/remoting/host/daemon_process.cc +++ b/remoting/host/daemon_process.cc @@ -259,7 +259,8 @@ void DaemonProcess::CrashNetworkProcess( void DaemonProcess::Initialize() { 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. base::FilePath default_config_dir = remoting::GetConfigDir(); base::FilePath config_path = default_config_dir.Append( diff --git a/remoting/host/desktop_process_main.cc b/remoting/host/desktop_process_main.cc index 5147168..454e6eb 100644 --- a/remoting/host/desktop_process_main.cc +++ b/remoting/host/desktop_process_main.cc @@ -23,7 +23,8 @@ namespace remoting { int DesktopProcessMain() { - const CommandLine* command_line = CommandLine::ForCurrentProcess(); + const base::CommandLine* command_line = + base::CommandLine::ForCurrentProcess(); std::string channel_name = command_line->GetSwitchValueASCII(kDaemonPipeSwitchName); diff --git a/remoting/host/desktop_resizer_linux.cc b/remoting/host/desktop_resizer_linux.cc index 3ebdea3..be24adb 100644 --- a/remoting/host/desktop_resizer_linux.cc +++ b/remoting/host/desktop_resizer_linux.cc @@ -160,9 +160,9 @@ DesktopResizerLinux::DesktopResizerLinux() : display_(XOpenDisplay(NULL)), screen_(DefaultScreen(display_)), root_(RootWindow(display_, screen_)), - exact_resize_(CommandLine::ForCurrentProcess()-> + exact_resize_(base::CommandLine::ForCurrentProcess()-> HasSwitch("server-supports-exact-resize")) { - XRRSelectInput (display_, root_, RRScreenChangeNotifyMask); + XRRSelectInput(display_, root_, RRScreenChangeNotifyMask); } DesktopResizerLinux::~DesktopResizerLinux() { diff --git a/remoting/host/host_main.cc b/remoting/host/host_main.cc index 7312e13..947e4ccc 100644 --- a/remoting/host/host_main.cc +++ b/remoting/host/host_main.cc @@ -86,27 +86,30 @@ void Usage(const base::FilePath& program_name) { // Runs the binary specified by the command line, elevated. int RunElevated() { - const CommandLine::SwitchMap& switches = - CommandLine::ForCurrentProcess()->GetSwitches(); - CommandLine::StringVector args = CommandLine::ForCurrentProcess()->GetArgs(); + const base::CommandLine::SwitchMap& switches = + base::CommandLine::ForCurrentProcess()->GetSwitches(); + base::CommandLine::StringVector args = + base::CommandLine::ForCurrentProcess()->GetArgs(); // Create the child process command line by copying switches from the current // command line. - CommandLine command_line(CommandLine::NO_PROGRAM); - for (CommandLine::SwitchMap::const_iterator i = switches.begin(); + base::CommandLine command_line(base::CommandLine::NO_PROGRAM); + for (base::CommandLine::SwitchMap::const_iterator i = switches.begin(); i != switches.end(); ++i) { if (i->first != kElevateSwitchName) 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) { command_line.AppendArgNative(*i); } // Get the name of the binary to launch. base::FilePath binary = - CommandLine::ForCurrentProcess()->GetSwitchValuePath(kElevateSwitchName); - CommandLine::StringType parameters = command_line.GetCommandLineString(); + base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( + kElevateSwitchName); + base::CommandLine::StringType parameters = + command_line.GetCommandLineString(); // Launch the child process requesting elevation. SHELLEXECUTEINFO info; @@ -157,7 +160,7 @@ int HostMain(int argc, char** argv) { base::mac::ScopedNSAutoreleasePool pool; #endif - CommandLine::Init(argc, argv); + base::CommandLine::Init(argc, argv); // 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 @@ -184,7 +187,8 @@ int HostMain(int argc, char** argv) { #endif // defined(OS_WIN) // Parse the command line. - const CommandLine* command_line = CommandLine::ForCurrentProcess(); + const base::CommandLine* command_line = + base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(kHelpSwitchName) || command_line->HasSwitch(kQuestionSwitchName)) { Usage(command_line->GetProgram()); diff --git a/remoting/host/it2me/it2me_native_messaging_host_main.cc b/remoting/host/it2me/it2me_native_messaging_host_main.cc index bae1828..bec6b39 100644 --- a/remoting/host/it2me/it2me_native_messaging_host_main.cc +++ b/remoting/host/it2me/it2me_native_messaging_host_main.cc @@ -131,7 +131,7 @@ int It2MeNativeMessagingHostMain(int argc, char** argv) { // This object instance is required by Chrome code (such as MessageLoop). base::AtExitManager exit_manager; - CommandLine::Init(argc, argv); + base::CommandLine::Init(argc, argv); remoting::InitHostLogging(); return StartIt2MeNativeMessagingHost(); diff --git a/remoting/host/plugin/host_plugin.cc b/remoting/host/plugin/host_plugin.cc index 16f278a..213ea89 100644 --- a/remoting/host/plugin/host_plugin.cc +++ b/remoting/host/plugin/host_plugin.cc @@ -371,7 +371,7 @@ void InitializePlugin() { g_at_exit_manager = new base::AtExitManager; // Init an empty command line for common objects that use it. - CommandLine::Init(0, NULL); + base::CommandLine::Init(0, NULL); if (remoting::LoadResources("")) { g_ui_name = new std::string( @@ -449,7 +449,7 @@ NPError GetValue(NPP instance, NPPVariable variable, void* value) { // NP_GetValue() can be called before NP_Initialize(). InitializePlugin(); - switch(variable) { + switch (variable) { default: VLOG(2) << "GetValue - default " << variable; return NPERR_GENERIC_ERROR; @@ -533,10 +533,10 @@ EXPORT NPError API_CALL NP_Initialize(NPNetscapeFuncs* npnetscape_funcs VLOG(2) << "NP_Initialize"; InitializePlugin(); - if(npnetscape_funcs == NULL) + if (npnetscape_funcs == NULL) 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; g_npnetscape_funcs = npnetscape_funcs; diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index c651be4..22f5da0 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -209,7 +209,7 @@ class HostProcess // Initializes IPC control channel and config file path from |cmd_line|. // 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. void StartWatchingConfigChanges(); @@ -361,7 +361,7 @@ HostProcess::~HostProcess() { 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) // Parse the handle value and convert it to a handle/file descriptor. std::string channel_name = @@ -631,7 +631,7 @@ void HostProcess::OnChannelError() { void HostProcess::StartOnUiThread() { DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); - if (!InitWithCommandLine(CommandLine::ForCurrentProcess())) { + if (!InitWithCommandLine(base::CommandLine::ForCurrentProcess())) { // Shutdown the host if the command line is invalid. context_->network_task_runner()->PostTask( FROM_HERE, base::Bind(&HostProcess::ShutdownHost, this, @@ -642,14 +642,14 @@ void HostProcess::StartOnUiThread() { #if defined(OS_LINUX) // If an audio pipe is specific on the command-line then initialize // AudioCapturerLinux to capture from it. - base::FilePath audio_pipe_name = CommandLine::ForCurrentProcess()-> + base::FilePath audio_pipe_name = base::CommandLine::ForCurrentProcess()-> GetSwitchValuePath(kAudioPipeSwitchName); if (!audio_pipe_name.empty()) { remoting::AudioCapturerLinux::InitializePipeReader( context_->audio_task_runner(), audio_pipe_name); } - base::FilePath gnubby_socket_name = CommandLine::ForCurrentProcess()-> + base::FilePath gnubby_socket_name = base::CommandLine::ForCurrentProcess()-> GetSwitchValuePath(kAuthSocknameSwitchName); if (!gnubby_socket_name.empty()) remoting::GnubbyAuthHandler::SetGnubbySocketName(gnubby_socket_name); diff --git a/remoting/host/service_urls.cc b/remoting/host/service_urls.cc index 8d8f083..9c82250 100644 --- a/remoting/host/service_urls.cc +++ b/remoting/host/service_urls.cc @@ -33,7 +33,7 @@ ServiceUrls::ServiceUrls() directory_bot_jid_(kDirectoryBotJid) { #if !defined(NDEBUG) // Allow debug builds to override urls via command line. - CommandLine* command_line = CommandLine::ForCurrentProcess(); + base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); CHECK(command_line); if (command_line->HasSwitch(kDirectoryBaseUrlSwitch)) { directory_base_url_ = command_line->GetSwitchValueASCII( diff --git a/remoting/host/setup/daemon_controller_delegate_linux.cc b/remoting/host/setup/daemon_controller_delegate_linux.cc index 427a572..c5a8344 100644 --- a/remoting/host/setup/daemon_controller_delegate_linux.cc +++ b/remoting/host/setup/daemon_controller_delegate_linux.cc @@ -85,7 +85,7 @@ bool RunHostScriptWithTimeout( LOG(ERROR) << "GetScriptPath() failed."; return false; } - CommandLine command_line(script_path); + base::CommandLine command_line(script_path); for (unsigned int i = 0; i < args.size(); ++i) { command_line.AppendArg(args[i]); } @@ -132,7 +132,7 @@ DaemonController::State DaemonControllerDelegateLinux::GetState() { if (!GetScriptPath(&script_path)) { return DaemonController::STATE_NOT_IMPLEMENTED; } - CommandLine command_line(script_path); + base::CommandLine command_line(script_path); command_line.AppendArg("--get-status"); std::string status; @@ -182,7 +182,7 @@ scoped_ptr<base::DictionaryValue> DaemonControllerDelegateLinux::GetConfig() { result->SetString(kXmppLoginConfigPath, value); } } 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() { if (!GetScriptPath(&script_path)) { return std::string(); } - CommandLine command_line(script_path); + base::CommandLine command_line(script_path); command_line.AppendArg("--host-version"); std::string version; diff --git a/remoting/host/setup/me2me_native_messaging_host.cc b/remoting/host/setup/me2me_native_messaging_host.cc index 339c6454..7ceea6b 100644 --- a/remoting/host/setup/me2me_native_messaging_host.cc +++ b/remoting/host/setup/me2me_native_messaging_host.cc @@ -592,30 +592,33 @@ void Me2MeNativeMessagingHost::EnsureElevatedHostCreated() { return; } - const CommandLine* current_command_line = CommandLine::ForCurrentProcess(); - const CommandLine::SwitchMap& switches = current_command_line->GetSwitches(); - CommandLine::StringVector args = current_command_line->GetArgs(); + const base::CommandLine* current_command_line = + base::CommandLine::ForCurrentProcess(); + 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 // command line. - CommandLine command_line(CommandLine::NO_PROGRAM); + base::CommandLine command_line(base::CommandLine::NO_PROGRAM); command_line.AppendSwitch(kElevatingSwitchName); command_line.AppendSwitchASCII(kInputSwitchName, input_pipe_name); command_line.AppendSwitchASCII(kOutputSwitchName, output_pipe_name); 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) { 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) { command_line.AppendArgNative(*i); } // Get the name of the binary to launch. 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. SHELLEXECUTEINFO info; diff --git a/remoting/host/setup/me2me_native_messaging_host_main.cc b/remoting/host/setup/me2me_native_messaging_host_main.cc index ee6aad8..e47b244 100644 --- a/remoting/host/setup/me2me_native_messaging_host_main.cc +++ b/remoting/host/setup/me2me_native_messaging_host_main.cc @@ -93,7 +93,8 @@ int StartMe2MeNativeMessagingHost() { // Pass handle of the native view to the controller so that the UAC prompts // are focused properly. - const CommandLine* command_line = CommandLine::ForCurrentProcess(); + const base::CommandLine* command_line = + base::CommandLine::ForCurrentProcess(); int64 native_view_handle = 0; if (command_line->HasSwitch(kParentWindowSwitchName)) { std::string native_view = @@ -254,7 +255,7 @@ int Me2MeNativeMessagingHostMain(int argc, char** argv) { // This object instance is required by Chrome code (such as MessageLoop). base::AtExitManager exit_manager; - CommandLine::Init(argc, argv); + base::CommandLine::Init(argc, argv); remoting::InitHostLogging(); return StartMe2MeNativeMessagingHost(); diff --git a/remoting/host/setup/start_host.cc b/remoting/host/setup/start_host.cc index ab5688db..2090a3a 100644 --- a/remoting/host/setup/start_host.cc +++ b/remoting/host/setup/start_host.cc @@ -86,8 +86,9 @@ void OnDone(HostStarter::Result result) { int main(int argc, char** argv) { // google_apis::GetOAuth2ClientID/Secret need a static CommandLine. - CommandLine::Init(argc, argv); - const CommandLine* command_line = CommandLine::ForCurrentProcess(); + base::CommandLine::Init(argc, argv); + const base::CommandLine* command_line = + base::CommandLine::ForCurrentProcess(); std::string host_name = command_line->GetSwitchValueASCII("name"); std::string host_pin = command_line->GetSwitchValueASCII("pin"); diff --git a/remoting/host/usage_stats_consent_mac.cc b/remoting/host/usage_stats_consent_mac.cc index 9198307..1a286b7 100644 --- a/remoting/host/usage_stats_consent_mac.cc +++ b/remoting/host/usage_stats_consent_mac.cc @@ -21,7 +21,7 @@ bool GetUsageStatsConsent(bool* allowed, bool* set_by_policy) { // Normally, the ConfigFileWatcher class would be used for retrieving config // settings, but this code needs to execute before Breakpad is initialised, // 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)) { base::FilePath config_file_path = command_line->GetSwitchValuePath(kHostConfigSwitchName); diff --git a/remoting/host/win/host_service.cc b/remoting/host/win/host_service.cc index 2fe2943..7c1197a 100644 --- a/remoting/host/win/host_service.cc +++ b/remoting/host/win/host_service.cc @@ -65,8 +65,8 @@ HostService* HostService::GetInstance() { return Singleton<HostService>::get(); } -bool HostService::InitWithCommandLine(const CommandLine* command_line) { - CommandLine::StringVector args = command_line->GetArgs(); +bool HostService::InitWithCommandLine(const base::CommandLine* command_line) { + base::CommandLine::StringVector args = command_line->GetArgs(); if (!args.empty()) { LOG(ERROR) << "No positional parameters expected."; return false; @@ -433,11 +433,11 @@ VOID WINAPI HostService::ServiceMain(DWORD argc, WCHAR* argv[]) { int DaemonProcessMain() { HostService* service = HostService::GetInstance(); - if (!service->InitWithCommandLine(CommandLine::ForCurrentProcess())) { + if (!service->InitWithCommandLine(base::CommandLine::ForCurrentProcess())) { return kUsageExitCode; } return service->Run(); } -} // namespace remoting +} // namespace remoting diff --git a/remoting/host/win/launch_process_with_token.cc b/remoting/host/win/launch_process_with_token.cc index 6f7e407..8ee0996 100644 --- a/remoting/host/win/launch_process_with_token.cc +++ b/remoting/host/win/launch_process_with_token.cc @@ -287,7 +287,7 @@ bool ReceiveCreateProcessResponse( bool SendCreateProcessRequest( HANDLE pipe, const base::FilePath::StringType& application_name, - const CommandLine::StringType& command_line, + const base::CommandLine::StringType& command_line, DWORD creation_flags, const base::char16* desktop_name) { // |CreateProcessRequest| structure passes the same parameters to @@ -370,11 +370,10 @@ bool SendCreateProcessRequest( bool CreateRemoteSessionProcess( uint32 session_id, const base::FilePath::StringType& application_name, - const CommandLine::StringType& command_line, + const base::CommandLine::StringType& command_line, DWORD creation_flags, const base::char16* desktop_name, - PROCESS_INFORMATION* process_information_out) -{ + PROCESS_INFORMATION* process_information_out) { DCHECK_LT(base::win::GetVersion(), base::win::VERSION_VISTA); base::win::ScopedHandle pipe; @@ -399,7 +398,7 @@ bool CreateRemoteSessionProcess( return true; } -} // namespace +} // namespace namespace remoting { @@ -448,7 +447,7 @@ bool CreateSessionToken(uint32 session_id, ScopedHandle* token_out) { } bool LaunchProcessWithToken(const base::FilePath& binary, - const CommandLine::StringType& command_line, + const base::CommandLine::StringType& command_line, HANDLE user_token, SECURITY_ATTRIBUTES* process_attributes, SECURITY_ATTRIBUTES* thread_attributes, @@ -521,4 +520,4 @@ bool LaunchProcessWithToken(const base::FilePath& binary, return true; } -} // namespace remoting +} // namespace remoting diff --git a/remoting/host/win/unprivileged_process_delegate.cc b/remoting/host/win/unprivileged_process_delegate.cc index b8ae249..1f5a174 100644 --- a/remoting/host/win/unprivileged_process_delegate.cc +++ b/remoting/host/win/unprivileged_process_delegate.cc @@ -291,7 +291,7 @@ void UnprivilegedProcessDelegate::LaunchProcess( "%d", reinterpret_cast<ULONG_PTR>(client.Get())); // 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); // Create our own window station and desktop accessible by |logon_sid|. @@ -418,4 +418,4 @@ void UnprivilegedProcessDelegate::ReportProcessLaunched( event_handler_->OnProcessLaunched(limited_handle.Pass()); } -} // namespace remoting +} // namespace remoting diff --git a/remoting/host/win/wts_session_process_delegate.cc b/remoting/host/win/wts_session_process_delegate.cc index 65f79ff..f939abf 100644 --- a/remoting/host/win/wts_session_process_delegate.cc +++ b/remoting/host/win/wts_session_process_delegate.cc @@ -348,7 +348,7 @@ void WtsSessionProcessDelegate::Core::DoLaunchProcess() { DCHECK(!pipe_.IsValid()); DCHECK(!worker_process_.IsValid()); - CommandLine command_line(target_command_->argv()); + base::CommandLine command_line(target_command_->argv()); if (launch_elevated_) { // The job object is not ready. Retry starting the host process later. if (!job_.IsValid()) { @@ -564,4 +564,4 @@ void WtsSessionProcessDelegate::KillProcess() { core_->KillProcess(); } -} // namespace remoting +} // namespace remoting |