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 "net/base/net_util.h" | 8 #include "net/base/net_util.h" |
9 #include "ppapi/c/pp_errors.h" | 9 #include "ppapi/c/pp_errors.h" |
10 #include "ppapi/cpp/completion_callback.h" | 10 #include "ppapi/cpp/completion_callback.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 121 } |
122 } | 122 } |
123 relay->ports = filtered_ports; | 123 relay->ports = filtered_ports; |
124 } | 124 } |
125 cricket::BasicPortAllocatorSession::ConfigReady(config); | 125 cricket::BasicPortAllocatorSession::ConfigReady(config); |
126 } | 126 } |
127 | 127 |
128 void PepperPortAllocatorSession::GetPortConfigurations() { | 128 void PepperPortAllocatorSession::GetPortConfigurations() { |
129 // Add an empty configuration synchronously, so a local connection | 129 // Add an empty configuration synchronously, so a local connection |
130 // can be started immediately. | 130 // can be started immediately. |
131 ConfigReady(new cricket::PortConfiguration(talk_base::SocketAddress())); | 131 ConfigReady(new cricket::PortConfiguration( |
| 132 talk_base::SocketAddress(), "", "")); |
132 | 133 |
133 ResolveStunServerAddress(); | 134 ResolveStunServerAddress(); |
134 TryCreateRelaySession(); | 135 TryCreateRelaySession(); |
135 } | 136 } |
136 | 137 |
137 void PepperPortAllocatorSession::ResolveStunServerAddress() { | 138 void PepperPortAllocatorSession::ResolveStunServerAddress() { |
138 if (stun_address_.IsNil()) { | 139 if (stun_address_.IsNil()) { |
139 return; | 140 return; |
140 } | 141 } |
141 | 142 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // and Relay parameters are stored together in PortConfiguration | 185 // and Relay parameters are stored together in PortConfiguration |
185 // and ReceiveSessionResponse() doesn't save relay session | 186 // and ReceiveSessionResponse() doesn't save relay session |
186 // configuration for the case we resolve STUN address later. This | 187 // configuration for the case we resolve STUN address later. This |
187 // method invokes overriden ConfigReady() which then submits | 188 // method invokes overriden ConfigReady() which then submits |
188 // resolved |stun_address_|. | 189 // resolved |stun_address_|. |
189 // | 190 // |
190 // TODO(sergeyu): Refactor HttpPortAllocatorSessionBase to fix this. | 191 // TODO(sergeyu): Refactor HttpPortAllocatorSessionBase to fix this. |
191 ReceiveSessionResponse(std::string(relay_response_body_.begin(), | 192 ReceiveSessionResponse(std::string(relay_response_body_.begin(), |
192 relay_response_body_.end())); | 193 relay_response_body_.end())); |
193 } else { | 194 } else { |
194 ConfigReady(new cricket::PortConfiguration(stun_address_)); | 195 ConfigReady(new cricket::PortConfiguration(stun_address_, "", "")); |
195 } | 196 } |
196 } | 197 } |
197 | 198 |
198 void PepperPortAllocatorSession::SendSessionRequest( | 199 void PepperPortAllocatorSession::SendSessionRequest( |
199 const std::string& host, | 200 const std::string& host, |
200 int port) { | 201 int port) { |
201 relay_url_loader_.reset(new pp::URLLoader(instance_)); | 202 relay_url_loader_.reset(new pp::URLLoader(instance_)); |
202 pp::URLRequestInfo request_info(instance_); | 203 pp::URLRequestInfo request_info(instance_); |
203 std::string url = "https://" + host + ":" + base::IntToString(port) + | 204 std::string url = "https://" + host + ":" + base::IntToString(port) + |
204 GetSessionRequestUrl() + "&sn=1"; | 205 GetSessionRequestUrl() + "&sn=1"; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 const std::string& content_name, | 342 const std::string& content_name, |
342 int component, | 343 int component, |
343 const std::string& ice_username_fragment, | 344 const std::string& ice_username_fragment, |
344 const std::string& ice_password) { | 345 const std::string& ice_password) { |
345 return new PepperPortAllocatorSession( | 346 return new PepperPortAllocatorSession( |
346 this, content_name, component, ice_username_fragment, ice_password, | 347 this, content_name, component, ice_username_fragment, ice_password, |
347 stun_hosts(), relay_hosts(), relay_token(), instance_); | 348 stun_hosts(), relay_hosts(), relay_token(), instance_); |
348 } | 349 } |
349 | 350 |
350 } // namespace remoting | 351 } // namespace remoting |
OLD | NEW |