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 namespace base { |
| 21 class MessageLoopProxy; |
| 22 } // namespace base |
21 | 23 |
22 namespace talk_base { | 24 namespace talk_base { |
23 class NetworkManager; | 25 class NetworkManager; |
24 class PacketSocketFactory; | 26 class PacketSocketFactory; |
25 } // namespace talk_base | 27 } // namespace talk_base |
26 | 28 |
27 namespace remoting { | 29 namespace remoting { |
28 | 30 |
29 class JingleThread; | 31 class JingleThread; |
30 class HostResolverFactory; | 32 class HostResolverFactory; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 virtual void OnConnectionClosed(ConnectionToHost* conn) = 0; | 69 virtual void OnConnectionClosed(ConnectionToHost* conn) = 0; |
68 | 70 |
69 // Called when the network connection has failed. | 71 // Called when the network connection has failed. |
70 virtual void OnConnectionFailed(ConnectionToHost* conn) = 0; | 72 virtual void OnConnectionFailed(ConnectionToHost* conn) = 0; |
71 }; | 73 }; |
72 | 74 |
73 // Takes ownership of |network_manager| and |socket_factory|. Both | 75 // Takes ownership of |network_manager| and |socket_factory|. Both |
74 // |network_manager| and |socket_factory| may be set to NULL. | 76 // |network_manager| and |socket_factory| may be set to NULL. |
75 // | 77 // |
76 // TODO(sergeyu): Constructor shouldn't need thread here. | 78 // TODO(sergeyu): Constructor shouldn't need thread here. |
77 ConnectionToHost(MessageLoop* network_message_loop, | 79 ConnectionToHost(base::MessageLoopProxy* network_message_loop, |
78 talk_base::NetworkManager* network_manager, | 80 talk_base::NetworkManager* network_manager, |
79 talk_base::PacketSocketFactory* socket_factory, | 81 talk_base::PacketSocketFactory* socket_factory, |
80 HostResolverFactory* host_resolver_factory, | 82 HostResolverFactory* host_resolver_factory, |
81 PortAllocatorSessionFactory* session_factory, | 83 PortAllocatorSessionFactory* session_factory, |
82 bool allow_nat_traversal); | 84 bool allow_nat_traversal); |
83 virtual ~ConnectionToHost(); | 85 virtual ~ConnectionToHost(); |
84 | 86 |
85 virtual void Connect(scoped_refptr<XmppProxy> xmpp_proxy, | 87 virtual void Connect(scoped_refptr<XmppProxy> xmpp_proxy, |
86 const std::string& your_jid, | 88 const std::string& your_jid, |
87 const std::string& host_jid, | 89 const std::string& host_jid, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 void NotifyIfChannelsReady(); | 132 void NotifyIfChannelsReady(); |
131 | 133 |
132 // Callback for |video_reader_|. | 134 // Callback for |video_reader_|. |
133 void OnVideoPacket(VideoPacket* packet); | 135 void OnVideoPacket(VideoPacket* packet); |
134 | 136 |
135 void CloseOnError(); | 137 void CloseOnError(); |
136 | 138 |
137 // Stops writing in the channels. | 139 // Stops writing in the channels. |
138 void CloseChannels(); | 140 void CloseChannels(); |
139 | 141 |
140 MessageLoop* message_loop_; | 142 scoped_refptr<base::MessageLoopProxy> message_loop_; |
141 scoped_ptr<talk_base::NetworkManager> network_manager_; | 143 scoped_ptr<talk_base::NetworkManager> network_manager_; |
142 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; | 144 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; |
143 scoped_ptr<HostResolverFactory> host_resolver_factory_; | 145 scoped_ptr<HostResolverFactory> host_resolver_factory_; |
144 scoped_ptr<PortAllocatorSessionFactory> port_allocator_session_factory_; | 146 scoped_ptr<PortAllocatorSessionFactory> port_allocator_session_factory_; |
145 bool allow_nat_traversal_; | 147 bool allow_nat_traversal_; |
146 | 148 |
147 std::string host_jid_; | 149 std::string host_jid_; |
148 std::string host_public_key_; | 150 std::string host_public_key_; |
149 std::string access_code_; | 151 std::string access_code_; |
150 | 152 |
(...skipping 27 matching lines...) Expand all Loading... |
178 private: | 180 private: |
179 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); | 181 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); |
180 }; | 182 }; |
181 | 183 |
182 } // namespace protocol | 184 } // namespace protocol |
183 } // namespace remoting | 185 } // namespace remoting |
184 | 186 |
185 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); | 187 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); |
186 | 188 |
187 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 189 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
OLD | NEW |