blob: f51fd64e36d1dc24e5c5d07cf565952448cb6ad6 [file] [log] [blame]
feltaafecea2015-07-29 16:00:001// 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_INTERSTITIALS_CHROME_METRICS_HELPER_H_
6#define CHROME_BROWSER_INTERSTITIALS_CHROME_METRICS_HELPER_H_
7
8#include <string>
9
avi6846aef2015-12-26 01:09:3810#include "base/macros.h"
Scott Violet6200d332018-02-23 21:29:2311#include "chrome/common/buildflags.h"
felt20e0f2002015-07-31 15:27:3612#include "components/security_interstitials/core/metrics_helper.h"
feltaafecea2015-07-29 16:00:0013#include "url/gurl.h"
14
15namespace content {
16class WebContents;
17}
18
felt6913b842015-09-29 18:31:0519class CaptivePortalMetricsRecorder;
20
Christopher Thompson8b286c92018-02-16 19:08:2521// This class adds desktop-Chrome-specific metrics to the
22// security_interstitials::MetricsHelper.
23// TODO(crbug.com/812808): Refactor out the use of this class if possible.
felt6913b842015-09-29 18:31:0524
25// This class is meant to be used on the UI thread for captive portal metrics.
feltaafecea2015-07-29 16:00:0026class ChromeMetricsHelper : public security_interstitials::MetricsHelper {
27 public:
28 ChromeMetricsHelper(
29 content::WebContents* web_contents,
30 const GURL& url,
Christopher Thompson8b286c92018-02-16 19:08:2531 const security_interstitials::MetricsHelper::ReportDetails settings);
feltaafecea2015-07-29 16:00:0032 ~ChromeMetricsHelper() override;
33
felt6913b842015-09-29 18:31:0534 void StartRecordingCaptivePortalMetrics(bool overridable);
35
feltaafecea2015-07-29 16:00:0036 protected:
37 // security_interstitials::MetricsHelper methods:
felt6913b842015-09-29 18:31:0538 void RecordExtraShutdownMetrics() override;
feltaafecea2015-07-29 16:00:0039
40 private:
Mikhail Lopatkind8b04d82018-03-20 20:11:1241#if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
feltaafecea2015-07-29 16:00:0042 content::WebContents* web_contents_;
pkasting28ae5792016-05-20 21:39:1443#endif
feltaafecea2015-07-29 16:00:0044 const GURL request_url_;
brettwab78fef2016-10-12 02:56:0545#if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
dcheng4af48582016-04-19 00:29:3546 std::unique_ptr<CaptivePortalMetricsRecorder> captive_portal_recorder_;
tedchocbf696bf2015-09-29 20:44:3547#endif
feltaafecea2015-07-29 16:00:0048
49 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsHelper);
50};
51
52#endif // CHROME_BROWSER_INTERSTITIALS_CHROME_METRICS_HELPER_H_