OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/media/webrtc/peer_connection_dependency_factory.h" | 5 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 scoped_refptr<webrtc::PeerConnectionInterface> | 377 scoped_refptr<webrtc::PeerConnectionInterface> |
378 PeerConnectionDependencyFactory::CreatePeerConnection( | 378 PeerConnectionDependencyFactory::CreatePeerConnection( |
379 const webrtc::PeerConnectionInterface::RTCConfiguration& config, | 379 const webrtc::PeerConnectionInterface::RTCConfiguration& config, |
380 blink::WebFrame* web_frame, | 380 blink::WebFrame* web_frame, |
381 webrtc::PeerConnectionObserver* observer) { | 381 webrtc::PeerConnectionObserver* observer) { |
382 CHECK(web_frame); | 382 CHECK(web_frame); |
383 CHECK(observer); | 383 CHECK(observer); |
384 if (!GetPcFactory().get()) | 384 if (!GetPcFactory().get()) |
385 return NULL; | 385 return NULL; |
386 | 386 |
387 rtc::scoped_ptr<PeerConnectionIdentityStore> identity_store( | 387 std::unique_ptr<PeerConnectionIdentityStore> identity_store( |
388 new PeerConnectionIdentityStore( | 388 new PeerConnectionIdentityStore( |
389 base::ThreadTaskRunnerHandle::Get(), GetWebRtcSignalingThread(), | 389 base::ThreadTaskRunnerHandle::Get(), GetWebRtcSignalingThread(), |
390 GURL(web_frame->document().url()), | 390 GURL(web_frame->document().url()), |
391 GURL(web_frame->document().firstPartyForCookies()))); | 391 GURL(web_frame->document().firstPartyForCookies()))); |
392 | 392 |
393 // Copy the flag from Preference associated with this WebFrame. | 393 // Copy the flag from Preference associated with this WebFrame. |
394 P2PPortAllocator::Config port_config; | 394 P2PPortAllocator::Config port_config; |
395 | 395 |
396 // |media_permission| will be called to check mic/camera permission. If at | 396 // |media_permission| will be called to check mic/camera permission. If at |
397 // least one of them is granted, P2PPortAllocator is allowed to gather local | 397 // least one of them is granted, P2PPortAllocator is allowed to gather local |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 // time. It's safe to use Unretained here since both destructor and | 486 // time. It's safe to use Unretained here since both destructor and |
487 // Initialize can only be called on the worker thread. | 487 // Initialize can only be called on the worker thread. |
488 chrome_worker_thread_.task_runner()->PostTask( | 488 chrome_worker_thread_.task_runner()->PostTask( |
489 FROM_HERE, base::Bind(&FilteringNetworkManager::Initialize, | 489 FROM_HERE, base::Bind(&FilteringNetworkManager::Initialize, |
490 base::Unretained(filtering_network_manager))); | 490 base::Unretained(filtering_network_manager))); |
491 } | 491 } |
492 network_manager.reset(filtering_network_manager); | 492 network_manager.reset(filtering_network_manager); |
493 } else { | 493 } else { |
494 network_manager.reset(new EmptyNetworkManager(network_manager_)); | 494 network_manager.reset(new EmptyNetworkManager(network_manager_)); |
495 } | 495 } |
496 rtc::scoped_ptr<P2PPortAllocator> port_allocator(new P2PPortAllocator( | 496 std::unique_ptr<P2PPortAllocator> port_allocator(new P2PPortAllocator( |
497 p2p_socket_dispatcher_, std::move(network_manager), socket_factory_.get(), | 497 p2p_socket_dispatcher_, std::move(network_manager), socket_factory_.get(), |
498 port_config, requesting_origin, chrome_worker_thread_.task_runner())); | 498 port_config, requesting_origin, chrome_worker_thread_.task_runner())); |
499 | 499 |
500 return GetPcFactory() | 500 return GetPcFactory() |
501 ->CreatePeerConnection(config, std::move(port_allocator), | 501 ->CreatePeerConnection(config, std::move(port_allocator), |
502 std::move(identity_store), observer) | 502 std::move(identity_store), observer) |
503 .get(); | 503 .get(); |
504 } | 504 } |
505 | 505 |
506 // static | 506 // static |
507 rtc::scoped_refptr<rtc::RTCCertificate> | 507 rtc::scoped_refptr<rtc::RTCCertificate> |
508 PeerConnectionDependencyFactory::GenerateDefaultCertificate() { | 508 PeerConnectionDependencyFactory::GenerateDefaultCertificate() { |
509 rtc::scoped_ptr<rtc::SSLIdentity> identity(rtc::SSLIdentity::Generate( | 509 std::unique_ptr<rtc::SSLIdentity> identity(rtc::SSLIdentity::Generate( |
510 webrtc::kIdentityName, rtc::KeyParams::ECDSA(rtc::EC_NIST_P256))); | 510 webrtc::kIdentityName, rtc::KeyParams::ECDSA(rtc::EC_NIST_P256))); |
511 return rtc::RTCCertificate::Create(std::move(identity)); | 511 return rtc::RTCCertificate::Create(std::move(identity)); |
512 } | 512 } |
513 | 513 |
514 scoped_refptr<webrtc::MediaStreamInterface> | 514 scoped_refptr<webrtc::MediaStreamInterface> |
515 PeerConnectionDependencyFactory::CreateLocalMediaStream( | 515 PeerConnectionDependencyFactory::CreateLocalMediaStream( |
516 const std::string& label) { | 516 const std::string& label) { |
517 return GetPcFactory()->CreateLocalMediaStream(label).get(); | 517 return GetPcFactory()->CreateLocalMediaStream(label).get(); |
518 } | 518 } |
519 | 519 |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
779 } | 779 } |
780 | 780 |
781 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { | 781 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { |
782 if (audio_device_.get()) | 782 if (audio_device_.get()) |
783 return; | 783 return; |
784 | 784 |
785 audio_device_ = new WebRtcAudioDeviceImpl(); | 785 audio_device_ = new WebRtcAudioDeviceImpl(); |
786 } | 786 } |
787 | 787 |
788 } // namespace content | 788 } // namespace content |
OLD | NEW |