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

Side by Side Diff: content/renderer/p2p/port_allocator.h

Issue 1514853003: Revert of Removing references to webrtc::PortAllocatorFactoryInterface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 unified diff | Download patch
OLDNEW
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/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
10 #include "third_party/webrtc/p2p/client/basicportallocator.h" 10 #include "third_party/webrtc/p2p/client/basicportallocator.h"
11 #include "url/gurl.h" 11 #include "url/gurl.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 class P2PPortAllocatorSession;
15 class P2PSocketDispatcher; 16 class P2PSocketDispatcher;
16 17
17 class P2PPortAllocator : public cricket::BasicPortAllocator { 18 class P2PPortAllocator : public cricket::BasicPortAllocator {
18 public: 19 public:
19 struct Config { 20 struct Config {
21 Config();
22 ~Config();
23
24 struct RelayServerConfig {
25 RelayServerConfig();
26 ~RelayServerConfig();
27
28 std::string username;
29 std::string password;
30 std::string server_address;
31 int port;
32 std::string transport_type;
33 bool secure;
34 };
35
36 std::set<rtc::SocketAddress> stun_servers;
37
38 std::vector<RelayServerConfig> relays;
39
20 // Enable non-proxied UDP-based transport when set to true. When set to 40 // Enable non-proxied UDP-based transport when set to true. When set to
21 // false, it effectively disables all UDP traffic until UDP-supporting proxy 41 // false, it effectively disables all UDP traffic until UDP-supporting proxy
22 // RETURN is available in the future. 42 // RETURN is available in the future.
23 bool enable_nonproxied_udp = true; 43 bool enable_nonproxied_udp = true;
24 44
25 // Request binding to individual NICs. Whether multiple routes is allowed is 45 // Request binding to individual NICs. Whether multiple routes is allowed is
26 // subject to the permission check on mic/camera. When specified as false or 46 // subject to the permission check on mic/camera. When specified as false or
27 // the permission request is denied, it still uses the default local address 47 // the permission request is denied, it still uses the default local address
28 // to generate a single local candidate. TODO(guoweis): Rename this to 48 // to generate a single local candidate. TODO(guoweis): Rename this to
29 // |request_multiple_routes|. 49 // |request_multiple_routes|.
30 bool enable_multiple_routes = true; 50 bool enable_multiple_routes = true;
31 51
32 // Enable exposing the default local address when set to true. This is 52 // Enable exposing the default local address when set to true. This is
33 // only in effect when the |enable_multiple_routes| is false or the 53 // only in effect when the |enable_multiple_routes| is false or the
34 // permission check of mic/camera is denied. 54 // permission check of mic/camera is denied.
35 bool enable_default_local_candidate = true; 55 bool enable_default_local_candidate = true;
36 }; 56 };
37 57
38 P2PPortAllocator( 58 P2PPortAllocator(
39 const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher, 59 const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher,
40 scoped_ptr<rtc::NetworkManager> network_manager, 60 scoped_ptr<rtc::NetworkManager> network_manager,
41 rtc::PacketSocketFactory* socket_factory, 61 rtc::PacketSocketFactory* socket_factory,
42 const Config& config, 62 const Config& config,
43 const GURL& origin, 63 const GURL& origin,
44 const scoped_refptr<base::SingleThreadTaskRunner> task_runner); 64 const scoped_refptr<base::SingleThreadTaskRunner> task_runner);
45 ~P2PPortAllocator() override; 65 ~P2PPortAllocator() override;
46 66
67 cricket::PortAllocatorSession* CreateSessionInternal(
68 const std::string& content_name,
69 int component,
70 const std::string& ice_username_fragment,
71 const std::string& ice_password) override;
72
47 private: 73 private:
74 friend class P2PPortAllocatorSession;
48 scoped_ptr<rtc::NetworkManager> network_manager_; 75 scoped_ptr<rtc::NetworkManager> network_manager_;
49 scoped_refptr<P2PSocketDispatcher> socket_dispatcher_; 76 scoped_refptr<P2PSocketDispatcher> socket_dispatcher_;
50 Config config_; 77 Config config_;
51 GURL origin_; 78 GURL origin_;
52 79
53 // This is the thread |network_manager_| is associated with and must be used 80 // This is the thread |network_manager_| is associated with and must be used
54 // to delete |network_manager_|. 81 // to delete |network_manager_|.
55 const scoped_refptr<base::SingleThreadTaskRunner> 82 const scoped_refptr<base::SingleThreadTaskRunner>
56 network_manager_task_runner_; 83 network_manager_task_runner_;
57 84
58 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocator); 85 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocator);
59 }; 86 };
60 87
88 class P2PPortAllocatorSession : public cricket::BasicPortAllocatorSession {
89 public:
90 P2PPortAllocatorSession(
91 P2PPortAllocator* allocator,
92 const std::string& content_name,
93 int component,
94 const std::string& ice_username_fragment,
95 const std::string& ice_password);
96 ~P2PPortAllocatorSession() override;
97
98 protected:
99 // Overrides for cricket::BasicPortAllocatorSession.
100 void GetPortConfigurations() override;
101
102 private:
103 P2PPortAllocator* allocator_;
104
105 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocatorSession);
106 };
107
61 } // namespace content 108 } // namespace content
62 109
63 #endif // CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_ 110 #endif // CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « content/renderer/p2p/filtering_network_manager.h ('k') | content/renderer/p2p/port_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698