#ifndef IOS_COMPONENTS_SECURITY_INTERSTITIALS_IOS_BLOCKING_PAGE_CONTROLLER_CLIENT_H_
#define IOS_COMPONENTS_SECURITY_INTERSTITIALS_IOS_BLOCKING_PAGE_CONTROLLER_CLIENT_H_
#include <string>
#import "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "components/security_interstitials/core/controller_client.h"
#include "ios/web/public/web_state_observer.h"
class GURL;
namespace web {
class WebState;
}
namespace security_interstitials {
class MetricsHelper;
class IOSBlockingPageControllerClient
: public security_interstitials::ControllerClient,
public web::WebStateObserver {
public:
IOSBlockingPageControllerClient(
web::WebState* web_state,
std::unique_ptr<security_interstitials::MetricsHelper> metrics_helper,
const std::string& app_locale);
IOSBlockingPageControllerClient(const IOSBlockingPageControllerClient&) =
delete;
IOSBlockingPageControllerClient& operator=(
const IOSBlockingPageControllerClient&) = delete;
~IOSBlockingPageControllerClient() override;
void Proceed() override;
void GoBack() override;
bool CanGoBack() override;
void OpenEnhancedProtectionSettings() override;
void WebStateDestroyed(web::WebState* web_state) override;
const std::string& GetApplicationLocale() const override;
void OpenUrlInNewForegroundTab(const GURL& url) override;
protected:
web::WebState* web_state() const { return web_state_; }
bool CanLaunchDateAndTimeSettings() override;
void LaunchDateAndTimeSettings() override;
bool CanGoBackBeforeNavigation() override;
void GoBackAfterNavigationCommitted() override;
void Reload() override;
void OpenUrlInCurrentTab(const GURL& url) override;
PrefService* GetPrefService() override;
const std::string GetExtendedReportingPrefName() const override;
private:
void Close();
raw_ptr<web::WebState> web_state_;
const std::string app_locale_;
base::WeakPtrFactory<IOSBlockingPageControllerClient> weak_factory_;
};
}
#endif