OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/setup/daemon_controller_delegate_win.h" | 5 #include "remoting/host/setup/daemon_controller_delegate_win.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 return ScopedScHandle(); | 248 return ScopedScHandle(); |
249 } | 249 } |
250 | 250 |
251 ScopedScHandle service(::OpenServiceW(scmanager.Get(), kWindowsServiceName, | 251 ScopedScHandle service(::OpenServiceW(scmanager.Get(), kWindowsServiceName, |
252 access)); | 252 access)); |
253 if (!service.IsValid()) { | 253 if (!service.IsValid()) { |
254 PLOG(ERROR) << "Failed to open to the '" << kWindowsServiceName | 254 PLOG(ERROR) << "Failed to open to the '" << kWindowsServiceName |
255 << "' service"; | 255 << "' service"; |
256 } | 256 } |
257 | 257 |
258 return service.Pass(); | 258 return service; |
259 } | 259 } |
260 | 260 |
261 void InvokeCompletionCallback( | 261 void InvokeCompletionCallback( |
262 const DaemonController::CompletionCallback& done, bool success) { | 262 const DaemonController::CompletionCallback& done, bool success) { |
263 DaemonController::AsyncResult async_result = | 263 DaemonController::AsyncResult async_result = |
264 success ? DaemonController::RESULT_OK : DaemonController::RESULT_FAILED; | 264 success ? DaemonController::RESULT_OK : DaemonController::RESULT_FAILED; |
265 done.Run(async_result); | 265 done.Run(async_result); |
266 } | 266 } |
267 | 267 |
268 bool StartDaemon() { | 268 bool StartDaemon() { |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 if (!WriteConfig(config_str)) { | 460 if (!WriteConfig(config_str)) { |
461 InvokeCompletionCallback(done, false); | 461 InvokeCompletionCallback(done, false); |
462 return; | 462 return; |
463 } | 463 } |
464 | 464 |
465 // Start daemon. | 465 // Start daemon. |
466 InvokeCompletionCallback(done, StartDaemon()); | 466 InvokeCompletionCallback(done, StartDaemon()); |
467 } | 467 } |
468 | 468 |
469 scoped_refptr<DaemonController> DaemonController::Create() { | 469 scoped_refptr<DaemonController> DaemonController::Create() { |
470 scoped_ptr<DaemonController::Delegate> delegate( | 470 return new DaemonController( |
471 new DaemonControllerDelegateWin()); | 471 make_scoped_ptr(new DaemonControllerDelegateWin())); |
472 return new DaemonController(delegate.Pass()); | |
473 } | 472 } |
474 | 473 |
475 } // namespace remoting | 474 } // namespace remoting |
OLD | NEW |