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 namespace base { | 20 namespace base { |
21 class MessageLoopProxy; | 21 class MessageLoopProxy; |
22 } // namespace base | 22 } // namespace base |
23 | 23 |
24 namespace pp { | 24 namespace pp { |
25 class Instance; | 25 class Instance; |
26 } // namespace pp | 26 } // namespace pp |
27 | 27 |
28 namespace talk_base { | |
29 class NetworkManager; | |
30 class PacketSocketFactory; | |
31 } // namespace talk_base | |
32 | |
33 namespace remoting { | 28 namespace remoting { |
34 | 29 |
35 class JingleThread; | 30 class JingleThread; |
36 class HostResolverFactory; | |
37 class PortAllocatorSessionFactory; | |
38 class XmppProxy; | 31 class XmppProxy; |
39 class VideoPacket; | 32 class VideoPacket; |
40 | 33 |
41 namespace protocol { | 34 namespace protocol { |
42 | 35 |
43 class ClientMessageDispatcher; | 36 class ClientMessageDispatcher; |
44 class ClientControlSender; | 37 class ClientControlSender; |
45 class ClientStub; | 38 class ClientStub; |
46 class HostControlSender; | 39 class HostControlSender; |
47 class HostStub; | 40 class HostStub; |
(...skipping 22 matching lines...) Expand all Loading... | |
70 virtual void OnConnectionOpened(ConnectionToHost* conn) = 0; | 63 virtual void OnConnectionOpened(ConnectionToHost* conn) = 0; |
71 | 64 |
72 // Called when the network connection is closed. | 65 // Called when the network connection is closed. |
73 virtual void OnConnectionClosed(ConnectionToHost* conn) = 0; | 66 virtual void OnConnectionClosed(ConnectionToHost* conn) = 0; |
74 | 67 |
75 // Called when the network connection has failed. | 68 // Called when the network connection has failed. |
76 virtual void OnConnectionFailed(ConnectionToHost* conn) = 0; | 69 virtual void OnConnectionFailed(ConnectionToHost* conn) = 0; |
77 }; | 70 }; |
78 | 71 |
79 // Takes ownership of |network_manager| and |socket_factory|. Both | 72 // Takes ownership of |network_manager| and |socket_factory|. Both |
80 // |network_manager| and |socket_factory| may be set to NULL. | 73 // |network_manager| and |socket_factory| may be set to NULL. |
Wez
2011/09/22 13:49:45
Remove this comment.
Sergey Ulanov
2011/09/22 18:12:00
Done.
| |
81 // | 74 // |
82 // TODO(sergeyu): Constructor shouldn't need thread here. | 75 // TODO(sergeyu): Constructor shouldn't need thread here. |
Wez
2011/09/22 13:49:45
nit: This comment is out-of-date.
Sergey Ulanov
2011/09/22 18:12:00
Done.
| |
83 ConnectionToHost(base::MessageLoopProxy* network_message_loop, | 76 ConnectionToHost(base::MessageLoopProxy* network_message_loop, |
84 pp::Instance* pp_instance, | 77 pp::Instance* pp_instance, |
85 talk_base::NetworkManager* network_manager, | |
86 talk_base::PacketSocketFactory* socket_factory, | |
87 HostResolverFactory* host_resolver_factory, | |
88 PortAllocatorSessionFactory* session_factory, | |
89 bool allow_nat_traversal); | 78 bool allow_nat_traversal); |
90 virtual ~ConnectionToHost(); | 79 virtual ~ConnectionToHost(); |
91 | 80 |
92 virtual void Connect(scoped_refptr<XmppProxy> xmpp_proxy, | 81 virtual void Connect(scoped_refptr<XmppProxy> xmpp_proxy, |
93 const std::string& your_jid, | 82 const std::string& your_jid, |
94 const std::string& host_jid, | 83 const std::string& host_jid, |
95 const std::string& host_public_key, | 84 const std::string& host_public_key, |
96 const std::string& access_code, | 85 const std::string& access_code, |
97 HostEventCallback* event_callback, | 86 HostEventCallback* event_callback, |
98 ClientStub* client_stub, | 87 ClientStub* client_stub, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 // Callback for |video_reader_|. | 128 // Callback for |video_reader_|. |
140 void OnVideoPacket(VideoPacket* packet); | 129 void OnVideoPacket(VideoPacket* packet); |
141 | 130 |
142 void CloseOnError(); | 131 void CloseOnError(); |
143 | 132 |
144 // Stops writing in the channels. | 133 // Stops writing in the channels. |
145 void CloseChannels(); | 134 void CloseChannels(); |
146 | 135 |
147 scoped_refptr<base::MessageLoopProxy> message_loop_; | 136 scoped_refptr<base::MessageLoopProxy> message_loop_; |
148 pp::Instance* pp_instance_; | 137 pp::Instance* pp_instance_; |
149 scoped_ptr<talk_base::NetworkManager> network_manager_; | |
150 scoped_ptr<talk_base::PacketSocketFactory> socket_factory_; | |
151 scoped_ptr<HostResolverFactory> host_resolver_factory_; | |
152 scoped_ptr<PortAllocatorSessionFactory> port_allocator_session_factory_; | |
153 bool allow_nat_traversal_; | 138 bool allow_nat_traversal_; |
154 | 139 |
155 std::string host_jid_; | 140 std::string host_jid_; |
156 std::string host_public_key_; | 141 std::string host_public_key_; |
157 std::string access_code_; | 142 std::string access_code_; |
158 | 143 |
159 HostEventCallback* event_callback_; | 144 HostEventCallback* event_callback_; |
160 | 145 |
161 // Stub for incoming messages. | 146 // Stub for incoming messages. |
162 ClientStub* client_stub_; | 147 ClientStub* client_stub_; |
(...skipping 23 matching lines...) Expand all Loading... | |
186 private: | 171 private: |
187 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); | 172 DISALLOW_COPY_AND_ASSIGN(ConnectionToHost); |
188 }; | 173 }; |
189 | 174 |
190 } // namespace protocol | 175 } // namespace protocol |
191 } // namespace remoting | 176 } // namespace remoting |
192 | 177 |
193 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); | 178 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::protocol::ConnectionToHost); |
194 | 179 |
195 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ | 180 #endif // REMOTING_PROTOCOL_CONNECTION_TO_HOST_H_ |
OLD | NEW |