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 #ifndef REMOTING_PROTOCOL_TRANSPORT_CONTEXT_H_ | 5 #ifndef REMOTING_PROTOCOL_TRANSPORT_CONTEXT_H_ |
6 #define REMOTING_PROTOCOL_TRANSPORT_CONTEXT_H_ | 6 #define REMOTING_PROTOCOL_TRANSPORT_CONTEXT_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 24 matching lines...) Expand all Loading... |
35 GetIceConfigCallback; | 35 GetIceConfigCallback; |
36 | 36 |
37 static scoped_refptr<TransportContext> ForTests(TransportRole role); | 37 static scoped_refptr<TransportContext> ForTests(TransportRole role); |
38 | 38 |
39 TransportContext(SignalStrategy* signal_strategy, | 39 TransportContext(SignalStrategy* signal_strategy, |
40 scoped_ptr<PortAllocatorFactory> port_allocator_factory, | 40 scoped_ptr<PortAllocatorFactory> port_allocator_factory, |
41 scoped_ptr<UrlRequestFactory> url_request_factory, | 41 scoped_ptr<UrlRequestFactory> url_request_factory, |
42 const NetworkSettings& network_settings, | 42 const NetworkSettings& network_settings, |
43 TransportRole role); | 43 TransportRole role); |
44 | 44 |
| 45 // Enables standard TURN servers. |
| 46 void UseTurn(const std::string& ice_config_url) { |
| 47 ice_config_url_ = ice_config_url; |
| 48 } |
| 49 |
45 // Prepares fresh JingleInfo. It may be called while connection is being | 50 // Prepares fresh JingleInfo. It may be called while connection is being |
46 // negotiated to minimize the chance that the following GetIceConfig() will | 51 // negotiated to minimize the chance that the following GetIceConfig() will |
47 // be blocking. | 52 // be blocking. |
48 void Prepare(); | 53 void Prepare(); |
49 | 54 |
50 // Requests fresh STUN and TURN information. | 55 // Requests fresh STUN and TURN information. |
51 void GetIceConfig(const GetIceConfigCallback& callback); | 56 void GetIceConfig(const GetIceConfigCallback& callback); |
52 | 57 |
53 PortAllocatorFactory* port_allocator_factory() { | 58 PortAllocatorFactory* port_allocator_factory() { |
54 return port_allocator_factory_.get(); | 59 return port_allocator_factory_.get(); |
(...skipping 11 matching lines...) Expand all Loading... |
66 | 71 |
67 void EnsureFreshJingleInfo(); | 72 void EnsureFreshJingleInfo(); |
68 void OnIceConfig(const IceConfig& ice_config); | 73 void OnIceConfig(const IceConfig& ice_config); |
69 | 74 |
70 SignalStrategy* signal_strategy_; | 75 SignalStrategy* signal_strategy_; |
71 scoped_ptr<PortAllocatorFactory> port_allocator_factory_; | 76 scoped_ptr<PortAllocatorFactory> port_allocator_factory_; |
72 scoped_ptr<UrlRequestFactory> url_request_factory_; | 77 scoped_ptr<UrlRequestFactory> url_request_factory_; |
73 NetworkSettings network_settings_; | 78 NetworkSettings network_settings_; |
74 TransportRole role_; | 79 TransportRole role_; |
75 | 80 |
| 81 std::string ice_config_url_; |
| 82 |
76 scoped_ptr<IceConfigRequest> ice_config_request_; | 83 scoped_ptr<IceConfigRequest> ice_config_request_; |
77 | 84 |
78 IceConfig ice_config_; | 85 IceConfig ice_config_; |
79 | 86 |
80 // When there is an active |jingle_info_request_| stores list of callbacks to | 87 // When there is an active |jingle_info_request_| stores list of callbacks to |
81 // be called once the request is finished. | 88 // be called once the request is finished. |
82 std::list<GetIceConfigCallback> pending_ice_config_callbacks_; | 89 std::list<GetIceConfigCallback> pending_ice_config_callbacks_; |
83 | 90 |
84 DISALLOW_COPY_AND_ASSIGN(TransportContext); | 91 DISALLOW_COPY_AND_ASSIGN(TransportContext); |
85 }; | 92 }; |
86 | 93 |
87 } // namespace protocol | 94 } // namespace protocol |
88 } // namespace remoting | 95 } // namespace remoting |
89 | 96 |
90 #endif // REMOTING_PROTOCOL_TRANSPORT_CONTEXT_H_ | 97 #endif // REMOTING_PROTOCOL_TRANSPORT_CONTEXT_H_ |
OLD | NEW |