chromium/chrome/browser/ui/webui/interstitials/interstitial_ui.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/ui/webui/interstitials/interstitial_ui.h"

#include <memory>
#include <utility>

#include "base/atomic_sequence_num.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted_memory.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/enterprise/connectors/interstitials/enterprise_block_controller_client.h"
#include "chrome/browser/enterprise/connectors/interstitials/enterprise_block_page.h"
#include "chrome/browser/enterprise/connectors/interstitials/enterprise_warn_controller_client.h"
#include "chrome/browser/enterprise/connectors/interstitials/enterprise_warn_page.h"
#include "chrome/browser/lookalikes/lookalike_url_blocking_page.h"
#include "chrome/browser/lookalikes/lookalike_url_controller_client.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
#include "chrome/browser/safe_browsing/test_safe_browsing_blocking_page_quiet.h"
#include "chrome/browser/ssl/chrome_security_blocking_page_factory.h"
#include "chrome/browser/ssl/https_only_mode_controller_client.h"
#include "chrome/browser/ssl/https_upgrades_util.h"
#include "chrome/browser/ssl/insecure_form/insecure_form_controller_client.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/url_constants.h"
#include "components/captive_portal/core/buildflags.h"
#include "components/grit/dev_ui_components_resources.h"
#include "components/lookalikes/core/lookalike_url_util.h"
#include "components/safe_browsing/content/browser/safe_browsing_blocking_page.h"
#include "components/safe_browsing/content/browser/ui_manager.h"
#include "components/safe_browsing/content/browser/unsafe_resource_util.h"
#include "components/safe_browsing/core/browser/db/database_manager.h"
#include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h"
#include "components/security_interstitials/content/bad_clock_blocking_page.h"
#include "components/security_interstitials/content/blocked_interception_blocking_page.h"
#include "components/security_interstitials/content/https_only_mode_blocking_page.h"
#include "components/security_interstitials/content/insecure_form_blocking_page.h"
#include "components/security_interstitials/content/mitm_software_blocking_page.h"
#include "components/security_interstitials/content/security_interstitial_page.h"
#include "components/security_interstitials/core/https_only_mode_metrics.h"
#include "components/security_interstitials/core/ssl_error_options_mask.h"
#include "components/security_interstitials/core/ssl_error_ui.h"
#include "components/security_interstitials/core/unsafe_resource.h"
#include "components/supervised_user/core/browser/supervised_user_error_page.h"  // nogncheck
#include "components/supervised_user/core/browser/supervised_user_interstitial.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
#include "content/public/browser/web_ui_data_source.h"
#include "crypto/rsa_private_key.h"
#include "net/base/net_errors.h"
#include "net/base/url_util.h"
#include "net/cert/x509_certificate.h"
#include "net/cert/x509_util.h"
#include "net/ssl/ssl_info.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/network/public/mojom/content_security_policy.mojom.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/web_ui_util.h"

#if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
#include "components/security_interstitials/content/captive_portal_blocking_page.h"
#endif

#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
#include "chrome/browser/supervised_user/supervised_user_verification_controller_client.h"
#include "chrome/browser/supervised_user/supervised_user_verification_page.h"
#endif

TestSafeBrowsingBlockingPageQuiet;

namespace {

// NSS requires that serial numbers be unique even for the same issuer;
// as all fake certificates will contain the same issuer name, it's
// necessary to ensure the serial number is unique, as otherwise
// NSS will fail to parse.
base::AtomicSequenceNumber g_serial_number;

scoped_refptr<net::X509Certificate> CreateFakeCert() {}

// Implementation of chrome://interstitials demonstration pages. This code is
// not used in displaying any real interstitials.
class InterstitialHTMLSource : public content::URLDataSource {};

std::unique_ptr<SSLBlockingPage> CreateSslBlockingPage(
    content::WebContents* web_contents) {}

std::unique_ptr<MITMSoftwareBlockingPage> CreateMITMSoftwareBlockingPage(
    content::WebContents* web_contents) {}

std::unique_ptr<BlockedInterceptionBlockingPage>
CreateBlockedInterceptionBlockingPage(content::WebContents* web_contents) {}

std::unique_ptr<BadClockBlockingPage> CreateBadClockBlockingPage(
    content::WebContents* web_contents) {}

std::unique_ptr<LookalikeUrlBlockingPage> CreateLookalikeInterstitialPage(
    content::WebContents* web_contents) {}

std::unique_ptr<security_interstitials::InsecureFormBlockingPage>
CreateInsecureFormPage(content::WebContents* web_contents) {}

std::unique_ptr<security_interstitials::HttpsOnlyModeBlockingPage>
CreateHttpsOnlyModePage(content::WebContents* web_contents) {}

std::unique_ptr<security_interstitials::SecurityInterstitialPage>
CreateSafeBrowsingBlockingPage(content::WebContents* web_contents) {}

std::unique_ptr<EnterpriseBlockPage> CreateEnterpriseBlockPage(
    content::WebContents* web_contents) {}

std::unique_ptr<EnterpriseWarnPage> CreateEnterpriseWarnPage(
    content::WebContents* web_contents) {}

#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
std::unique_ptr<SupervisedUserVerificationPage>
CreateSupervisedUserVerificationPage(content::WebContents* web_contents) {}

std::unique_ptr<SupervisedUserVerificationPage>
CreateSupervisedUserVerificationPageForBlockedSite(
    content::WebContents* web_contents) {}
#endif

std::unique_ptr<TestSafeBrowsingBlockingPageQuiet>
CreateSafeBrowsingQuietBlockingPage(content::WebContents* web_contents) {}

#if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
std::unique_ptr<CaptivePortalBlockingPage> CreateCaptivePortalBlockingPage(
    content::WebContents* web_contents) {}
#endif

}  //  namespace

InterstitialUI::InterstitialUI(content::WebUI* web_ui)
    :{}

InterstitialUI::~InterstitialUI() = default;

// InterstitialHTMLSource

std::string InterstitialHTMLSource::GetMimeType(const GURL&) {}

std::string InterstitialHTMLSource::GetSource() {}

std::string InterstitialHTMLSource::GetContentSecurityPolicy(
    const network::mojom::CSPDirectiveName directive) {}

void InterstitialHTMLSource::StartDataRequest(
    const GURL& request_url,
    const content::WebContents::Getter& wc_getter,
    content::URLDataSource::GotDataCallback callback) {}

std::string InterstitialHTMLSource::GetSupervisedUserInterstitialHTML(
    const std::string& path) {}