Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6348)

Unified Diff: chrome/browser/ssl/ssl_blocking_page.h

Issue 622683006: Refactor security interstitials, add SecurityInterstitialPage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: thestig comments Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ssl/ssl_blocking_page.h
diff --git a/chrome/browser/ssl/ssl_blocking_page.h b/chrome/browser/ssl/ssl_blocking_page.h
index fa510085be5881ff9c8d91b297a9ea63744bde2b..062c3b99df422f3e03ed7c6d48a01808d0643d96 100644
--- a/chrome/browser/ssl/ssl_blocking_page.h
+++ b/chrome/browser/ssl/ssl_blocking_page.h
@@ -13,19 +13,10 @@
#include "base/task/cancelable_task_tracker.h"
#include "base/time/time.h"
#include "chrome/browser/history/history_service.h"
-#include "content/public/browser/interstitial_page_delegate.h"
+#include "chrome/browser/interstitials/security_interstitial_page.h"
#include "net/ssl/ssl_info.h"
#include "url/gurl.h"
-namespace base {
-class DictionaryValue;
-}
-
-namespace content {
-class InterstitialPage;
-class WebContents;
-}
-
#if defined(ENABLE_EXTENSIONS)
namespace extensions {
class ExperienceSamplingEvent;
@@ -37,7 +28,7 @@ class SSLErrorClassification;
// This class is responsible for showing/hiding the interstitial page that is
// shown when a certificate error happens.
// It deletes itself when the interstitial page is closed.
-class SSLBlockingPage : public content::InterstitialPageDelegate {
+class SSLBlockingPage : public SecurityInterstitialPage {
public:
// These represent the commands sent from the interstitial JavaScript. They
// are defined in chrome/browser/resources/ssl/ssl_errors_common.js.
@@ -57,10 +48,10 @@ class SSLBlockingPage : public content::InterstitialPageDelegate {
EXPIRED_BUT_PREVIOUSLY_ALLOWED = 1 << 2
};
- ~SSLBlockingPage() override;
+ // Interstitial type, used in tests.
+ static const void* kTypeForTesting;
- // Create an interstitial and show it.
- void Show();
+ ~SSLBlockingPage() override;
// Creates an SSL blocking page. If the blocking page isn't shown, the caller
// is responsible for cleaning up the blocking page, otherwise the
@@ -73,6 +64,9 @@ class SSLBlockingPage : public content::InterstitialPageDelegate {
int options_mask,
const base::Callback<void(bool)>& callback);
+ // SecurityInterstitialPage method:
+ const void* GetTypeForTesting() const override;
+
// A method that sets strings in the specified dictionary from the passed
// vector so that they can be used to resource the ssl_roadblock.html/
// ssl_error.html files.
@@ -82,13 +76,17 @@ class SSLBlockingPage : public content::InterstitialPageDelegate {
protected:
// InterstitialPageDelegate implementation.
- std::string GetHTMLContents() override;
void CommandReceived(const std::string& command) override;
void OverrideEntry(content::NavigationEntry* entry) override;
void OverrideRendererPrefs(content::RendererPreferences* prefs) override;
void OnProceed() override;
void OnDontProceed() override;
+ // SecurityInterstitialPage implementation:
+ bool ShouldCreateNewNavigation() const override;
+ void PopulateInterstitialStrings(
+ base::DictionaryValue* load_time_data) override;
+
private:
void NotifyDenyCertificate();
void NotifyAllowCertificate();
@@ -98,7 +96,6 @@ class SSLBlockingPage : public content::InterstitialPageDelegate {
base::Callback<void(bool)> callback_;
- content::WebContents* web_contents_;
const int cert_error_;
const net::SSLInfo ssl_info_;
const GURL request_url_;
@@ -113,7 +110,6 @@ class SSLBlockingPage : public content::InterstitialPageDelegate {
bool danger_overridable_;
// Has the site requested strict enforcement of certificate errors?
const bool strict_enforcement_;
- content::InterstitialPage* interstitial_page_; // Owns us.
// Is the hostname for an internal network?
bool internal_;
// How many times is this same URL in history?
« no previous file with comments | « chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc ('k') | chrome/browser/ssl/ssl_blocking_page.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698