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

Unified Diff: remoting/host/host_port_allocator.h

Issue 10160013: Implement HostPortAllocator. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/chromoting_host_context.cc ('k') | remoting/host/host_port_allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/host_port_allocator.h
diff --git a/remoting/host/host_port_allocator.h b/remoting/host/host_port_allocator.h
new file mode 100644
index 0000000000000000000000000000000000000000..868102fba2d25b5736ab5be0a8e8d00f2f19d245
--- /dev/null
+++ b/remoting/host/host_port_allocator.h
@@ -0,0 +1,55 @@
+// 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.
+
+#ifndef REMOTING_HOST_HOST_PORT_ALLOCATOR_H_
+#define REMOTING_HOST_HOST_PORT_ALLOCATOR_H_
+
+#include <set>
+
+#include "base/memory/scoped_ptr.h"
+#include "remoting/host/url_fetcher.h"
+#include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h"
+
+namespace net {
+class URLRequestContextGetter;
+} // namespace net
+
+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
+// to the specified NetworkSettings.
+class HostPortAllocator : public cricket::HttpPortAllocatorBase {
+ public:
+ static scoped_ptr<HostPortAllocator> Create(
+ const scoped_refptr<net::URLRequestContextGetter>& url_context,
+ const NetworkSettings& network_settings);
+
+ virtual ~HostPortAllocator();
+
+ // cricket::HttpPortAllocatorBase overrides.
+ virtual cricket::PortAllocatorSession* CreateSession(
+ const std::string& channel_name,
+ int component) OVERRIDE;
+
+ private:
+ HostPortAllocator(
+ const scoped_refptr<net::URLRequestContextGetter>& url_context,
+ scoped_ptr<talk_base::NetworkManager> network_manager,
+ scoped_ptr<talk_base::PacketSocketFactory> socket_factory);
+
+ scoped_refptr<net::URLRequestContextGetter> url_context_;
+ scoped_ptr<talk_base::NetworkManager> network_manager_;
+ scoped_ptr<talk_base::PacketSocketFactory> socket_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(HostPortAllocator);
+};
+
+} // namespace remoting
+
+#endif // REMOTING_HOST_HOST_PORT_ALLOCATOR_H_
« no previous file with comments | « remoting/host/chromoting_host_context.cc ('k') | remoting/host/host_port_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698