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

Side by Side 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: Added comments 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 unified diff | Download patch
OLDNEW
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 "base/time/time.h" 8 #include "base/time/time.h"
9 #include "content/public/browser/notification_observer.h"
10 #include "content/public/browser/notification_registrar.h"
9 #include "net/cert/x509_certificate.h" 11 #include "net/cert/x509_certificate.h"
10 12
13 namespace content {
14 class WebContents;
15 }
16
11 // This class calculates the severity scores for the different type of SSL 17 // This class calculates the severity scores for the different type of SSL
12 // errors. 18 // errors.
13 class SSLErrorClassification { 19 class SSLErrorClassification : public content::NotificationObserver {
14 public: 20 public:
15 SSLErrorClassification(base::Time current_time, 21 SSLErrorClassification(content::WebContents& web_contents,
16 const net::X509Certificate& cert); 22 base::Time current_time,
17 ~SSLErrorClassification(); 23 const::net::X509Certificate& cert);
meacer 2014/07/19 00:06:45 You don't need :: before net here, do you? const
radhikabhar 2014/07/21 16:05:11 Done.
24 virtual ~SSLErrorClassification();
18 25
19 // This method checks whether the user clock is in the past or not. 26 // This method checks whether the system time is in the past.
20 static bool IsUserClockInThePast(base::Time time_now); 27 static bool IsUserClockInThePast(base::Time time_now);
21 28
22 // This method checks whether the system time is too far in the future or 29 // This method checks whether the system time is too far in the future or
23 // the user is using a version of Chrome which is more than 1 year old. 30 // the user is using a version of Chrome which is more than 1 year old.
24 static bool IsUserClockInTheFuture(base::Time time_now); 31 static bool IsUserClockInTheFuture(base::Time time_now);
25 32
33 // This method checks whether captive protals have been detected or not.
34 void CaptivePortalDetect(bool record_histograms,
meacer 2014/07/19 00:06:45 Maybe I'm missing something but I can't see the im
radhikabhar 2014/07/21 16:05:11 My bad. I had this function previously then delete
35 bool overridable);
36
26 // A method which calculates the severity score when the ssl error is 37 // A method which calculates the severity score when the ssl error is
27 // CERT_DATE_INVALID. 38 // CERT_DATE_INVALID.
28 float InvalidDateSeverityScore() const; 39 float InvalidDateSeverityScore() const;
29 40
30 static void RecordUMAStatistics(bool overridable); 41 void RecordUMAStatistics(bool overridable);
42 void RecordUMAStatisticsCaptivePortals(bool overridable);
meacer 2014/07/19 00:06:45 nit: Maybe rename to RecordCaptivePortalUMAStatist
radhikabhar 2014/07/21 16:05:11 Done.
31 base::TimeDelta TimePassedSinceExpiry() const; 43 base::TimeDelta TimePassedSinceExpiry() const;
32 44
33 private: 45 private:
34 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassification, TestDateInvalidScore); 46 FRIEND_TEST_ALL_PREFIXES(SSLErrorClassificationTest, TestDateInvalidScore);
35 47
36 float CalculateScoreTimePassedSinceExpiry() const; 48 float CalculateScoreTimePassedSinceExpiry() const;
49 float CalculateScoreEnvironments() const;
37 50
51 // content::NotificationObserver:
52 virtual void Observe(
53 int type,
54 const content::NotificationSource& source,
55 const content::NotificationDetails& details) OVERRIDE;
56
57 content::WebContents& web_contents_;
meacer 2014/07/19 00:06:45 I think you should make this a pointer. The majori
38 // This stores the current time. 58 // This stores the current time.
39 base::Time current_time_; 59 base::Time current_time_;
40
41 // This stores the certificate. 60 // This stores the certificate.
42 const net::X509Certificate& cert_; 61 const net::X509Certificate& cert_;
62 // Is captive portal detection enabled?
63 bool captive_portal_detection_enabled_;
64 // Did the probe complete before the interstitial was closed?
65 bool captive_portal_probe_completed_;
66 // Did the captive portal probe receive an error or get a non-HTTP response?
67 bool captive_portal_no_response_;
68 // Was a captive portal detected?
69 bool captive_portal_detected_;
70
71 content::NotificationRegistrar registrar_;
43 }; 72 };
44 73
45 #endif // CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_ 74 #endif // CHROME_BROWSER_SSL_SSL_ERROR_CLASSIFICATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698