Chromium Code Reviews| 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/host_service_win.h" | 8 #include "remoting/host/host_service_win.h" |
| 9 | 9 |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 #include "remoting/base/scoped_sc_handle_win.h" | 27 #include "remoting/base/scoped_sc_handle_win.h" |
| 28 #include "remoting/host/branding.h" | 28 #include "remoting/host/branding.h" |
| 29 #include "remoting/host/host_service_resource.h" | 29 #include "remoting/host/host_service_resource.h" |
| 30 #include "remoting/host/wts_console_observer_win.h" | 30 #include "remoting/host/wts_console_observer_win.h" |
| 31 #include "remoting/host/wts_session_process_launcher_win.h" | 31 #include "remoting/host/wts_session_process_launcher_win.h" |
| 32 | 32 |
| 33 using base::StringPrintf; | 33 using base::StringPrintf; |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 // Service name. | |
| 38 const char kServiceName[] = "chromoting"; | |
| 39 // TODO(alexeypa): investigate and migrate this over to Chrome's i18n framework. | 37 // TODO(alexeypa): investigate and migrate this over to Chrome's i18n framework. |
| 40 const char kMuiStringFormat[] = "@%ls,-%d"; | 38 const char kMuiStringFormat[] = "@%ls,-%d"; |
| 41 const char kServiceDependencies[] = ""; | 39 const char kServiceDependencies[] = ""; |
| 42 | 40 |
| 43 const char kServiceCommandLineFormat[] = "\"%ls\" --host-binary=\"%ls\""; | 41 const char kServiceCommandLineFormat[] = "\"%ls\" --host-binary=\"%ls\""; |
| 44 | 42 |
| 45 const DWORD kServiceStopTimeoutMs = 30 * 1000; | 43 const DWORD kServiceStopTimeoutMs = 30 * 1000; |
| 46 | 44 |
| 47 // Session id that does not represent any session. | 45 // Session id that does not represent any session. |
| 48 const uint32 kInvalidSession = 0xffffffff; | 46 const uint32 kInvalidSession = 0xffffffff; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 } | 95 } |
| 98 | 96 |
| 99 } // namespace | 97 } // namespace |
| 100 | 98 |
| 101 namespace remoting { | 99 namespace remoting { |
| 102 | 100 |
| 103 HostService::HostService() : | 101 HostService::HostService() : |
| 104 console_session_id_(kInvalidSession), | 102 console_session_id_(kInvalidSession), |
| 105 message_loop_(NULL), | 103 message_loop_(NULL), |
| 106 run_routine_(&HostService::RunAsService), | 104 run_routine_(&HostService::RunAsService), |
| 107 service_name_(ASCIIToUTF16(kServiceName)), | 105 service_name_(ASCIIToUTF16(kWindowsServiceName)), |
|
Wez
2012/03/30 22:11:01
nit: Someone could conceivably put UTF-8 in kWindo
alexeypa (please no reviews)
2012/03/30 23:47:09
Done.
| |
| 108 service_status_handle_(0), | 106 service_status_handle_(0), |
| 109 shutting_down_(false), | 107 shutting_down_(false), |
| 110 stopped_event_(true, false) { | 108 stopped_event_(true, false) { |
| 111 } | 109 } |
| 112 | 110 |
| 113 HostService::~HostService() { | 111 HostService::~HostService() { |
| 114 } | 112 } |
| 115 | 113 |
| 116 void HostService::AddWtsConsoleObserver(WtsConsoleObserver* observer) { | 114 void HostService::AddWtsConsoleObserver(WtsConsoleObserver* observer) { |
| 117 console_observers_.AddObserver(observer); | 115 console_observers_.AddObserver(observer); |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 589 } | 587 } |
| 590 | 588 |
| 591 remoting::HostService* service = remoting::HostService::GetInstance(); | 589 remoting::HostService* service = remoting::HostService::GetInstance(); |
| 592 if (!service->InitWithCommandLine(command_line)) { | 590 if (!service->InitWithCommandLine(command_line)) { |
| 593 usage(argv[0]); | 591 usage(argv[0]); |
| 594 return kUsageExitCode; | 592 return kUsageExitCode; |
| 595 } | 593 } |
| 596 | 594 |
| 597 return service->Run(); | 595 return service->Run(); |
| 598 } | 596 } |
| OLD | NEW |