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

Unified Diff: remoting/jingle_glue/http_port_allocator.h

Issue 6623048: Replace libjingle's HttpPortAllocatorSession with Pepper's http client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thread switching Created 9 years, 9 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
Index: remoting/jingle_glue/http_port_allocator.h
diff --git a/remoting/jingle_glue/http_port_allocator.h b/remoting/jingle_glue/http_port_allocator.h
new file mode 100644
index 0000000000000000000000000000000000000000..8778d64a4d75e1b50d01528ac14922d60dd2709f
--- /dev/null
+++ b/remoting/jingle_glue/http_port_allocator.h
@@ -0,0 +1,61 @@
+// 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/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_

Powered by Google App Engine
This is Rietveld 408576698