| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // This file overrides HttpPortAllocator defined in |
| 6 // third_party/libjingle/talk/p2p/client/httpportallocator.h to inject a |
| 7 // custom HTTP client. |
| 8 |
| 9 #ifndef REMOTING_JINGLE_GLUE_HTTP_PORT_ALLOCATOR_H_ |
| 10 #define REMOTING_JINGLE_GLUE_HTTP_PORT_ALLOCATOR_H_ |
| 11 |
| 12 #include <string> |
| 13 #include <vector> |
| 14 |
| 15 #include "base/scoped_ptr.h" |
| 16 #include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h" |
| 17 |
| 18 namespace remoting { |
| 19 |
| 20 // A factory class to generate cricket::PortAllocatorSession. |
| 21 class PortAllocatorSessionFactory { |
| 22 public: |
| 23 PortAllocatorSessionFactory() { |
| 24 } |
| 25 |
| 26 virtual ~PortAllocatorSessionFactory(); |
| 27 |
| 28 virtual cricket::PortAllocatorSession* CreateSession( |
| 29 cricket::BasicPortAllocator* allocator, |
| 30 const std::string& name, |
| 31 const std::string& session_type, |
| 32 const std::vector<talk_base::SocketAddress>& stun_hosts, |
| 33 const std::vector<std::string>& relay_hosts, |
| 34 const std::string& relay, |
| 35 const std::string& agent) = 0; |
| 36 |
| 37 private: |
| 38 DISALLOW_COPY_AND_ASSIGN(PortAllocatorSessionFactory); |
| 39 }; |
| 40 |
| 41 class HttpPortAllocator : public cricket::HttpPortAllocator { |
| 42 public: |
| 43 HttpPortAllocator(talk_base::NetworkManager* network_manager, |
| 44 talk_base::PacketSocketFactory* socket_factory, |
| 45 PortAllocatorSessionFactory* session_factory, |
| 46 const std::string& user_agent); |
| 47 virtual ~HttpPortAllocator(); |
| 48 |
| 49 // Override CreateSession() to inject a custom HTTP session. |
| 50 virtual cricket::PortAllocatorSession* CreateSession( |
| 51 const std::string& name, const std::string& session_type); |
| 52 |
| 53 private: |
| 54 PortAllocatorSessionFactory* session_factory_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(HttpPortAllocator); |
| 57 }; |
| 58 |
| 59 } // namespace remoting |
| 60 |
| 61 #endif // REMOTING_JINGLE_GLUE_HTTP_PORT_ALLOCATOR_H_ |
| OLD | NEW |