electron/shell/browser/net/cert_verifier_client.h
electron-roller[bot] 85718349cc
chore: bump chromium to 93.0.4539.0 (main) (#29608)
Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: Samuel Attard <sam@electronjs.org>
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-06-16 15:43:51 -07:00

51 lines
1.5 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.
#ifndef SHELL_BROWSER_NET_CERT_VERIFIER_CLIENT_H_
#define SHELL_BROWSER_NET_CERT_VERIFIER_CLIENT_H_
#include <string>
#include "net/cert/x509_certificate.h"
#include "services/network/public/mojom/network_context.mojom.h"
namespace electron {
struct VerifyRequestParams {
std::string hostname;
std::string default_result;
int error_code;
scoped_refptr<net::X509Certificate> certificate;
scoped_refptr<net::X509Certificate> validated_certificate;
VerifyRequestParams();
VerifyRequestParams(const VerifyRequestParams&);
~VerifyRequestParams();
};
class CertVerifierClient : public network::mojom::CertVerifierClient {
public:
using CertVerifyProc =
base::RepeatingCallback<void(const VerifyRequestParams& request,
base::OnceCallback<void(int)>)>;
explicit CertVerifierClient(CertVerifyProc proc);
~CertVerifierClient() override;
// network::mojom::CertVerifierClient
void Verify(int default_error,
const net::CertVerifyResult& default_result,
const scoped_refptr<net::X509Certificate>& certificate,
const std::string& hostname,
int flags,
const absl::optional<std::string>& ocsp_response,
VerifyCallback callback) override;
private:
CertVerifyProc cert_verify_proc_;
};
} // namespace electron
#endif // SHELL_BROWSER_NET_CERT_VERIFIER_CLIENT_H_