summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/plugin/host_script_object.cc2
-rw-r--r--remoting/host/remoting_me2me_host.cc2
-rw-r--r--remoting/host/session_manager_factory.cc23
-rw-r--r--remoting/host/session_manager_factory.h9
-rw-r--r--remoting/jingle_glue/chromium_port_allocator.cc (renamed from remoting/host/host_port_allocator.cc)42
-rw-r--r--remoting/jingle_glue/chromium_port_allocator.h (renamed from remoting/host/host_port_allocator.h)22
-rw-r--r--remoting/jingle_glue/network_settings.h (renamed from remoting/host/network_settings.h)6
-rw-r--r--remoting/protocol/libjingle_transport_factory.cc25
-rw-r--r--remoting/protocol/libjingle_transport_factory.h14
-rw-r--r--remoting/remoting.gyp6
10 files changed, 92 insertions, 59 deletions
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
index 8a5e133..ff60292 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -26,13 +26,13 @@
#include "remoting/host/host_secret.h"
#include "remoting/host/host_status_observer.h"
#include "remoting/host/it2me_desktop_environment.h"
-#include "remoting/host/network_settings.h"
#include "remoting/host/pin_hash.h"
#include "remoting/host/plugin/host_log_handler.h"
#include "remoting/host/policy_hack/policy_watcher.h"
#include "remoting/host/register_support_host_request.h"
#include "remoting/host/service_urls.h"
#include "remoting/host/session_manager_factory.h"
+#include "remoting/jingle_glue/network_settings.h"
#include "remoting/jingle_glue/xmpp_signal_strategy.h"
#include "remoting/protocol/it2me_host_authenticator_factory.h"
#include "third_party/npapi/bindings/npruntime.h"
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index 252390a..9df3657 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -57,7 +57,6 @@
#include "remoting/host/log_to_server.h"
#include "remoting/host/logging.h"
#include "remoting/host/me2me_desktop_environment.h"
-#include "remoting/host/network_settings.h"
#include "remoting/host/policy_hack/policy_watcher.h"
#include "remoting/host/service_urls.h"
#include "remoting/host/session_manager_factory.h"
@@ -65,6 +64,7 @@
#include "remoting/host/token_validator_factory_impl.h"
#include "remoting/host/ui_strings.h"
#include "remoting/host/usage_stats_consent.h"
+#include "remoting/jingle_glue/network_settings.h"
#include "remoting/jingle_glue/xmpp_signal_strategy.h"
#include "remoting/protocol/me2me_host_authenticator_factory.h"
#include "remoting/protocol/pairing_registry.h"
diff --git a/remoting/host/session_manager_factory.cc b/remoting/host/session_manager_factory.cc
index df21786..bbaa8ef 100644
--- a/remoting/host/session_manager_factory.cc
+++ b/remoting/host/session_manager_factory.cc
@@ -4,11 +4,11 @@
#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/jingle_glue/chromium_port_allocator.h"
+#include "remoting/jingle_glue/network_settings.h"
#include "remoting/protocol/jingle_session_manager.h"
+#include "remoting/protocol/libjingle_transport_factory.h"
+#include "remoting/protocol/session_manager.h"
namespace remoting {
@@ -16,20 +16,9 @@ scoped_ptr<protocol::SessionManager> CreateHostSessionManager(
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<HostPortAllocator> port_allocator(
- HostPortAllocator::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
- // HostPortAllocator allocated ports.
scoped_ptr<protocol::TransportFactory> transport_factory(
- new protocol::LibjingleTransportFactory(
- port_allocator.PassAs<cricket::HttpPortAllocatorBase>(),
- incoming_only));
+ protocol::LibjingleTransportFactory::Create(network_settings,
+ url_request_context_getter));
// Use the Jingle protocol for channel-negotiation signalling between
// peer TransportFactories.
diff --git a/remoting/host/session_manager_factory.h b/remoting/host/session_manager_factory.h
index fb289bc..2c0a1b6 100644
--- a/remoting/host/session_manager_factory.h
+++ b/remoting/host/session_manager_factory.h
@@ -7,12 +7,19 @@
#include "base/memory/scoped_ptr.h"
#include "net/url_request/url_request_context_getter.h"
-#include "remoting/protocol/session_manager.h"
+
+namespace net {
+class URLRequestContextGetter;
+} // namespace net
namespace remoting {
struct NetworkSettings;
+namespace protocol {
+ class SessionManager;
+} // namespace protocol
+
scoped_ptr<protocol::SessionManager> CreateHostSessionManager(
const NetworkSettings& network_settings,
const scoped_refptr<net::URLRequestContextGetter>&
diff --git a/remoting/host/host_port_allocator.cc b/remoting/jingle_glue/chromium_port_allocator.cc
index 4fdd790..43f4210 100644
--- a/remoting/host/host_port_allocator.cc
+++ b/remoting/jingle_glue/chromium_port_allocator.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 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/host_port_allocator.h"
+#include "remoting/jingle_glue/chromium_port_allocator.h"
#include "base/bind.h"
#include "base/stl_util.h"
@@ -12,18 +12,18 @@
#include "net/url_request/url_fetcher.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "net/url_request/url_request_context_getter.h"
-#include "remoting/host/network_settings.h"
#include "remoting/jingle_glue/chromium_socket_factory.h"
+#include "remoting/jingle_glue/network_settings.h"
namespace remoting {
namespace {
-class HostPortAllocatorSession
+class ChromiumPortAllocatorSession
: public cricket::HttpPortAllocatorSessionBase,
public net::URLFetcherDelegate {
public:
- HostPortAllocatorSession(
+ ChromiumPortAllocatorSession(
cricket::HttpPortAllocatorBase* allocator,
const std::string& content_name,
int component,
@@ -33,7 +33,7 @@ class HostPortAllocatorSession
const std::vector<std::string>& relay_hosts,
const std::string& relay,
const scoped_refptr<net::URLRequestContextGetter>& url_context);
- virtual ~HostPortAllocatorSession();
+ virtual ~ChromiumPortAllocatorSession();
// cricket::HttpPortAllocatorBase overrides.
virtual void ConfigReady(cricket::PortConfiguration* config) OVERRIDE;
@@ -46,10 +46,10 @@ class HostPortAllocatorSession
scoped_refptr<net::URLRequestContextGetter> url_context_;
std::set<const net::URLFetcher*> url_fetchers_;
- DISALLOW_COPY_AND_ASSIGN(HostPortAllocatorSession);
+ DISALLOW_COPY_AND_ASSIGN(ChromiumPortAllocatorSession);
};
-HostPortAllocatorSession::HostPortAllocatorSession(
+ChromiumPortAllocatorSession::ChromiumPortAllocatorSession(
cricket::HttpPortAllocatorBase* allocator,
const std::string& content_name,
int component,
@@ -70,11 +70,12 @@ HostPortAllocatorSession::HostPortAllocatorSession(
std::string()),
url_context_(url_context) {}
-HostPortAllocatorSession::~HostPortAllocatorSession() {
+ChromiumPortAllocatorSession::~ChromiumPortAllocatorSession() {
STLDeleteElements(&url_fetchers_);
}
-void HostPortAllocatorSession::ConfigReady(cricket::PortConfiguration* config) {
+void ChromiumPortAllocatorSession::ConfigReady(
+ cricket::PortConfiguration* config) {
// Filter out non-UDP relay ports, so that we don't try using TCP.
for (cricket::PortConfiguration::RelayList::iterator relay =
config->relays.begin(); relay != config->relays.end(); ++relay) {
@@ -90,8 +91,9 @@ void HostPortAllocatorSession::ConfigReady(cricket::PortConfiguration* config) {
cricket::BasicPortAllocatorSession::ConfigReady(config);
}
-void HostPortAllocatorSession::SendSessionRequest(const std::string& host,
- int port) {
+void ChromiumPortAllocatorSession::SendSessionRequest(
+ const std::string& host,
+ int port) {
GURL url("https://" + host + ":" + base::IntToString(port) +
GetSessionRequestUrl() + "&sn=1");
scoped_ptr<net::URLFetcher> url_fetcher(
@@ -105,7 +107,7 @@ void HostPortAllocatorSession::SendSessionRequest(const std::string& host,
url_fetchers_.insert(url_fetcher.release());
}
-void HostPortAllocatorSession::OnURLFetchComplete(
+void ChromiumPortAllocatorSession::OnURLFetchComplete(
const net::URLFetcher* source) {
int response_code = source->GetResponseCode();
std::string response;
@@ -127,15 +129,15 @@ void HostPortAllocatorSession::OnURLFetchComplete(
} // namespace
// static
-scoped_ptr<HostPortAllocator> HostPortAllocator::Create(
+scoped_ptr<ChromiumPortAllocator> ChromiumPortAllocator::Create(
const scoped_refptr<net::URLRequestContextGetter>& url_context,
const NetworkSettings& network_settings) {
scoped_ptr<talk_base::NetworkManager> network_manager(
new talk_base::BasicNetworkManager());
scoped_ptr<talk_base::PacketSocketFactory> socket_factory(
new remoting::ChromiumPacketSocketFactory());
- scoped_ptr<HostPortAllocator> result(
- new HostPortAllocator(url_context, network_manager.Pass(),
+ scoped_ptr<ChromiumPortAllocator> result(
+ new ChromiumPortAllocator(url_context, network_manager.Pass(),
socket_factory.Pass()));
// We always use PseudoTcp to provide a reliable channel. It
@@ -158,7 +160,7 @@ scoped_ptr<HostPortAllocator> HostPortAllocator::Create(
return result.Pass();
}
-HostPortAllocator::HostPortAllocator(
+ChromiumPortAllocator::ChromiumPortAllocator(
const scoped_refptr<net::URLRequestContextGetter>& url_context,
scoped_ptr<talk_base::NetworkManager> network_manager,
scoped_ptr<talk_base::PacketSocketFactory> socket_factory)
@@ -169,15 +171,15 @@ HostPortAllocator::HostPortAllocator(
network_manager_(network_manager.Pass()),
socket_factory_(socket_factory.Pass()) {}
-HostPortAllocator::~HostPortAllocator() {
+ChromiumPortAllocator::~ChromiumPortAllocator() {
}
-cricket::PortAllocatorSession* HostPortAllocator::CreateSessionInternal(
+cricket::PortAllocatorSession* ChromiumPortAllocator::CreateSessionInternal(
const std::string& content_name,
int component,
const std::string& ice_username_fragment,
const std::string& ice_password) {
- return new HostPortAllocatorSession(
+ return new ChromiumPortAllocatorSession(
this, content_name, component, ice_username_fragment, ice_password,
stun_hosts(), relay_hosts(), relay_token(), url_context_);
}
diff --git a/remoting/host/host_port_allocator.h b/remoting/jingle_glue/chromium_port_allocator.h
index 47d0893..d5c850f 100644
--- a/remoting/host/host_port_allocator.h
+++ b/remoting/jingle_glue/chromium_port_allocator.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 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.
-#ifndef REMOTING_HOST_HOST_PORT_ALLOCATOR_H_
-#define REMOTING_HOST_HOST_PORT_ALLOCATOR_H_
+#ifndef REMOTING_JINGLE_GLUE_CHROMIUM_PORT_ALLOCATOR_H_
+#define REMOTING_JINGLE_GLUE_CHROMIUM_PORT_ALLOCATOR_H_
#include <set>
@@ -19,18 +19,16 @@ namespace remoting {
struct NetworkSettings;
-// An implementation of cricket::PortAllocator for libjingle that is
-// used by the remoting host. The main difference from
-// cricket::HttpPortAllocator is that it uses Chromium's HTTP stack
-// when creating relay sessions. It also configures itself according
+// An implementation of cricket::PortAllocator for libjingle that
+// uses Chromium's network stack and configures itself according
// to the specified NetworkSettings.
-class HostPortAllocator : public cricket::HttpPortAllocatorBase {
+class ChromiumPortAllocator : public cricket::HttpPortAllocatorBase {
public:
- static scoped_ptr<HostPortAllocator> Create(
+ static scoped_ptr<ChromiumPortAllocator> Create(
const scoped_refptr<net::URLRequestContextGetter>& url_context,
const NetworkSettings& network_settings);
- virtual ~HostPortAllocator();
+ virtual ~ChromiumPortAllocator();
// cricket::HttpPortAllocatorBase overrides.
virtual cricket::PortAllocatorSession* CreateSessionInternal(
@@ -40,7 +38,7 @@ class HostPortAllocator : public cricket::HttpPortAllocatorBase {
const std::string& ice_password) OVERRIDE;
private:
- HostPortAllocator(
+ ChromiumPortAllocator(
const scoped_refptr<net::URLRequestContextGetter>& url_context,
scoped_ptr<talk_base::NetworkManager> network_manager,
scoped_ptr<talk_base::PacketSocketFactory> socket_factory);
@@ -49,7 +47,7 @@ class HostPortAllocator : public cricket::HttpPortAllocatorBase {
scoped_ptr<talk_base::NetworkManager> network_manager_;
scoped_ptr<talk_base::PacketSocketFactory> socket_factory_;
- DISALLOW_COPY_AND_ASSIGN(HostPortAllocator);
+ DISALLOW_COPY_AND_ASSIGN(ChromiumPortAllocator);
};
} // namespace remoting
diff --git a/remoting/host/network_settings.h b/remoting/jingle_glue/network_settings.h
index 3c1ed97..a37b0bc 100644
--- a/remoting/host/network_settings.h
+++ b/remoting/jingle_glue/network_settings.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2013 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.
-#ifndef REMOTING_HOST_NETWORK_SETTINGS_H_
-#define REMOTING_HOST_NETWORK_SETTINGS_H_
+#ifndef REMOTING_JINGLE_GLUE_NETWORK_SETTINGS_H_
+#define REMOTING_JINGLE_GLUE_NETWORK_SETTINGS_H_
namespace remoting {
diff --git a/remoting/protocol/libjingle_transport_factory.cc b/remoting/protocol/libjingle_transport_factory.cc
index d7c9b3b..138b0ed 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)
diff --git a/remoting/protocol/libjingle_transport_factory.h b/remoting/protocol/libjingle_transport_factory.h
index bb54bd4..5c399bb 100644
--- a/remoting/protocol/libjingle_transport_factory.h
+++ b/remoting/protocol/libjingle_transport_factory.h
@@ -12,16 +12,30 @@ class HttpPortAllocatorBase;
class PortAllocator;
} // namespace cricket
+namespace net {
+class URLRequestContextGetter;
+} // namespace net
+
namespace talk_base {
class NetworkManager;
class PacketSocketFactory;
} // namespace talk_base
namespace remoting {
+
+struct NetworkSettings;
+
namespace protocol {
class LibjingleTransportFactory : public TransportFactory {
public:
+ // Creates an instance of the class using ChromiumPortAllocator.
+ // Must be called from an IO thread.
+ static scoped_ptr<LibjingleTransportFactory> Create(
+ const NetworkSettings& network_settings,
+ const scoped_refptr<net::URLRequestContextGetter>&
+ url_request_context_getter);
+
// Need to use cricket::HttpPortAllocatorBase pointer for the
// |port_allocator|, so that it is possible to configure
// |port_allocator| with STUN/Relay addresses.
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index 784a178..f442e6e 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -363,8 +363,6 @@
'host/host_config.cc',
'host/host_config.h',
'host/host_exit_codes.h',
- 'host/host_port_allocator.cc',
- 'host/host_port_allocator.h',
'host/host_secret.cc',
'host/host_secret.h',
'host/host_status_monitor.h',
@@ -415,7 +413,6 @@
'host/me2me_desktop_environment.h',
'host/mouse_clamping_filter.cc',
'host/mouse_clamping_filter.h',
- 'host/network_settings.h',
'host/pam_authorization_factory_posix.cc',
'host/pam_authorization_factory_posix.h',
'host/pin_hash.cc',
@@ -2424,12 +2421,15 @@
'../third_party/libjingle/libjingle.gyp:libjingle',
],
'sources': [
+ 'jingle_glue/chromium_port_allocator.cc',
+ 'jingle_glue/chromium_port_allocator.h',
'jingle_glue/chromium_socket_factory.cc',
'jingle_glue/chromium_socket_factory.h',
'jingle_glue/iq_sender.cc',
'jingle_glue/iq_sender.h',
'jingle_glue/jingle_info_request.cc',
'jingle_glue/jingle_info_request.h',
+ 'jingle_glue/network_settings.h',
'jingle_glue/signal_strategy.h',
'jingle_glue/xmpp_signal_strategy.cc',
'jingle_glue/xmpp_signal_strategy.h',