| 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 #ifndef REMOTING_HOST_WIN_HOST_SERVICE_H_ | 5 #ifndef REMOTING_HOST_WIN_HOST_SERVICE_H_ |
| 6 #define REMOTING_HOST_WIN_HOST_SERVICE_H_ | 6 #define REMOTING_HOST_WIN_HOST_SERVICE_H_ |
| 7 | 7 |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #include <stdint.h> |
| 9 | 10 |
| 10 #include <list> | 11 #include <list> |
| 11 | 12 |
| 13 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" |
| 14 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 15 #include "base/synchronization/waitable_event.h" | 17 #include "base/synchronization/waitable_event.h" |
| 16 #include "remoting/host/win/wts_terminal_monitor.h" | 18 #include "remoting/host/win/wts_terminal_monitor.h" |
| 17 | 19 |
| 18 namespace base { | 20 namespace base { |
| 19 class CommandLine; | 21 class CommandLine; |
| 20 class SingleThreadTaskRunner; | 22 class SingleThreadTaskRunner; |
| 21 } // namespace base | 23 } // namespace base |
| (...skipping 18 matching lines...) Expand all Loading... |
| 40 bool AddWtsTerminalObserver(const std::string& terminal_id, | 42 bool AddWtsTerminalObserver(const std::string& terminal_id, |
| 41 WtsTerminalObserver* observer) override; | 43 WtsTerminalObserver* observer) override; |
| 42 void RemoveWtsTerminalObserver( | 44 void RemoveWtsTerminalObserver( |
| 43 WtsTerminalObserver* observer) override; | 45 WtsTerminalObserver* observer) override; |
| 44 | 46 |
| 45 private: | 47 private: |
| 46 HostService(); | 48 HostService(); |
| 47 ~HostService() override; | 49 ~HostService() override; |
| 48 | 50 |
| 49 // Notifies the service of changes in session state. | 51 // Notifies the service of changes in session state. |
| 50 void OnSessionChange(uint32 event, uint32 session_id); | 52 void OnSessionChange(uint32_t event, uint32_t session_id); |
| 51 | 53 |
| 52 // Creates the process launcher. | 54 // Creates the process launcher. |
| 53 void CreateLauncher(scoped_refptr<AutoThreadTaskRunner> task_runner); | 55 void CreateLauncher(scoped_refptr<AutoThreadTaskRunner> task_runner); |
| 54 | 56 |
| 55 // This function handshakes with the service control manager and starts | 57 // This function handshakes with the service control manager and starts |
| 56 // the service. | 58 // the service. |
| 57 int RunAsService(); | 59 int RunAsService(); |
| 58 | 60 |
| 59 // Runs the service on the service thread. A separate routine is used to make | 61 // Runs the service on the service thread. A separate routine is used to make |
| 60 // sure all local objects are destoyed by the time |stopped_event_| is | 62 // sure all local objects are destoyed by the time |stopped_event_| is |
| (...skipping 23 matching lines...) Expand all Loading... |
| 84 | 86 |
| 85 // The main service entry point. | 87 // The main service entry point. |
| 86 static VOID WINAPI ServiceMain(DWORD argc, WCHAR* argv[]); | 88 static VOID WINAPI ServiceMain(DWORD argc, WCHAR* argv[]); |
| 87 | 89 |
| 88 struct RegisteredObserver { | 90 struct RegisteredObserver { |
| 89 // Unique identifier of the terminal to observe. | 91 // Unique identifier of the terminal to observe. |
| 90 std::string terminal_id; | 92 std::string terminal_id; |
| 91 | 93 |
| 92 // Specifies ID of the attached session or |kInvalidSession| if no session | 94 // Specifies ID of the attached session or |kInvalidSession| if no session |
| 93 // is attached to the WTS terminal. | 95 // is attached to the WTS terminal. |
| 94 uint32 session_id; | 96 uint32_t session_id; |
| 95 | 97 |
| 96 // Points to the observer receiving notifications about the WTS terminal | 98 // Points to the observer receiving notifications about the WTS terminal |
| 97 // identified by |terminal_id|. | 99 // identified by |terminal_id|. |
| 98 WtsTerminalObserver* observer; | 100 WtsTerminalObserver* observer; |
| 99 }; | 101 }; |
| 100 | 102 |
| 101 // The list of observers receiving session notifications. | 103 // The list of observers receiving session notifications. |
| 102 std::list<RegisteredObserver> observers_; | 104 std::list<RegisteredObserver> observers_; |
| 103 | 105 |
| 104 scoped_ptr<DaemonProcess> daemon_process_; | 106 scoped_ptr<DaemonProcess> daemon_process_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 123 | 125 |
| 124 // Singleton. | 126 // Singleton. |
| 125 friend struct base::DefaultSingletonTraits<HostService>; | 127 friend struct base::DefaultSingletonTraits<HostService>; |
| 126 | 128 |
| 127 DISALLOW_COPY_AND_ASSIGN(HostService); | 129 DISALLOW_COPY_AND_ASSIGN(HostService); |
| 128 }; | 130 }; |
| 129 | 131 |
| 130 } // namespace remoting | 132 } // namespace remoting |
| 131 | 133 |
| 132 #endif // REMOTING_HOST_WIN_HOST_SERVICE_H_ | 134 #endif // REMOTING_HOST_WIN_HOST_SERVICE_H_ |
| OLD | NEW |