OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_SSL_SSL_BLOCKING_PAGE_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
6 #define CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 6 #define CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 class WebContents; | 26 class WebContents; |
27 } | 27 } |
28 | 28 |
29 // This class is responsible for showing/hiding the interstitial page that is | 29 // This class is responsible for showing/hiding the interstitial page that is |
30 // shown when a certificate error happens. | 30 // shown when a certificate error happens. |
31 // It deletes itself when the interstitial page is closed. | 31 // It deletes itself when the interstitial page is closed. |
32 // | 32 // |
33 // This class should only be used on the UI thread because its implementation | 33 // This class should only be used on the UI thread because its implementation |
34 // uses captive_portal::CaptivePortalService which can only be accessed on the | 34 // uses captive_portal::CaptivePortalService which can only be accessed on the |
35 // UI thread. | 35 // UI thread. |
36 class SSLBlockingPage : public content::InterstitialPageDelegate, | 36 class SSLBlockingPage : public content::InterstitialPageDelegate { |
37 public content::NotificationObserver { | |
38 public: | 37 public: |
39 // These represent the commands sent from the interstitial JavaScript. They | 38 // These represent the commands sent from the interstitial JavaScript. They |
40 // are defined in chrome/browser/resources/ssl/ssl_errors_common.js. | 39 // are defined in chrome/browser/resources/ssl/ssl_errors_common.js. |
41 // DO NOT reorder or change these without also changing the JavaScript! | 40 // DO NOT reorder or change these without also changing the JavaScript! |
42 enum SSLBlockingPageCommands { | 41 enum SSLBlockingPageCommands { |
43 CMD_DONT_PROCEED = 0, | 42 CMD_DONT_PROCEED = 0, |
44 CMD_PROCEED = 1, | 43 CMD_PROCEED = 1, |
45 CMD_MORE = 2, | 44 CMD_MORE = 2, |
46 CMD_RELOAD = 3, | 45 CMD_RELOAD = 3, |
47 CMD_HELP = 4, | 46 CMD_HELP = 4, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 void NotifyAllowCertificate(); | 79 void NotifyAllowCertificate(); |
81 | 80 |
82 // These fetch the appropriate HTML page, depending on the | 81 // These fetch the appropriate HTML page, depending on the |
83 // SSLInterstitialVersion Finch trial. | 82 // SSLInterstitialVersion Finch trial. |
84 std::string GetHTMLContentsV1(); | 83 std::string GetHTMLContentsV1(); |
85 std::string GetHTMLContentsV2(); | 84 std::string GetHTMLContentsV2(); |
86 | 85 |
87 // Used to query the HistoryService to see if the URL is in history. For UMA. | 86 // Used to query the HistoryService to see if the URL is in history. For UMA. |
88 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); | 87 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); |
89 | 88 |
90 // content::NotificationObserver: | |
91 virtual void Observe( | |
92 int type, | |
93 const content::NotificationSource& source, | |
94 const content::NotificationDetails& details) OVERRIDE; | |
95 | |
96 base::Callback<void(bool)> callback_; | 89 base::Callback<void(bool)> callback_; |
97 | 90 |
98 content::WebContents* web_contents_; | 91 content::WebContents* web_contents_; |
99 int cert_error_; | 92 int cert_error_; |
100 const net::SSLInfo ssl_info_; | 93 const net::SSLInfo ssl_info_; |
101 GURL request_url_; | 94 GURL request_url_; |
102 // Could the user successfully override the error? | 95 // Could the user successfully override the error? |
103 bool overridable_; | 96 bool overridable_; |
104 // Has the site requested strict enforcement of certificate errors? | 97 // Has the site requested strict enforcement of certificate errors? |
105 bool strict_enforcement_; | 98 bool strict_enforcement_; |
106 content::InterstitialPage* interstitial_page_; // Owns us. | 99 content::InterstitialPage* interstitial_page_; // Owns us. |
107 // Is the hostname for an internal network? | 100 // Is the hostname for an internal network? |
108 bool internal_; | 101 bool internal_; |
109 // How many times is this same URL in history? | 102 // How many times is this same URL in history? |
110 int num_visits_; | 103 int num_visits_; |
111 // Used for getting num_visits_. | 104 // Used for getting num_visits_. |
112 base::CancelableTaskTracker request_tracker_; | 105 base::CancelableTaskTracker request_tracker_; |
113 // Is captive portal detection enabled? | |
114 bool captive_portal_detection_enabled_; | |
115 // Did the probe complete before the interstitial was closed? | |
116 bool captive_portal_probe_completed_; | |
117 // Did the captive portal probe receive an error or get a non-HTTP response? | |
118 bool captive_portal_no_response_; | |
119 // Was a captive portal detected? | |
120 bool captive_portal_detected_; | |
121 | 106 |
122 // For the FieldTrial: this contains the name of the condition. | 107 // For the FieldTrial: this contains the name of the condition. |
123 std::string trial_condition_; | 108 std::string trial_condition_; |
124 | 109 |
125 content::NotificationRegistrar registrar_; | 110 content::NotificationRegistrar registrar_; |
126 | 111 |
127 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); | 112 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); |
128 }; | 113 }; |
129 | 114 |
130 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 115 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
OLD | NEW |