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

Side by Side Diff: remoting/host/jingle_session_manager_factory.cc

Issue 10538091: [Chromoting] Make ChromotingHost's dependency on libjingle injected, instead of hard-coded. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch for Windows build. Created 8 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 | Annotate | Revision Log
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/jingle_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 JingleSessionManagerFactory::JingleSessionManagerFactory() {
16 }
17
18 JingleSessionManagerFactory::~JingleSessionManagerFactory() {
19 }
20
21 scoped_ptr<protocol::SessionManager>
22 JingleSessionManagerFactory::CreateSessionManager(
23 const NetworkSettings& network_settings,
24 const scoped_refptr<net::URLRequestContextGetter>&
25 url_request_context_getter) {
26 // Create a cricket::PortAllocator that uses Chrome's network stack.
27 scoped_ptr<HostPortAllocator> port_allocator(
28 HostPortAllocator::Create(url_request_context_getter,
29 network_settings));
30
31 bool incoming_only = network_settings.nat_traversal_mode ==
32 NetworkSettings::NAT_TRAVERSAL_DISABLED;
33
34 scoped_ptr<protocol::TransportFactory> transport_factory(
35 new protocol::LibjingleTransportFactory(
36 port_allocator.PassAs<cricket::HttpPortAllocatorBase>(),
37 incoming_only));
38
39 // Create a Jingle-protocol SessionManager that uses the libjingle
40 // TransportFactory.
41 bool fetch_stun_relay_info = network_settings.nat_traversal_mode ==
42 NetworkSettings::NAT_TRAVERSAL_ENABLED;
43 scoped_ptr<protocol::JingleSessionManager> session_manager(
44 new protocol::JingleSessionManager(
45 transport_factory.Pass(), fetch_stun_relay_info));
46 return session_manager.PassAs<protocol::SessionManager>();
47 }
48
49 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698