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

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

Issue 1520323007: Simplify ConnectionToHost interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sm_cleanup
Patch Set: Created 5 years 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.h ('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
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_CONNECTION_TO_HOST_IMPL_H_ 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_IMPL_H_
6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_IMPL_H_ 6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_IMPL_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback_forward.h" 11 #include "base/callback_forward.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/threading/non_thread_safe.h" 14 #include "base/threading/non_thread_safe.h"
15 #include "remoting/proto/internal.pb.h" 15 #include "remoting/proto/internal.pb.h"
16 #include "remoting/protocol/channel_dispatcher_base.h" 16 #include "remoting/protocol/channel_dispatcher_base.h"
17 #include "remoting/protocol/clipboard_filter.h" 17 #include "remoting/protocol/clipboard_filter.h"
18 #include "remoting/protocol/connection_to_host.h" 18 #include "remoting/protocol/connection_to_host.h"
19 #include "remoting/protocol/errors.h" 19 #include "remoting/protocol/errors.h"
20 #include "remoting/protocol/input_filter.h" 20 #include "remoting/protocol/input_filter.h"
21 #include "remoting/protocol/message_reader.h" 21 #include "remoting/protocol/message_reader.h"
22 #include "remoting/protocol/monitored_video_stub.h" 22 #include "remoting/protocol/monitored_video_stub.h"
23 #include "remoting/protocol/session.h" 23 #include "remoting/protocol/session.h"
24 #include "remoting/protocol/session_config.h" 24 #include "remoting/protocol/session_config.h"
25 #include "remoting/protocol/session_manager.h" 25 #include "remoting/protocol/session_manager.h"
26 #include "remoting/signaling/signal_strategy.h"
27 26
28 namespace remoting { 27 namespace remoting {
29
30 class XmppProxy;
31 class VideoPacket;
32
33 namespace protocol { 28 namespace protocol {
34 29
35 class AudioReader; 30 class AudioReader;
36 class ClientControlDispatcher; 31 class ClientControlDispatcher;
37 class ClientEventDispatcher; 32 class ClientEventDispatcher;
38 class ClientVideoDispatcher; 33 class ClientVideoDispatcher;
39 34
40 class ConnectionToHostImpl : public ConnectionToHost, 35 class ConnectionToHostImpl : public ConnectionToHost,
41 public SignalStrategy::Listener,
42 public Session::EventHandler, 36 public Session::EventHandler,
43 public ChannelDispatcherBase::EventHandler, 37 public ChannelDispatcherBase::EventHandler,
44 public base::NonThreadSafe { 38 public base::NonThreadSafe {
45 public: 39 public:
46 ConnectionToHostImpl(); 40 ConnectionToHostImpl();
47 ~ConnectionToHostImpl() override; 41 ~ConnectionToHostImpl() override;
48 42
49 // ConnectionToHost interface. 43 // ConnectionToHost interface.
50 void set_candidate_config(scoped_ptr<CandidateSessionConfig> config) override;
51 void set_client_stub(ClientStub* client_stub) override; 44 void set_client_stub(ClientStub* client_stub) override;
52 void set_clipboard_stub(ClipboardStub* clipboard_stub) override; 45 void set_clipboard_stub(ClipboardStub* clipboard_stub) override;
53 void set_video_stub(VideoStub* video_stub) override; 46 void set_video_stub(VideoStub* video_stub) override;
54 void set_audio_stub(AudioStub* audio_stub) override; 47 void set_audio_stub(AudioStub* audio_stub) override;
55 void Connect(SignalStrategy* signal_strategy, 48 void Connect(scoped_ptr<Session> session,
56 scoped_refptr<TransportContext> transport_context,
57 scoped_ptr<Authenticator> authenticator,
58 const std::string& host_jid,
59 HostEventCallback* event_callback) override; 49 HostEventCallback* event_callback) override;
60 const SessionConfig& config() override; 50 const SessionConfig& config() override;
61 ClipboardStub* clipboard_forwarder() override; 51 ClipboardStub* clipboard_forwarder() override;
62 HostStub* host_stub() override; 52 HostStub* host_stub() override;
63 InputStub* input_stub() override; 53 InputStub* input_stub() override;
64 State state() const override; 54 State state() const override;
65 55
66 private: 56 private:
67 void StartSession();
68
69 // SignalStrategy::StatusObserver interface.
70 void OnSignalStrategyStateChange(SignalStrategy::State state) override;
71 bool OnSignalStrategyIncomingStanza(const buzz::XmlElement* stanza) override;
72
73 // Session::EventHandler interface. 57 // Session::EventHandler interface.
74 void OnSessionStateChange(Session::State state) override; 58 void OnSessionStateChange(Session::State state) override;
75 void OnSessionRouteChange(const std::string& channel_name, 59 void OnSessionRouteChange(const std::string& channel_name,
76 const TransportRoute& route) override; 60 const TransportRoute& route) override;
77 61
78 // ChannelDispatcherBase::EventHandler interface. 62 // ChannelDispatcherBase::EventHandler interface.
79 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override; 63 void OnChannelInitialized(ChannelDispatcherBase* channel_dispatcher) override;
80 void OnChannelError(ChannelDispatcherBase* channel_dispatcher, 64 void OnChannelError(ChannelDispatcherBase* channel_dispatcher,
81 ErrorCode error) override; 65 ErrorCode error) override;
82 66
83 // MonitoredVideoStub::EventHandler interface. 67 // MonitoredVideoStub::EventHandler interface.
84 virtual void OnVideoChannelStatus(bool active); 68 virtual void OnVideoChannelStatus(bool active);
85 69
86 void NotifyIfChannelsReady(); 70 void NotifyIfChannelsReady();
87 71
88 void CloseOnError(ErrorCode error); 72 void CloseOnError(ErrorCode error);
89 73
90 // Stops writing in the channels. 74 // Stops writing in the channels.
91 void CloseChannels(); 75 void CloseChannels();
92 76
93 void SetState(State state, ErrorCode error); 77 void SetState(State state, ErrorCode error);
94 78
95 std::string host_jid_; 79 HostEventCallback* event_callback_ = nullptr;
96 std::string host_public_key_;
97 scoped_ptr<Authenticator> authenticator_;
98
99 HostEventCallback* event_callback_;
100
101 scoped_ptr<CandidateSessionConfig> candidate_config_;
102 80
103 // Stub for incoming messages. 81 // Stub for incoming messages.
104 ClientStub* client_stub_; 82 ClientStub* client_stub_ = nullptr;
105 ClipboardStub* clipboard_stub_; 83 ClipboardStub* clipboard_stub_ = nullptr;
106 AudioStub* audio_stub_; 84 AudioStub* audio_stub_ = nullptr;
107 85
108 SignalStrategy* signal_strategy_;
109 scoped_ptr<SessionManager> session_manager_; 86 scoped_ptr<SessionManager> session_manager_;
110 scoped_ptr<Session> session_; 87 scoped_ptr<Session> session_;
111 scoped_ptr<MonitoredVideoStub> monitored_video_stub_; 88 scoped_ptr<MonitoredVideoStub> monitored_video_stub_;
112 89
113 scoped_ptr<ClientVideoDispatcher> video_dispatcher_; 90 scoped_ptr<ClientVideoDispatcher> video_dispatcher_;
114 scoped_ptr<AudioReader> audio_reader_; 91 scoped_ptr<AudioReader> audio_reader_;
115 scoped_ptr<ClientControlDispatcher> control_dispatcher_; 92 scoped_ptr<ClientControlDispatcher> control_dispatcher_;
116 scoped_ptr<ClientEventDispatcher> event_dispatcher_; 93 scoped_ptr<ClientEventDispatcher> event_dispatcher_;
117 ClipboardFilter clipboard_forwarder_; 94 ClipboardFilter clipboard_forwarder_;
118 InputFilter event_forwarder_; 95 InputFilter event_forwarder_;
119 96
120 // Internal state of the connection. 97 // Internal state of the connection.
121 State state_; 98 State state_ = INITIALIZING;
122 ErrorCode error_; 99 ErrorCode error_ = OK;
123 100
124 private: 101 private:
125 DISALLOW_COPY_AND_ASSIGN(ConnectionToHostImpl); 102 DISALLOW_COPY_AND_ASSIGN(ConnectionToHostImpl);
126 }; 103 };
127 104
128 } // namespace protocol 105 } // namespace protocol
129 } // namespace remoting 106 } // namespace remoting
130 107
131 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_IMPL_H_ 108 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « remoting/protocol/connection_to_host.h ('k') | remoting/protocol/connection_to_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698