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

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

Issue 1418113002: RTCPeerConnection.generateCertificate taking AlgorithmIdentifier and using WebCrypto (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase with master Created 5 years, 1 month 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 "content/renderer/media/peer_connection_identity_store.h" 7 #include "content/renderer/media/peer_connection_identity_store.h"
8 #include "content/renderer/media/rtc_certificate.h" 8 #include "content/renderer/media/rtc_certificate.h"
9 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" 9 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
10 #include "content/renderer/render_thread_impl.h" 10 #include "content/renderer/render_thread_impl.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 DISALLOW_COPY_AND_ASSIGN(RTCCertificateIdentityObserver); 129 DISALLOW_COPY_AND_ASSIGN(RTCCertificateIdentityObserver);
130 }; 130 };
131 131
132 } // namespace 132 } // namespace
133 133
134 void RTCCertificateGenerator::generateCertificate( 134 void RTCCertificateGenerator::generateCertificate(
135 const blink::WebRTCKeyParams& key_params, 135 const blink::WebRTCKeyParams& key_params,
136 const blink::WebURL& url, 136 const blink::WebURL& url,
137 const blink::WebURL& first_party_for_cookies, 137 const blink::WebURL& first_party_for_cookies,
138 blink::WebCallbacks<blink::WebRTCCertificate*, void>* observer) { 138 blink::WebCallbacks<blink::WebRTCCertificate*, void>* observer) {
139 DCHECK(isValidKeyParams(key_params)); 139 DCHECK(isSupportedKeyParams(key_params));
140 140
141 #if defined(ENABLE_WEBRTC) 141 #if defined(ENABLE_WEBRTC)
142 const scoped_refptr<base::SingleThreadTaskRunner> main_thread = 142 const scoped_refptr<base::SingleThreadTaskRunner> main_thread =
143 base::ThreadTaskRunnerHandle::Get(); 143 base::ThreadTaskRunnerHandle::Get();
144 144
145 PeerConnectionDependencyFactory* pc_dependency_factory = 145 PeerConnectionDependencyFactory* pc_dependency_factory =
146 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory(); 146 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory();
147 pc_dependency_factory->EnsureInitialized(); 147 pc_dependency_factory->EnsureInitialized();
148 const scoped_refptr<base::SingleThreadTaskRunner> signaling_thread = 148 const scoped_refptr<base::SingleThreadTaskRunner> signaling_thread =
149 pc_dependency_factory->GetWebRtcSignalingThread(); 149 pc_dependency_factory->GetWebRtcSignalingThread();
150 150
151 rtc::scoped_refptr<RTCCertificateIdentityObserver> identity_observer( 151 rtc::scoped_refptr<RTCCertificateIdentityObserver> identity_observer(
152 new rtc::RefCountedObject<RTCCertificateIdentityObserver>( 152 new rtc::RefCountedObject<RTCCertificateIdentityObserver>(
153 main_thread, signaling_thread)); 153 main_thread, signaling_thread));
154 // |identity_observer| lives until request has completed. 154 // |identity_observer| lives until request has completed.
155 identity_observer->RequestIdentity( 155 identity_observer->RequestIdentity(
156 key_params, url, first_party_for_cookies, observer); 156 key_params, url, first_party_for_cookies, observer);
157 #else 157 #else
158 observer->onError(); 158 observer->onError();
159 #endif 159 #endif
160 } 160 }
161 161
162 bool RTCCertificateGenerator::isValidKeyParams( 162 bool RTCCertificateGenerator::isSupportedKeyParams(
163 const blink::WebRTCKeyParams& key_params) { 163 const blink::WebRTCKeyParams& key_params) {
164 return WebRTCKeyParamsToKeyParams(key_params).IsValid(); 164 return WebRTCKeyParamsToKeyParams(key_params).IsValid();
165 } 165 }
166 166
167 } // namespace content 167 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698