Fire an error if a pref used in the UI is missing once all prefs are fetched.
[chromium-blink-merge.git] / chrome / browser / interstitials / security_interstitial_page.h
blob0e96ebc1190c7db66f75010513309a2b5c76747b
1 // Copyright 2014 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_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_
6 #define CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_
8 #include "base/strings/string16.h"
9 #include "content/public/browser/interstitial_page_delegate.h"
10 #include "url/gurl.h"
12 namespace base {
13 class DictionaryValue;
16 namespace content {
17 class InterstitialPage;
18 class WebContents;
21 class SecurityInterstitialPage : public content::InterstitialPageDelegate {
22 public:
23 // These represent the commands sent from the interstitial JavaScript.
24 // DO NOT reorder or change these without also changing the JavaScript!
25 // See chrome/browser/resources/security_warnings/interstitial_v2.js
26 enum SecurityInterstitialCommands {
27 // Decisions
28 CMD_DONT_PROCEED = 0,
29 CMD_PROCEED = 1,
30 // Ways for user to get more information
31 CMD_SHOW_MORE_SECTION = 2,
32 CMD_OPEN_HELP_CENTER = 3,
33 CMD_OPEN_DIAGNOSTIC = 4,
34 // Primary button actions
35 CMD_RELOAD = 5,
36 CMD_OPEN_DATE_SETTINGS = 6,
37 CMD_OPEN_LOGIN = 7,
38 // Safe Browsing Extended Reporting
39 CMD_DO_REPORT = 8,
40 CMD_DONT_REPORT = 9,
41 CMD_OPEN_REPORTING_PRIVACY = 10,
44 SecurityInterstitialPage(content::WebContents* web_contents,
45 const GURL& url);
46 ~SecurityInterstitialPage() override;
48 // Creates an interstitial and shows it.
49 virtual void Show();
51 // Prevents creating the actual interstitial view for testing.
52 void DontCreateViewForTesting();
54 protected:
55 // Returns true if the interstitial should create a new navigation entry.
56 virtual bool ShouldCreateNewNavigation() const = 0;
58 // Populates the strings used to generate the HTML from the template.
59 virtual void PopulateInterstitialStrings(
60 base::DictionaryValue* load_time_data) = 0;
62 // InterstitialPageDelegate method:
63 std::string GetHTMLContents() override;
65 // Returns the formatted host name for the request url.
66 base::string16 GetFormattedHostName() const;
68 content::InterstitialPage* interstitial_page() const;
69 content::WebContents* web_contents() const;
70 GURL request_url() const;
72 private:
73 content::WebContents* web_contents_;
74 const GURL request_url_;
75 // Once shown, |interstitial_page| takes ownership of this
76 // SecurityInterstitialPage instance.
77 content::InterstitialPage* interstitial_page_;
78 // Whether the interstitial should create a view.
79 bool create_view_;
81 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage);
84 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_