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

Unified Diff: remoting/protocol/libjingle_transport_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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/libjingle_transport_factory.h ('k') | remoting/remoting.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/libjingle_transport_factory.cc
diff --git a/remoting/protocol/libjingle_transport_factory.cc b/remoting/protocol/libjingle_transport_factory.cc
index d7c9b3becccc8a9ce0b5f9d2fc49fc7aeede273e..138b0ed8d2813f664a0edcf7b875de4f49f442b4 100644
--- a/remoting/protocol/libjingle_transport_factory.cc
+++ b/remoting/protocol/libjingle_transport_factory.cc
@@ -13,9 +13,11 @@
#include "jingle/glue/utils.h"
#include "net/base/net_errors.h"
#include "remoting/base/constants.h"
+#include "remoting/jingle_glue/chromium_port_allocator.h"
+#include "remoting/jingle_glue/chromium_socket_factory.h"
+#include "remoting/jingle_glue/network_settings.h"
#include "remoting/protocol/channel_authenticator.h"
#include "remoting/protocol/transport_config.h"
-#include "remoting/jingle_glue/chromium_socket_factory.h"
#include "third_party/libjingle/source/talk/base/network.h"
#include "third_party/libjingle/source/talk/p2p/base/constants.h"
#include "third_party/libjingle/source/talk/p2p/base/p2ptransportchannel.h"
@@ -361,6 +363,27 @@ void LibjingleStreamTransport::NotifyConnectFailed() {
} // namespace
+scoped_ptr<LibjingleTransportFactory> LibjingleTransportFactory::Create(
+ const NetworkSettings& network_settings,
+ const scoped_refptr<net::URLRequestContextGetter>&
+ url_request_context_getter) {
+ // Use Chrome's network stack to allocate ports for peer-to-peer channels.
+ scoped_ptr<ChromiumPortAllocator> port_allocator(
+ ChromiumPortAllocator::Create(url_request_context_getter,
+ network_settings));
+
+ bool incoming_only = network_settings.nat_traversal_mode ==
+ NetworkSettings::NAT_TRAVERSAL_DISABLED;
+
+ // Use libjingle for negotiation of peer-to-peer channels over
+ // NativePortAllocator allocated ports.
+ scoped_ptr<LibjingleTransportFactory> transport_factory(
+ new LibjingleTransportFactory(
+ port_allocator.PassAs<cricket::HttpPortAllocatorBase>(),
+ incoming_only));
+ return transport_factory.Pass();
+}
+
LibjingleTransportFactory::LibjingleTransportFactory(
scoped_ptr<cricket::HttpPortAllocatorBase> port_allocator,
bool incoming_only)
« no previous file with comments | « remoting/protocol/libjingle_transport_factory.h ('k') | remoting/remoting.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698