| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ | 5 #ifndef REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ |
| 6 #define REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ | 6 #define REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "remoting/protocol/channel_dispatcher_base.h" | 11 #include "remoting/protocol/channel_dispatcher_base.h" |
| 12 #include "remoting/protocol/clipboard_filter.h" | 12 #include "remoting/protocol/clipboard_filter.h" |
| 13 #include "remoting/protocol/connection_to_host.h" | 13 #include "remoting/protocol/connection_to_host.h" |
| 14 #include "remoting/protocol/errors.h" | 14 #include "remoting/protocol/errors.h" |
| 15 #include "remoting/protocol/input_filter.h" | 15 #include "remoting/protocol/input_filter.h" |
| 16 #include "remoting/protocol/session.h" | 16 #include "remoting/protocol/session.h" |
| 17 #include "remoting/protocol/webrtc_transport.h" |
| 17 | 18 |
| 18 namespace remoting { | 19 namespace remoting { |
| 19 namespace protocol { | 20 namespace protocol { |
| 20 | 21 |
| 21 class ClientControlDispatcher; | 22 class ClientControlDispatcher; |
| 22 class ClientEventDispatcher; | 23 class ClientEventDispatcher; |
| 23 class SessionConfig; | 24 class SessionConfig; |
| 24 | 25 |
| 25 class WebrtcConnectionToHost : public ConnectionToHost, | 26 class WebrtcConnectionToHost : public ConnectionToHost, |
| 26 public Session::EventHandler, | 27 public Session::EventHandler, |
| 28 public WebrtcTransport::EventHandler, |
| 27 public ChannelDispatcherBase::EventHandler { | 29 public ChannelDispatcherBase::EventHandler { |
| 28 public: | 30 public: |
| 29 WebrtcConnectionToHost(); | 31 WebrtcConnectionToHost(); |
| 30 ~WebrtcConnectionToHost() override; | 32 ~WebrtcConnectionToHost() override; |
| 31 | 33 |
| 32 // ConnectionToHost interface. | 34 // ConnectionToHost interface. |
| 33 void set_client_stub(ClientStub* client_stub) override; | 35 void set_client_stub(ClientStub* client_stub) override; |
| 34 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; | 36 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; |
| 35 void set_video_stub(VideoStub* video_stub) override; | 37 void set_video_stub(VideoStub* video_stub) override; |
| 36 void set_audio_stub(AudioStub* audio_stub) override; | 38 void set_audio_stub(AudioStub* audio_stub) override; |
| 37 void Connect(scoped_ptr<Session> session, | 39 void Connect(scoped_ptr<Session> session, |
| 40 scoped_refptr<TransportContext> transport_context, |
| 38 HostEventCallback* event_callback) override; | 41 HostEventCallback* event_callback) override; |
| 39 const SessionConfig& config() override; | 42 const SessionConfig& config() override; |
| 40 ClipboardStub* clipboard_forwarder() override; | 43 ClipboardStub* clipboard_forwarder() override; |
| 41 HostStub* host_stub() override; | 44 HostStub* host_stub() override; |
| 42 InputStub* input_stub() override; | 45 InputStub* input_stub() override; |
| 43 State state() const override; | 46 State state() const override; |
| 44 | 47 |
| 45 private: | 48 private: |
| 46 // Session::EventHandler interface. | 49 // Session::EventHandler interface. |
| 47 void OnSessionStateChange(Session::State state) override; | 50 void OnSessionStateChange(Session::State state) override; |
| 48 void OnSessionRouteChange(const std::string& channel_name, | 51 |
| 49 const TransportRoute& route) override; | 52 // WebrtcTransport::EventHandler interface. |
| 53 void OnWebrtcTransportConnected() override; |
| 54 void OnWebrtcTransportError(ErrorCode error) override; |
| 50 | 55 |
| 51 // ChannelDispatcherBase::EventHandler interface. | 56 // ChannelDispatcherBase::EventHandler interface. |
| 52 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; | 57 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; |
| 53 void OnChannelError(ChannelDispatcherBase* channel_dispatcher, | 58 void OnChannelError(ChannelDispatcherBase* channel_dispatcher, |
| 54 ErrorCode error) override; | 59 ErrorCode error) override; |
| 55 | 60 |
| 56 void NotifyIfChannelsReady(); | 61 void NotifyIfChannelsReady(); |
| 57 | 62 |
| 58 void CloseChannels(); | 63 void CloseChannels(); |
| 59 | 64 |
| 60 void SetState(State state, ErrorCode error); | 65 void SetState(State state, ErrorCode error); |
| 61 | 66 |
| 62 HostEventCallback* event_callback_ = nullptr; | 67 HostEventCallback* event_callback_ = nullptr; |
| 63 | 68 |
| 64 // Stub for incoming messages. | 69 // Stub for incoming messages. |
| 65 ClientStub* client_stub_ = nullptr; | 70 ClientStub* client_stub_ = nullptr; |
| 66 ClipboardStub* clipboard_stub_ = nullptr; | 71 ClipboardStub* clipboard_stub_ = nullptr; |
| 67 | 72 |
| 68 scoped_ptr<Session> session_; | 73 scoped_ptr<Session> session_; |
| 74 scoped_ptr<WebrtcTransport> transport_; |
| 69 | 75 |
| 70 scoped_ptr<ClientControlDispatcher> control_dispatcher_; | 76 scoped_ptr<ClientControlDispatcher> control_dispatcher_; |
| 71 scoped_ptr<ClientEventDispatcher> event_dispatcher_; | 77 scoped_ptr<ClientEventDispatcher> event_dispatcher_; |
| 72 ClipboardFilter clipboard_forwarder_; | 78 ClipboardFilter clipboard_forwarder_; |
| 73 InputFilter event_forwarder_; | 79 InputFilter event_forwarder_; |
| 74 | 80 |
| 75 // Internal state of the connection. | 81 // Internal state of the connection. |
| 76 State state_ = INITIALIZING; | 82 State state_ = INITIALIZING; |
| 77 ErrorCode error_ = OK; | 83 ErrorCode error_ = OK; |
| 78 | 84 |
| 79 private: | 85 private: |
| 80 DISALLOW_COPY_AND_ASSIGN(WebrtcConnectionToHost); | 86 DISALLOW_COPY_AND_ASSIGN(WebrtcConnectionToHost); |
| 81 }; | 87 }; |
| 82 | 88 |
| 83 } // namespace protocol | 89 } // namespace protocol |
| 84 } // namespace remoting | 90 } // namespace remoting |
| 85 | 91 |
| 86 #endif // REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ | 92 #endif // REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ |
| OLD | NEW |