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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #if defined(ENABLE_EXTENSIONS) | 29 #if defined(ENABLE_EXTENSIONS) |
30 namespace extensions { | 30 namespace extensions { |
31 class ExperienceSamplingEvent; | 31 class ExperienceSamplingEvent; |
32 } | 32 } |
33 #endif | 33 #endif |
34 | 34 |
35 // This class is responsible for showing/hiding the interstitial page that is | 35 // This class is responsible for showing/hiding the interstitial page that is |
36 // shown when a certificate error happens. | 36 // shown when a certificate error happens. |
37 // It deletes itself when the interstitial page is closed. | 37 // It deletes itself when the interstitial page is closed. |
38 // | 38 class SSLBlockingPage : public content::InterstitialPageDelegate { |
39 // This class should only be used on the UI thread because its implementation | |
40 // uses captive_portal::CaptivePortalService which can only be accessed on the | |
41 // UI thread. | |
42 class SSLBlockingPage : public content::InterstitialPageDelegate, | |
43 public content::NotificationObserver { | |
44 public: | 39 public: |
45 // These represent the commands sent from the interstitial JavaScript. They | 40 // These represent the commands sent from the interstitial JavaScript. They |
46 // are defined in chrome/browser/resources/ssl/ssl_errors_common.js. | 41 // are defined in chrome/browser/resources/ssl/ssl_errors_common.js. |
47 // DO NOT reorder or change these without also changing the JavaScript! | 42 // DO NOT reorder or change these without also changing the JavaScript! |
48 enum SSLBlockingPageCommands { | 43 enum SSLBlockingPageCommands { |
49 CMD_DONT_PROCEED = 0, | 44 CMD_DONT_PROCEED = 0, |
50 CMD_PROCEED = 1, | 45 CMD_PROCEED = 1, |
51 CMD_MORE = 2, | 46 CMD_MORE = 2, |
52 CMD_RELOAD = 3, | 47 CMD_RELOAD = 3, |
53 CMD_HELP = 4, | 48 CMD_HELP = 4, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 virtual void OnProceed() OVERRIDE; | 83 virtual void OnProceed() OVERRIDE; |
89 virtual void OnDontProceed() OVERRIDE; | 84 virtual void OnDontProceed() OVERRIDE; |
90 | 85 |
91 private: | 86 private: |
92 void NotifyDenyCertificate(); | 87 void NotifyDenyCertificate(); |
93 void NotifyAllowCertificate(); | 88 void NotifyAllowCertificate(); |
94 | 89 |
95 // Used to query the HistoryService to see if the URL is in history. For UMA. | 90 // Used to query the HistoryService to see if the URL is in history. For UMA. |
96 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); | 91 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); |
97 | 92 |
98 // content::NotificationObserver: | |
99 virtual void Observe( | |
100 int type, | |
101 const content::NotificationSource& source, | |
102 const content::NotificationDetails& details) OVERRIDE; | |
103 | |
104 base::Callback<void(bool)> callback_; | 93 base::Callback<void(bool)> callback_; |
105 | 94 |
106 content::WebContents* web_contents_; | 95 content::WebContents* web_contents_; |
107 int cert_error_; | 96 int cert_error_; |
108 const net::SSLInfo ssl_info_; | 97 const net::SSLInfo ssl_info_; |
109 GURL request_url_; | 98 GURL request_url_; |
110 // Could the user successfully override the error? | 99 // Could the user successfully override the error? |
111 // overridable_ will be set to false if strict_enforcement_ is true. | 100 // overridable_ will be set to false if strict_enforcement_ is true. |
112 bool overridable_; | 101 bool overridable_; |
113 // Has the site requested strict enforcement of certificate errors? | 102 // Has the site requested strict enforcement of certificate errors? |
114 bool strict_enforcement_; | 103 bool strict_enforcement_; |
115 content::InterstitialPage* interstitial_page_; // Owns us. | 104 content::InterstitialPage* interstitial_page_; // Owns us. |
116 // Is the hostname for an internal network? | 105 // Is the hostname for an internal network? |
117 bool internal_; | 106 bool internal_; |
118 // How many times is this same URL in history? | 107 // How many times is this same URL in history? |
119 int num_visits_; | 108 int num_visits_; |
120 // Used for getting num_visits_. | 109 // Used for getting num_visits_. |
121 base::CancelableTaskTracker request_tracker_; | 110 base::CancelableTaskTracker request_tracker_; |
122 // Is captive portal detection enabled? | |
123 bool captive_portal_detection_enabled_; | |
124 // Did the probe complete before the interstitial was closed? | |
125 bool captive_portal_probe_completed_; | |
126 // Did the captive portal probe receive an error or get a non-HTTP response? | |
127 bool captive_portal_no_response_; | |
128 // Was a captive portal detected? | |
129 bool captive_portal_detected_; | |
130 | 111 |
131 // For the FieldTrial: this contains the name of the condition. | 112 // For the FieldTrial: this contains the name of the condition. |
132 std::string trial_condition_; | 113 std::string trial_condition_; |
133 | 114 |
134 #if defined(ENABLE_EXTENSIONS) | 115 #if defined(ENABLE_EXTENSIONS) |
135 // For Chrome Experience Sampling Platform: this maintains event state. | 116 // For Chrome Experience Sampling Platform: this maintains event state. |
136 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; | 117 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
137 #endif | 118 #endif |
138 | 119 |
139 content::NotificationRegistrar registrar_; | 120 content::NotificationRegistrar registrar_; |
140 | 121 |
141 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); | 122 DISALLOW_COPY_AND_ASSIGN(SSLBlockingPage); |
142 }; | 123 }; |
143 | 124 |
144 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ | 125 #endif // CHROME_BROWSER_SSL_SSL_BLOCKING_PAGE_H_ |
OLD | NEW |