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