| OLD | NEW |
| 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_SSL_SSL_ERROR_CLASSIFICATION_H_ | 5 #ifndef CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
| 6 #define CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ | 6 #define CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 // This class should only be used on the UI thread because its | 24 // This class should only be used on the UI thread because its |
| 25 // implementation uses captive_portal::CaptivePortalService which can only be | 25 // implementation uses captive_portal::CaptivePortalService which can only be |
| 26 // accessed on the UI thread. | 26 // accessed on the UI thread. |
| 27 class SSLErrorClassification : public content::NotificationObserver { | 27 class SSLErrorClassification : public content::NotificationObserver { |
| 28 public: | 28 public: |
| 29 SSLErrorClassification(content::WebContents* web_contents, | 29 SSLErrorClassification(content::WebContents* web_contents, |
| 30 const base::Time& current_time, | 30 const base::Time& current_time, |
| 31 const GURL& url, | 31 const GURL& url, |
| 32 int cert_error, | 32 int cert_error, |
| 33 const net::X509Certificate& cert); | 33 const net::X509Certificate& cert); |
| 34 virtual ~SSLErrorClassification(); | 34 ~SSLErrorClassification() override; |
| 35 | 35 |
| 36 // Returns true if the system time is in the past. | 36 // Returns true if the system time is in the past. |
| 37 static bool IsUserClockInThePast(const base::Time& time_now); | 37 static bool IsUserClockInThePast(const base::Time& time_now); |
| 38 | 38 |
| 39 // Returns true if the system time is too far in the future or the user is | 39 // Returns true if the system time is too far in the future or the user is |
| 40 // using a version of Chrome which is more than 1 year old. | 40 // using a version of Chrome which is more than 1 year old. |
| 41 static bool IsUserClockInTheFuture(const base::Time& time_now); | 41 static bool IsUserClockInTheFuture(const base::Time& time_now); |
| 42 | 42 |
| 43 // Returns true if the Windows platform is likely to not have SHA-256 support. | 43 // Returns true if the Windows platform is likely to not have SHA-256 support. |
| 44 // On other platforms, returns false always. | 44 // On other platforms, returns false always. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // --> 2. | 119 // --> 2. |
| 120 size_t FindSubDomainDifference(const Tokens& potential_subdomain, | 120 size_t FindSubDomainDifference(const Tokens& potential_subdomain, |
| 121 const Tokens& parent) const; | 121 const Tokens& parent) const; |
| 122 | 122 |
| 123 static Tokens Tokenize(const std::string& name); | 123 static Tokens Tokenize(const std::string& name); |
| 124 | 124 |
| 125 float CalculateScoreTimePassedSinceExpiry() const; | 125 float CalculateScoreTimePassedSinceExpiry() const; |
| 126 float CalculateScoreEnvironments() const; | 126 float CalculateScoreEnvironments() const; |
| 127 | 127 |
| 128 // content::NotificationObserver: | 128 // content::NotificationObserver: |
| 129 virtual void Observe( | 129 void Observe(int type, |
| 130 int type, | 130 const content::NotificationSource& source, |
| 131 const content::NotificationSource& source, | 131 const content::NotificationDetails& details) override; |
| 132 const content::NotificationDetails& details) override; | |
| 133 | 132 |
| 134 content::WebContents* web_contents_; | 133 content::WebContents* web_contents_; |
| 135 // This stores the current time. | 134 // This stores the current time. |
| 136 base::Time current_time_; | 135 base::Time current_time_; |
| 137 const GURL request_url_; | 136 const GURL request_url_; |
| 138 int cert_error_; | 137 int cert_error_; |
| 139 // This stores the certificate. | 138 // This stores the certificate. |
| 140 const net::X509Certificate& cert_; | 139 const net::X509Certificate& cert_; |
| 141 // Is captive portal detection enabled? | 140 // Is captive portal detection enabled? |
| 142 bool captive_portal_detection_enabled_; | 141 bool captive_portal_detection_enabled_; |
| 143 // Did the probe complete before the interstitial was closed? | 142 // Did the probe complete before the interstitial was closed? |
| 144 bool captive_portal_probe_completed_; | 143 bool captive_portal_probe_completed_; |
| 145 // Did the captive portal probe receive an error or get a non-HTTP response? | 144 // Did the captive portal probe receive an error or get a non-HTTP response? |
| 146 bool captive_portal_no_response_; | 145 bool captive_portal_no_response_; |
| 147 // Was a captive portal detected? | 146 // Was a captive portal detected? |
| 148 bool captive_portal_detected_; | 147 bool captive_portal_detected_; |
| 149 | 148 |
| 150 content::NotificationRegistrar registrar_; | 149 content::NotificationRegistrar registrar_; |
| 151 }; | 150 }; |
| 152 | 151 |
| 153 #endif // CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ | 152 #endif // CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
| OLD | NEW |