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

Side by Side Diff: remoting/host/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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "remoting/host/session_manager_factory.h"
6
7 #include "net/url_request/url_request_context_getter.h"
8 #include "remoting/host/host_port_allocator.h"
9 #include "remoting/host/network_settings.h"
10 #include "remoting/protocol/libjingle_transport_factory.h"
11 #include "remoting/protocol/jingle_session_manager.h"
12
13 namespace remoting {
14
15 scoped_ptr<protocol::SessionManager> CreateHostSessionManager(
16 const NetworkSettings& network_settings,
17 const scoped_refptr<net::URLRequestContextGetter>&
18 url_request_context_getter) {
19 // Use Chrome's network stack to allocate ports for peer-to-peer channels.
20 scoped_ptr<HostPortAllocator> port_allocator(
21 HostPortAllocator::Create(url_request_context_getter,
22 network_settings));
23
24 bool incoming_only = network_settings.nat_traversal_mode ==
25 NetworkSettings::NAT_TRAVERSAL_DISABLED;
26
27 // Use libjingle for negotiation of peer-to-peer channels over
28 // HostPortAllocator allocated ports.
29 scoped_ptr<protocol::TransportFactory> transport_factory(
30 new protocol::LibjingleTransportFactory(
31 port_allocator.PassAs<cricket::HttpPortAllocatorBase>(),
32 incoming_only));
33
34 // Use the Jingle protocol for channel-negotiation signalling between
35 // peer TransportFactories.
36 bool fetch_stun_relay_info = network_settings.nat_traversal_mode ==
37 NetworkSettings::NAT_TRAVERSAL_ENABLED;
38
39 scoped_ptr<protocol::JingleSessionManager> session_manager(
40 new protocol::JingleSessionManager(
41 transport_factory.Pass(), fetch_stun_relay_info));
42 return session_manager.PassAs<protocol::SessionManager>();
43 }
44
45 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698