Commit de63ca3b authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Remove WebRTCCertificateGenerator

... in favor of its Blink renderer child class, RTCCertificateGenerator.

CL also the alias WebRTCCertificateCallback to RTCCertificateCallback.

BUG=787254, 919392
R=guidou@chromium.org, haraken@chromium.org

Change-Id: I05c68fc040cd1842052a639425dcc6654b11c8ca
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1814606
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarGuido Urdaneta <guidou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704604}
parent f40c9b3c
...@@ -291,7 +291,6 @@ source_set("blink_headers") { ...@@ -291,7 +291,6 @@ source_set("blink_headers") {
"platform/web_resource_timing_info.h", "platform/web_resource_timing_info.h",
"platform/web_rtc_answer_options.h", "platform/web_rtc_answer_options.h",
"platform/web_rtc_api_name.h", "platform/web_rtc_api_name.h",
"platform/web_rtc_certificate_generator.h",
"platform/web_rtc_data_channel_init.h", "platform/web_rtc_data_channel_init.h",
"platform/web_rtc_dtmf_sender_handler.h", "platform/web_rtc_dtmf_sender_handler.h",
"platform/web_rtc_dtmf_sender_handler_client.h", "platform/web_rtc_dtmf_sender_handler_client.h",
......
/*
* Copyright (C) 2015 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_CERTIFICATE_GENERATOR_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_CERTIFICATE_GENERATOR_H_
#include <memory>
#include "third_party/blink/public/platform/web_rtc_key_params.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/webrtc/api/peer_connection_interface.h"
namespace base {
class SingleThreadTaskRunner;
}
namespace blink {
using WebRTCCertificateCallback =
base::OnceCallback<void(rtc::scoped_refptr<rtc::RTCCertificate>)>;
// Interface defining a class that can generate WebRTCCertificates
// asynchronously.
class WebRTCCertificateGenerator {
public:
virtual ~WebRTCCertificateGenerator() = default;
// Start generating a certificate asynchronously. |observer| is invoked on the
// same thread that called generateCertificate when the operation is
// completed.
virtual void GenerateCertificate(
const WebRTCKeyParams&,
WebRTCCertificateCallback completion_callback,
scoped_refptr<base::SingleThreadTaskRunner>) = 0;
virtual void GenerateCertificateWithExpiration(
const WebRTCKeyParams&,
uint64_t expires_ms,
WebRTCCertificateCallback completion_callback,
scoped_refptr<base::SingleThreadTaskRunner>) = 0;
// Determines if the parameters are supported by |GenerateCertificate|.
// For example, if the number of bits of some parameter is too small or too
// large we may want to reject it for security or performance reasons.
virtual bool IsSupportedKeyParams(const WebRTCKeyParams&) = 0;
// Creates a certificate from the PEM strings. See also
// |rtc::RTCCertificate::ToPEM|.
virtual rtc::scoped_refptr<rtc::RTCCertificate> FromPEM(
blink::WebString pem_private_key,
blink::WebString pem_certificate) = 0;
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_WEB_RTC_CERTIFICATE_GENERATOR_H_
...@@ -52,7 +52,7 @@ class RTCCertificateGeneratorRequest ...@@ -52,7 +52,7 @@ class RTCCertificateGeneratorRequest
void GenerateCertificateAsync( void GenerateCertificateAsync(
const blink::WebRTCKeyParams& key_params, const blink::WebRTCKeyParams& key_params,
const absl::optional<uint64_t>& expires_ms, const absl::optional<uint64_t>& expires_ms,
blink::WebRTCCertificateCallback completion_callback) { blink::RTCCertificateCallback completion_callback) {
DCHECK(main_thread_->BelongsToCurrentThread()); DCHECK(main_thread_->BelongsToCurrentThread());
DCHECK(completion_callback); DCHECK(completion_callback);
...@@ -70,7 +70,7 @@ class RTCCertificateGeneratorRequest ...@@ -70,7 +70,7 @@ class RTCCertificateGeneratorRequest
void GenerateCertificateOnWorkerThread( void GenerateCertificateOnWorkerThread(
const blink::WebRTCKeyParams key_params, const blink::WebRTCKeyParams key_params,
const absl::optional<uint64_t> expires_ms, const absl::optional<uint64_t> expires_ms,
blink::WebRTCCertificateCallback completion_callback) { blink::RTCCertificateCallback completion_callback) {
DCHECK(worker_thread_->BelongsToCurrentThread()); DCHECK(worker_thread_->BelongsToCurrentThread());
rtc::scoped_refptr<rtc::RTCCertificate> certificate = rtc::scoped_refptr<rtc::RTCCertificate> certificate =
...@@ -84,7 +84,7 @@ class RTCCertificateGeneratorRequest ...@@ -84,7 +84,7 @@ class RTCCertificateGeneratorRequest
} }
void DoCallbackOnMainThread( void DoCallbackOnMainThread(
blink::WebRTCCertificateCallback completion_callback, blink::RTCCertificateCallback completion_callback,
rtc::scoped_refptr<rtc::RTCCertificate> certificate) { rtc::scoped_refptr<rtc::RTCCertificate> certificate) {
DCHECK(main_thread_->BelongsToCurrentThread()); DCHECK(main_thread_->BelongsToCurrentThread());
DCHECK(completion_callback); DCHECK(completion_callback);
...@@ -100,7 +100,7 @@ class RTCCertificateGeneratorRequest ...@@ -100,7 +100,7 @@ class RTCCertificateGeneratorRequest
void GenerateCertificateWithOptionalExpiration( void GenerateCertificateWithOptionalExpiration(
const blink::WebRTCKeyParams& key_params, const blink::WebRTCKeyParams& key_params,
const absl::optional<uint64_t>& expires_ms, const absl::optional<uint64_t>& expires_ms,
blink::WebRTCCertificateCallback completion_callback, blink::RTCCertificateCallback completion_callback,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
DCHECK(WebRTCKeyParamsToKeyParams(key_params).IsValid()); DCHECK(WebRTCKeyParamsToKeyParams(key_params).IsValid());
auto* pc_dependency_factory = auto* pc_dependency_factory =
...@@ -118,7 +118,7 @@ void GenerateCertificateWithOptionalExpiration( ...@@ -118,7 +118,7 @@ void GenerateCertificateWithOptionalExpiration(
void RTCCertificateGenerator::GenerateCertificate( void RTCCertificateGenerator::GenerateCertificate(
const blink::WebRTCKeyParams& key_params, const blink::WebRTCKeyParams& key_params,
blink::WebRTCCertificateCallback completion_callback, blink::RTCCertificateCallback completion_callback,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
GenerateCertificateWithOptionalExpiration( GenerateCertificateWithOptionalExpiration(
key_params, absl::nullopt, std::move(completion_callback), task_runner); key_params, absl::nullopt, std::move(completion_callback), task_runner);
...@@ -127,7 +127,7 @@ void RTCCertificateGenerator::GenerateCertificate( ...@@ -127,7 +127,7 @@ void RTCCertificateGenerator::GenerateCertificate(
void RTCCertificateGenerator::GenerateCertificateWithExpiration( void RTCCertificateGenerator::GenerateCertificateWithExpiration(
const blink::WebRTCKeyParams& key_params, const blink::WebRTCKeyParams& key_params,
uint64_t expires_ms, uint64_t expires_ms,
blink::WebRTCCertificateCallback completion_callback, blink::RTCCertificateCallback completion_callback,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
GenerateCertificateWithOptionalExpiration( GenerateCertificateWithOptionalExpiration(
key_params, expires_ms, std::move(completion_callback), task_runner); key_params, expires_ms, std::move(completion_callback), task_runner);
......
...@@ -5,9 +5,11 @@ ...@@ -5,9 +5,11 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_RTC_CERTIFICATE_GENERATOR_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_RTC_CERTIFICATE_GENERATOR_H_
#define THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_RTC_CERTIFICATE_GENERATOR_H_ #define THIRD_PARTY_BLINK_RENDERER_MODULES_PEERCONNECTION_RTC_CERTIFICATE_GENERATOR_H_
#include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "third_party/blink/public/platform/web_rtc_certificate_generator.h"
#include "third_party/blink/public/platform/web_rtc_key_params.h" #include "third_party/blink/public/platform/web_rtc_key_params.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/renderer/modules/modules_export.h" #include "third_party/blink/renderer/modules/modules_export.h"
#include "third_party/webrtc/api/peer_connection_interface.h" #include "third_party/webrtc/api/peer_connection_interface.h"
...@@ -17,29 +19,42 @@ class SingleThreadTaskRunner; ...@@ -17,29 +19,42 @@ class SingleThreadTaskRunner;
namespace blink { namespace blink {
using RTCCertificateCallback =
base::OnceCallback<void(rtc::scoped_refptr<rtc::RTCCertificate>)>;
// Chromium's WebRTCCertificateGenerator implementation; uses the // Chromium's WebRTCCertificateGenerator implementation; uses the
// PeerConnectionIdentityStore/SSLIdentity::Generate to generate the identity, // PeerConnectionIdentityStore/SSLIdentity::Generate to generate the identity,
// rtc::RTCCertificate and blink::RTCCertificate. // rtc::RTCCertificate and blink::RTCCertificate.
class MODULES_EXPORT RTCCertificateGenerator //
: public blink::WebRTCCertificateGenerator { // TODO(crbug.com/787254): Convert use of WebString to WTF::String.
class MODULES_EXPORT RTCCertificateGenerator {
public: public:
RTCCertificateGenerator() {} RTCCertificateGenerator() {}
~RTCCertificateGenerator() override {} ~RTCCertificateGenerator() {}
// blink::WebRTCCertificateGenerator implementation. // Start generating a certificate asynchronously. |observer| is invoked on the
// same thread that called generateCertificate when the operation is
// completed.
void GenerateCertificate( void GenerateCertificate(
const blink::WebRTCKeyParams& key_params, const blink::WebRTCKeyParams& key_params,
blink::WebRTCCertificateCallback completion_callback, blink::RTCCertificateCallback completion_callback,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) override; scoped_refptr<base::SingleThreadTaskRunner> task_runner);
void GenerateCertificateWithExpiration( void GenerateCertificateWithExpiration(
const blink::WebRTCKeyParams& key_params, const blink::WebRTCKeyParams& key_params,
uint64_t expires_ms, uint64_t expires_ms,
blink::WebRTCCertificateCallback completion_callback, blink::RTCCertificateCallback completion_callback,
scoped_refptr<base::SingleThreadTaskRunner> task_runner) override; scoped_refptr<base::SingleThreadTaskRunner> task_runner);
bool IsSupportedKeyParams(const blink::WebRTCKeyParams& key_params) override;
// Determines if the parameters are supported by |GenerateCertificate|.
// For example, if the number of bits of some parameter is too small or too
// large we may want to reject it for security or performance reasons.
bool IsSupportedKeyParams(const blink::WebRTCKeyParams& key_params);
// Creates a certificate from the PEM strings. See also
// |rtc::RTCCertificate::ToPEM|.
rtc::scoped_refptr<rtc::RTCCertificate> FromPEM( rtc::scoped_refptr<rtc::RTCCertificate> FromPEM(
blink::WebString pem_private_key, blink::WebString pem_private_key,
blink::WebString pem_certificate) override; blink::WebString pem_certificate);
private: private:
DISALLOW_COPY_AND_ASSIGN(RTCCertificateGenerator); DISALLOW_COPY_AND_ASSIGN(RTCCertificateGenerator);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment