Index: remoting/protocol/connection_to_client.h |
diff --git a/remoting/protocol/connection_to_client.h b/remoting/protocol/connection_to_client.h |
index 5e7bc6782dd35ef3fdb765db47f25209da8ebe9a..2aac7283e46eee4bb64e77a7d65c6b272a83aae8 100644 |
--- a/remoting/protocol/connection_to_client.h |
+++ b/remoting/protocol/connection_to_client.h |
@@ -5,35 +5,25 @@ |
#ifndef REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
#define REMOTING_PROTOCOL_CONNECTION_TO_CLIENT_H_ |
-#include <deque> |
#include <string> |
-#include <vector> |
-#include "base/memory/scoped_ptr.h" |
-#include "base/synchronization/lock.h" |
-#include "base/threading/non_thread_safe.h" |
-#include "remoting/protocol/audio_writer.h" |
-#include "remoting/protocol/session.h" |
+#include "remoting/protocol/transport.h" |
namespace remoting { |
namespace protocol { |
+class AudioStub; |
class ClientStub; |
class ClipboardStub; |
-class HostControlDispatcher; |
-class HostEventDispatcher; |
class HostStub; |
-class HostVideoDispatcher; |
class InputStub; |
+class Session; |
class VideoFeedbackStub; |
class VideoStub; |
-// This class represents a remote viewer connection to the chromoting |
-// host. It sets up all protocol channels and connects them to the |
-// stubs. |
-class ConnectionToClient : public base::NonThreadSafe, |
- public Session::EventHandler, |
- public ChannelDispatcherBase::EventHandler { |
+// This interface represents a remote viewer connection to the chromoting host. |
+// It sets up all protocol channels and connects them to the stubs. |
+class ConnectionToClient { |
public: |
class EventHandler { |
public: |
@@ -66,73 +56,42 @@ class ConnectionToClient : public base::NonThreadSafe, |
virtual ~EventHandler() {} |
}; |
- // Constructs a ConnectionToClient object for the |session|. Takes |
- // ownership of |session|. |
- explicit ConnectionToClient(Session* session); |
- ~ConnectionToClient() override; |
+ ConnectionToClient() {} |
+ virtual ~ConnectionToClient() {} |
// Set |event_handler| for connection events. Must be called once when this |
// object is created. |
- void SetEventHandler(EventHandler* event_handler); |
+ virtual void SetEventHandler(EventHandler* event_handler) = 0; |
- // Returns the connection in use. |
- virtual Session* session(); |
+ // Returns the Session object for the connection. |
+ // TODO(sergeyu): Remove this method. |
+ virtual Session* session() = 0; |
// Disconnect the client connection. |
- virtual void Disconnect(ErrorCode error); |
+ virtual void Disconnect(ErrorCode error) = 0; |
// Callback for HostEventDispatcher to be called with a timestamp for each |
// received event. |
- virtual void OnInputEventReceived(int64_t timestamp); |
+ virtual void OnInputEventReceived(int64_t timestamp) = 0; |
// Get the stubs used by the host to transmit messages to the client. |
// The stubs must not be accessed before OnConnectionAuthenticated(), or |
// after OnConnectionClosed(). |
// Note that the audio stub will be nullptr if audio is not enabled. |
- virtual VideoStub* video_stub(); |
- virtual AudioStub* audio_stub(); |
- virtual ClientStub* client_stub(); |
+ virtual VideoStub* video_stub() = 0; |
+ virtual AudioStub* audio_stub() = 0; |
+ virtual ClientStub* client_stub() = 0; |
// Set the stubs which will handle messages we receive from the client. These |
// must be called in EventHandler::OnConnectionAuthenticated(). |
- virtual void set_clipboard_stub(ClipboardStub* clipboard_stub); |
- virtual void set_host_stub(HostStub* host_stub); |
- virtual void set_input_stub(InputStub* input_stub); |
+ virtual void set_clipboard_stub(ClipboardStub* clipboard_stub) = 0; |
+ virtual void set_host_stub(HostStub* host_stub) = 0; |
+ virtual void set_input_stub(InputStub* input_stub) = 0; |
// Sets video feedback stub. Can be called at any time after connection is |
// authenticated. |
- virtual void set_video_feedback_stub(VideoFeedbackStub* video_feedback_stub); |
- |
- // Session::EventHandler interface. |
- void OnSessionStateChange(Session::State state) override; |
- void OnSessionRouteChange(const std::string& channel_name, |
- const TransportRoute& route) override; |
- |
- // ChannelDispatcherBase::EventHandler interface. |
- void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; |
- void OnChannelError(ChannelDispatcherBase* channel_dispatcher, |
- ErrorCode error) override; |
- |
- private: |
- void NotifyIfChannelsReady(); |
- |
- void Close(ErrorCode error); |
- |
- // Stops writing in the channels. |
- void CloseChannels(); |
- |
- // Event handler for handling events sent from this object. |
- EventHandler* handler_; |
- |
- // The libjingle channel used to send and receive data from the remote client. |
- scoped_ptr<Session> session_; |
- |
- scoped_ptr<HostControlDispatcher> control_dispatcher_; |
- scoped_ptr<HostEventDispatcher> event_dispatcher_; |
- scoped_ptr<HostVideoDispatcher> video_dispatcher_; |
- scoped_ptr<AudioWriter> audio_writer_; |
- |
- DISALLOW_COPY_AND_ASSIGN(ConnectionToClient); |
+ virtual void set_video_feedback_stub( |
+ VideoFeedbackStub* video_feedback_stub) = 0; |
}; |
} // namespace protocol |