Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: remoting/protocol/connection_to_host_impl.h

Issue 976233003: Adding the base ChromotingInstance implementation and unittests. This class will be used by the ap… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing Final Feedback Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « remoting/protocol/connection_to_host.cc ('k') | remoting/protocol/connection_to_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 ClientControlDispatcher;
37 class ClientEventDispatcher;
38 class ClientVideoDispatcher;
39
40 class ConnectionToHostImpl : public ConnectionToHost,
41 public SignalStrategy::Listener,
42 public SessionManager::Listener,
43 public Session::EventHandler,
44 public ChannelDispatcherBase::EventHandler,
45 public base::NonThreadSafe {
46 public:
47 ConnectionToHostImpl();
48 ~ConnectionToHostImpl() override;
49
50 // ConnectionToHost interface.
51 void set_candidate_config(scoped_ptr<CandidateSessionConfig> config) override;
52 void set_client_stub(ClientStub* client_stub) override;
53 void set_clipboard_stub(ClipboardStub* clipboard_stub) override;
54 void set_video_stub(VideoStub* video_stub) override;
55 void set_audio_stub(AudioStub* audio_stub) override;
56 void Connect(SignalStrategy* signal_strategy,
57 scoped_ptr<TransportFactory> transport_factory,
58 scoped_ptr<Authenticator> authenticator,
59 const std::string& host_jid,
60 HostEventCallback* event_callback) override;
61 const SessionConfig& config() override;
62 ClipboardStub* clipboard_forwarder() override;
63 HostStub* host_stub() override;
64 InputStub* input_stub() override;
65 State state() const override;
66
67 private:
68 // SignalStrategy::StatusObserver interface.
69 void OnSignalStrategyStateChange(SignalStrategy::State state) override;
70 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override;
71
72 // SessionManager::Listener interface.
73 void OnSessionManagerReady() override;
74 void OnIncomingSession(
75 Session* session,
76 SessionManager::IncomingSessionResponse* response) override;
77
78 // Session::EventHandler interface.
79 void OnSessionStateChange(Session::State state) override;
80 void OnSessionRouteChange(const std::string& channel_name,
81 const TransportRoute& route) override;
82
83 // ChannelDispatcherBase::EventHandler interface.
84 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override;
85 void OnChannelError(ChannelDispatcherBase* channel_dispatcher,
86 ErrorCode error) override;
87
88 // MonitoredVideoStub::EventHandler interface.
89 virtual void OnVideoChannelStatus(bool active);
90
91 void NotifyIfChannelsReady();
92
93 void CloseOnError(ErrorCode error);
94
95 // Stops writing in the channels.
96 void CloseChannels();
97
98 void SetState(State state, ErrorCode error);
99
100 std::string host_jid_;
101 std::string host_public_key_;
102 scoped_ptr<Authenticator> authenticator_;
103
104 HostEventCallback* event_callback_;
105
106 scoped_ptr<CandidateSessionConfig> candidate_config_;
107
108 // Stub for incoming messages.
109 ClientStub* client_stub_;
110 ClipboardStub* clipboard_stub_;
111 AudioStub* audio_stub_;
112
113 SignalStrategy* signal_strategy_;
114 scoped_ptr<SessionManager> session_manager_;
115 scoped_ptr<Session> session_;
116 scoped_ptr<MonitoredVideoStub> monitored_video_stub_;
117
118 scoped_ptr<ClientVideoDispatcher> video_dispatcher_;
119 scoped_ptr<AudioReader> audio_reader_;
120 scoped_ptr<ClientControlDispatcher> control_dispatcher_;
121 scoped_ptr<ClientEventDispatcher> event_dispatcher_;
122 ClipboardFilter clipboard_forwarder_;
123 InputFilter event_forwarder_;
124
125 // Internal state of the connection.
126 State state_;
127 ErrorCode error_;
128
129 private:
130 DISALLOW_COPY_AND_ASSIGN(ConnectionToHostImpl);
131 };
132
133 } // namespace protocol
134 } // namespace remoting
135
136 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « remoting/protocol/connection_to_host.cc ('k') | remoting/protocol/connection_to_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698