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

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: add report-sending callback for browser tests 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
16 namespace content { 17 namespace content {
17 class InterstitialPage; 18 class InterstitialPage;
18 class WebContents; 19 class WebContents;
19 } 20 }
20 21
22 namespace interstitials {
23 // Constants used to communicate with the JavaScript.
24 extern const char kBoxChecked[];
25 extern const char kDisplayCheckBox[];
26 extern const char kOptInLink[];
27 extern const char kPrivacyLinkHtml[];
28 }
29
21 class SecurityInterstitialPage : public content::InterstitialPageDelegate { 30 class SecurityInterstitialPage : public content::InterstitialPageDelegate {
22 public: 31 public:
23 SecurityInterstitialPage(content::WebContents* web_contents, 32 SecurityInterstitialPage(content::WebContents* web_contents,
24 const GURL& url); 33 const GURL& url);
25 ~SecurityInterstitialPage() override; 34 ~SecurityInterstitialPage() override;
26 35
27 // Creates an interstitial and shows it. 36 // Creates an interstitial and shows it.
28 virtual void Show(); 37 virtual void Show();
29 38
30 // Returns interstitial type for testing. 39 // Returns interstitial type for testing.
31 virtual const void* GetTypeForTesting() const = 0; 40 virtual const void* GetTypeForTesting() const = 0;
32 41
33 // Prevents creating the actual interstitial view for testing. 42 // Prevents creating the actual interstitial view for testing.
34 void DontCreateViewForTesting(); 43 void DontCreateViewForTesting();
35 44
45 // Allows tests to be notified when an invalid cert chain report has
46 // been sent (or not sent).
47 void SetCertificateReportCallbackForTesting(base::Callback<void()>& callback);
mattm 2015/03/04 02:58:41 Shouldn't this (and the member) be on SSLBlockingP
estark 2015/03/12 22:22:21 I put them here because in a follow-up CL I'm goin
48
36 protected: 49 protected:
37 // Returns true if the interstitial should create a new navigation entry. 50 // Returns true if the interstitial should create a new navigation entry.
38 virtual bool ShouldCreateNewNavigation() const = 0; 51 virtual bool ShouldCreateNewNavigation() const = 0;
39 52
40 // Populates the strings used to generate the HTML from the template. 53 // Populates the strings used to generate the HTML from the template.
41 virtual void PopulateInterstitialStrings( 54 virtual void PopulateInterstitialStrings(
42 base::DictionaryValue* load_time_data) = 0; 55 base::DictionaryValue* load_time_data) = 0;
43 56
44 // InterstitialPageDelegate method: 57 // InterstitialPageDelegate method:
45 std::string GetHTMLContents() override; 58 std::string GetHTMLContents() override;
46 59
47 // Returns the formatted host name for the request url. 60 // Returns the formatted host name for the request url.
48 base::string16 GetFormattedHostName() const; 61 base::string16 GetFormattedHostName() const;
49 62
50 content::InterstitialPage* interstitial_page() const; 63 content::InterstitialPage* interstitial_page() const;
51 content::WebContents* web_contents() const; 64 content::WebContents* web_contents() const;
52 GURL request_url() const; 65 GURL request_url() const;
53 66
67 // Record the user's preference for reporting information about
68 // malware and SSL errors.
69 void SetReportingPreference(bool report);
70
71 // Fills the passed dictionary with the values to be passed to the template
72 // when creating the HTML.
73 virtual void PopulateExtendedReportingOption(
74 base::DictionaryValue* load_time_data) = 0;
75
76 // Returns the boolean value of the given |pref| from the PrefService of the
77 // Profile associated with |web_contents_|.
78 bool IsPrefEnabled(const char* pref);
79
80 // This callback is run when an extended reporting certificate chain
81 // report has been sent, or when it is decided that it should not be
82 // sent (for example, when in incognito mode).
83 base::Callback<void()> certificate_report_callback_for_testing_;
Bernhard Bauer 2015/03/03 21:38:06 This is typedef'd as base::Closure.
estark 2015/03/12 22:22:21 Done.
84
54 private: 85 private:
55 content::WebContents* web_contents_; 86 content::WebContents* web_contents_;
56 const GURL request_url_; 87 const GURL request_url_;
57 // Once shown, |interstitial_page| takes ownership of this 88 // Once shown, |interstitial_page| takes ownership of this
58 // SecurityInterstitialPage instance. 89 // SecurityInterstitialPage instance.
59 content::InterstitialPage* interstitial_page_; 90 content::InterstitialPage* interstitial_page_;
60 // Whether the interstitial should create a view. 91 // Whether the interstitial should create a view.
61 bool create_view_; 92 bool create_view_;
62 93
63 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage); 94 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialPage);
64 }; 95 };
65 96
66 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_ 97 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_PAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698