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

Side by Side Diff: content/renderer/media/rtc_certificate_generator.cc

Issue 1949033002: Ability to persist RTCCertificate in IndexedDB (enables cloning). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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/rtc_certificate_generator.h" 5 #include "content/renderer/media/rtc_certificate_generator.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 void OnSuccess(std::unique_ptr<rtc::SSLIdentity> identity) override { 109 void OnSuccess(std::unique_ptr<rtc::SSLIdentity> identity) override {
110 DCHECK(signaling_thread_->BelongsToCurrentThread()); 110 DCHECK(signaling_thread_->BelongsToCurrentThread());
111 DCHECK(observer_); 111 DCHECK(observer_);
112 rtc::scoped_refptr<rtc::RTCCertificate> certificate = 112 rtc::scoped_refptr<rtc::RTCCertificate> certificate =
113 rtc::RTCCertificate::Create(std::move(identity)); 113 rtc::RTCCertificate::Create(std::move(identity));
114 main_thread_->PostTask( 114 main_thread_->PostTask(
115 FROM_HERE, 115 FROM_HERE,
116 base::Bind(&RTCCertificateIdentityObserver::DoCallbackOnMainThread, 116 base::Bind(&RTCCertificateIdentityObserver::DoCallbackOnMainThread,
117 this, base::Passed(base::WrapUnique( 117 this, base::Passed(base::WrapUnique(
118 new RTCCertificate(key_params_, certificate))))); 118 new RTCCertificate(certificate)))));
119 } 119 }
120 120
121 void DoCallbackOnMainThread( 121 void DoCallbackOnMainThread(
122 std::unique_ptr<blink::WebRTCCertificate> certificate) { 122 std::unique_ptr<blink::WebRTCCertificate> certificate) {
123 DCHECK(main_thread_->BelongsToCurrentThread()); 123 DCHECK(main_thread_->BelongsToCurrentThread());
124 DCHECK(observer_); 124 DCHECK(observer_);
125 if (certificate) 125 if (certificate)
126 observer_->onSuccess(std::move(certificate)); 126 observer_->onSuccess(std::move(certificate));
127 else 127 else
128 observer_->onError(); 128 observer_->onError();
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 #else 190 #else
191 observer->onError(); 191 observer->onError();
192 #endif 192 #endif
193 } 193 }
194 194
195 bool RTCCertificateGenerator::isSupportedKeyParams( 195 bool RTCCertificateGenerator::isSupportedKeyParams(
196 const blink::WebRTCKeyParams& key_params) { 196 const blink::WebRTCKeyParams& key_params) {
197 return WebRTCKeyParamsToKeyParams(key_params).IsValid(); 197 return WebRTCKeyParamsToKeyParams(key_params).IsValid();
198 } 198 }
199 199
200 std::unique_ptr<blink::WebRTCCertificate> RTCCertificateGenerator::fromPEM(
201 const std::string& pem_private_key,
202 const std::string& pem_certificate) {
203 rtc::scoped_refptr<rtc::RTCCertificate> certificate =
204 rtc::RTCCertificate::FromPEM(
205 rtc::RTCCertificatePEM(pem_private_key, pem_certificate));
206 return std::unique_ptr<blink::WebRTCCertificate>(
207 new RTCCertificate(certificate));
208 }
209
200 } // namespace content 210 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/rtc_certificate_generator.h ('k') | third_party/WebKit/Source/bindings/core/v8/SerializationTag.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698