Chromium Code Reviews| Index: webrtc/p2p/base/dtlstransport.h |
| diff --git a/webrtc/p2p/base/dtlstransport.h b/webrtc/p2p/base/dtlstransport.h |
| index 27cece49d04ea9cfe328ad0084eca36a7b967f93..56df931a18a63a40e21290048c325009cfe31738 100644 |
| --- a/webrtc/p2p/base/dtlstransport.h |
| +++ b/webrtc/p2p/base/dtlstransport.h |
| @@ -30,9 +30,9 @@ class DtlsTransport : public Base { |
| rtc::Thread* worker_thread, |
| const std::string& content_name, |
| PortAllocator* allocator, |
| - rtc::SSLIdentity* identity) |
| + const rtc::scoped_refptr<webrtc::DtlsCertificate>& certificate) |
| : Base(signaling_thread, worker_thread, content_name, allocator), |
| - identity_(identity), |
| + certificate_(certificate), |
| secure_role_(rtc::SSL_CLIENT), |
| ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10) { |
| } |
| @@ -40,14 +40,16 @@ class DtlsTransport : public Base { |
| ~DtlsTransport() { |
| Base::DestroyAllChannels(); |
| } |
| - virtual void SetIdentity_w(rtc::SSLIdentity* identity) { |
| - identity_ = identity; |
| + void SetCertificate_w( |
| + const rtc::scoped_refptr<webrtc::DtlsCertificate>& certificate) override { |
| + certificate_ = certificate; |
|
tommi (sloooow) - chröme
2015/08/18 14:49:35
would be good to have thread checks for methods th
|
| } |
| - virtual bool GetIdentity_w(rtc::SSLIdentity** identity) { |
| - if (!identity_) |
| + bool GetCertificate_w( |
| + rtc::scoped_refptr<webrtc::DtlsCertificate>* certificate) override { |
| + if (!certificate_.get()) |
| return false; |
| - *identity = identity_->GetReference(); |
| + *certificate = certificate_; |
| return true; |
| } |
| @@ -63,10 +65,10 @@ class DtlsTransport : public Base { |
| if (local_fp) { |
| // Sanity check local fingerprint. |
| - if (identity_) { |
| + if (certificate_.get()) { |
| rtc::scoped_ptr<rtc::SSLFingerprint> local_fp_tmp( |
| rtc::SSLFingerprint::Create(local_fp->algorithm, |
| - identity_)); |
| + certificate_->identity())); |
| ASSERT(local_fp_tmp.get() != NULL); |
| if (!(*local_fp_tmp == *local_fp)) { |
| std::ostringstream desc; |
| @@ -81,10 +83,10 @@ class DtlsTransport : public Base { |
| error_desc); |
| } |
| } else { |
| - identity_ = NULL; |
| + certificate_ = nullptr; |
| } |
| - if (!channel->SetLocalIdentity(identity_)) { |
| + if (!channel->SetLocalCertificate(certificate_)) { |
| return BadTransportDescription("Failed to set local identity.", |
| error_desc); |
| } |
| @@ -237,7 +239,7 @@ class DtlsTransport : public Base { |
| return Base::ApplyNegotiatedTransportDescription_w(channel, error_desc); |
| } |
| - rtc::SSLIdentity* identity_; |
| + rtc::scoped_refptr<webrtc::DtlsCertificate> certificate_; |
| rtc::SSLRole secure_role_; |
| rtc::SSLProtocolVersion ssl_max_version_; |
| rtc::scoped_ptr<rtc::SSLFingerprint> remote_fingerprint_; |