Index: chrome/browser/ssl/captive_portal_metrics_helper.h |
diff --git a/chrome/browser/ssl/captive_portal_metrics_helper.h b/chrome/browser/ssl/captive_portal_metrics_helper.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..63915907ffa6eabc260c58cd9da6147ec95f788a |
--- /dev/null |
+++ b/chrome/browser/ssl/captive_portal_metrics_helper.h |
@@ -0,0 +1,53 @@ |
+// 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_CAPTIVE_PORTAL_METRICS_HELPER_H_ |
+#define CHROME_BROWSER_SSL_CAPTIVE_PORTAL_METRICS_HELPER_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 helps the SSL interstitial record captive portal-specific |
+// metrics. It 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 CaptivePortalMetricsHelper : public content::NotificationObserver { |
estark
2015/09/25 23:53:35
nit: What do you think about naming it CaptivePort
felt
2015/09/27 20:08:15
Sure.
|
+ public: |
+ CaptivePortalMetricsHelper(content::WebContents* web_contents, |
+ bool overridable); |
+ ~CaptivePortalMetricsHelper() override; |
+ |
+ // Should be called when the interstitial is closing. |
+ void RecordCaptivePortalUMAStatistics() const; |
+ |
+ private: |
+ typedef std::vector<std::string> Tokens; |
+ |
+ // content::NotificationObserver: |
+ void Observe(int type, |
+ const content::NotificationSource& source, |
+ const content::NotificationDetails& details) override; |
+ |
+ bool overridable_; |
+ 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_; |
+ bool captive_portal_detected_; |
+ |
+ content::NotificationRegistrar registrar_; |
+}; |
+ |
+#endif // CHROME_BROWSER_SSL_CAPTIVE_PORTAL_METRICS_HELPER_H_ |