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

Unified Diff: content/renderer/media/rtc_certificate_generator.cc

Issue 1740993002: RTCPeerConnection.generateCertificate: Optionally specify expiration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/rtc_certificate_generator.cc
diff --git a/content/renderer/media/rtc_certificate_generator.cc b/content/renderer/media/rtc_certificate_generator.cc
index 05661d304af846964dd60ba339ff97d615b47789..2928fa6b48ccd26f63e4d1c419dd0f0e043a97a4 100644
--- a/content/renderer/media/rtc_certificate_generator.cc
+++ b/content/renderer/media/rtc_certificate_generator.cc
@@ -57,6 +57,7 @@ class RTCCertificateIdentityObserver
const blink::WebRTCKeyParams& key_params,
const GURL& url,
const GURL& first_party_for_cookies,
+ const rtc::Optional<uint64_t>& expires_ms,
std::unique_ptr<blink::WebRTCCertificateCallback> observer) {
DCHECK(main_thread_->BelongsToCurrentThread());
DCHECK(!observer_) << "Already have a RequestIdentity in progress.";
@@ -66,20 +67,22 @@ class RTCCertificateIdentityObserver
// Identity request must be performed on the WebRTC signaling thread.
signaling_thread_->PostTask(FROM_HERE, base::Bind(
&RTCCertificateIdentityObserver::RequestIdentityOnWebRtcSignalingThread,
- this, url, first_party_for_cookies));
+ this, url, first_party_for_cookies, expires_ms));
}
private:
void RequestIdentityOnWebRtcSignalingThread(
GURL url,
- GURL first_party_for_cookies) {
+ GURL first_party_for_cookies,
+ rtc::Optional<uint64_t> expires_ms) {
DCHECK(signaling_thread_->BelongsToCurrentThread());
rtc::scoped_ptr<PeerConnectionIdentityStore> store(
new PeerConnectionIdentityStore(main_thread_, signaling_thread_, url,
first_party_for_cookies));
// Request identity with |this| as the observer. OnSuccess/OnFailure will be
// called asynchronously.
- store->RequestIdentity(WebRTCKeyParamsToKeyParams(key_params_), this);
+ store->RequestIdentity(WebRTCKeyParamsToKeyParams(key_params_),
+ expires_ms, this);
}
// webrtc::DtlsIdentityRequestObserver implementation.
@@ -144,6 +147,28 @@ void RTCCertificateGenerator::generateCertificate(
const blink::WebURL& url,
const blink::WebURL& first_party_for_cookies,
std::unique_ptr<blink::WebRTCCertificateCallback> observer) {
+ generateCertificateWithOptionalExpiration(
+ key_params, url, first_party_for_cookies, rtc::Optional<uint64_t>(),
+ std::move(observer));
+}
+
+void RTCCertificateGenerator::generateCertificateWithExpiration(
+ const blink::WebRTCKeyParams& key_params,
+ const blink::WebURL& url,
+ const blink::WebURL& first_party_for_cookies,
+ uint64_t expires_ms,
+ std::unique_ptr<blink::WebRTCCertificateCallback> observer) {
+ generateCertificateWithOptionalExpiration(
+ key_params, url, first_party_for_cookies,
+ rtc::Optional<uint64_t>(expires_ms), std::move(observer));
+}
+
+void RTCCertificateGenerator::generateCertificateWithOptionalExpiration(
+ const blink::WebRTCKeyParams& key_params,
+ const blink::WebURL& url,
+ const blink::WebURL& first_party_for_cookies,
+ const rtc::Optional<uint64_t>& expires_ms,
+ std::unique_ptr<blink::WebRTCCertificateCallback> observer) {
DCHECK(isSupportedKeyParams(key_params));
#if defined(ENABLE_WEBRTC)
@@ -161,7 +186,7 @@ void RTCCertificateGenerator::generateCertificate(
main_thread, signaling_thread));
// |identity_observer| lives until request has completed.
identity_observer->RequestIdentity(key_params, url, first_party_for_cookies,
- std::move(observer));
+ expires_ms, std::move(observer));
#else
observer->onError();
#endif

Powered by Google App Engine
This is Rietveld 408576698