Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_ | 5 #ifndef CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_ |
| 6 #define CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_ | 6 #define CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "net/base/net_util.h" | 10 #include "net/base/net_util.h" |
| 11 #include "third_party/libjingle/source/talk/p2p/client/basicportallocator.h" | 11 #include "third_party/libjingle/source/talk/p2p/client/basicportallocator.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLLoader Client.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLLoader Client.h" |
| 13 #include "webkit/glue/p2p_transport.h" | |
| 14 | 13 |
| 15 namespace WebKit { | 14 namespace WebKit { |
| 16 class WebFrame; | 15 class WebFrame; |
| 17 class WebURLLoader; | 16 class WebURLLoader; |
| 18 } // namespace WebKit | 17 } // namespace WebKit |
| 19 | 18 |
| 20 namespace content { | 19 namespace content { |
| 21 | 20 |
| 22 class P2PHostAddressRequest; | 21 class P2PHostAddressRequest; |
| 23 class P2PPortAllocatorSession; | 22 class P2PPortAllocatorSession; |
| 24 class P2PSocketDispatcher; | 23 class P2PSocketDispatcher; |
| 25 | 24 |
| 26 // TODO(sergeyu): There is overlap between this class and | 25 // TODO(sergeyu): There is overlap between this class and HttpPortAllocator. |
| 27 // HttpPortAllocator. Refactor HttpPortAllocator | 26 // Refactor this class to inherit from HttpPortAllocator to avoid code |
| 27 // duplication. | |
| 28 class P2PPortAllocator : public cricket::BasicPortAllocator { | 28 class P2PPortAllocator : public cricket::BasicPortAllocator { |
| 29 public: | 29 public: |
| 30 struct Config { | |
| 31 Config(); | |
| 32 ~Config(); | |
| 33 | |
| 34 // STUN server address and port. | |
| 35 std::string stun_server; | |
| 36 int stun_server_port; | |
| 37 | |
| 38 // Relay server address and port. | |
| 39 std::string relay_server; | |
| 40 int relay_server_port; | |
| 41 | |
| 42 // Relay server username. | |
| 43 std::string relay_username; | |
| 44 | |
| 45 // Relay server password. | |
| 46 std::string relay_password; | |
| 47 | |
| 48 // When set to true relay is a legacy Google relay (not TURN | |
|
brettw
2012/08/15 19:18:49
I think this comment may fit on one line.
Sergey Ulanov
2012/08/15 19:25:03
Done.
| |
| 49 // compliant). | |
| 50 bool legacy_relay; | |
| 51 | |
| 52 // Disable TCP-based transport when set to true. | |
| 53 bool disable_tcp_transport; | |
| 54 }; | |
| 55 | |
| 30 P2PPortAllocator(WebKit::WebFrame* web_frame, | 56 P2PPortAllocator(WebKit::WebFrame* web_frame, |
| 31 P2PSocketDispatcher* socket_dispatcher, | 57 P2PSocketDispatcher* socket_dispatcher, |
| 32 talk_base::NetworkManager* network_manager, | 58 talk_base::NetworkManager* network_manager, |
| 33 talk_base::PacketSocketFactory* socket_factory, | 59 talk_base::PacketSocketFactory* socket_factory, |
| 34 const webkit_glue::P2PTransport::Config& config); | 60 const Config& config); |
| 35 virtual ~P2PPortAllocator(); | 61 virtual ~P2PPortAllocator(); |
| 36 | 62 |
| 37 virtual cricket::PortAllocatorSession* CreateSessionInternal( | 63 virtual cricket::PortAllocatorSession* CreateSessionInternal( |
| 38 const std::string& content_name, | 64 const std::string& content_name, |
| 39 int component, | 65 int component, |
| 40 const std::string& ice_username_fragment, | 66 const std::string& ice_username_fragment, |
| 41 const std::string& ice_password) OVERRIDE; | 67 const std::string& ice_password) OVERRIDE; |
| 42 | 68 |
| 43 private: | 69 private: |
| 44 friend class P2PPortAllocatorSession; | 70 friend class P2PPortAllocatorSession; |
| 45 | 71 |
| 46 WebKit::WebFrame* web_frame_; | 72 WebKit::WebFrame* web_frame_; |
| 47 P2PSocketDispatcher* socket_dispatcher_; | 73 P2PSocketDispatcher* socket_dispatcher_; |
| 48 webkit_glue::P2PTransport::Config config_; | 74 Config config_; |
| 49 | 75 |
| 50 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocator); | 76 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocator); |
| 51 }; | 77 }; |
| 52 | 78 |
| 53 class P2PPortAllocatorSession : public cricket::BasicPortAllocatorSession, | 79 class P2PPortAllocatorSession : public cricket::BasicPortAllocatorSession, |
| 54 public WebKit::WebURLLoaderClient { | 80 public WebKit::WebURLLoaderClient { |
| 55 public: | 81 public: |
| 56 P2PPortAllocatorSession( | 82 P2PPortAllocatorSession( |
| 57 P2PPortAllocator* allocator, | 83 P2PPortAllocator* allocator, |
| 58 const std::string& content_name, | 84 const std::string& content_name, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 int relay_udp_port_; | 122 int relay_udp_port_; |
| 97 int relay_tcp_port_; | 123 int relay_tcp_port_; |
| 98 int relay_ssltcp_port_; | 124 int relay_ssltcp_port_; |
| 99 | 125 |
| 100 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocatorSession); | 126 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocatorSession); |
| 101 }; | 127 }; |
| 102 | 128 |
| 103 } // namespace content | 129 } // namespace content |
| 104 | 130 |
| 105 #endif // CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_ | 131 #endif // CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_ |
| OLD | NEW |