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