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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... | |
26 class ClientStub; | 26 class ClientStub; |
27 class ExtensionMessage; | 27 class ExtensionMessage; |
28 } | 28 } |
29 | 29 |
30 // Helper class used to create and manage a set of HostExtensionSession | 30 // Helper class used to create and manage a set of HostExtensionSession |
31 // instances depending upon the set of registered HostExtensions, and the | 31 // instances depending upon the set of registered HostExtensions, and the |
32 // set of capabilities negotiated between client and host. | 32 // set of capabilities negotiated between client and host. |
33 class HostExtensionSessionManager { | 33 class HostExtensionSessionManager { |
34 public: | 34 public: |
35 // Creates an extension manager for the specified |extensions|. | 35 // Creates an extension manager for the specified |extensions|. |
36 HostExtensionSessionManager(const std::vector<HostExtension*>& extensions, | 36 HostExtensionSessionManager(const std::vector<HostExtension*>& extensions, |
Peter Kasting
2014/08/22 06:38:28
Nit: Since you already have a typedef for this in
Wez
2014/08/25 23:23:10
Done.
| |
37 ClientSessionControl* client_session_control); | 37 ClientSessionControl* client_session_control); |
38 virtual ~HostExtensionSessionManager(); | 38 virtual ~HostExtensionSessionManager(); |
39 | 39 |
40 // Returns the union of all capabilities supported by registered extensions. | 40 // Returns the union of all capabilities supported by registered extensions. |
41 std::string GetCapabilities(); | 41 std::string GetCapabilities(); |
Peter Kasting
2014/08/22 06:38:28
This can probably be const.
Wez
2014/08/25 23:23:11
Done.
| |
42 | 42 |
43 // Calls the corresponding hook functions in each extension in turn, to give | 43 // Calls the corresponding hook functions in each extension in turn, to give |
44 // them an opportunity to wrap or replace video components. | 44 // them an opportunity to wrap or replace video components. |
Peter Kasting
2014/08/22 06:38:29
It seems like more comments could be useful. For
Wez
2014/08/25 23:23:10
Clarified that the order is undefined.
| |
45 scoped_ptr<webrtc::DesktopCapturer> OnCreateVideoCapturer( | 45 scoped_ptr<webrtc::DesktopCapturer> OnCreateVideoCapturer( |
Peter Kasting
2014/08/22 06:38:29
Nit: It might be clearer to have these functions l
Wez
2014/08/25 23:23:11
Done.
| |
46 scoped_ptr<webrtc::DesktopCapturer> capturer); | 46 scoped_ptr<webrtc::DesktopCapturer> capturer); |
47 scoped_ptr<VideoEncoder> OnCreateVideoEncoder( | 47 scoped_ptr<VideoEncoder> OnCreateVideoEncoder( |
48 scoped_ptr<VideoEncoder> encoder); | 48 scoped_ptr<VideoEncoder> encoder); |
49 | 49 |
50 // Handles completion of authentication and capabilities negotiation, creating | 50 // Handles completion of authentication and capabilities negotiation, creating |
51 // the set of |HostExtensionSession| to match the client's capabilities. | 51 // the set of |HostExtensionSession| to match the client's capabilities. |
Peter Kasting
2014/08/22 06:38:29
Nit: |HostExtensionSession|s
Wez
2014/08/25 23:23:10
Acknowledged. Removed the || since we don't seem
| |
52 void OnNegotiatedCapabilities(protocol::ClientStub* client_stub, | 52 void OnNegotiatedCapabilities(protocol::ClientStub* client_stub, |
53 const std::string& capabilities); | 53 const std::string& capabilities); |
54 | 54 |
55 // Passes |message| to each |HostExtensionSession| in turn until the message | 55 // Passes |message| to each |HostExtensionSession| in turn until the message |
56 // is handled, or none remain. Returns true if the message was handled. | 56 // is handled, or none remain. Returns true if the message was handled. |
Peter Kasting
2014/08/22 06:38:29
Again, what order do these go in?
Wez
2014/08/25 23:23:10
It's also not valid for two extensions to handle t
Peter Kasting
2014/08/25 23:39:06
I don't have an opinion -- that's less of a readab
| |
57 bool OnExtensionMessage(const protocol::ExtensionMessage& message); | 57 bool OnExtensionMessage(const protocol::ExtensionMessage& message); |
58 | 58 |
59 private: | 59 private: |
60 typedef std::vector<HostExtension*> HostExtensionList; | 60 typedef std::vector<HostExtension*> HostExtensionList; |
Peter Kasting
2014/08/22 06:38:29
Nit: Don't use "List" in a typename, especially if
Wez
2014/08/25 23:23:11
Done.
| |
61 typedef ScopedVector<HostExtensionSession> HostExtensionSessionList; | 61 typedef ScopedVector<HostExtensionSession> HostExtensionSessionList; |
62 | 62 |
63 // Passed to HostExtensionSessions to allow them to send messages, | 63 // Passed to HostExtensionSessions to allow them to send messages, |
64 // disconnect the session, etc. | 64 // disconnect the session, etc. |
65 ClientSessionControl* client_session_control_; | 65 ClientSessionControl* client_session_control_; |
66 protocol::ClientStub* client_stub_; | 66 protocol::ClientStub* client_stub_; |
67 | 67 |
68 // List of HostExtensions to attach to the session, if it reaches the | 68 // List of HostExtensions to attach to the session, if it reaches the |
Peter Kasting
2014/08/22 06:38:28
Nit: Again, avoid "list" except perhaps where you'
Wez
2014/08/25 23:23:11
Done.
| |
69 // authenticated state. | 69 // authenticated state. |
70 HostExtensionList extensions_; | 70 HostExtensionList extensions_; |
71 | 71 |
72 // List of HostExtensionSessions, used to handle extension messages. | 72 // List of HostExtensionSessions, used to handle extension messages. |
73 HostExtensionSessionList extension_sessions_; | 73 HostExtensionSessionList extension_sessions_; |
74 | 74 |
75 DISALLOW_COPY_AND_ASSIGN(HostExtensionSessionManager); | 75 DISALLOW_COPY_AND_ASSIGN(HostExtensionSessionManager); |
76 }; | 76 }; |
77 | 77 |
78 } // namespace remoting | 78 } // namespace remoting |
79 | 79 |
80 #endif // REMOTING_HOST_HOST_EXTENSION_SESSION_MANAGER_H_ | 80 #endif // REMOTING_HOST_HOST_EXTENSION_SESSION_MANAGER_H_ |
81 | |
OLD | NEW |