summaryrefslogtreecommitdiffstats
path: root/remoting/jingle_glue
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-23 19:11:34 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-23 19:11:34 +0000
commit3623ef76ca3a58a41be3c8e2d76f3ac1e4b9a1b5 (patch)
tree2c9715ca0107d40d0ff9dda60a628bfa4bcaf5e3 /remoting/jingle_glue
parentb5e8df4db8d3f6d44d7cdcfc18b9e5381e968b95 (diff)
downloadchromium_src-3623ef76ca3a58a41be3c8e2d76f3ac1e4b9a1b5.zip
chromium_src-3623ef76ca3a58a41be3c8e2d76f3ac1e4b9a1b5.tar.gz
chromium_src-3623ef76ca3a58a41be3c8e2d76f3ac1e4b9a1b5.tar.bz2
Remove old sandboxing-related code.
1. Remove sandboxing code from JingleSessionManager 2. Remove custom port allocator used by chromoting. 3. Remove code for STUN server address resolution from JingleInfoRequest and HostResolver interface. BUG=None TEST=compiles. Review URL: http://codereview.chromium.org/7969019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102545 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/jingle_glue')
-rw-r--r--remoting/jingle_glue/host_resolver.cc13
-rw-r--r--remoting/jingle_glue/host_resolver.h45
-rw-r--r--remoting/jingle_glue/http_port_allocator.cc38
-rw-r--r--remoting/jingle_glue/http_port_allocator.h61
-rw-r--r--remoting/jingle_glue/jingle_info_request.cc44
-rw-r--r--remoting/jingle_glue/jingle_info_request.h14
6 files changed, 10 insertions, 205 deletions
diff --git a/remoting/jingle_glue/host_resolver.cc b/remoting/jingle_glue/host_resolver.cc
deleted file mode 100644
index 5ad3316..0000000
--- a/remoting/jingle_glue/host_resolver.cc
+++ /dev/null
@@ -1,13 +0,0 @@
-// Copyright (c) 2011 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/jingle_glue/host_resolver.h"
-
-namespace remoting {
-
-HostResolver::HostResolver() { }
-
-HostResolver::~HostResolver() { }
-
-} // namespace remoting
diff --git a/remoting/jingle_glue/host_resolver.h b/remoting/jingle_glue/host_resolver.h
deleted file mode 100644
index d74ae2b..0000000
--- a/remoting/jingle_glue/host_resolver.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright (c) 2011 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_JINGLE_GLUE_HOST_RESOLVER_H_
-#define REMOTING_JINGLE_GLUE_HOST_RESOLVER_H_
-
-#include <string>
-
-#include "base/basictypes.h"
-#include "third_party/libjingle/source/talk/base/sigslot.h"
-#include "third_party/libjingle/source/talk/base/socketaddress.h"
-
-namespace remoting {
-
-// TODO(sergeyu): Move HostResolver and HostResolverFactory to
-// libjingle and use them in StunPort.
-
-class HostResolver {
- public:
- HostResolver();
- virtual ~HostResolver();
-
- virtual void Resolve(const talk_base::SocketAddress& address) = 0;
-
- sigslot::signal2<HostResolver*, const talk_base::SocketAddress&> SignalDone;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(HostResolver);
-};
-
-class HostResolverFactory {
- public:
- HostResolverFactory() { }
- virtual ~HostResolverFactory() { }
-
- virtual HostResolver* CreateHostResolver() = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(HostResolverFactory);
-};
-
-} // namespace remoting
-
-#endif // REMOTING_JINGLE_GLUE_HOST_RESOLVER_H_
diff --git a/remoting/jingle_glue/http_port_allocator.cc b/remoting/jingle_glue/http_port_allocator.cc
deleted file mode 100644
index 06639da..0000000
--- a/remoting/jingle_glue/http_port_allocator.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (c) 2011 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/jingle_glue/http_port_allocator.h"
-
-namespace remoting {
-
-PortAllocatorSessionFactory::~PortAllocatorSessionFactory() {
-}
-
-HttpPortAllocator::HttpPortAllocator(
- talk_base::NetworkManager* network_manager,
- talk_base::PacketSocketFactory* socket_factory,
- PortAllocatorSessionFactory* session_factory,
- const std::string &user_agent)
- : cricket::HttpPortAllocator(network_manager,
- socket_factory,
- user_agent),
- session_factory_(session_factory) {
-}
-
-HttpPortAllocator::~HttpPortAllocator() {
-}
-
-cricket::PortAllocatorSession *HttpPortAllocator::CreateSession(
- const std::string& name, const std::string& session_type) {
- if (session_factory_) {
- return session_factory_->CreateSession(
- this, name, session_type, stun_hosts(), relay_hosts(), relay_token(),
- user_agent());
- }
- return new cricket::HttpPortAllocatorSession(
- this, name, session_type, stun_hosts(), relay_hosts(), relay_token(),
- user_agent());
-}
-
-} // namespace remoting
diff --git a/remoting/jingle_glue/http_port_allocator.h b/remoting/jingle_glue/http_port_allocator.h
deleted file mode 100644
index 07aa830..0000000
--- a/remoting/jingle_glue/http_port_allocator.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2011 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.
-
-// This file overrides HttpPortAllocator defined in
-// third_party/libjingle/talk/p2p/client/httpportallocator.h to inject a
-// custom HTTP client.
-
-#ifndef REMOTING_JINGLE_GLUE_HTTP_PORT_ALLOCATOR_H_
-#define REMOTING_JINGLE_GLUE_HTTP_PORT_ALLOCATOR_H_
-
-#include <string>
-#include <vector>
-
-#include "base/memory/scoped_ptr.h"
-#include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h"
-
-namespace remoting {
-
-// A factory class to generate cricket::PortAllocatorSession.
-class PortAllocatorSessionFactory {
- public:
- PortAllocatorSessionFactory() {
- }
-
- virtual ~PortAllocatorSessionFactory();
-
- virtual cricket::PortAllocatorSession* CreateSession(
- cricket::BasicPortAllocator* allocator,
- const std::string& name,
- const std::string& session_type,
- const std::vector<talk_base::SocketAddress>& stun_hosts,
- const std::vector<std::string>& relay_hosts,
- const std::string& relay,
- const std::string& agent) = 0;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(PortAllocatorSessionFactory);
-};
-
-class HttpPortAllocator : public cricket::HttpPortAllocator {
- public:
- HttpPortAllocator(talk_base::NetworkManager* network_manager,
- talk_base::PacketSocketFactory* socket_factory,
- PortAllocatorSessionFactory* session_factory,
- const std::string& user_agent);
- virtual ~HttpPortAllocator();
-
- // Override CreateSession() to inject a custom HTTP session.
- virtual cricket::PortAllocatorSession* CreateSession(
- const std::string& name, const std::string& session_type);
-
- private:
- PortAllocatorSessionFactory* session_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(HttpPortAllocator);
-};
-
-} // namespace remoting
-
-#endif // REMOTING_JINGLE_GLUE_HTTP_PORT_ALLOCATOR_H_
diff --git a/remoting/jingle_glue/jingle_info_request.cc b/remoting/jingle_glue/jingle_info_request.cc
index 9a5d16d..148a65f 100644
--- a/remoting/jingle_glue/jingle_info_request.cc
+++ b/remoting/jingle_glue/jingle_info_request.cc
@@ -10,7 +10,6 @@
#include "base/stl_util.h"
#include "base/string_number_conversions.h"
#include "net/base/net_util.h"
-#include "remoting/jingle_glue/host_resolver.h"
#include "remoting/jingle_glue/iq_request.h"
#include "third_party/libjingle/source/talk/base/socketaddress.h"
#include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
@@ -19,17 +18,13 @@
namespace remoting {
-JingleInfoRequest::JingleInfoRequest(IqRequest* request,
- HostResolverFactory* host_resolver_factory)
- : host_resolver_factory_(host_resolver_factory),
- request_(request) {
+JingleInfoRequest::JingleInfoRequest(IqRequest* request)
+ : request_(request) {
request_->set_callback(base::Bind(&JingleInfoRequest::OnResponse,
base::Unretained(this)));
}
JingleInfoRequest::~JingleInfoRequest() {
- STLDeleteContainerPointers(stun_dns_requests_.begin(),
- stun_dns_requests_.end());
}
void JingleInfoRequest::Send(const OnJingleInfoCallback& callback) {
@@ -48,6 +43,7 @@ void JingleInfoRequest::OnResponse(const buzz::XmlElement* stanza) {
return;
}
+ std::vector<talk_base::SocketAddress> stun_hosts;
const buzz::XmlElement* stun = query->FirstNamed(buzz::QN_JINGLE_INFO_STUN);
if (stun) {
for (const buzz::XmlElement* server =
@@ -63,49 +59,27 @@ void JingleInfoRequest::OnResponse(const buzz::XmlElement* stanza) {
continue;
}
- if (host_resolver_factory_) {
- net::IPAddressNumber ip_number;
- HostResolver* resolver = host_resolver_factory_->CreateHostResolver();
- stun_dns_requests_.insert(resolver);
- resolver->SignalDone.connect(
- this, &JingleInfoRequest::OnStunAddressResponse);
- resolver->Resolve(talk_base::SocketAddress(host, port));
- } else {
- // If there is no |host_resolver_factory_|, we're not sandboxed, so
- // we can let libjingle itself do the DNS resolution.
- stun_hosts_.push_back(talk_base::SocketAddress(host, port));
- }
+ stun_hosts.push_back(talk_base::SocketAddress(host, port));
}
}
}
+ std::vector<std::string> relay_hosts;
+ std::string relay_token;
const buzz::XmlElement* relay = query->FirstNamed(buzz::QN_JINGLE_INFO_RELAY);
if (relay) {
- relay_token_ = relay->TextNamed(buzz::QN_JINGLE_INFO_TOKEN);
+ relay_token = relay->TextNamed(buzz::QN_JINGLE_INFO_TOKEN);
for (const buzz::XmlElement* server =
relay->FirstNamed(buzz::QN_JINGLE_INFO_SERVER);
server != NULL;
server = server->NextNamed(buzz::QN_JINGLE_INFO_SERVER)) {
std::string host = server->Attr(buzz::QN_JINGLE_INFO_HOST);
if (host != buzz::STR_EMPTY)
- relay_hosts_.push_back(host);
+ relay_hosts.push_back(host);
}
}
- if (stun_dns_requests_.empty())
- on_jingle_info_cb_.Run(relay_token_, relay_hosts_, stun_hosts_);
-}
-
-void JingleInfoRequest::OnStunAddressResponse(
- HostResolver* resolver, const talk_base::SocketAddress& address) {
- if (!address.IsNil())
- stun_hosts_.push_back(address);
-
- MessageLoop::current()->DeleteSoon(FROM_HERE, resolver);
- stun_dns_requests_.erase(resolver);
-
- if (stun_dns_requests_.empty())
- on_jingle_info_cb_.Run(relay_token_, relay_hosts_, stun_hosts_);
+ on_jingle_info_cb_.Run(relay_token, relay_hosts, stun_hosts);
}
} // namespace remoting
diff --git a/remoting/jingle_glue/jingle_info_request.h b/remoting/jingle_glue/jingle_info_request.h
index df7552f..6d5bcf6 100644
--- a/remoting/jingle_glue/jingle_info_request.h
+++ b/remoting/jingle_glue/jingle_info_request.h
@@ -27,8 +27,6 @@ class SocketAddress;
namespace remoting {
class IqRequest;
-class HostResolver;
-class HostResolverFactory;
// JingleInfoRequest handles requesting STUN/Relay infromation from
// the Google Talk network. The query is made when Send() is
@@ -49,8 +47,7 @@ class JingleInfoRequest : public sigslot::has_slots<> {
const std::string&, const std::vector<std::string>&,
const std::vector<talk_base::SocketAddress>&)> OnJingleInfoCallback;
- explicit JingleInfoRequest(IqRequest* request,
- HostResolverFactory* host_resolver_factory);
+ explicit JingleInfoRequest(IqRequest* request);
virtual ~JingleInfoRequest();
void Send(const OnJingleInfoCallback& callback);
@@ -59,19 +56,10 @@ class JingleInfoRequest : public sigslot::has_slots<> {
struct PendingDnsRequest;
void OnResponse(const buzz::XmlElement* stanza);
- void OnStunAddressResponse(HostResolver* resolver,
- const talk_base::SocketAddress& address);
- HostResolverFactory* host_resolver_factory_;
scoped_ptr<IqRequest> request_;
OnJingleInfoCallback on_jingle_info_cb_;
- std::vector<std::string> relay_hosts_;
- std::vector<talk_base::SocketAddress> stun_hosts_;
- std::string relay_token_;
-
- std::set<HostResolver*> stun_dns_requests_;
-
DISALLOW_COPY_AND_ASSIGN(JingleInfoRequest);
};