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

Unified Diff: remoting/host/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: Review. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/session_manager_factory.h ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/session_manager_factory.cc
diff --git a/remoting/host/session_manager_factory.cc b/remoting/host/session_manager_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6a78cac58a5c8ab8e7d7adc9e3a2d693f8355be4
--- /dev/null
+++ b/remoting/host/session_manager_factory.cc
@@ -0,0 +1,42 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/host/session_manager_factory.h"
+
+#include "net/url_request/url_request_context_getter.h"
+#include "remoting/host/host_port_allocator.h"
+#include "remoting/host/network_settings.h"
+#include "remoting/protocol/libjingle_transport_factory.h"
+#include "remoting/protocol/jingle_session_manager.h"
+
+namespace remoting {
+
+scoped_ptr<protocol::SessionManager> CreateHostSessionManager(
+ const NetworkSettings& network_settings,
+ const scoped_refptr<net::URLRequestContextGetter>&
+ url_request_context_getter) {
+ // Create a cricket::PortAllocator that uses Chrome's network stack.
Wez 2012/06/14 01:00:58 nit: Suggest "Use Chrome's network stack to alloca
simonmorris 2012/06/14 01:24:02 Done.
+ scoped_ptr<HostPortAllocator> port_allocator(
+ HostPortAllocator::Create(url_request_context_getter,
+ network_settings));
+
+ bool incoming_only = network_settings.nat_traversal_mode ==
+ NetworkSettings::NAT_TRAVERSAL_DISABLED;
Wez 2012/06/14 01:00:58 nit: Add a comment e.g. "Use libjingle for negotia
simonmorris 2012/06/14 01:24:02 Done.
+
+ scoped_ptr<protocol::TransportFactory> transport_factory(
+ new protocol::LibjingleTransportFactory(
+ port_allocator.PassAs<cricket::HttpPortAllocatorBase>(),
+ incoming_only));
+
+ // Create a Jingle-protocol SessionManager that uses the libjingle
+ // TransportFactory.
Wez 2012/06/14 01:00:58 nit: Suggest "Use the Jingle protocol for channel-
simonmorris 2012/06/14 01:24:02 Done.
+ bool fetch_stun_relay_info = network_settings.nat_traversal_mode ==
+ NetworkSettings::NAT_TRAVERSAL_ENABLED;
+ scoped_ptr<protocol::JingleSessionManager> session_manager(
Wez 2012/06/14 01:00:58 nit: Add a blank line after the fetch_stun_relay_i
simonmorris 2012/06/14 01:24:02 Done.
+ new protocol::JingleSessionManager(
+ transport_factory.Pass(), fetch_stun_relay_info));
+ return session_manager.PassAs<protocol::SessionManager>();
+}
+
+} // namespace remoting
« no previous file with comments | « remoting/host/session_manager_factory.h ('k') | remoting/host/simple_host_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698