| 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_WTS_TERMINAL_MONITOR_H_ | 5 #ifndef REMOTING_HOST_WIN_WTS_TERMINAL_MONITOR_H_ |
| 6 #define REMOTING_HOST_WIN_WTS_TERMINAL_MONITOR_H_ | 6 #define REMOTING_HOST_WIN_WTS_TERMINAL_MONITOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <string> | 10 #include <string> |
| 9 | 11 |
| 10 #include "base/basictypes.h" | 12 #include "base/macros.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 12 | 14 |
| 13 namespace remoting { | 15 namespace remoting { |
| 14 | 16 |
| 15 class WtsTerminalObserver; | 17 class WtsTerminalObserver; |
| 16 | 18 |
| 17 // Session id that does not represent any session. | 19 // Session id that does not represent any session. |
| 18 extern const uint32 kInvalidSessionId; | 20 extern const uint32_t kInvalidSessionId; |
| 19 | 21 |
| 20 class WtsTerminalMonitor { | 22 class WtsTerminalMonitor { |
| 21 public: | 23 public: |
| 22 // The console terminal ID. | 24 // The console terminal ID. |
| 23 static const char kConsole[]; | 25 static const char kConsole[]; |
| 24 | 26 |
| 25 virtual ~WtsTerminalMonitor(); | 27 virtual ~WtsTerminalMonitor(); |
| 26 | 28 |
| 27 // Registers an observer to receive notifications about a particular WTS | 29 // Registers an observer to receive notifications about a particular WTS |
| 28 // terminal. |terminal_id| is used to specify an RdpClient instance for which | 30 // terminal. |terminal_id| is used to specify an RdpClient instance for which |
| 29 // the connected session should be monitored, or |kConsole| may be passed to | 31 // the connected session should be monitored, or |kConsole| may be passed to |
| 30 // monitor the console session. | 32 // monitor the console session. |
| 31 // | 33 // |
| 32 // Each observer instance can monitor a single WTS console. Returns | 34 // Each observer instance can monitor a single WTS console. Returns |
| 33 // |true| of success. Returns |false| if |observer| is already registered. | 35 // |true| of success. Returns |false| if |observer| is already registered. |
| 34 virtual bool AddWtsTerminalObserver(const std::string& terminal_id, | 36 virtual bool AddWtsTerminalObserver(const std::string& terminal_id, |
| 35 WtsTerminalObserver* observer) = 0; | 37 WtsTerminalObserver* observer) = 0; |
| 36 | 38 |
| 37 // Unregisters a previously registered observer. | 39 // Unregisters a previously registered observer. |
| 38 virtual void RemoveWtsTerminalObserver(WtsTerminalObserver* observer) = 0; | 40 virtual void RemoveWtsTerminalObserver(WtsTerminalObserver* observer) = 0; |
| 39 | 41 |
| 40 // Returns ID of the terminal connected to |session_id| in |*terminal_id|. | 42 // Returns ID of the terminal connected to |session_id| in |*terminal_id|. |
| 41 // Returns false if |session_id| is not attached to the physical console or | 43 // Returns false if |session_id| is not attached to the physical console or |
| 42 // does not have an assigned terminal ID. | 44 // does not have an assigned terminal ID. |
| 43 static bool LookupTerminalId(uint32 session_id, std::string* terminal_id); | 45 static bool LookupTerminalId(uint32_t session_id, std::string* terminal_id); |
| 44 | 46 |
| 45 // Returns ID of the session that |terminal_id| is attached. | 47 // Returns ID of the session that |terminal_id| is attached. |
| 46 // |kInvalidSessionId| is returned if none of the sessions is currently | 48 // |kInvalidSessionId| is returned if none of the sessions is currently |
| 47 // attahced to |client_endpoint|. | 49 // attahced to |client_endpoint|. |
| 48 static uint32 LookupSessionId(const std::string& terminal_id); | 50 static uint32_t LookupSessionId(const std::string& terminal_id); |
| 49 | 51 |
| 50 protected: | 52 protected: |
| 51 WtsTerminalMonitor(); | 53 WtsTerminalMonitor(); |
| 52 | 54 |
| 53 private: | 55 private: |
| 54 DISALLOW_COPY_AND_ASSIGN(WtsTerminalMonitor); | 56 DISALLOW_COPY_AND_ASSIGN(WtsTerminalMonitor); |
| 55 }; | 57 }; |
| 56 | 58 |
| 57 } // namespace remoting | 59 } // namespace remoting |
| 58 | 60 |
| 59 #endif // REMOTING_HOST_WIN_WTS_TERMINAL_MONITOR_H_ | 61 #endif // REMOTING_HOST_WIN_WTS_TERMINAL_MONITOR_H_ |
| OLD | NEW |