Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: remoting/host/host_extension_session_manager.h

Issue 468613002: Readability review. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 14 matching lines...) Expand all
25 namespace protocol { 25 namespace protocol {
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 typedef std::vector<HostExtension*> HostExtensions;
36
35 // Creates an extension manager for the specified |extensions|. 37 // Creates an extension manager for the specified |extensions|.
36 HostExtensionSessionManager(const std::vector<HostExtension*>& extensions, 38 HostExtensionSessionManager(const HostExtensions& extensions,
37 ClientSessionControl* client_session_control); 39 ClientSessionControl* client_session_control);
38 virtual ~HostExtensionSessionManager(); 40 virtual ~HostExtensionSessionManager();
39 41
40 // Returns the union of all capabilities supported by registered extensions. 42 // Returns the union of all capabilities supported by registered extensions.
41 std::string GetCapabilities(); 43 std::string GetCapabilities() const;
42 44
43 // Calls the corresponding hook functions in each extension in turn, to give 45 // Calls the corresponding hook functions for each extension, to allow them
44 // them an opportunity to wrap or replace video components. 46 // to wrap or replace video pipeline components. Only extensions which return
45 scoped_ptr<webrtc::DesktopCapturer> OnCreateVideoCapturer( 47 // true from ModifiesVideoPipeline() will be called.
46 scoped_ptr<webrtc::DesktopCapturer> capturer); 48 // The order in which extensions are called is undefined.
47 scoped_ptr<VideoEncoder> OnCreateVideoEncoder( 49 void OnCreateVideoCapturer(scoped_ptr<webrtc::DesktopCapturer>* capturer);
48 scoped_ptr<VideoEncoder> encoder); 50 void OnCreateVideoEncoder(scoped_ptr<VideoEncoder>* encoder);
49 51
50 // Handles completion of authentication and capabilities negotiation, creating 52 // Handles completion of authentication and capabilities negotiation, creating
51 // the set of |HostExtensionSession| to match the client's capabilities. 53 // the set of HostExtensionSessions to match the client's capabilities.
52 void OnNegotiatedCapabilities(protocol::ClientStub* client_stub, 54 void OnNegotiatedCapabilities(protocol::ClientStub* client_stub,
53 const std::string& capabilities); 55 const std::string& capabilities);
54 56
55 // Passes |message| to each |HostExtensionSession| in turn until the message 57 // Passes |message| to each HostExtensionSession in turn until the message
56 // is handled, or none remain. Returns true if the message was handled. 58 // is handled, or none remain. Returns true if the message was handled.
59 // It is not valid for more than one extension to handle the same message.
57 bool OnExtensionMessage(const protocol::ExtensionMessage& message); 60 bool OnExtensionMessage(const protocol::ExtensionMessage& message);
58 61
59 private: 62 private:
60 typedef std::vector<HostExtension*> HostExtensionList; 63 typedef ScopedVector<HostExtensionSession> HostExtensionSessions;
61 typedef ScopedVector<HostExtensionSession> HostExtensionSessionList;
62 64
63 // Passed to HostExtensionSessions to allow them to send messages, 65 // Passed to HostExtensionSessions to allow them to send messages,
64 // disconnect the session, etc. 66 // disconnect the session, etc.
65 ClientSessionControl* client_session_control_; 67 ClientSessionControl* client_session_control_;
66 protocol::ClientStub* client_stub_; 68 protocol::ClientStub* client_stub_;
67 69
68 // List of HostExtensions to attach to the session, if it reaches the 70 // The HostExtensions to instantiate for the session, if it reaches the
69 // authenticated state. 71 // authenticated state.
70 HostExtensionList extensions_; 72 HostExtensions extensions_;
71 73
72 // List of HostExtensionSessions, used to handle extension messages. 74 // The instantiated HostExtensionSessions, used to handle extension messages.
73 HostExtensionSessionList extension_sessions_; 75 HostExtensionSessions extension_sessions_;
74 76
75 DISALLOW_COPY_AND_ASSIGN(HostExtensionSessionManager); 77 DISALLOW_COPY_AND_ASSIGN(HostExtensionSessionManager);
76 }; 78 };
77 79
78 } // namespace remoting 80 } // namespace remoting
79 81
80 #endif // REMOTING_HOST_HOST_EXTENSION_SESSION_MANAGER_H_ 82 #endif // REMOTING_HOST_HOST_EXTENSION_SESSION_MANAGER_H_
OLDNEW
« no previous file with comments | « remoting/host/host_extension_session.cc ('k') | remoting/host/host_extension_session_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698