OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "remoting/client/plugin/pepper_port_allocator.h" | 5 #include "remoting/client/plugin/pepper_port_allocator.h" |
6 | 6 |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/cpp/completion_callback.h" | 9 #include "ppapi/cpp/completion_callback.h" |
10 #include "ppapi/cpp/url_loader.h" | 10 #include "ppapi/cpp/url_loader.h" |
(...skipping 10 matching lines...) Expand all Loading... | |
21 // URLLoader. Normally the response from URL loader is smaller than 1kB. | 21 // URLLoader. Normally the response from URL loader is smaller than 1kB. |
22 const int kReadSize = 1024; | 22 const int kReadSize = 1024; |
23 | 23 |
24 class PepperPortAllocatorSession | 24 class PepperPortAllocatorSession |
25 : public cricket::HttpPortAllocatorSessionBase { | 25 : public cricket::HttpPortAllocatorSessionBase { |
26 public: | 26 public: |
27 PepperPortAllocatorSession( | 27 PepperPortAllocatorSession( |
28 cricket::HttpPortAllocatorBase* allocator, | 28 cricket::HttpPortAllocatorBase* allocator, |
29 const std::string& channel_name, | 29 const std::string& channel_name, |
30 int component, | 30 int component, |
31 const std::string& ice_ufrag, | |
Sergey Ulanov
2012/05/09 18:58:00
here and below in this file.
Mallinath (Gone from Chromium)
2012/05/09 22:04:22
Done.
| |
32 const std::string& ice_pwd, | |
31 const std::vector<talk_base::SocketAddress>& stun_hosts, | 33 const std::vector<talk_base::SocketAddress>& stun_hosts, |
32 const std::vector<std::string>& relay_hosts, | 34 const std::vector<std::string>& relay_hosts, |
33 const std::string& relay, | 35 const std::string& relay, |
34 const pp::InstanceHandle& instance); | 36 const pp::InstanceHandle& instance); |
35 virtual ~PepperPortAllocatorSession(); | 37 virtual ~PepperPortAllocatorSession(); |
36 | 38 |
37 // cricket::HttpPortAllocatorBase overrides. | 39 // cricket::HttpPortAllocatorBase overrides. |
38 virtual void ConfigReady(cricket::PortConfiguration* config) OVERRIDE; | 40 virtual void ConfigReady(cricket::PortConfiguration* config) OVERRIDE; |
39 virtual void SendSessionRequest(const std::string& host, int port) OVERRIDE; | 41 virtual void SendSessionRequest(const std::string& host, int port) OVERRIDE; |
40 | 42 |
(...skipping 11 matching lines...) Expand all Loading... | |
52 scoped_ptr<pp::URLLoader> url_loader_; | 54 scoped_ptr<pp::URLLoader> url_loader_; |
53 std::vector<char> body_; | 55 std::vector<char> body_; |
54 | 56 |
55 DISALLOW_COPY_AND_ASSIGN(PepperPortAllocatorSession); | 57 DISALLOW_COPY_AND_ASSIGN(PepperPortAllocatorSession); |
56 }; | 58 }; |
57 | 59 |
58 PepperPortAllocatorSession::PepperPortAllocatorSession( | 60 PepperPortAllocatorSession::PepperPortAllocatorSession( |
59 cricket::HttpPortAllocatorBase* allocator, | 61 cricket::HttpPortAllocatorBase* allocator, |
60 const std::string& channel_name, | 62 const std::string& channel_name, |
61 int component, | 63 int component, |
64 const std::string& ice_ufrag, | |
65 const std::string& ice_pwd, | |
62 const std::vector<talk_base::SocketAddress>& stun_hosts, | 66 const std::vector<talk_base::SocketAddress>& stun_hosts, |
63 const std::vector<std::string>& relay_hosts, | 67 const std::vector<std::string>& relay_hosts, |
64 const std::string& relay, | 68 const std::string& relay, |
65 const pp::InstanceHandle& instance) | 69 const pp::InstanceHandle& instance) |
66 : HttpPortAllocatorSessionBase( | 70 : HttpPortAllocatorSessionBase( |
67 allocator, channel_name, component, stun_hosts, relay_hosts, relay, ""), | 71 allocator, channel_name, component, ice_ufrag, ice_pwd, |
72 stun_hosts, relay_hosts, relay, ""), | |
68 instance_(instance) { | 73 instance_(instance) { |
69 } | 74 } |
70 | 75 |
71 PepperPortAllocatorSession::~PepperPortAllocatorSession() { | 76 PepperPortAllocatorSession::~PepperPortAllocatorSession() { |
72 } | 77 } |
73 | 78 |
74 void PepperPortAllocatorSession::ConfigReady( | 79 void PepperPortAllocatorSession::ConfigReady( |
75 cricket::PortConfiguration* config) { | 80 cricket::PortConfiguration* config) { |
76 // Filter out non-UDP relay ports, so that we don't try using TCP. | 81 // Filter out non-UDP relay ports, so that we don't try using TCP. |
77 for (cricket::PortConfiguration::RelayList::iterator relay = | 82 for (cricket::PortConfiguration::RelayList::iterator relay = |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
205 scoped_ptr<talk_base::PacketSocketFactory> socket_factory) | 210 scoped_ptr<talk_base::PacketSocketFactory> socket_factory) |
206 : HttpPortAllocatorBase(network_manager.get(), socket_factory.get(), ""), | 211 : HttpPortAllocatorBase(network_manager.get(), socket_factory.get(), ""), |
207 instance_(instance), | 212 instance_(instance), |
208 network_manager_(network_manager.Pass()), | 213 network_manager_(network_manager.Pass()), |
209 socket_factory_(socket_factory.Pass()) { | 214 socket_factory_(socket_factory.Pass()) { |
210 } | 215 } |
211 | 216 |
212 PepperPortAllocator::~PepperPortAllocator() { | 217 PepperPortAllocator::~PepperPortAllocator() { |
213 } | 218 } |
214 | 219 |
215 cricket::PortAllocatorSession* PepperPortAllocator::CreateSession( | 220 cricket::PortAllocatorSession* PepperPortAllocator::CreateSessionInternal( |
216 const std::string& channel_name, | 221 const std::string& channel_name, |
217 int component) { | 222 int component, |
223 const std::string& ice_ufrag, | |
224 const std::string& ice_pwd) { | |
218 return new PepperPortAllocatorSession( | 225 return new PepperPortAllocatorSession( |
219 this, channel_name, component, stun_hosts(), | 226 this, channel_name, component, ice_ufrag, ice_pwd, stun_hosts(), |
220 relay_hosts(), relay_token(), instance_); | 227 relay_hosts(), relay_token(), instance_); |
221 } | 228 } |
222 | 229 |
223 } // namespace remoting | 230 } // namespace remoting |
OLD | NEW |