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

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: Created 5 years, 3 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
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 "third_party/webrtc/p2p/client/basicportallocator.h" 9 #include "third_party/webrtc/p2p/client/basicportallocator.h"
9 #include "url/gurl.h" 10 #include "url/gurl.h"
10 11
11 namespace content { 12 namespace content {
12 13
13 class P2PPortAllocatorSession; 14 class P2PPortAllocatorSession;
14 class P2PSocketDispatcher; 15 class P2PSocketDispatcher;
15 16
16 class P2PPortAllocator : public cricket::BasicPortAllocator { 17 class P2PPortAllocator : public cricket::BasicPortAllocator {
17 public: 18 public:
(...skipping 19 matching lines...) Expand all
37 38
38 // Enable non-proxied UDP-based transport when set to true. When set to 39 // 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 40 // false, it effectively disables all UDP traffic until UDP-supporting proxy
40 // RETURN is available in the future. 41 // RETURN is available in the future.
41 bool enable_nonproxied_udp = true; 42 bool enable_nonproxied_udp = true;
42 43
43 // Disable binding to individual NICs when set to false. 44 // Disable binding to individual NICs when set to false.
44 bool enable_multiple_routes = true; 45 bool enable_multiple_routes = true;
45 }; 46 };
46 47
47 P2PPortAllocator(P2PSocketDispatcher* socket_dispatcher, 48 struct Params {
Sergey Ulanov 2015/09/21 22:12:59 Do you really need to add this? Does it need to be
guoweis_left_chromium 2015/09/22 17:56:56 Done.
48 rtc::NetworkManager* network_manager, 49 Params(const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher,
49 rtc::PacketSocketFactory* socket_factory, 50 rtc::PacketSocketFactory* socket_factory,
50 const Config& config, 51 const GURL& origin,
51 const GURL& origin); 52 const Config& config);
53 ~Params();
54 const scoped_refptr<P2PSocketDispatcher> socket_dispatcher;
55 rtc::PacketSocketFactory* socket_factory;
56 GURL requesting_origin;
57 Config config;
58 };
59
60 P2PPortAllocator(const Params& params,
61 scoped_ptr<rtc::NetworkManager> network_manager);
52 ~P2PPortAllocator() override; 62 ~P2PPortAllocator() override;
53 63
54 cricket::PortAllocatorSession* CreateSessionInternal( 64 cricket::PortAllocatorSession* CreateSessionInternal(
55 const std::string& content_name, 65 const std::string& content_name,
56 int component, 66 int component,
57 const std::string& ice_username_fragment, 67 const std::string& ice_username_fragment,
58 const std::string& ice_password) override; 68 const std::string& ice_password) override;
59 69
60 private: 70 private:
61 friend class P2PPortAllocatorSession; 71 friend class P2PPortAllocatorSession;
62 72 scoped_ptr<rtc::NetworkManager> network_manager_;
63 P2PSocketDispatcher* socket_dispatcher_; 73 scoped_refptr<P2PSocketDispatcher> socket_dispatcher_;
64 Config config_; 74 Config config_;
65 GURL origin_; 75 GURL origin_;
66 76
67 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocator); 77 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocator);
68 }; 78 };
69 79
70 class P2PPortAllocatorSession : public cricket::BasicPortAllocatorSession { 80 class P2PPortAllocatorSession : public cricket::BasicPortAllocatorSession {
71 public: 81 public:
72 P2PPortAllocatorSession( 82 P2PPortAllocatorSession(
73 P2PPortAllocator* allocator, 83 P2PPortAllocator* allocator,
74 const std::string& content_name, 84 const std::string& content_name,
75 int component, 85 int component,
76 const std::string& ice_username_fragment, 86 const std::string& ice_username_fragment,
77 const std::string& ice_password); 87 const std::string& ice_password);
78 ~P2PPortAllocatorSession() override; 88 ~P2PPortAllocatorSession() override;
79 89
80 protected: 90 protected:
81 // Overrides for cricket::BasicPortAllocatorSession. 91 // Overrides for cricket::BasicPortAllocatorSession.
82 void GetPortConfigurations() override; 92 void GetPortConfigurations() override;
83 93
84 private: 94 private:
85 P2PPortAllocator* allocator_; 95 P2PPortAllocator* allocator_;
86 96
87 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocatorSession); 97 DISALLOW_COPY_AND_ASSIGN(P2PPortAllocatorSession);
88 }; 98 };
89 99
90 } // namespace content 100 } // namespace content
91 101
92 #endif // CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_ 102 #endif // CONTENT_RENDERER_P2P_PORT_ALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698