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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 virtual void OnProceed() OVERRIDE; | 81 virtual void OnProceed() OVERRIDE; |
83 virtual void OnDontProceed() OVERRIDE; | 82 virtual void OnDontProceed() OVERRIDE; |
84 | 83 |
85 private: | 84 private: |
86 void NotifyDenyCertificate(); | 85 void NotifyDenyCertificate(); |
87 void NotifyAllowCertificate(); | 86 void NotifyAllowCertificate(); |
88 | 87 |
89 // Used to query the HistoryService to see if the URL is in history. For UMA. | 88 // Used to query the HistoryService to see if the URL is in history. For UMA. |
90 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); | 89 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); |
91 | 90 |
92 // content::NotificationObserver: | |
93 virtual void Observe( | |
94 int type, | |
95 const content::NotificationSource& source, | |
96 const content::NotificationDetails& details) OVERRIDE; | |
97 | |
98 base::Callback<void(bool)> callback_; | 91 base::Callback<void(bool)> callback_; |
99 | 92 |
100 content::WebContents* web_contents_; | 93 content::WebContents* web_contents_; |
101 int cert_error_; | 94 int cert_error_; |
102 const net::SSLInfo ssl_info_; | 95 const net::SSLInfo ssl_info_; |
103 GURL request_url_; | 96 GURL request_url_; |
104 // Could the user successfully override the error? | 97 // Could the user successfully override the error? |
105 bool overridable_; | 98 bool overridable_; |
106 // Has the site requested strict enforcement of certificate errors? | 99 // Has the site requested strict enforcement of certificate errors? |
107 bool strict_enforcement_; | 100 bool strict_enforcement_; |
108 content::InterstitialPage* interstitial_page_; // Owns us. | 101 content::InterstitialPage* interstitial_page_; // Owns us. |
109 // Is the hostname for an internal network? | 102 // Is the hostname for an internal network? |
110 bool internal_; | 103 bool internal_; |
111 // How many times is this same URL in history? | 104 // How many times is this same URL in history? |
112 int num_visits_; | 105 int num_visits_; |
113 // Used for getting num_visits_. | 106 // Used for getting num_visits_. |
114 base::CancelableTaskTracker request_tracker_; | 107 base::CancelableTaskTracker request_tracker_; |
115 // Is captive portal detection enabled? | |
116 bool captive_portal_detection_enabled_; | |
117 // Did the probe complete before the interstitial was closed? | |
118 bool captive_portal_probe_completed_; | |
119 // Did the captive portal probe receive an error or get a non-HTTP response? | |
120 bool captive_portal_no_response_; | |
121 // Was a captive portal detected? | |
122 bool captive_portal_detected_; | |
123 | 108 |
124 content::NotificationRegistrar registrar_; | 109 content::NotificationRegistrar registrar_; |
125 | 110 |
126 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); | 111 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); |
127 }; | 112 }; |
128 | 113 |
129 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 114 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
OLD | NEW |