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

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

Issue 1349823004: Check media permissions (mic/camera) before exposing local addresses to WebRTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, fix test issue, fix windows build issue. Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « content/renderer/p2p/network_manager_uma.cc ('k') | content/renderer/p2p/port_allocator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
9 #include "base/single_thread_task_runner.h"
8 #include "third_party/webrtc/p2p/client/basicportallocator.h" 10 #include "third_party/webrtc/p2p/client/basicportallocator.h"
9 #include "url/gurl.h" 11 #include "url/gurl.h"
10 12
11 namespace content { 13 namespace content {
12 14
13 class P2PPortAllocatorSession; 15 class P2PPortAllocatorSession;
14 class P2PSocketDispatcher; 16 class P2PSocketDispatcher;
15 17
16 class P2PPortAllocator : public cricket::BasicPortAllocator { 18 class P2PPortAllocator : public cricket::BasicPortAllocator {
17 public: 19 public:
(...skipping 19 matching lines...) Expand all
37 39
38 // 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
39 // false, it effectively disables all UDP traffic until UDP-supporting proxy 41 // false, it effectively disables all UDP traffic until UDP-supporting proxy
40 // RETURN is available in the future. 42 // RETURN is available in the future.
41 bool enable_nonproxied_udp = true; 43 bool enable_nonproxied_udp = true;
42 44
43 // Disable binding to individual NICs when set to false. 45 // Disable binding to individual NICs when set to false.
44 bool enable_multiple_routes = true; 46 bool enable_multiple_routes = true;
45 }; 47 };
46 48
47 P2PPortAllocator(P2PSocketDispatcher* socket_dispatcher, 49 P2PPortAllocator(
48 rtc::NetworkManager* network_manager, 50 const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher,
49 rtc::PacketSocketFactory* socket_factory, 51 scoped_ptr<rtc::NetworkManager> network_manager,
50 const Config& config, 52 rtc::PacketSocketFactory* socket_factory,
51 const GURL& origin); 53 const Config& config,
54 const GURL& origin,
55 const scoped_refptr<base::SingleThreadTaskRunner> task_runner);
52 ~P2PPortAllocator() override; 56 ~P2PPortAllocator() override;
53 57
54 cricket::PortAllocatorSession* CreateSessionInternal( 58 cricket::PortAllocatorSession* CreateSessionInternal(
55 const std::string& content_name, 59 const std::string& content_name,
56 int component, 60 int component,
57 const std::string& ice_username_fragment, 61 const std::string& ice_username_fragment,
58 const std::string& ice_password) override; 62 const std::string& ice_password) override;
59 63
60 private: 64 private:
61 friend class P2PPortAllocatorSession; 65 friend class P2PPortAllocatorSession;
62 66 scoped_ptr<rtc::NetworkManager> network_manager_;
63 P2PSocketDispatcher* socket_dispatcher_; 67 scoped_refptr<P2PSocketDispatcher> socket_dispatcher_;
64 Config config_; 68 Config config_;
65 GURL origin_; 69 GURL origin_;
66 70
71 // This is the thread |network_manager_| is associated with and must be used
72 // to delete |network_manager_|.
73 const scoped_refptr<base::SingleThreadTaskRunner>
74 network_manager_task_runner_;
75
67 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocator); 76 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocator);
68 }; 77 };
69 78
70 class P2PPortAllocatorSession : public cricket::BasicPortAllocatorSession { 79 class P2PPortAllocatorSession : public cricket::BasicPortAllocatorSession {
71 public: 80 public:
72 P2PPortAllocatorSession( 81 P2PPortAllocatorSession(
73 P2PPortAllocator* allocator, 82 P2PPortAllocator* allocator,
74 const std::string& content_name, 83 const std::string& content_name,
75 int component, 84 int component,
76 const std::string& ice_username_fragment, 85 const std::string& ice_username_fragment,
77 const std::string& ice_password); 86 const std::string& ice_password);
78 ~P2PPortAllocatorSession() override; 87 ~P2PPortAllocatorSession() override;
79 88
80 protected: 89 protected:
81 // Overrides for cricket::BasicPortAllocatorSession. 90 // Overrides for cricket::BasicPortAllocatorSession.
82 void GetPortConfigurations() override; 91 void GetPortConfigurations() override;
83 92
84 private: 93 private:
85 P2PPortAllocator* allocator_; 94 P2PPortAllocator* allocator_;
86 95
87 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocatorSession); 96 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocatorSession);
88 }; 97 };
89 98
90 } // namespace content 99 } // namespace content
91 100
92 #endif // CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_ 101 #endif // CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « content/renderer/p2p/network_manager_uma.cc ('k') | content/renderer/p2p/port_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698