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 |
127 // Callback for |video_reader_|. | 130 // Callback for |video_reader_|. |
128 void OnVideoPacket(VideoPacket* packet); | 131 void OnVideoPacket(VideoPacket* packet); |
129 | 132 |
| 133 void CloseOnError(); |
| 134 |
130 // Stops writing in the channels. | 135 // Stops writing in the channels. |
131 void CloseChannels(); | 136 void CloseChannels(); |
132 | 137 |
133 MessageLoop* message_loop_; | 138 MessageLoop* message_loop_; |
134 scoped_ptr<talk_base::NetworkManager> network_manager_; | 139 scoped_ptr<talk_base::NetworkManager> network_manager_; |
135 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; | 140 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; |
136 scoped_ptr<HostResolverFactory> host_resolver_factory_; | 141 scoped_ptr<HostResolverFactory> host_resolver_factory_; |
137 scoped_ptr<PortAllocatorSessionFactory> port_allocator_session_factory_; | 142 scoped_ptr<PortAllocatorSessionFactory> port_allocator_session_factory_; |
138 bool allow_nat_traversal_; | 143 bool allow_nat_traversal_; |
139 | 144 |
140 // Internal state of the connection. | 145 std::string host_jid_; |
141 State state_; | 146 std::string host_public_key_; |
| 147 std::string access_code_; |
| 148 |
| 149 HostEventCallback* event_callback_; |
| 150 |
| 151 // Stub for incoming messages. |
| 152 ClientStub* client_stub_; |
| 153 VideoStub* video_stub_; |
142 | 154 |
143 scoped_ptr<SignalStrategy> signal_strategy_; | 155 scoped_ptr<SignalStrategy> signal_strategy_; |
144 std::string local_jid_; | 156 std::string local_jid_; |
145 scoped_ptr<SessionManager> session_manager_; | 157 scoped_ptr<SessionManager> session_manager_; |
146 scoped_ptr<Session> session_; | 158 scoped_ptr<Session> session_; |
147 | 159 |
| 160 // Handlers for incoming messages. |
148 scoped_ptr<VideoReader> video_reader_; | 161 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_; | 162 scoped_ptr<ClientMessageDispatcher> dispatcher_; |
157 | 163 |
158 //////////////////////////////////////////////////////////////////////////// | 164 // 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_; | 165 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_; | 166 scoped_ptr<HostControlSender> host_control_sender_; |
169 | 167 |
170 // Stub for receiving control messages from the host. | 168 // Internal state of the connection. |
171 ClientStub* client_stub_; | 169 State state_; |
172 | 170 |
173 //////////////////////////////////////////////////////////////////////////// | 171 // State of the channels. |
174 // Video channel interface | 172 bool control_connected_; |
175 | 173 bool input_connected_; |
176 // Stub for receiving video packets from the host. | 174 bool video_connected_; |
177 VideoStub* video_stub_; | |
178 | 175 |
179 private: | 176 private: |
180 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); | 177 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); |
181 }; | 178 }; |
182 | 179 |
183 } // namespace protocol | 180 } // namespace protocol |
184 } // namespace remoting | 181 } // namespace remoting |
185 | 182 |
186 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); | 183 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); |
187 | 184 |
188 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 185 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
OLD | NEW |