diff options
author | sergeyu <sergeyu@chromium.org> | 2015-12-18 11:41:42 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-18 19:42:56 +0000 |
commit | 4b00d04ba9640c7f893467fcbfc77f58990a9a52 (patch) | |
tree | e7632a61d73e6c0eec82bfda26abf126372b229e /remoting/protocol/webrtc_connection_to_host.h | |
parent | dd4e248e6a1df0b265d0eaec2d7b472b0a3c012d (diff) | |
download | chromium_src-4b00d04ba9640c7f893467fcbfc77f58990a9a52.zip chromium_src-4b00d04ba9640c7f893467fcbfc77f58990a9a52.tar.gz chromium_src-4b00d04ba9640c7f893467fcbfc77f58990a9a52.tar.bz2 |
Start WebrtcConnectionToHost.
The new class implements input and control channels for
webrtc-based connection. Video and Audio are not supported
yet.
Removed webrtc_connection_to_client_unittest.cc because
WebrtcConnectionToClient is tested by connection_tests.cc.
BUG=547158
Review URL: https://codereview.chromium.org/1540443002
Cr-Commit-Position: refs/heads/master@{#366151}
Diffstat (limited to 'remoting/protocol/webrtc_connection_to_host.h')
-rw-r--r-- | remoting/protocol/webrtc_connection_to_host.h | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/remoting/protocol/webrtc_connection_to_host.h b/remoting/protocol/webrtc_connection_to_host.h new file mode 100644 index 0000000..046aeae --- /dev/null +++ b/remoting/protocol/webrtc_connection_to_host.h @@ -0,0 +1,86 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ +#define REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ + +#include <string> + +#include "base/memory/scoped_ptr.h" +#include "remoting/protocol/channel_dispatcher_base.h" +#include "remoting/protocol/clipboard_filter.h" +#include "remoting/protocol/connection_to_host.h" +#include "remoting/protocol/errors.h" +#include "remoting/protocol/input_filter.h" +#include "remoting/protocol/session.h" + +namespace remoting { +namespace protocol { + +class ClientControlDispatcher; +class ClientEventDispatcher; +class SessionConfig; + +class WebrtcConnectionToHost : public ConnectionToHost, + public Session::EventHandler, + public ChannelDispatcherBase::EventHandler { + public: + WebrtcConnectionToHost(); + ~WebrtcConnectionToHost() override; + + // ConnectionToHost interface. + void set_client_stub(ClientStub* client_stub) override; + void set_clipboard_stub(ClipboardStub* clipboard_stub) override; + void set_video_stub(VideoStub* video_stub) override; + void set_audio_stub(AudioStub* audio_stub) override; + void Connect(scoped_ptr<Session> session, + HostEventCallback* event_callback) override; + const SessionConfig& config() override; + ClipboardStub* clipboard_forwarder() override; + HostStub* host_stub() override; + InputStub* input_stub() override; + State state() const override; + + private: + // 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; + + void NotifyIfChannelsReady(); + + void CloseChannels(); + + void SetState(State state, ErrorCode error); + + HostEventCallback* event_callback_ = nullptr; + + // Stub for incoming messages. + ClientStub* client_stub_ = nullptr; + ClipboardStub* clipboard_stub_ = nullptr; + + scoped_ptr<Session> session_; + + scoped_ptr<ClientControlDispatcher> control_dispatcher_; + scoped_ptr<ClientEventDispatcher> event_dispatcher_; + ClipboardFilter clipboard_forwarder_; + InputFilter event_forwarder_; + + // Internal state of the connection. + State state_ = INITIALIZING; + ErrorCode error_ = OK; + + private: + DISALLOW_COPY_AND_ASSIGN(WebrtcConnectionToHost); +}; + +} // namespace protocol +} // namespace remoting + +#endif // REMOTING_PROTOCOL_WEBRTC_CONNECTION_TO_HOST_H_ |