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 <sddl.h> | 10 #include <sddl.h> |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 LOG_GETLASTERROR(ERROR) | 265 LOG_GETLASTERROR(ERROR) |
266 << "Failed to report service status to the service control manager"; | 266 << "Failed to report service status to the service control manager"; |
267 return; | 267 return; |
268 } | 268 } |
269 | 269 |
270 // Initialize COM. | 270 // Initialize COM. |
271 base::win::ScopedCOMInitializer com_initializer; | 271 base::win::ScopedCOMInitializer com_initializer; |
272 if (!com_initializer.succeeded()) | 272 if (!com_initializer.succeeded()) |
273 return; | 273 return; |
274 | 274 |
275 if (!InitializeComSecurity(WideToUTF8(kComProcessSd), | 275 if (!InitializeComSecurity(base::WideToUTF8(kComProcessSd), |
276 WideToUTF8(kComProcessMandatoryLabel), false)) { | 276 base::WideToUTF8(kComProcessMandatoryLabel), |
| 277 false)) { |
277 return; | 278 return; |
278 } | 279 } |
279 | 280 |
280 CreateLauncher(scoped_refptr<AutoThreadTaskRunner>( | 281 CreateLauncher(scoped_refptr<AutoThreadTaskRunner>( |
281 new AutoThreadTaskRunner(main_task_runner_, | 282 new AutoThreadTaskRunner(main_task_runner_, |
282 run_loop.QuitClosure()))); | 283 run_loop.QuitClosure()))); |
283 | 284 |
284 // Run the service. | 285 // Run the service. |
285 run_loop.Run(); | 286 run_loop.Run(); |
286 weak_factory_.InvalidateWeakPtrs(); | 287 weak_factory_.InvalidateWeakPtrs(); |
(...skipping 14 matching lines...) Expand all Loading... |
301 main_task_runner_ = message_loop.message_loop_proxy(); | 302 main_task_runner_ = message_loop.message_loop_proxy(); |
302 weak_ptr_ = weak_factory_.GetWeakPtr(); | 303 weak_ptr_ = weak_factory_.GetWeakPtr(); |
303 | 304 |
304 int result = kInitializationFailed; | 305 int result = kInitializationFailed; |
305 | 306 |
306 // Initialize COM. | 307 // Initialize COM. |
307 base::win::ScopedCOMInitializer com_initializer; | 308 base::win::ScopedCOMInitializer com_initializer; |
308 if (!com_initializer.succeeded()) | 309 if (!com_initializer.succeeded()) |
309 return result; | 310 return result; |
310 | 311 |
311 if (!InitializeComSecurity(WideToUTF8(kComProcessSd), | 312 if (!InitializeComSecurity(base::WideToUTF8(kComProcessSd), |
312 WideToUTF8(kComProcessMandatoryLabel), false)) { | 313 base::WideToUTF8(kComProcessMandatoryLabel), |
| 314 false)) { |
313 return result; | 315 return result; |
314 } | 316 } |
315 | 317 |
316 // Subscribe to Ctrl-C and other console events. | 318 // Subscribe to Ctrl-C and other console events. |
317 if (!SetConsoleCtrlHandler(&HostService::ConsoleControlHandler, TRUE)) { | 319 if (!SetConsoleCtrlHandler(&HostService::ConsoleControlHandler, TRUE)) { |
318 LOG_GETLASTERROR(ERROR) | 320 LOG_GETLASTERROR(ERROR) |
319 << "Failed to set console control handler"; | 321 << "Failed to set console control handler"; |
320 return result; | 322 return result; |
321 } | 323 } |
322 | 324 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 int DaemonProcessMain() { | 438 int DaemonProcessMain() { |
437 HostService* service = HostService::GetInstance(); | 439 HostService* service = HostService::GetInstance(); |
438 if (!service->InitWithCommandLine(CommandLine::ForCurrentProcess())) { | 440 if (!service->InitWithCommandLine(CommandLine::ForCurrentProcess())) { |
439 return kUsageExitCode; | 441 return kUsageExitCode; |
440 } | 442 } |
441 | 443 |
442 return service->Run(); | 444 return service->Run(); |
443 } | 445 } |
444 | 446 |
445 } // namespace remoting | 447 } // namespace remoting |
OLD | NEW |