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

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

Issue 2157453002: Do FilteringNetworkManager::CheckPermission from new Initialize method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2785
Patch Set: Created 4 years, 5 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/port_allocator.h ('k') | no next file » | 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 #include "content/renderer/p2p/port_allocator.h" 5 #include "content/renderer/p2p/port_allocator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
15 #include "content/renderer/p2p/socket_dispatcher.h" 15 #include "content/renderer/p2p/socket_dispatcher.h"
16 16
17 namespace content { 17 namespace content {
18 18
19 P2PPortAllocator::P2PPortAllocator( 19 P2PPortAllocator::P2PPortAllocator(
20 const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher, 20 const scoped_refptr<P2PSocketDispatcher>& socket_dispatcher,
21 std::unique_ptr<rtc::NetworkManager> network_manager, 21 std::unique_ptr<rtc::NetworkManager> network_manager,
22 rtc::PacketSocketFactory* socket_factory, 22 rtc::PacketSocketFactory* socket_factory,
23 const Config& config, 23 const Config& config,
24 const GURL& origin) 24 const GURL& origin)
25 : cricket::BasicPortAllocator(network_manager.get(), socket_factory), 25 : cricket::BasicPortAllocator(network_manager.get(), socket_factory),
26 network_manager_(std::move(network_manager)), 26 network_manager_(std::move(network_manager)),
27 socket_dispatcher_(socket_dispatcher), 27 socket_dispatcher_(socket_dispatcher),
28 config_(config), 28 config_(config),
29 origin_(origin) { 29 origin_(origin) {
30 DCHECK(socket_dispatcher);
31 DCHECK(network_manager_);
32 DCHECK(socket_factory);
30 uint32_t flags = 0; 33 uint32_t flags = 0;
31 if (!config_.enable_multiple_routes) { 34 if (!config_.enable_multiple_routes) {
32 flags |= cricket::PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION; 35 flags |= cricket::PORTALLOCATOR_DISABLE_ADAPTER_ENUMERATION;
33 } 36 }
34 if (!config_.enable_default_local_candidate) { 37 if (!config_.enable_default_local_candidate) {
35 flags |= cricket::PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE; 38 flags |= cricket::PORTALLOCATOR_DISABLE_DEFAULT_LOCAL_CANDIDATE;
36 } 39 }
37 if (!config_.enable_nonproxied_udp) { 40 if (!config_.enable_nonproxied_udp) {
38 flags |= cricket::PORTALLOCATOR_DISABLE_UDP | 41 flags |= cricket::PORTALLOCATOR_DISABLE_UDP |
39 cricket::PORTALLOCATOR_DISABLE_STUN | 42 cricket::PORTALLOCATOR_DISABLE_STUN |
40 cricket::PORTALLOCATOR_DISABLE_UDP_RELAY; 43 cricket::PORTALLOCATOR_DISABLE_UDP_RELAY;
41 } 44 }
42 set_flags(flags); 45 set_flags(flags);
43 set_allow_tcp_listen(false); 46 set_allow_tcp_listen(false);
44 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); 47 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
45 bool enable_webrtc_stun_origin = 48 bool enable_webrtc_stun_origin =
46 cmd_line->HasSwitch(switches::kEnableWebRtcStunOrigin); 49 cmd_line->HasSwitch(switches::kEnableWebRtcStunOrigin);
47 if (enable_webrtc_stun_origin) { 50 if (enable_webrtc_stun_origin) {
48 set_origin(origin_.spec()); 51 set_origin(origin_.spec());
49 } 52 }
50 } 53 }
51 54
52 P2PPortAllocator::~P2PPortAllocator() {} 55 P2PPortAllocator::~P2PPortAllocator() {}
53 56
57 void P2PPortAllocator::Initialize() {
58 BasicPortAllocator::Initialize();
59 network_manager_->Initialize();
60 }
61
54 } // namespace content 62 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/p2p/port_allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698