Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / remoting / host / win / wts_terminal_monitor.h
blobc9dde920e27e2039df8f25fa31bb4d372c36b8be
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
3 // found in the LICENSE file.
5 #ifndef REMOTING_HOST_WIN_WTS_TERMINAL_MONITOR_H_
6 #define REMOTING_HOST_WIN_WTS_TERMINAL_MONITOR_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "base/strings/utf_string_conversions.h"
13 namespace remoting {
15 class WtsTerminalObserver;
17 // Session id that does not represent any session.
18 extern const uint32 kInvalidSessionId;
20 class WtsTerminalMonitor {
21 public:
22 // The console terminal ID.
23 static const char* kConsole;
25 virtual ~WtsTerminalMonitor();
27 // Registers an observer to receive notifications about a particular WTS
28 // 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
30 // monitor the console session.
32 // Each observer instance can monitor a single WTS console. Returns
33 // |true| of success. Returns |false| if |observer| is already registered.
34 virtual bool AddWtsTerminalObserver(const std::string& terminal_id,
35 WtsTerminalObserver* observer) = 0;
37 // Unregisters a previously registered observer.
38 virtual void RemoveWtsTerminalObserver(WtsTerminalObserver* observer) = 0;
40 // 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
42 // does not have an assigned terminal ID.
43 static bool LookupTerminalId(uint32 session_id, std::string* terminal_id);
45 // Returns ID of the session that |terminal_id| is attached.
46 // |kInvalidSessionId| is returned if none of the sessions is currently
47 // attahced to |client_endpoint|.
48 static uint32 LookupSessionId(const std::string& terminal_id);
50 protected:
51 WtsTerminalMonitor();
53 private:
54 DISALLOW_COPY_AND_ASSIGN(WtsTerminalMonitor);
57 } // namespace remoting
59 #endif // REMOTING_HOST_WIN_WTS_TERMINAL_MONITOR_H_