Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1248)

Side by Side Diff: remoting/protocol/session_manager_factory.cc

Issue 17101034: Add static Create method to LibjingleTransportFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/host/session_manager_factory.h" 5 #include "remoting/protocol/session_manager_factory.h"
6 6
7 #include "net/url_request/url_request_context_getter.h" 7 #include "remoting/protocol/jingle_session_manager.h"
8 #include "remoting/host/host_port_allocator.h"
9 #include "remoting/host/network_settings.h"
10 #include "remoting/protocol/libjingle_transport_factory.h" 8 #include "remoting/protocol/libjingle_transport_factory.h"
11 #include "remoting/protocol/jingle_session_manager.h" 9 #include "remoting/protocol/native_port_allocator.h"
10 #include "remoting/protocol/network_settings.h"
11 #include "remoting/protocol/session_manager.h"
12 12
13 namespace remoting { 13 namespace remoting {
14 14
15 scoped_ptr<protocol::SessionManager> CreateHostSessionManager( 15 namespace protocol {
16
17 scoped_ptr<protocol::TransportFactory> CreateTransportFactory(
Sergey Ulanov 2013/06/20 19:37:53 This function doesn't belong to this file. It woul
16 const NetworkSettings& network_settings, 18 const NetworkSettings& network_settings,
17 const scoped_refptr<net::URLRequestContextGetter>& 19 const scoped_refptr<net::URLRequestContextGetter>&
18 url_request_context_getter) { 20 url_request_context_getter) {
19 // Use Chrome's network stack to allocate ports for peer-to-peer channels. 21 // Use Chrome's network stack to allocate ports for peer-to-peer channels.
20 scoped_ptr<HostPortAllocator> port_allocator( 22 scoped_ptr<NativePortAllocator> port_allocator(
21 HostPortAllocator::Create(url_request_context_getter, 23 NativePortAllocator::Create(url_request_context_getter,
22 network_settings)); 24 network_settings));
23 25
24 bool incoming_only = network_settings.nat_traversal_mode == 26 bool incoming_only = network_settings.nat_traversal_mode ==
25 NetworkSettings::NAT_TRAVERSAL_DISABLED; 27 NetworkSettings::NAT_TRAVERSAL_DISABLED;
26 28
27 // Use libjingle for negotiation of peer-to-peer channels over 29 // Use libjingle for negotiation of peer-to-peer channels over
28 // HostPortAllocator allocated ports. 30 // NativePortAllocator allocated ports.
29 scoped_ptr<protocol::TransportFactory> transport_factory( 31 scoped_ptr<protocol::TransportFactory> transport_factory(
30 new protocol::LibjingleTransportFactory( 32 new protocol::LibjingleTransportFactory(
31 port_allocator.PassAs<cricket::HttpPortAllocatorBase>(), 33 port_allocator.PassAs<cricket::HttpPortAllocatorBase>(),
32 incoming_only)); 34 incoming_only));
35 return transport_factory.Pass();
36 }
37
38 scoped_ptr<protocol::SessionManager> CreateNativeSessionManager(
Sergey Ulanov 2013/06/20 19:37:53 This function doesn't do much, so I don't think we
39 const NetworkSettings& network_settings,
40 const scoped_refptr<net::URLRequestContextGetter>&
41 url_request_context_getter) {
42 scoped_ptr<protocol::TransportFactory> transport_factory(
43 CreateTransportFactory(network_settings,
44 url_request_context_getter));
Sergey Ulanov 2013/06/20 19:37:53 this argument should be aligned with the first arg
33 45
34 // Use the Jingle protocol for channel-negotiation signalling between 46 // Use the Jingle protocol for channel-negotiation signalling between
35 // peer TransportFactories. 47 // peer TransportFactories.
36 bool fetch_stun_relay_info = network_settings.nat_traversal_mode == 48 bool fetch_stun_relay_info = network_settings.nat_traversal_mode ==
37 NetworkSettings::NAT_TRAVERSAL_ENABLED; 49 NetworkSettings::NAT_TRAVERSAL_ENABLED;
38 50
39 scoped_ptr<protocol::JingleSessionManager> session_manager( 51 scoped_ptr<protocol::JingleSessionManager> session_manager(
40 new protocol::JingleSessionManager( 52 new protocol::JingleSessionManager(
41 transport_factory.Pass(), fetch_stun_relay_info)); 53 transport_factory.Pass(), fetch_stun_relay_info));
42 return session_manager.PassAs<protocol::SessionManager>(); 54 return session_manager.PassAs<protocol::SessionManager>();
43 } 55 }
44 56
57 } // namespace protocol
58
45 } // namespace remoting 59 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698