OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_SSL_CAPTIVE_PORTAL_METRICS_RECORDER_H_ |
| 6 #define CHROME_BROWSER_SSL_CAPTIVE_PORTAL_METRICS_RECORDER_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/time/time.h" |
| 12 #include "content/public/browser/notification_observer.h" |
| 13 #include "content/public/browser/notification_registrar.h" |
| 14 #include "net/cert/x509_certificate.h" |
| 15 #include "url/gurl.h" |
| 16 |
| 17 namespace content { |
| 18 class WebContents; |
| 19 } |
| 20 |
| 21 // This class helps the SSL interstitial record captive portal-specific |
| 22 // metrics. It should only be used on the UI thread because its implementation |
| 23 // uses captive_portal::CaptivePortalService which can only be accessed on the |
| 24 // UI thread. |
| 25 class CaptivePortalMetricsRecorder : public content::NotificationObserver { |
| 26 public: |
| 27 CaptivePortalMetricsRecorder(content::WebContents* web_contents, |
| 28 bool overridable); |
| 29 ~CaptivePortalMetricsRecorder() override; |
| 30 |
| 31 // Should be called when the interstitial is closing. |
| 32 void RecordCaptivePortalUMAStatistics() const; |
| 33 |
| 34 private: |
| 35 typedef std::vector<std::string> Tokens; |
| 36 |
| 37 // content::NotificationObserver: |
| 38 void Observe(int type, |
| 39 const content::NotificationSource& source, |
| 40 const content::NotificationDetails& details) override; |
| 41 |
| 42 #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
| 43 bool overridable_; |
| 44 #endif |
| 45 bool captive_portal_detection_enabled_; |
| 46 // Did the probe complete before the interstitial was closed? |
| 47 bool captive_portal_probe_completed_; |
| 48 // Did the captive portal probe receive an error or get a non-HTTP response? |
| 49 bool captive_portal_no_response_; |
| 50 bool captive_portal_detected_; |
| 51 |
| 52 content::NotificationRegistrar registrar_; |
| 53 }; |
| 54 |
| 55 #endif // CHROME_BROWSER_SSL_CAPTIVE_PORTAL_METRICS_RECORDER_H_ |
OLD | NEW |