OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_H_ | 5 #ifndef REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 6 #define REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 State state() const; | 117 State state() const; |
118 | 118 |
119 private: | 119 private: |
120 // Called on the jingle thread after we've successfully to XMPP server. Starts | 120 // Called on the jingle thread after we've successfully to XMPP server. Starts |
121 // P2P connection to the host. | 121 // P2P connection to the host. |
122 void InitSession(); | 122 void InitSession(); |
123 | 123 |
124 // Callback for |session_|. | 124 // Callback for |session_|. |
125 void OnSessionStateChange(Session::State state); | 125 void OnSessionStateChange(Session::State state); |
126 | 126 |
| 127 // Callback for VideoReader::Init(). |
| 128 void OnVideoChannelInitialized(bool successful); |
| 129 |
| 130 void NotifyIfChannelsReady(); |
| 131 |
127 // Callback for |video_reader_|. | 132 // Callback for |video_reader_|. |
128 void OnVideoPacket(VideoPacket* packet); | 133 void OnVideoPacket(VideoPacket* packet); |
129 | 134 |
| 135 void CloseOnError(); |
| 136 |
130 // Stops writing in the channels. | 137 // Stops writing in the channels. |
131 void CloseChannels(); | 138 void CloseChannels(); |
132 | 139 |
133 MessageLoop* message_loop_; | 140 MessageLoop* message_loop_; |
134 scoped_ptr<talk_base::NetworkManager> network_manager_; | 141 scoped_ptr<talk_base::NetworkManager> network_manager_; |
135 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; | 142 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; |
136 scoped_ptr<HostResolverFactory> host_resolver_factory_; | 143 scoped_ptr<HostResolverFactory> host_resolver_factory_; |
137 scoped_ptr<PortAllocatorSessionFactory> port_allocator_session_factory_; | 144 scoped_ptr<PortAllocatorSessionFactory> port_allocator_session_factory_; |
138 bool allow_nat_traversal_; | 145 bool allow_nat_traversal_; |
139 | 146 |
140 // Internal state of the connection. | 147 std::string host_jid_; |
141 State state_; | 148 std::string host_public_key_; |
| 149 std::string access_code_; |
| 150 |
| 151 HostEventCallback* event_callback_; |
| 152 |
| 153 // Stub for incoming messages. |
| 154 ClientStub* client_stub_; |
| 155 VideoStub* video_stub_; |
142 | 156 |
143 scoped_ptr<SignalStrategy> signal_strategy_; | 157 scoped_ptr<SignalStrategy> signal_strategy_; |
144 std::string local_jid_; | 158 std::string local_jid_; |
145 scoped_ptr<SessionManager> session_manager_; | 159 scoped_ptr<SessionManager> session_manager_; |
146 scoped_ptr<Session> session_; | 160 scoped_ptr<Session> session_; |
147 | 161 |
| 162 // Handlers for incoming messages. |
148 scoped_ptr<VideoReader> video_reader_; | 163 scoped_ptr<VideoReader> video_reader_; |
149 | |
150 HostEventCallback* event_callback_; | |
151 | |
152 std::string host_jid_; | |
153 std::string host_public_key_; | |
154 std::string access_code_; | |
155 | |
156 scoped_ptr<ClientMessageDispatcher> dispatcher_; | 164 scoped_ptr<ClientMessageDispatcher> dispatcher_; |
157 | 165 |
158 //////////////////////////////////////////////////////////////////////////// | 166 // Senders for outgoing messages. |
159 // User input event channel interface | |
160 | |
161 // Stub for sending input event messages to the host. | |
162 scoped_ptr<InputSender> input_sender_; | 167 scoped_ptr<InputSender> input_sender_; |
163 | |
164 //////////////////////////////////////////////////////////////////////////// | |
165 // Protocol control channel interface | |
166 | |
167 // Stub for sending control messages to the host. | |
168 scoped_ptr<HostControlSender> host_control_sender_; | 168 scoped_ptr<HostControlSender> host_control_sender_; |
169 | 169 |
170 // Stub for receiving control messages from the host. | 170 // Internal state of the connection. |
171 ClientStub* client_stub_; | 171 State state_; |
172 | 172 |
173 //////////////////////////////////////////////////////////////////////////// | 173 // State of the channels. |
174 // Video channel interface | 174 bool control_connected_; |
175 | 175 bool input_connected_; |
176 // Stub for receiving video packets from the host. | 176 bool video_connected_; |
177 VideoStub* video_stub_; | |
178 | 177 |
179 private: | 178 private: |
180 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); | 179 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); |
181 }; | 180 }; |
182 | 181 |
183 } // namespace protocol | 182 } // namespace protocol |
184 } // namespace remoting | 183 } // namespace remoting |
185 | 184 |
186 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); | 185 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); |
187 | 186 |
188 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 187 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
OLD | NEW |