OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_HOST_EXTENSION_SESSION_MANAGER_H_ | 5 #ifndef REMOTING_HOST_HOST_EXTENSION_SESSION_MANAGER_H_ |
6 #define REMOTING_HOST_HOST_EXTENSION_SESSION_MANAGER_H_ | 6 #define REMOTING_HOST_HOST_EXTENSION_SESSION_MANAGER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 | 14 |
15 namespace webrtc { | 15 namespace webrtc { |
16 class DesktopCapturer; | 16 class DesktopCapturer; |
17 } | 17 } |
18 | 18 |
19 namespace remoting { | 19 namespace remoting { |
20 | 20 |
21 class ClientSessionControl; | 21 class ClientSessionControl; |
| 22 class ClientSessionDetails; |
22 class HostExtension; | 23 class HostExtension; |
23 class HostExtensionSession; | 24 class HostExtensionSession; |
24 class VideoEncoder; | 25 class VideoEncoder; |
25 | 26 |
26 namespace protocol { | 27 namespace protocol { |
27 class ClientStub; | 28 class ClientStub; |
28 class ExtensionMessage; | 29 class ExtensionMessage; |
29 } | 30 } |
30 | 31 |
31 // Helper class used to create and manage a set of HostExtensionSession | 32 // Helper class used to create and manage a set of HostExtensionSession |
32 // instances depending upon the set of registered HostExtensions, and the | 33 // instances depending upon the set of registered HostExtensions, and the |
33 // set of capabilities negotiated between client and host. | 34 // set of capabilities negotiated between client and host. |
34 class HostExtensionSessionManager { | 35 class HostExtensionSessionManager { |
35 public: | 36 public: |
36 typedef std::vector<HostExtension*> HostExtensions; | 37 typedef std::vector<HostExtension*> HostExtensions; |
37 | 38 |
38 // Creates an extension manager for the specified |extensions|. | 39 // Creates an extension manager for the specified |extensions|. |
39 HostExtensionSessionManager(const HostExtensions& extensions, | 40 HostExtensionSessionManager(const HostExtensions& extensions, |
40 ClientSessionControl* client_session_control); | 41 ClientSessionControl* client_session_control, |
| 42 ClientSessionDetails* client_session_details); |
41 virtual ~HostExtensionSessionManager(); | 43 virtual ~HostExtensionSessionManager(); |
42 | 44 |
43 // Returns the union of all capabilities supported by registered extensions. | 45 // Returns the union of all capabilities supported by registered extensions. |
44 std::string GetCapabilities() const; | 46 std::string GetCapabilities() const; |
45 | 47 |
46 // Handles completion of authentication and capabilities negotiation, creating | 48 // Handles completion of authentication and capabilities negotiation, creating |
47 // the set of HostExtensionSessions to match the client's capabilities. | 49 // the set of HostExtensionSessions to match the client's capabilities. |
48 void OnNegotiatedCapabilities(protocol::ClientStub* client_stub, | 50 void OnNegotiatedCapabilities(protocol::ClientStub* client_stub, |
49 const std::string& capabilities); | 51 const std::string& capabilities); |
50 | 52 |
51 // Passes |message| to each HostExtensionSession in turn until the message | 53 // Passes |message| to each HostExtensionSession in turn until the message |
52 // is handled, or none remain. Returns true if the message was handled. | 54 // is handled, or none remain. Returns true if the message was handled. |
53 // It is not valid for more than one extension to handle the same message. | 55 // It is not valid for more than one extension to handle the same message. |
54 bool OnExtensionMessage(const protocol::ExtensionMessage& message); | 56 bool OnExtensionMessage(const protocol::ExtensionMessage& message); |
55 | 57 |
56 private: | 58 private: |
57 typedef ScopedVector<HostExtensionSession> HostExtensionSessions; | 59 typedef ScopedVector<HostExtensionSession> HostExtensionSessions; |
58 | 60 |
59 // Passed to HostExtensionSessions to allow them to send messages, | 61 // Passed to HostExtensionSessions to allow them to send messages, |
60 // disconnect the session, etc. | 62 // disconnect the session, etc. |
61 ClientSessionControl* client_session_control_; | 63 ClientSessionControl* client_session_control_; |
| 64 ClientSessionDetails* client_session_details_; |
62 protocol::ClientStub* client_stub_; | 65 protocol::ClientStub* client_stub_; |
63 | 66 |
64 // The HostExtensions to instantiate for the session, if it reaches the | 67 // The HostExtensions to instantiate for the session, if it reaches the |
65 // authenticated state. | 68 // authenticated state. |
66 HostExtensions extensions_; | 69 HostExtensions extensions_; |
67 | 70 |
68 // The instantiated HostExtensionSessions, used to handle extension messages. | 71 // The instantiated HostExtensionSessions, used to handle extension messages. |
69 HostExtensionSessions extension_sessions_; | 72 HostExtensionSessions extension_sessions_; |
70 | 73 |
71 DISALLOW_COPY_AND_ASSIGN(HostExtensionSessionManager); | 74 DISALLOW_COPY_AND_ASSIGN(HostExtensionSessionManager); |
72 }; | 75 }; |
73 | 76 |
74 } // namespace remoting | 77 } // namespace remoting |
75 | 78 |
76 #endif // REMOTING_HOST_HOST_EXTENSION_SESSION_MANAGER_H_ | 79 #endif // REMOTING_HOST_HOST_EXTENSION_SESSION_MANAGER_H_ |
OLD | NEW |