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

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

Issue 2517953003: Move enable_webrtc to a buildflag header. (Closed)
Patch Set: Fix Created 4 years 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"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/single_thread_task_runner.h" 13 #include "base/single_thread_task_runner.h"
14 #include "content/renderer/media/rtc_certificate.h" 14 #include "content/renderer/media/rtc_certificate.h"
15 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" 15 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
16 #include "content/renderer/render_thread_impl.h" 16 #include "content/renderer/render_thread_impl.h"
17 #include "media/media_features.h"
17 #include "third_party/webrtc/base/rtccertificate.h" 18 #include "third_party/webrtc/base/rtccertificate.h"
18 #include "third_party/webrtc/base/rtccertificategenerator.h" 19 #include "third_party/webrtc/base/rtccertificategenerator.h"
19 #include "third_party/webrtc/base/scoped_ref_ptr.h" 20 #include "third_party/webrtc/base/scoped_ref_ptr.h"
20 #include "url/gurl.h" 21 #include "url/gurl.h"
21 22
22 namespace content { 23 namespace content {
23 namespace { 24 namespace {
24 25
25 rtc::KeyParams WebRTCKeyParamsToKeyParams( 26 rtc::KeyParams WebRTCKeyParamsToKeyParams(
26 const blink::WebRTCKeyParams& key_params) { 27 const blink::WebRTCKeyParams& key_params) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 std::unique_ptr<blink::WebRTCCertificateCallback> observer) { 130 std::unique_ptr<blink::WebRTCCertificateCallback> observer) {
130 generateCertificateWithOptionalExpiration( 131 generateCertificateWithOptionalExpiration(
131 key_params, rtc::Optional<uint64_t>(expires_ms), std::move(observer)); 132 key_params, rtc::Optional<uint64_t>(expires_ms), std::move(observer));
132 } 133 }
133 134
134 void RTCCertificateGenerator::generateCertificateWithOptionalExpiration( 135 void RTCCertificateGenerator::generateCertificateWithOptionalExpiration(
135 const blink::WebRTCKeyParams& key_params, 136 const blink::WebRTCKeyParams& key_params,
136 const rtc::Optional<uint64_t>& expires_ms, 137 const rtc::Optional<uint64_t>& expires_ms,
137 std::unique_ptr<blink::WebRTCCertificateCallback> observer) { 138 std::unique_ptr<blink::WebRTCCertificateCallback> observer) {
138 DCHECK(isSupportedKeyParams(key_params)); 139 DCHECK(isSupportedKeyParams(key_params));
139 #if defined(ENABLE_WEBRTC) 140 #if BUILDFLAG(ENABLE_WEBRTC)
140 const scoped_refptr<base::SingleThreadTaskRunner> main_thread = 141 const scoped_refptr<base::SingleThreadTaskRunner> main_thread =
141 base::ThreadTaskRunnerHandle::Get(); 142 base::ThreadTaskRunnerHandle::Get();
142 PeerConnectionDependencyFactory* pc_dependency_factory = 143 PeerConnectionDependencyFactory* pc_dependency_factory =
143 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory(); 144 RenderThreadImpl::current()->GetPeerConnectionDependencyFactory();
144 pc_dependency_factory->EnsureInitialized(); 145 pc_dependency_factory->EnsureInitialized();
145 146
146 scoped_refptr<RTCCertificateGeneratorRequest> request = 147 scoped_refptr<RTCCertificateGeneratorRequest> request =
147 new RTCCertificateGeneratorRequest( 148 new RTCCertificateGeneratorRequest(
148 main_thread, 149 main_thread,
149 pc_dependency_factory->GetWebRtcWorkerThread()); 150 pc_dependency_factory->GetWebRtcWorkerThread());
(...skipping 15 matching lines...) Expand all
165 rtc::scoped_refptr<rtc::RTCCertificate> certificate = 166 rtc::scoped_refptr<rtc::RTCCertificate> certificate =
166 rtc::RTCCertificate::FromPEM( 167 rtc::RTCCertificate::FromPEM(
167 rtc::RTCCertificatePEM(pem_private_key.utf8(), 168 rtc::RTCCertificatePEM(pem_private_key.utf8(),
168 pem_certificate.utf8())); 169 pem_certificate.utf8()));
169 if (!certificate) 170 if (!certificate)
170 return nullptr; 171 return nullptr;
171 return base::MakeUnique<RTCCertificate>(certificate); 172 return base::MakeUnique<RTCCertificate>(certificate);
172 } 173 }
173 174
174 } // namespace content 175 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/mock_render_process_host.cc ('k') | content/renderer/pepper/content_renderer_pepper_host_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698