| Index: remoting/protocol/session_manager.h
|
| diff --git a/remoting/protocol/session_manager.h b/remoting/protocol/session_manager.h
|
| index 8fb3685c6ae65eb15ecc908f7dc328f3c7719878..b4972e79c3609ba048b3de6eafa53066659c83f4 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"
|
|
|
| @@ -68,14 +69,8 @@ class Authenticator;
|
| class AuthenticatorFactory;
|
|
|
| // Generic interface for Chromoting session manager.
|
| -//
|
| -// TODO(sergeyu): Split this into two separate interfaces: one for the
|
| -// client side and one for the host side.
|
| class SessionManager : public base::NonThreadSafe {
|
| public:
|
| - SessionManager() {}
|
| - virtual ~SessionManager() {}
|
| -
|
| enum IncomingSessionResponse {
|
| // Accept the session.
|
| ACCEPT,
|
| @@ -89,38 +84,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 +115,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
|
|
|