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

Side by Side Diff: chrome/browser/interstitials/security_interstitial_page.h

Issue 935663004: Add checkbox for reporting invalid TLS/SSL cert chains (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comment typo Created 5 years, 9 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ 5 #ifndef CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_
6 #define CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ 6 #define CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_
7 7
8 #include "base/callback.h"
8 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
9 #include "content/public/browser/interstitial_page_delegate.h" 10 #include "content/public/browser/interstitial_page_delegate.h"
10 #include "url/gurl.h" 11 #include "url/gurl.h"
11 12
12 namespace base { 13 namespace base {
13 class DictionaryValue; 14 class DictionaryValue;
14 } 15 }
15 16
17 namespace chrome_browser_net {
18 class CertificateErrorReporter;
19 }
20
16 namespace content { 21 namespace content {
17 class InterstitialPage; 22 class InterstitialPage;
18 class WebContents; 23 class WebContents;
19 } 24 }
20 25
26 namespace interstitials {
27 // Constants used to communicate with the JavaScript.
28 extern const char kBoxChecked[];
29 extern const char kDisplayCheckBox[];
30 extern const char kOptInLink[];
31 extern const char kPrivacyLinkHtml[];
32 }
33
21 class SecurityInterstitialPage : public content::InterstitialPageDelegate { 34 class SecurityInterstitialPage : public content::InterstitialPageDelegate {
22 public: 35 public:
23 // These represent the commands sent from the interstitial JavaScript. 36 // These represent the commands sent from the interstitial JavaScript.
24 // DO NOT reorder or change these without also changing the JavaScript! 37 // DO NOT reorder or change these without also changing the JavaScript!
25 // See chrome/browser/resources/security_warnings/interstitial_v2.js 38 // See chrome/browser/resources/security_warnings/interstitial_v2.js
26 enum SecurityInterstitialCommands { 39 enum SecurityInterstitialCommands {
27 // Decisions 40 // Decisions
28 CMD_DONT_PROCEED = 0, 41 CMD_DONT_PROCEED = 0,
29 CMD_PROCEED = 1, 42 CMD_PROCEED = 1,
30 // Ways for user to get more information 43 // Ways for user to get more information
(...skipping 13 matching lines...) Expand all
44 SecurityInterstitialPage(content::WebContents* web_contents, 57 SecurityInterstitialPage(content::WebContents* web_contents,
45 const GURL& url); 58 const GURL& url);
46 ~SecurityInterstitialPage() override; 59 ~SecurityInterstitialPage() override;
47 60
48 // Creates an interstitial and shows it. 61 // Creates an interstitial and shows it.
49 virtual void Show(); 62 virtual void Show();
50 63
51 // Prevents creating the actual interstitial view for testing. 64 // Prevents creating the actual interstitial view for testing.
52 void DontCreateViewForTesting(); 65 void DontCreateViewForTesting();
53 66
67 // Allows tests to be notified when an invalid cert chain report has
68 // been sent (or not sent).
69 void SetCertificateReportCallbackForTesting(const base::Closure& callback);
70
54 protected: 71 protected:
55 // Returns true if the interstitial should create a new navigation entry. 72 // Returns true if the interstitial should create a new navigation entry.
56 virtual bool ShouldCreateNewNavigation() const = 0; 73 virtual bool ShouldCreateNewNavigation() const = 0;
57 74
58 // Populates the strings used to generate the HTML from the template. 75 // Populates the strings used to generate the HTML from the template.
59 virtual void PopulateInterstitialStrings( 76 virtual void PopulateInterstitialStrings(
60 base::DictionaryValue* load_time_data) = 0; 77 base::DictionaryValue* load_time_data) = 0;
61 78
62 // InterstitialPageDelegate method: 79 // InterstitialPageDelegate method:
63 std::string GetHTMLContents() override; 80 std::string GetHTMLContents() override;
64 81
65 // Returns the formatted host name for the request url. 82 // Returns the formatted host name for the request url.
66 base::string16 GetFormattedHostName() const; 83 base::string16 GetFormattedHostName() const;
67 84
68 content::InterstitialPage* interstitial_page() const; 85 content::InterstitialPage* interstitial_page() const;
69 content::WebContents* web_contents() const; 86 content::WebContents* web_contents() const;
70 GURL request_url() const; 87 GURL request_url() const;
71 88
89 // Record the user's preference for reporting information about
90 // malware and SSL errors.
91 void SetReportingPreference(bool report);
92
93 // Fills the passed dictionary with the values to be passed to the template
94 // when creating the HTML.
95 virtual void PopulateExtendedReportingOption(
96 base::DictionaryValue* load_time_data) = 0;
mattm 2015/03/17 20:58:12 This doesn't need to be in SecurityInterstitialPag
estark 2015/03/18 15:57:18 Done.
97
98 // Returns the boolean value of the given |pref| from the PrefService of the
99 // Profile associated with |web_contents_|.
100 bool IsPrefEnabled(const char* pref);
101
102 // This callback is run when an extended reporting certificate chain
103 // report has been sent, or when it is decided that it should not be
104 // sent (for example, when in incognito mode).
105 base::Closure certificate_report_callback_for_testing_;
106
107 protected:
108 void OpenExtendedReportingPrivacyPolicy();
109
72 private: 110 private:
73 content::WebContents* web_contents_; 111 content::WebContents* web_contents_;
74 const GURL request_url_; 112 const GURL request_url_;
75 // Once shown, |interstitial_page| takes ownership of this 113 // Once shown, |interstitial_page| takes ownership of this
76 // SecurityInterstitialPage instance. 114 // SecurityInterstitialPage instance.
77 content::InterstitialPage* interstitial_page_; 115 content::InterstitialPage* interstitial_page_;
78 // Whether the interstitial should create a view. 116 // Whether the interstitial should create a view.
79 bool create_view_; 117 bool create_view_;
80 118
81 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); 119 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage);
82 }; 120 };
83 121
84 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ 122 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698