| 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 #include "remoting/host/daemon_process.h" | 5 #include "remoting/host/daemon_process.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <utility> |
| 10 |
| 9 #include "base/base_switches.h" | 11 #include "base/base_switches.h" |
| 10 #include "base/bind.h" | 12 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
| 12 #include "base/location.h" | 14 #include "base/location.h" |
| 13 #include "base/logging.h" | 15 #include "base/logging.h" |
| 14 #include "base/macros.h" | 16 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 18 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/process/process.h" | 19 #include "base/process/process.h" |
| 18 #include "base/single_thread_task_runner.h" | 20 #include "base/single_thread_task_runner.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 Stop(); | 224 Stop(); |
| 223 return; | 225 return; |
| 224 } | 226 } |
| 225 | 227 |
| 226 scoped_ptr<base::CommandLine> target(new base::CommandLine(host_binary)); | 228 scoped_ptr<base::CommandLine> target(new base::CommandLine(host_binary)); |
| 227 target->AppendSwitchASCII(kProcessTypeSwitchName, kProcessTypeHost); | 229 target->AppendSwitchASCII(kProcessTypeSwitchName, kProcessTypeHost); |
| 228 target->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(), | 230 target->CopySwitchesFrom(*base::CommandLine::ForCurrentProcess(), |
| 229 kCopiedSwitchNames, arraysize(kCopiedSwitchNames)); | 231 kCopiedSwitchNames, arraysize(kCopiedSwitchNames)); |
| 230 | 232 |
| 231 scoped_ptr<UnprivilegedProcessDelegate> delegate( | 233 scoped_ptr<UnprivilegedProcessDelegate> delegate( |
| 232 new UnprivilegedProcessDelegate(io_task_runner(), target.Pass())); | 234 new UnprivilegedProcessDelegate(io_task_runner(), std::move(target))); |
| 233 network_launcher_.reset(new WorkerProcessLauncher(delegate.Pass(), this)); | 235 network_launcher_.reset(new WorkerProcessLauncher(std::move(delegate), this)); |
| 234 } | 236 } |
| 235 | 237 |
| 236 scoped_ptr<DaemonProcess> DaemonProcess::Create( | 238 scoped_ptr<DaemonProcess> DaemonProcess::Create( |
| 237 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, | 239 scoped_refptr<AutoThreadTaskRunner> caller_task_runner, |
| 238 scoped_refptr<AutoThreadTaskRunner> io_task_runner, | 240 scoped_refptr<AutoThreadTaskRunner> io_task_runner, |
| 239 const base::Closure& stopped_callback) { | 241 const base::Closure& stopped_callback) { |
| 240 scoped_ptr<DaemonProcessWin> daemon_process( | 242 scoped_ptr<DaemonProcessWin> daemon_process( |
| 241 new DaemonProcessWin(caller_task_runner, io_task_runner, | 243 new DaemonProcessWin(caller_task_runner, io_task_runner, |
| 242 stopped_callback)); | 244 stopped_callback)); |
| 243 daemon_process->Initialize(); | 245 daemon_process->Initialize(); |
| 244 return daemon_process.Pass(); | 246 return std::move(daemon_process); |
| 245 } | 247 } |
| 246 | 248 |
| 247 void DaemonProcessWin::DisableAutoStart() { | 249 void DaemonProcessWin::DisableAutoStart() { |
| 248 ScopedScHandle scmanager( | 250 ScopedScHandle scmanager( |
| 249 OpenSCManager(nullptr, SERVICES_ACTIVE_DATABASE, | 251 OpenSCManager(nullptr, SERVICES_ACTIVE_DATABASE, |
| 250 SC_MANAGER_CONNECT | SC_MANAGER_ENUMERATE_SERVICE)); | 252 SC_MANAGER_CONNECT | SC_MANAGER_ENUMERATE_SERVICE)); |
| 251 if (!scmanager.IsValid()) { | 253 if (!scmanager.IsValid()) { |
| 252 PLOG(INFO) << "Failed to connect to the service control manager"; | 254 PLOG(INFO) << "Failed to connect to the service control manager"; |
| 253 return; | 255 return; |
| 254 } | 256 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 << "\\" << kPairingRegistrySecretsKeyName; | 382 << "\\" << kPairingRegistrySecretsKeyName; |
| 381 return false; | 383 return false; |
| 382 } | 384 } |
| 383 | 385 |
| 384 pairing_registry_privileged_key_.Set(privileged.Take()); | 386 pairing_registry_privileged_key_.Set(privileged.Take()); |
| 385 pairing_registry_unprivileged_key_.Set(unprivileged.Take()); | 387 pairing_registry_unprivileged_key_.Set(unprivileged.Take()); |
| 386 return true; | 388 return true; |
| 387 } | 389 } |
| 388 | 390 |
| 389 } // namespace remoting | 391 } // namespace remoting |
| OLD | NEW |