Chromium Code Reviews| Index: components/ssl_errors/error_classification.h |
| diff --git a/chrome/browser/ssl/ssl_error_classification.h b/components/ssl_errors/error_classification.h |
| similarity index 71% |
| rename from chrome/browser/ssl/ssl_error_classification.h |
| rename to components/ssl_errors/error_classification.h |
| index 8fe69589f98bb93aee9c11cb2f9c2b6ffe8de227..eb20bab6a0986e39f37cea5e7e8392727c6b59e6 100644 |
| --- a/chrome/browser/ssl/ssl_error_classification.h |
| +++ b/components/ssl_errors/error_classification.h |
| @@ -1,37 +1,27 @@ |
| -// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#ifndef CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
| -#define CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
| +#ifndef COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ |
| +#define COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ |
| #include <string> |
| #include <vector> |
| #include "base/time/time.h" |
| -#include "content/public/browser/notification_observer.h" |
| -#include "content/public/browser/notification_registrar.h" |
| #include "net/cert/x509_certificate.h" |
| #include "url/gurl.h" |
| -namespace content { |
| -class WebContents; |
| -} |
| - |
| -// This class classifies characteristics of SSL errors, including information |
| -// about captive portal detection. |
| -// |
| -// This class should only be used on the UI thread because its |
| -// implementation uses captive_portal::CaptivePortalService which can only be |
| -// accessed on the UI thread. |
| -class SSLErrorClassification : public content::NotificationObserver { |
| +namespace ssl_errors { |
| + |
| +// This class classifies characteristics of SSL errors. |
| +class ErrorClassification { |
| public: |
| - SSLErrorClassification(content::WebContents* web_contents, |
| - const base::Time& current_time, |
| - const GURL& url, |
| - int cert_error, |
| - const net::X509Certificate& cert); |
| - ~SSLErrorClassification() override; |
| + ErrorClassification(const base::Time& current_time, |
| + const GURL& url, |
| + int cert_error, |
| + const net::X509Certificate& cert); |
| + ~ErrorClassification(); |
| // Returns true if the system time is in the past. |
| static bool IsUserClockInThePast(const base::Time& time_now); |
| @@ -86,14 +76,12 @@ class SSLErrorClassification : public content::NotificationObserver { |
| void InvalidAuthoritySeverityScore(); |
| void RecordUMAStatistics(bool overridable) const; |
| - void RecordCaptivePortalUMAStatistics(bool overridable) const; |
| base::TimeDelta TimePassedSinceExpiry() const; |
| private: |
| - FRIEND_TEST_ALL_PREFIXES(SSLErrorClassificationTest, TestDateInvalidScore); |
| - FRIEND_TEST_ALL_PREFIXES(SSLErrorClassificationTest, TestNameMismatch); |
| - FRIEND_TEST_ALL_PREFIXES(SSLErrorClassificationTest, |
| - TestHostNameHasKnownTLD); |
| + FRIEND_TEST_ALL_PREFIXES(ErrorClassificationTest, TestDateInvalidScore); |
| + FRIEND_TEST_ALL_PREFIXES(ErrorClassificationTest, TestNameMismatch); |
| + FRIEND_TEST_ALL_PREFIXES(ErrorClassificationTest, TestHostNameHasKnownTLD); |
| typedef std::vector<std::string> Tokens; |
| @@ -105,14 +93,14 @@ class SSLErrorClassification : public content::NotificationObserver { |
| // Returns true if |child| is a subdomain of any of the |potential_parents|. |
| bool NameUnderAnyNames(const Tokens& child, |
| - const std::vector<Tokens>& potential_parents) const; |
| + const std::vector<Tokens>& potential_parents) const; |
| // Returns true if any of the |potential_children| is a subdomain of the |
| // |parent|. The inverse case should be treated carefully as this is most |
| // likely a MITM attack. We don't want foo.appspot.com to be able to MITM for |
| // appspot.com. |
| bool AnyNamesUnderName(const std::vector<Tokens>& potential_children, |
| - const Tokens& parent) const; |
| + const Tokens& parent) const; |
| // Returns true if |hostname| is too broad for the scope of a wildcard |
| // certificate. E.g.: |
| @@ -152,28 +140,14 @@ class SSLErrorClassification : public content::NotificationObserver { |
| float CalculateScoreTimePassedSinceExpiry() const; |
| float CalculateScoreEnvironments() const; |
| - // content::NotificationObserver: |
| - void Observe(int type, |
| - const content::NotificationSource& source, |
| - const content::NotificationDetails& details) override; |
| - |
| - content::WebContents* web_contents_; |
| // This stores the current time. |
|
estark
2015/09/23 22:42:19
nit on pre-existing code, which must surely be the
|
| base::Time current_time_; |
| const GURL request_url_; |
| int cert_error_; |
| // This stores the certificate. |
| const net::X509Certificate& cert_; |
| - // Is captive portal detection enabled? |
| - bool captive_portal_detection_enabled_; |
| - // Did the probe complete before the interstitial was closed? |
| - bool captive_portal_probe_completed_; |
| - // Did the captive portal probe receive an error or get a non-HTTP response? |
| - bool captive_portal_no_response_; |
| - // Was a captive portal detected? |
| - bool captive_portal_detected_; |
| - |
| - content::NotificationRegistrar registrar_; |
| }; |
| -#endif // CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ |
| +} // namespace ssl_errors |
| + |
| +#endif // COMPONENTS_SSL_ERRORS_ERROR_CLASSIFICATION_H_ |