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