electron/shell/browser/net/cert_verifier_client.cc
Cheng Zhao 3ae3233e65
chore: remove native_mate (Part 12) (#20869)
* refactor: move mate::Event to gin

* refactor: move mate::Locker to gin

* refactor: convert contextBridge to gin

* refactor: convert contentTracing to gin

* refactor: remove callback converter of native_mate

* refactor: remove file_dialog_converter and native_window_converter from native_mate

* refactor: convert webFrame to gin

* refactor: move blink_converter to gin

* refactor: remove net_converter from native_mate

* refactor: remove event_emitter_caller_deprecated

* refactor: remove gurl_converter from native_mate

* refactor: remove file_path and string16_converter from native_mate

* refactor: remove image_converter from native_mate

* refactor: move value_converter to gin
2019-10-31 16:56:00 +09:00

43 lines
1.3 KiB
C++

// Copyright (c) 2019 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include <utility>
#include "shell/browser/net/cert_verifier_client.h"
namespace electron {
VerifyRequestParams::VerifyRequestParams() = default;
VerifyRequestParams::~VerifyRequestParams() = default;
VerifyRequestParams::VerifyRequestParams(const VerifyRequestParams&) = default;
CertVerifierClient::CertVerifierClient(CertVerifyProc proc)
: cert_verify_proc_(proc) {}
CertVerifierClient::~CertVerifierClient() = default;
void CertVerifierClient::Verify(
int default_error,
const net::CertVerifyResult& default_result,
const scoped_refptr<net::X509Certificate>& certificate,
const std::string& hostname,
int flags,
const base::Optional<std::string>& ocsp_response,
VerifyCallback callback) {
VerifyRequestParams params;
params.hostname = hostname;
params.default_result = net::ErrorToString(default_error);
params.error_code = default_error;
params.certificate = certificate;
cert_verify_proc_.Run(
params,
base::AdaptCallbackForRepeating(base::BindOnce(
[](VerifyCallback callback, const net::CertVerifyResult& result,
int err) { std::move(callback).Run(err, result); },
std::move(callback), default_result)));
}
} // namespace electron