Popular sites on the NTP: check that experiment group StartsWith (rather than IS...
[chromium-blink-merge.git] / chrome / browser / ssl / bad_clock_blocking_page.h
blobb7e4a774919e1e4933a1038b873812dd68b22c6f
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SSL_BAD_CLOCK_BLOCKING_PAGE_H_
6 #define CHROME_BROWSER_SSL_BAD_CLOCK_BLOCKING_PAGE_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "base/time/time.h"
12 #include "chrome/browser/interstitials/security_interstitial_page.h"
13 #include "net/ssl/ssl_info.h"
15 class GURL;
17 // This class is responsible for showing/hiding the interstitial page that is
18 // shown when a certificate error happens. This error is not overridable.
19 // It deletes itself when the interstitial page is closed.
20 class BadClockBlockingPage : public SecurityInterstitialPage {
21 public:
22 // Interstitial type, used in tests.
23 static InterstitialPageDelegate::TypeID kTypeForTesting;
25 // Creates a bad clock interstitial. If the blocking page isn't shown, the
26 // caller is responsible for cleaning up the blocking page, otherwise the
27 // interstitial takes ownership when shown.
28 BadClockBlockingPage(content::WebContents* web_contents,
29 int cert_error,
30 const net::SSLInfo& ssl_info,
31 const GURL& request_url,
32 const base::Time& time_triggered,
33 const base::Callback<void(bool)>& callback);
35 ~BadClockBlockingPage() override;
37 // InterstitialPageDelegate method:
38 InterstitialPageDelegate::TypeID GetTypeForTesting() const override;
40 protected:
41 // InterstitialPageDelegate implementation.
42 void CommandReceived(const std::string& command) override;
43 void OverrideEntry(content::NavigationEntry* entry) override;
44 void OverrideRendererPrefs(content::RendererPreferences* prefs) override;
45 void OnDontProceed() override;
47 // SecurityInterstitialPage implementation:
48 bool ShouldCreateNewNavigation() const override;
49 void PopulateInterstitialStrings(
50 base::DictionaryValue* load_time_data) override;
52 private:
53 void NotifyDenyCertificate();
55 base::Callback<void(bool)> callback_;
57 const int cert_error_;
58 const net::SSLInfo ssl_info_;
60 // The time at which the interstitial was triggered. The interstitial
61 // calculates all times relative to this.
62 const base::Time time_triggered_;
64 DISALLOW_COPY_AND_ASSIGN(BadClockBlockingPage);
67 #endif // CHROME_BROWSER_SSL_BAD_CLOCK_BLOCKING_PAGE_H_