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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/task.h" | 12 #include "base/task.h" |
13 #include "remoting/jingle_glue/signal_strategy.h" | 13 #include "remoting/jingle_glue/signal_strategy.h" |
14 #include "remoting/proto/internal.pb.h" | 14 #include "remoting/proto/internal.pb.h" |
15 #include "remoting/protocol/connection_to_host.h" | 15 #include "remoting/protocol/connection_to_host.h" |
16 #include "remoting/protocol/message_reader.h" | 16 #include "remoting/protocol/message_reader.h" |
17 #include "remoting/protocol/session.h" | 17 #include "remoting/protocol/session.h" |
18 #include "remoting/protocol/session_manager.h" | 18 #include "remoting/protocol/session_manager.h" |
19 | 19 |
20 class MessageLoop; | 20 class MessageLoop; |
21 | 21 |
22 namespace talk_base { | 22 namespace talk_base { |
23 class NetworkManager; | 23 class NetworkManager; |
24 class PacketSocketFactory; | 24 class PacketSocketFactory; |
25 } // namespace talk_base | 25 } // namespace talk_base |
26 | 26 |
27 namespace remoting { | 27 namespace remoting { |
28 | 28 |
29 class JingleThread; | 29 class JingleThread; |
| 30 class HostAddressResolver; |
30 class PortAllocatorSessionFactory; | 31 class PortAllocatorSessionFactory; |
31 class XmppProxy; | 32 class XmppProxy; |
32 class VideoPacket; | 33 class VideoPacket; |
33 | 34 |
34 namespace protocol { | 35 namespace protocol { |
35 | 36 |
36 class ClientMessageDispatcher; | 37 class ClientMessageDispatcher; |
37 class ClientControlSender; | 38 class ClientControlSender; |
38 class ClientStub; | 39 class ClientStub; |
39 class HostControlSender; | 40 class HostControlSender; |
(...skipping 29 matching lines...) Expand all Loading... |
69 virtual void OnConnectionFailed(ConnectionToHost* conn) = 0; | 70 virtual void OnConnectionFailed(ConnectionToHost* conn) = 0; |
70 }; | 71 }; |
71 | 72 |
72 // Takes ownership of |network_manager| and |socket_factory|. Both | 73 // Takes ownership of |network_manager| and |socket_factory|. Both |
73 // |network_manager| and |socket_factory| may be set to NULL. | 74 // |network_manager| and |socket_factory| may be set to NULL. |
74 // | 75 // |
75 // TODO(sergeyu): Constructor shouldn't need thread here. | 76 // TODO(sergeyu): Constructor shouldn't need thread here. |
76 ConnectionToHost(MessageLoop* network_message_loop, | 77 ConnectionToHost(MessageLoop* network_message_loop, |
77 talk_base::NetworkManager* network_manager, | 78 talk_base::NetworkManager* network_manager, |
78 talk_base::PacketSocketFactory* socket_factory, | 79 talk_base::PacketSocketFactory* socket_factory, |
| 80 HostAddressResolver* host_address_resolver, |
79 PortAllocatorSessionFactory* session_factory, | 81 PortAllocatorSessionFactory* session_factory, |
80 bool allow_nat_traversal); | 82 bool allow_nat_traversal); |
81 virtual ~ConnectionToHost(); | 83 virtual ~ConnectionToHost(); |
82 | 84 |
83 virtual void Connect(scoped_refptr<XmppProxy> xmpp_proxy, | 85 virtual void Connect(scoped_refptr<XmppProxy> xmpp_proxy, |
84 const std::string& your_jid, | 86 const std::string& your_jid, |
85 const std::string& host_jid, | 87 const std::string& host_jid, |
86 const std::string& host_public_key, | 88 const std::string& host_public_key, |
87 const std::string& access_code, | 89 const std::string& access_code, |
88 HostEventCallback* event_callback, | 90 HostEventCallback* event_callback, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 126 |
125 // Callback for |video_reader_|. | 127 // Callback for |video_reader_|. |
126 void OnVideoPacket(VideoPacket* packet); | 128 void OnVideoPacket(VideoPacket* packet); |
127 | 129 |
128 // Stops writing in the channels. | 130 // Stops writing in the channels. |
129 void CloseChannels(); | 131 void CloseChannels(); |
130 | 132 |
131 MessageLoop* message_loop_; | 133 MessageLoop* message_loop_; |
132 scoped_ptr<talk_base::NetworkManager> network_manager_; | 134 scoped_ptr<talk_base::NetworkManager> network_manager_; |
133 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; | 135 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; |
| 136 scoped_ptr<HostAddressResolver> host_address_resolver_; |
134 scoped_ptr<PortAllocatorSessionFactory> port_allocator_session_factory_; | 137 scoped_ptr<PortAllocatorSessionFactory> port_allocator_session_factory_; |
135 bool allow_nat_traversal_; | 138 bool allow_nat_traversal_; |
136 | 139 |
137 // Internal state of the connection. | 140 // Internal state of the connection. |
138 State state_; | 141 State state_; |
139 | 142 |
140 scoped_ptr<SignalStrategy> signal_strategy_; | 143 scoped_ptr<SignalStrategy> signal_strategy_; |
141 std::string local_jid_; | 144 std::string local_jid_; |
142 scoped_ptr<SessionManager> session_manager_; | 145 scoped_ptr<SessionManager> session_manager_; |
143 scoped_ptr<Session> session_; | 146 scoped_ptr<Session> session_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 private: | 179 private: |
177 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); | 180 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); |
178 }; | 181 }; |
179 | 182 |
180 } // namespace protocol | 183 } // namespace protocol |
181 } // namespace remoting | 184 } // namespace remoting |
182 | 185 |
183 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); | 186 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); |
184 | 187 |
185 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 188 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
OLD | NEW |