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

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

Issue 1516163002: Reland 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;
16 class P2PSocketDispatcher; 15 class P2PSocketDispatcher;
17 16
18 class P2PPortAllocator : public cricket::BasicPortAllocator { 17 class P2PPortAllocator : public cricket::BasicPortAllocator {
19 public: 18 public:
20 struct Config { 19 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
40 // Enable non-proxied UDP-based transport when set to true. When set to 20 // Enable non-proxied UDP-based transport when set to true. When set to
41 // false, it effectively disables all UDP traffic until UDP-supporting proxy 21 // false, it effectively disables all UDP traffic until UDP-supporting proxy
42 // RETURN is available in the future. 22 // RETURN is available in the future.
43 bool enable_nonproxied_udp = true; 23 bool enable_nonproxied_udp = true;
44 24
45 // Request binding to individual NICs. Whether multiple routes is allowed is 25 // Request binding to individual NICs. Whether multiple routes is allowed is
46 // subject to the permission check on mic/camera. When specified as false or 26 // subject to the permission check on mic/camera. When specified as false or
47 // the permission request is denied, it still uses the default local address 27 // the permission request is denied, it still uses the default local address
48 // to generate a single local candidate. TODO(guoweis): Rename this to 28 // to generate a single local candidate. TODO(guoweis): Rename this to
49 // |request_multiple_routes|. 29 // |request_multiple_routes|.
50 bool enable_multiple_routes = true; 30 bool enable_multiple_routes = true;
51 31
52 // Enable exposing the default local address when set to true. This is 32 // Enable exposing the default local address when set to true. This is
53 // only in effect when the |enable_multiple_routes| is false or the 33 // only in effect when the |enable_multiple_routes| is false or the
54 // permission check of mic/camera is denied. 34 // permission check of mic/camera is denied.
55 bool enable_default_local_candidate = true; 35 bool enable_default_local_candidate = true;
56 }; 36 };
57 37
58 P2PPortAllocator( 38 P2PPortAllocator(
59 const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher, 39 const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher,
60 scoped_ptr<rtc::NetworkManager> network_manager, 40 scoped_ptr<rtc::NetworkManager> network_manager,
61 rtc::PacketSocketFactory* socket_factory, 41 rtc::PacketSocketFactory* socket_factory,
62 const Config& config, 42 const Config& config,
63 const GURL& origin, 43 const GURL& origin,
64 const scoped_refptr<base::SingleThreadTaskRunner> task_runner); 44 const scoped_refptr<base::SingleThreadTaskRunner> task_runner);
65 ~P2PPortAllocator() override; 45 ~P2PPortAllocator() override;
66 46
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
73 private: 47 private:
74 friend class P2PPortAllocatorSession;
75 scoped_ptr<rtc::NetworkManager> network_manager_; 48 scoped_ptr<rtc::NetworkManager> network_manager_;
76 scoped_refptr<P2PSocketDispatcher> socket_dispatcher_; 49 scoped_refptr<P2PSocketDispatcher> socket_dispatcher_;
77 Config config_; 50 Config config_;
78 GURL origin_; 51 GURL origin_;
79 52
80 // This is the thread |network_manager_| is associated with and must be used 53 // This is the thread |network_manager_| is associated with and must be used
81 // to delete |network_manager_|. 54 // to delete |network_manager_|.
82 const scoped_refptr<base::SingleThreadTaskRunner> 55 const scoped_refptr<base::SingleThreadTaskRunner>
83 network_manager_task_runner_; 56 network_manager_task_runner_;
84 57
85 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocator); 58 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocator);
86 }; 59 };
87 60
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
108 } // namespace content 61 } // namespace content
109 62
110 #endif // CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_ 63 #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