Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: chrome/browser/ssl/ssl_error_classification.h

Issue 400323002: Refactor the captive portal code to move from the ssl_blocking_page class to the ssl_error_classific (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Moved the histogram stuff Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ssl/ssl_error_classification.h
diff --git a/chrome/browser/ssl/ssl_error_classification.h b/chrome/browser/ssl/ssl_error_classification.h
index 87851ec60f72ee373063c7b963705c8ae21ee0a7..000f709fd8ee69da64b5d40676e4465f4f14495d 100644
--- a/chrome/browser/ssl/ssl_error_classification.h
+++ b/chrome/browser/ssl/ssl_error_classification.h
@@ -6,17 +6,25 @@
#define CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_
#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"
+namespace content {
+class WebContents;
+}
+
// This class calculates the severity scores for the different type of SSL
// errors.
-class SSLErrorClassification {
+class SSLErrorClassification : public content::NotificationObserver {
public:
- SSLErrorClassification(base::Time current_time,
+ SSLErrorClassification(content::WebContents* web_contents,
+ base::Time current_time,
+ int cert_error,
const net::X509Certificate& cert);
- ~SSLErrorClassification();
+ virtual ~SSLErrorClassification();
- // This method checks whether the user clock is in the past or not.
+ // This method checks whether the system time is in the past.
static bool IsUserClockInThePast(base::Time time_now);
// This method checks whether the system time is too far in the future or
@@ -27,21 +35,40 @@ class SSLErrorClassification {
// A method which calculates the severity score when the ssl error is
// CERT_DATE_INVALID.
- float InvalidDateSeverityScore() const;
+ void InvalidDateSeverityScore() const;
- static void RecordUMAStatistics(bool overridable);
+ void RecordUMAStatistics(bool overridable) const;
+ void RecordCaptivePortalUMAStatistics(bool overridable) const;
base::TimeDelta TimePassedSinceExpiry() const;
private:
- FRIEND_TEST_ALL_PREFIXES(SSLErrorClassification, TestDateInvalidScore);
+ FRIEND_TEST_ALL_PREFIXES(SSLErrorClassificationTest, TestDateInvalidScore);
float CalculateScoreTimePassedSinceExpiry() const;
+ float CalculateScoreEnvironments() const;
+
+ // content::NotificationObserver:
+ virtual void Observe(
+ int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+ content::WebContents* web_contents_;
// This stores the current time.
base::Time current_time_;
-
+ 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_

Powered by Google App Engine
This is Rietveld 408576698