#include "chrome/browser/ui/webui/certificate_manager/certificate_manager_handler.h"
#include <memory>
#include <vector>
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "build/build_config.h"
#include "chrome/browser/net/profile_network_context_service.h"
#include "chrome/browser/net/profile_network_context_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/certificate_manager/certificate_manager_utils.h"
#include "chrome/browser/ui/webui/certificate_manager/chrome_root_store_cert_source.h"
#include "chrome/browser/ui/webui/certificate_manager/client_cert_sources.h"
#include "chrome/browser/ui/webui/certificate_manager/enterprise_cert_sources.h"
#include "chrome/browser/ui/webui/certificate_manager/platform_cert_sources.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/browser/web_contents.h"
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
#include "chrome/browser/ui/webui/settings/settings_utils.h"
#endif
namespace {
void GetCertManagementMetadataAsync(
ProfileNetworkContextService::CertificatePoliciesForView policies,
CertificateManagerPageHandler::GetCertManagementMetadataCallback callback,
cert_verifier::mojom::PlatformRootStoreInfoPtr info) { … }
}
CertificateManagerPageHandler::CertificateManagerPageHandler(
mojo::PendingRemote<certificate_manager_v2::mojom::CertificateManagerPage>
pending_client,
mojo::PendingReceiver<
certificate_manager_v2::mojom::CertificateManagerPageHandler>
pending_handler,
Profile* profile,
content::WebContents* web_contents)
: … { … }
CertificateManagerPageHandler::~CertificateManagerPageHandler() = default;
void CertificateManagerPageHandler::GetCertificates(
certificate_manager_v2::mojom::CertificateSource source_id,
GetCertificatesCallback callback) { … }
void CertificateManagerPageHandler::ViewCertificate(
certificate_manager_v2::mojom::CertificateSource source_id,
const std::string& sha256hash_hex) { … }
void CertificateManagerPageHandler::ExportCertificates(
certificate_manager_v2::mojom::CertificateSource source_id) { … }
void CertificateManagerPageHandler::ImportCertificate(
certificate_manager_v2::mojom::CertificateSource source_id,
ImportCertificateCallback callback) { … }
CertificateManagerPageHandler::CertSource::~CertSource() = default;
CertificateManagerPageHandler::CertSource&
CertificateManagerPageHandler::GetCertSource(
certificate_manager_v2::mojom::CertificateSource source) { … }
void CertificateManagerPageHandler::GetCertManagementMetadata(
GetCertManagementMetadataCallback callback) { … }
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
void CertificateManagerPageHandler::ShowNativeManageCertificates() {
settings_utils::ShowManageSSLCertificates(web_contents_);
}
#endif
void CertificateManagerPageHandler::CertSource::ImportCertificate(
base::WeakPtr<content::WebContents> web_contents,
CertificateManagerPageHandler::ImportCertificateCallback callback) { … }