Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_IMPL_H_ | |
| 6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_IMPL_H_ | |
| 7 | |
| 8 #include <set> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/callback_forward.h" | |
| 12 #include "base/memory/ref_counted.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/threading/non_thread_safe.h" | |
| 15 #include "remoting/proto/internal.pb.h" | |
| 16 #include "remoting/protocol/channel_dispatcher_base.h" | |
| 17 #include "remoting/protocol/clipboard_filter.h" | |
| 18 #include "remoting/protocol/connection_to_host.h" | |
| 19 #include "remoting/protocol/errors.h" | |
| 20 #include "remoting/protocol/input_filter.h" | |
| 21 #include "remoting/protocol/message_reader.h" | |
| 22 #include "remoting/protocol/monitored_video_stub.h" | |
| 23 #include "remoting/protocol/session.h" | |
| 24 #include "remoting/protocol/session_config.h" | |
| 25 #include "remoting/protocol/session_manager.h" | |
| 26 #include "remoting/signaling/signal_strategy.h" | |
| 27 | |
| 28 namespace remoting { | |
| 29 | |
| 30 class XmppProxy; | |
| 31 class VideoPacket; | |
| 32 | |
| 33 namespace protocol { | |
| 34 | |
| 35 class AudioReader; | |
| 36 class AudioStub; | |
| 37 class Authenticator; | |
| 38 class ClientControlDispatcher; | |
| 39 class ClientEventDispatcher; | |
| 40 class ClientStub; | |
| 41 class ClipboardStub; | |
| 42 class HostStub; | |
| 43 class InputStub; | |
| 44 class SessionConfig; | |
| 45 class TransportFactory; | |
| 46 class ClientVideoDispatcher; | |
| 47 class VideoStub; | |
|
Sergey Ulanov
2015/03/11 20:22:17
Many of these classes are already forward-declared
| |
| 48 | |
| 49 class ConnectionToHostImpl : public ConnectionToHost, | |
| 50 public SignalStrategy::Listener, | |
| 51 public SessionManager::Listener, | |
| 52 public Session::EventHandler, | |
| 53 public ChannelDispatcherBase::EventHandler, | |
| 54 public base::NonThreadSafe { | |
| 55 public: | |
| 56 ConnectionToHostImpl(); | |
| 57 ~ConnectionToHostImpl() override; | |
| 58 | |
| 59 // ConnectionToHost interface. | |
| 60 void set_candidate_config(scoped_ptr<CandidateSessionConfig> config) override; | |
| 61 void set_client_stub(ClientStub* client_stub) override; | |
| 62 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; | |
| 63 void set_video_stub(VideoStub* video_stub) override; | |
| 64 void set_audio_stub(AudioStub* audio_stub) override; | |
| 65 void Connect(SignalStrategy* signal_strategy, | |
| 66 scoped_ptr<TransportFactory> transport_factory, | |
| 67 scoped_ptr<Authenticator> authenticator, | |
| 68 const std::string& host_jid, | |
| 69 HostEventCallback* event_callback) override; | |
| 70 const SessionConfig& config() override; | |
| 71 ClipboardStub* clipboard_forwarder() override; | |
| 72 HostStub* host_stub() override; | |
| 73 InputStub* input_stub() override; | |
| 74 State state() const override; | |
| 75 | |
| 76 // SignalStrategy::StatusObserver interface. | |
|
Sergey Ulanov
2015/03/11 20:22:17
please move all interfaces other than ConnectionTo
| |
| 77 void OnSignalStrategyStateChange(SignalStrategy::State state) override; | |
| 78 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override; | |
| 79 | |
| 80 // SessionManager::Listener interface. | |
| 81 void OnSessionManagerReady() override; | |
| 82 void OnIncomingSession( | |
| 83 Session* session, | |
| 84 SessionManager::IncomingSessionResponse* response) override; | |
| 85 | |
| 86 // Session::EventHandler interface. | |
| 87 void OnSessionStateChange(Session::State state) override; | |
| 88 void OnSessionRouteChange(const std::string& channel_name, | |
| 89 const TransportRoute& route) override; | |
| 90 | |
| 91 // ChannelDispatcherBase::EventHandler interface. | |
| 92 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; | |
| 93 void OnChannelError(ChannelDispatcherBase* channel_dispatcher, | |
| 94 ErrorCode error) override; | |
| 95 | |
| 96 // MonitoredVideoStub::EventHandler interface. | |
| 97 virtual void OnVideoChannelStatus(bool active); | |
| 98 | |
| 99 private: | |
| 100 void NotifyIfChannelsReady(); | |
| 101 | |
| 102 void CloseOnError(ErrorCode error); | |
| 103 | |
| 104 // Stops writing in the channels. | |
| 105 void CloseChannels(); | |
| 106 | |
| 107 void SetState(State state, ErrorCode error); | |
| 108 | |
| 109 std::string host_jid_; | |
| 110 std::string host_public_key_; | |
| 111 scoped_ptr<Authenticator> authenticator_; | |
| 112 | |
| 113 HostEventCallback* event_callback_; | |
| 114 | |
| 115 scoped_ptr<CandidateSessionConfig> candidate_config_; | |
| 116 | |
| 117 // Stub for incoming messages. | |
| 118 ClientStub* client_stub_; | |
| 119 ClipboardStub* clipboard_stub_; | |
| 120 AudioStub* audio_stub_; | |
| 121 | |
| 122 SignalStrategy* signal_strategy_; | |
| 123 scoped_ptr<SessionManager> session_manager_; | |
| 124 scoped_ptr<Session> session_; | |
| 125 scoped_ptr<MonitoredVideoStub> monitored_video_stub_; | |
| 126 | |
| 127 scoped_ptr<ClientVideoDispatcher> video_dispatcher_; | |
| 128 scoped_ptr<AudioReader> audio_reader_; | |
| 129 scoped_ptr<ClientControlDispatcher> control_dispatcher_; | |
| 130 scoped_ptr<ClientEventDispatcher> event_dispatcher_; | |
| 131 ClipboardFilter clipboard_forwarder_; | |
| 132 InputFilter event_forwarder_; | |
| 133 | |
| 134 // Internal state of the connection. | |
| 135 State state_; | |
| 136 ErrorCode error_; | |
| 137 | |
| 138 private: | |
| 139 DISALLOW_COPY_AND_ASSIGN(ConnectionToHostImpl); | |
| 140 }; | |
| 141 | |
| 142 } // namespace protocol | |
| 143 } // namespace remoting | |
| 144 | |
| 145 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_IMPL_H_ | |
| OLD | NEW |