| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file implements the Windows service controlling Me2Me host processes | 5 // This file implements the Windows service controlling Me2Me host processes |
| 6 // running within user sessions. | 6 // running within user sessions. |
| 7 | 7 |
| 8 #include "remoting/host/win/host_service.h" | 8 #include "remoting/host/win/host_service.h" |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 L"Options:\n" | 77 L"Options:\n" |
| 78 L" --console - Run the service interactively for debugging purposes.\n" | 78 L" --console - Run the service interactively for debugging purposes.\n" |
| 79 L" --elevate=<...> - Run <...> elevated.\n" | 79 L" --elevate=<...> - Run <...> elevated.\n" |
| 80 L" --help, --? - Print this message.\n"; | 80 L" --help, --? - Print this message.\n"; |
| 81 | 81 |
| 82 // The command line parameters that should be copied from the service's command | 82 // The command line parameters that should be copied from the service's command |
| 83 // line when launching an elevated child. | 83 // line when launching an elevated child. |
| 84 const char* kCopiedSwitchNames[] = { | 84 const char* kCopiedSwitchNames[] = { |
| 85 "host-config", "daemon-pipe", switches::kV, switches::kVModule }; | 85 "host-config", "daemon-pipe", switches::kV, switches::kVModule }; |
| 86 | 86 |
| 87 void usage(const FilePath& program_name) { | 87 void usage(const base::FilePath& program_name) { |
| 88 LOG(INFO) << StringPrintf(kUsageMessage, | 88 LOG(INFO) << StringPrintf(kUsageMessage, |
| 89 UTF16ToWide(program_name.value()).c_str()); | 89 UTF16ToWide(program_name.value()).c_str()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace | 92 } // namespace |
| 93 | 93 |
| 94 namespace remoting { | 94 namespace remoting { |
| 95 | 95 |
| 96 HostService::HostService() : | 96 HostService::HostService() : |
| 97 console_session_id_(kInvalidSessionId), | 97 console_session_id_(kInvalidSessionId), |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 base::Bind(&HostService::OnChildStopped, base::Unretained(this)), | 224 base::Bind(&HostService::OnChildStopped, base::Unretained(this)), |
| 225 this, | 225 this, |
| 226 task_runner, | 226 task_runner, |
| 227 io_task_runner)); | 227 io_task_runner)); |
| 228 | 228 |
| 229 #endif // !defined(REMOTING_MULTI_PROCESS) | 229 #endif // !defined(REMOTING_MULTI_PROCESS) |
| 230 } | 230 } |
| 231 | 231 |
| 232 int HostService::Elevate() { | 232 int HostService::Elevate() { |
| 233 // Get the name of the binary to launch. | 233 // Get the name of the binary to launch. |
| 234 FilePath binary = | 234 base::FilePath binary = |
| 235 CommandLine::ForCurrentProcess()->GetSwitchValuePath(kElevateSwitchName); | 235 CommandLine::ForCurrentProcess()->GetSwitchValuePath(kElevateSwitchName); |
| 236 | 236 |
| 237 // Create the child process command line by copying known switches from our | 237 // Create the child process command line by copying known switches from our |
| 238 // command line. | 238 // command line. |
| 239 CommandLine command_line(CommandLine::NO_PROGRAM); | 239 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 240 command_line.CopySwitchesFrom(*CommandLine::ForCurrentProcess(), | 240 command_line.CopySwitchesFrom(*CommandLine::ForCurrentProcess(), |
| 241 kCopiedSwitchNames, | 241 kCopiedSwitchNames, |
| 242 arraysize(kCopiedSwitchNames)); | 242 arraysize(kCopiedSwitchNames)); |
| 243 CommandLine::StringType parameters = command_line.GetCommandLineString(); | 243 CommandLine::StringType parameters = command_line.GetCommandLineString(); |
| 244 | 244 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 } | 486 } |
| 487 | 487 |
| 488 remoting::HostService* service = remoting::HostService::GetInstance(); | 488 remoting::HostService* service = remoting::HostService::GetInstance(); |
| 489 if (!service->InitWithCommandLine(command_line)) { | 489 if (!service->InitWithCommandLine(command_line)) { |
| 490 usage(command_line->GetProgram()); | 490 usage(command_line->GetProgram()); |
| 491 return remoting::kUsageExitCode; | 491 return remoting::kUsageExitCode; |
| 492 } | 492 } |
| 493 | 493 |
| 494 return service->Run(); | 494 return service->Run(); |
| 495 } | 495 } |
| OLD | NEW |