| OLD | NEW |
| 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 #ifndef CONTENT_RENDERER_MEDIA_RTC_CERTIFICATE_GENERATOR_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RTC_CERTIFICATE_GENERATOR_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_RTC_CERTIFICATE_GENERATOR_H_ | 6 #define CONTENT_RENDERER_MEDIA_RTC_CERTIFICATE_GENERATOR_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 9 #include "third_party/WebKit/public/platform/WebRTCCertificate.h" | 10 #include "third_party/WebKit/public/platform/WebRTCCertificate.h" |
| 10 #include "third_party/WebKit/public/platform/WebRTCCertificateGenerator.h" | 11 #include "third_party/WebKit/public/platform/WebRTCCertificateGenerator.h" |
| 11 #include "third_party/WebKit/public/platform/WebRTCKeyParams.h" | 12 #include "third_party/WebKit/public/platform/WebRTCKeyParams.h" |
| 12 #include "third_party/webrtc/base/optional.h" | 13 #include "third_party/webrtc/base/optional.h" |
| 14 #include "third_party/webrtc/base/rtccertificate.h" |
| 13 | 15 |
| 14 namespace content { | 16 namespace content { |
| 15 | 17 |
| 16 // Chromium's WebRTCCertificateGenerator implementation; uses the | 18 // Chromium's WebRTCCertificateGenerator implementation; uses the |
| 17 // PeerConnectionIdentityStore/SSLIdentity::Generate to generate the identity, | 19 // PeerConnectionIdentityStore/SSLIdentity::Generate to generate the identity, |
| 18 // rtc::RTCCertificate and content::RTCCertificate. | 20 // rtc::RTCCertificate and content::RTCCertificate. |
| 19 class RTCCertificateGenerator : public blink::WebRTCCertificateGenerator { | 21 class RTCCertificateGenerator : public blink::WebRTCCertificateGenerator { |
| 20 public: | 22 public: |
| 21 RTCCertificateGenerator() {} | 23 RTCCertificateGenerator() {} |
| 22 ~RTCCertificateGenerator() override {} | 24 ~RTCCertificateGenerator() override {} |
| 23 | 25 |
| 24 // blink::WebRTCCertificateGenerator implementation. | 26 // blink::WebRTCCertificateGenerator implementation. |
| 25 void generateCertificate( | 27 void generateCertificate( |
| 26 const blink::WebRTCKeyParams& key_params, | 28 const blink::WebRTCKeyParams& key_params, |
| 27 const blink::WebURL& url, | 29 const blink::WebURL& url, |
| 28 const blink::WebURL& first_party_for_cookies, | 30 const blink::WebURL& first_party_for_cookies, |
| 29 std::unique_ptr<blink::WebRTCCertificateCallback> observer) override; | 31 std::unique_ptr<blink::WebRTCCertificateCallback> observer) override; |
| 30 void generateCertificateWithExpiration( | 32 void generateCertificateWithExpiration( |
| 31 const blink::WebRTCKeyParams& key_params, | 33 const blink::WebRTCKeyParams& key_params, |
| 32 const blink::WebURL& url, | 34 const blink::WebURL& url, |
| 33 const blink::WebURL& first_party_for_cookies, | 35 const blink::WebURL& first_party_for_cookies, |
| 34 uint64_t expires_ms, | 36 uint64_t expires_ms, |
| 35 std::unique_ptr<blink::WebRTCCertificateCallback> observer) override; | 37 std::unique_ptr<blink::WebRTCCertificateCallback> observer) override; |
| 36 bool isSupportedKeyParams(const blink::WebRTCKeyParams& key_params) override; | 38 bool isSupportedKeyParams(const blink::WebRTCKeyParams& key_params) override; |
| 37 std::unique_ptr<blink::WebRTCCertificate> fromPEM( | 39 std::unique_ptr<blink::WebRTCCertificate> fromPEM( |
| 38 const std::string& pem_private_key, | 40 const std::string& pem_private_key, |
| 39 const std::string& pem_certificate) override; | 41 const std::string& pem_certificate) override; |
| 40 | 42 |
| 43 static scoped_refptr<rtc::RTCCertificate> generateCertificateAndWait( |
| 44 const rtc::KeyParams& key_params, |
| 45 const rtc::Optional<uint64_t>& expires_ms); |
| 46 |
| 41 private: | 47 private: |
| 42 void generateCertificateWithOptionalExpiration( | 48 void generateCertificateWithOptionalExpiration( |
| 43 const blink::WebRTCKeyParams& key_params, | 49 const blink::WebRTCKeyParams& key_params, |
| 44 const blink::WebURL& url, | 50 const blink::WebURL& url, |
| 45 const blink::WebURL& first_party_for_cookies, | 51 const blink::WebURL& first_party_for_cookies, |
| 46 const rtc::Optional<uint64_t>& expires_ms, | 52 const rtc::Optional<uint64_t>& expires_ms, |
| 47 std::unique_ptr<blink::WebRTCCertificateCallback> observer); | 53 std::unique_ptr<blink::WebRTCCertificateCallback> observer); |
| 48 | 54 |
| 49 DISALLOW_COPY_AND_ASSIGN(RTCCertificateGenerator); | 55 DISALLOW_COPY_AND_ASSIGN(RTCCertificateGenerator); |
| 50 }; | 56 }; |
| 51 | 57 |
| 52 } // namespace content | 58 } // namespace content |
| 53 | 59 |
| 54 #endif // CONTENT_RENDERER_MEDIA_RTC_CERTIFICATE_GENERATOR_H_ | 60 #endif // CONTENT_RENDERER_MEDIA_RTC_CERTIFICATE_GENERATOR_H_ |
| OLD | NEW |