Chromium Code Reviews| Index: remoting/protocol/session_manager.h |
| diff --git a/remoting/protocol/session_manager.h b/remoting/protocol/session_manager.h |
| index 8fb3685c6ae65eb15ecc908f7dc328f3c7719878..cc772af19b9f47633ecc6f0ad501ac4e2fc63131 100644 |
| --- a/remoting/protocol/session_manager.h |
| +++ b/remoting/protocol/session_manager.h |
| @@ -55,6 +55,7 @@ |
| #include <string> |
| +#include "base/callback.h" |
| #include "base/threading/non_thread_safe.h" |
| #include "remoting/protocol/session.h" |
| @@ -73,9 +74,6 @@ class AuthenticatorFactory; |
| // client side and one for the host side. |
|
Jamie
2015/12/15 00:32:01
Is this TODO still needed?
Sergey Ulanov
2015/12/16 23:17:39
Done.
|
| class SessionManager : public base::NonThreadSafe { |
| public: |
| - SessionManager() {} |
| - virtual ~SessionManager() {} |
| - |
| enum IncomingSessionResponse { |
| // Accept the session. |
| ACCEPT, |
| @@ -89,38 +87,30 @@ class SessionManager : public base::NonThreadSafe { |
| DECLINE, |
| }; |
| - class Listener { |
| - public: |
| - Listener() {} |
| - |
| - // Called when a new session is received. If the host decides to |
| - // accept the session it should set the |response| to |
| - // ACCEPT. Otherwise it should set it to DECLINE, or |
| - // INCOMPATIBLE. INCOMPATIBLE indicates that the session has |
| - // incompatible configuration, and cannot be accepted. If the |
| - // callback accepts the |session| then it must also set |
| - // configuration for the |session| using Session::set_config(). |
| - // The callback must take ownership of the |session| if it ACCEPTs it. |
| - virtual void OnIncomingSession(Session* session, |
| - IncomingSessionResponse* response) = 0; |
| - |
| - protected: |
| - ~Listener() {} |
| - }; |
| + // Callback used to accept incoming connections. If the host decides to accept |
| + // the session it should set the |response| to ACCEPT. Otherwise it should set |
| + // it to DECLINE, or INCOMPATIBLE. INCOMPATIBLE indicates that the session has |
| + // incompatible configuration, and cannot be accepted. If the callback accepts |
| + // the |session| then it must also set configuration for the |session| using |
| + // Session::set_config(). The callback must take ownership of the |session| if |
| + // it ACCEPTs it. |
| + typedef base::Callback<void(Session* session, |
| + IncomingSessionResponse* response)> |
| + IncomingSessionCallback; |
| - // Initializes the SessionManager. Caller retains ownership of the |
| - // |signal_strategy| and |listener|. |
| - virtual void Init(SignalStrategy* signal_strategy, |
| - Listener* listener) = 0; |
| + SessionManager() {} |
| + virtual ~SessionManager() {} |
| + |
| + // Starts accepting incoming connections. |
| + virtual void AcceptIncoming( |
| + const IncomingSessionCallback& incoming_session_callback) = 0; |
| // Sets local protocol configuration to be used when negotiating outgoing and |
| // incoming connections. |
| virtual void set_protocol_config( |
| scoped_ptr<CandidateSessionConfig> config) = 0; |
| - // Tries to create a session to the host |jid|. Must be called only |
| - // after initialization has finished successfully, i.e. after |
| - // Listener::OnInitialized() has been called. |
| + // Tries to create a session to the host |jid|. |
| // |
| // |host_jid| is the full jid of the host to connect to. |
| // |authenticator| is a client authenticator for the session. |
| @@ -128,11 +118,6 @@ class SessionManager : public base::NonThreadSafe { |
| const std::string& host_jid, |
| scoped_ptr<Authenticator> authenticator) = 0; |
| - // Close session manager. Can be called only after all corresponding |
| - // sessions are destroyed. No callbacks are called after this method |
| - // returns. |
| - virtual void Close() = 0; |
| - |
| // Set authenticator factory that should be used to authenticate |
| // incoming connection. No connections will be accepted if |
| // authenticator factory isn't set. Must not be called more than |