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 | 9 |
10 #include <list> | 10 #include <list> |
11 | 11 |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "base/synchronization/waitable_event.h" | 14 #include "base/synchronization/waitable_event.h" |
15 #include "net/base/ip_endpoint.h" | 15 #include "net/base/ip_endpoint.h" |
| 16 #include "remoting/host/win/message_window.h" |
16 #include "remoting/host/win/wts_terminal_monitor.h" | 17 #include "remoting/host/win/wts_terminal_monitor.h" |
17 | 18 |
18 class CommandLine; | 19 class CommandLine; |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class SingleThreadTaskRunner; | 22 class SingleThreadTaskRunner; |
22 } // namespace base | 23 } // namespace base |
23 | 24 |
24 namespace remoting { | 25 namespace remoting { |
25 | 26 |
26 class AutoThreadTaskRunner; | 27 class AutoThreadTaskRunner; |
27 class Stoppable; | 28 class Stoppable; |
28 class WtsTerminalObserver; | 29 class WtsTerminalObserver; |
29 | 30 |
30 class HostService : public WtsTerminalMonitor { | 31 class HostService : public win::MessageWindow::Delegate, |
| 32 public WtsTerminalMonitor { |
31 public: | 33 public: |
32 static HostService* GetInstance(); | 34 static HostService* GetInstance(); |
33 | 35 |
34 // This function parses the command line and selects the action routine. | 36 // This function parses the command line and selects the action routine. |
35 bool InitWithCommandLine(const CommandLine* command_line); | 37 bool InitWithCommandLine(const CommandLine* command_line); |
36 | 38 |
37 // Invoke the choosen action routine. | 39 // Invoke the choosen action routine. |
38 int Run(); | 40 int Run(); |
39 | 41 |
40 // WtsTerminalMonitor implementation | 42 // WtsTerminalMonitor implementation |
(...skipping 20 matching lines...) Expand all Loading... |
61 | 63 |
62 // Runs the service on the service thread. A separate routine is used to make | 64 // Runs the service on the service thread. A separate routine is used to make |
63 // sure all local objects are destoyed by the time |stopped_event_| is | 65 // sure all local objects are destoyed by the time |stopped_event_| is |
64 // signalled. | 66 // signalled. |
65 void RunAsServiceImpl(); | 67 void RunAsServiceImpl(); |
66 | 68 |
67 // This function starts the service in interactive mode (i.e. as a plain | 69 // This function starts the service in interactive mode (i.e. as a plain |
68 // console application). | 70 // console application). |
69 int RunInConsole(); | 71 int RunInConsole(); |
70 | 72 |
| 73 // win::MessageWindow::Delegate interface. |
| 74 virtual bool HandleMessage(HWND hwnd, |
| 75 UINT message, |
| 76 WPARAM wparam, |
| 77 LPARAM lparam, |
| 78 LRESULT* result) OVERRIDE; |
| 79 |
71 static BOOL WINAPI ConsoleControlHandler(DWORD event); | 80 static BOOL WINAPI ConsoleControlHandler(DWORD event); |
72 | 81 |
73 // The control handler of the service. | 82 // The control handler of the service. |
74 static DWORD WINAPI ServiceControlHandler(DWORD control, | 83 static DWORD WINAPI ServiceControlHandler(DWORD control, |
75 DWORD event_type, | 84 DWORD event_type, |
76 LPVOID event_data, | 85 LPVOID event_data, |
77 LPVOID context); | 86 LPVOID context); |
78 | 87 |
79 // The main service entry point. | 88 // The main service entry point. |
80 static VOID WINAPI ServiceMain(DWORD argc, WCHAR* argv[]); | 89 static VOID WINAPI ServiceMain(DWORD argc, WCHAR* argv[]); |
81 | 90 |
82 static LRESULT CALLBACK SessionChangeNotificationProc(HWND hwnd, | |
83 UINT message, | |
84 WPARAM wparam, | |
85 LPARAM lparam); | |
86 | |
87 struct RegisteredObserver { | 91 struct RegisteredObserver { |
88 // Specifies the client address of an RDP connection or IPEndPoint() for | 92 // Specifies the client address of an RDP connection or IPEndPoint() for |
89 // the physical console. | 93 // the physical console. |
90 net::IPEndPoint client_endpoint; | 94 net::IPEndPoint client_endpoint; |
91 | 95 |
92 // Specifies ID of the attached session or |kInvalidSession| if no session | 96 // Specifies ID of the attached session or |kInvalidSession| if no session |
93 // is attached to the WTS console. | 97 // is attached to the WTS console. |
94 uint32 session_id; | 98 uint32 session_id; |
95 | 99 |
96 // Points to the observer receiving notifications about the WTS console | 100 // Points to the observer receiving notifications about the WTS console |
(...skipping 20 matching lines...) Expand all Loading... |
117 | 121 |
118 // Singleton. | 122 // Singleton. |
119 friend struct DefaultSingletonTraits<HostService>; | 123 friend struct DefaultSingletonTraits<HostService>; |
120 | 124 |
121 DISALLOW_COPY_AND_ASSIGN(HostService); | 125 DISALLOW_COPY_AND_ASSIGN(HostService); |
122 }; | 126 }; |
123 | 127 |
124 } // namespace remoting | 128 } // namespace remoting |
125 | 129 |
126 #endif // REMOTING_HOST_WIN_HOST_SERVICE_H_ | 130 #endif // REMOTING_HOST_WIN_HOST_SERVICE_H_ |
OLD | NEW |