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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
11 #include "remoting/protocol/port_allocator_factory.h" | 11 #include "remoting/protocol/port_allocator_factory.h" |
12 #include "third_party/webrtc/p2p/client/httpportallocator.h" | 12 #include "third_party/webrtc/p2p/client/httpportallocator.h" |
13 | 13 |
| 14 #if !defined(OS_NACL) |
| 15 #include "jingle/glue/thread_wrapper.h" |
| 16 #include "net/url_request/url_request_context_getter.h" |
| 17 #include "remoting/protocol/chromium_port_allocator.h" |
| 18 #endif // !defined(OS_NACL) |
| 19 |
14 namespace remoting { | 20 namespace remoting { |
15 namespace protocol { | 21 namespace protocol { |
16 | 22 |
17 // Get fresh STUN/Relay configuration every hour. | 23 // Get fresh STUN/Relay configuration every hour. |
18 static const int kJingleInfoUpdatePeriodSeconds = 3600; | 24 static const int kJingleInfoUpdatePeriodSeconds = 3600; |
19 | 25 |
| 26 #if !defined(OS_NACL) |
| 27 // static |
| 28 scoped_refptr<TransportContext> TransportContext::ForTests(TransportRole role) { |
| 29 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
| 30 return new protocol::TransportContext( |
| 31 nullptr, make_scoped_ptr( |
| 32 new protocol::ChromiumPortAllocatorFactory(nullptr)), |
| 33 protocol::NetworkSettings( |
| 34 protocol::NetworkSettings::NAT_TRAVERSAL_OUTGOING), |
| 35 role); |
| 36 } |
| 37 #endif // !defined(OS_NACL) |
| 38 |
20 TransportContext::TransportContext( | 39 TransportContext::TransportContext( |
21 SignalStrategy* signal_strategy, | 40 SignalStrategy* signal_strategy, |
22 scoped_ptr<PortAllocatorFactory> port_allocator_factory, | 41 scoped_ptr<PortAllocatorFactory> port_allocator_factory, |
23 const NetworkSettings& network_settings, | 42 const NetworkSettings& network_settings, |
24 TransportRole role) | 43 TransportRole role) |
25 : signal_strategy_(signal_strategy), | 44 : signal_strategy_(signal_strategy), |
26 port_allocator_factory_(std::move(port_allocator_factory)), | 45 port_allocator_factory_(std::move(port_allocator_factory)), |
27 network_settings_(network_settings), | 46 network_settings_(network_settings), |
28 role_(role) {} | 47 role_(role) {} |
29 | 48 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 132 |
114 result->set_flags(flags); | 133 result->set_flags(flags); |
115 result->SetPortRange(network_settings_.port_range.min_port, | 134 result->SetPortRange(network_settings_.port_range.min_port, |
116 network_settings_.port_range.max_port); | 135 network_settings_.port_range.max_port); |
117 | 136 |
118 return std::move(result); | 137 return std::move(result); |
119 } | 138 } |
120 | 139 |
121 } // namespace protocol | 140 } // namespace protocol |
122 } // namespace remoting | 141 } // namespace remoting |
OLD | NEW |