blob: 967a9e7d8c99cd1454d74a40115aab3853c12a88 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/memory/weak_ptr.h"
#include "components/security_interstitials/core/controller_client.h"
#include "gin/wrappable.h"
namespace content {
class RenderFrame;
// This class makes various helper functions available to interstitials
// when committed interstitials are on. It is bound to the JavaScript
// window.certificateErrorPageController object.
class SecurityInterstitialPageController
: public gin::Wrappable<SecurityInterstitialPageController> {
static gin::WrapperInfo kWrapperInfo;
class Delegate {
// Called when the interstitial calls any of the installed JS methods.
// |command| describes the command sent by the interstitial.
virtual void SendCommand(
security_interstitials::SecurityInterstitialCommand command) = 0;
virtual ~Delegate();
// Will invoke methods on |delegate| in response to user actions taken on the
// interstitial. May call delegate methods even after the page has been
// navigated away from, so it is recommended consumers make sure the weak
// pointers are destroyed in response to navigations.
static void Install(content::RenderFrame* render_frame,
base::WeakPtr<Delegate> delegate);
explicit SecurityInterstitialPageController(base::WeakPtr<Delegate> delegate);
~SecurityInterstitialPageController() override;
void DontProceed();
void Proceed();
void ShowMoreSection();
void OpenHelpCenter();
void OpenDiagnostic();
void Reload();
void OpenDateSettings();
void OpenLogin();
void DoReport();
void DontReport();
void OpenReportingPrivacy();
void OpenWhitepaper();
void ReportPhishingError();
void SendCommand(security_interstitials::SecurityInterstitialCommand command);
// gin::WrappableBase
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
base::WeakPtr<Delegate> const delegate_;