OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/protocol/transport_context.h" | 5 #include "remoting/protocol/transport_context.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
12 #include "base/thread_task_runner_handle.h" | 12 #include "base/thread_task_runner_handle.h" |
13 #include "remoting/base/url_request.h" | 13 #include "remoting/base/url_request.h" |
| 14 #include "remoting/protocol/http_ice_config_request.h" |
14 #include "remoting/protocol/jingle_info_request.h" | 15 #include "remoting/protocol/jingle_info_request.h" |
15 #include "remoting/protocol/port_allocator_factory.h" | 16 #include "remoting/protocol/port_allocator_factory.h" |
16 #include "third_party/webrtc/base/socketaddress.h" | 17 #include "third_party/webrtc/base/socketaddress.h" |
17 | 18 |
18 #if !defined(OS_NACL) | 19 #if !defined(OS_NACL) |
19 #include "jingle/glue/thread_wrapper.h" | 20 #include "jingle/glue/thread_wrapper.h" |
20 #include "net/url_request/url_request_context_getter.h" | 21 #include "net/url_request/url_request_context_getter.h" |
21 #include "remoting/protocol/chromium_port_allocator_factory.h" | 22 #include "remoting/protocol/chromium_port_allocator_factory.h" |
22 #endif // !defined(OS_NACL) | 23 #endif // !defined(OS_NACL) |
23 | 24 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 return; | 73 return; |
73 | 74 |
74 // Don't need to make jingleinfo request if both STUN and Relay are disabled. | 75 // Don't need to make jingleinfo request if both STUN and Relay are disabled. |
75 if ((network_settings_.flags & (NetworkSettings::NAT_TRAVERSAL_STUN | | 76 if ((network_settings_.flags & (NetworkSettings::NAT_TRAVERSAL_STUN | |
76 NetworkSettings::NAT_TRAVERSAL_RELAY)) == 0) { | 77 NetworkSettings::NAT_TRAVERSAL_RELAY)) == 0) { |
77 return; | 78 return; |
78 } | 79 } |
79 | 80 |
80 if (ice_config_.is_null() || | 81 if (ice_config_.is_null() || |
81 base::Time::Now() > ice_config_.expiration_time) { | 82 base::Time::Now() > ice_config_.expiration_time) { |
82 ice_config_request_.reset(new JingleInfoRequest(signal_strategy_)); | 83 if (!ice_config_url_.empty()) { |
| 84 ice_config_request_.reset(new HttpIceConfigRequest( |
| 85 url_request_factory_.get(), ice_config_url_)); |
| 86 } else { |
| 87 ice_config_request_.reset(new JingleInfoRequest(signal_strategy_)); |
| 88 } |
83 ice_config_request_->Send(base::Bind( | 89 ice_config_request_->Send(base::Bind( |
84 &TransportContext::OnIceConfig, base::Unretained(this))); | 90 &TransportContext::OnIceConfig, base::Unretained(this))); |
85 } | 91 } |
86 } | 92 } |
87 | 93 |
88 void TransportContext::OnIceConfig(const IceConfig& ice_config) { | 94 void TransportContext::OnIceConfig(const IceConfig& ice_config) { |
89 ice_config_ = ice_config; | 95 ice_config_ = ice_config; |
90 ice_config_request_.reset(); | 96 ice_config_request_.reset(); |
91 | 97 |
92 while (!pending_ice_config_callbacks_.empty()) { | 98 while (!pending_ice_config_callbacks_.empty()) { |
93 pending_ice_config_callbacks_.begin()->Run(ice_config_); | 99 pending_ice_config_callbacks_.begin()->Run(ice_config_); |
94 pending_ice_config_callbacks_.pop_front(); | 100 pending_ice_config_callbacks_.pop_front(); |
95 } | 101 } |
96 } | 102 } |
97 | 103 |
98 } // namespace protocol | 104 } // namespace protocol |
99 } // namespace remoting | 105 } // namespace remoting |
OLD | NEW |