blob: 29e5a88706e0133c0a465b2d39968192e8040f9b [file] [log] [blame]
Avi Drissman8ba1bad2022-09-13 19:22:361// Copyright 2015 The Chromium Authors
feltaafecea2015-07-29 16:00:002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Colin Blundell11fbeaad2020-02-07 16:16:365#ifndef COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_CONTENT_METRICS_HELPER_H_
6#define COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_CONTENT_METRICS_HELPER_H_
feltaafecea2015-07-29 16:00:007
Colin Blundell7cf3fe32020-01-23 09:52:498#include "components/captive_portal/core/buildflags.h"
felt20e0f2002015-07-31 15:27:369#include "components/security_interstitials/core/metrics_helper.h"
feltaafecea2015-07-29 16:00:0010#include "url/gurl.h"
11
Colin Blundelle4c1c642020-02-06 23:51:4912namespace captive_portal {
13class CaptivePortalService;
14}
15
16namespace history {
17class HistoryService;
feltaafecea2015-07-29 16:00:0018}
19
felt6913b842015-09-29 18:31:0520class CaptivePortalMetricsRecorder;
21
Colin Blundell11fbeaad2020-02-07 16:16:3622// This class adds metrics specific to the usage of CaptivePortalService to the
Christopher Thompson8b286c92018-02-16 19:08:2523// security_interstitials::MetricsHelper.
24// TODO(crbug.com/812808): Refactor out the use of this class if possible.
felt6913b842015-09-29 18:31:0525
26// This class is meant to be used on the UI thread for captive portal metrics.
Colin Blundell11fbeaad2020-02-07 16:16:3627class ContentMetricsHelper : public security_interstitials::MetricsHelper {
feltaafecea2015-07-29 16:00:0028 public:
Colin Blundell11fbeaad2020-02-07 16:16:3629 ContentMetricsHelper(
Colin Blundelle4c1c642020-02-06 23:51:4930 history::HistoryService* history_service,
feltaafecea2015-07-29 16:00:0031 const GURL& url,
Christopher Thompson8b286c92018-02-16 19:08:2532 const security_interstitials::MetricsHelper::ReportDetails settings);
Peter Boström09c01822021-09-20 22:43:2733
34 ContentMetricsHelper(const ContentMetricsHelper&) = delete;
35 ContentMetricsHelper& operator=(const ContentMetricsHelper&) = delete;
36
Colin Blundell11fbeaad2020-02-07 16:16:3637 ~ContentMetricsHelper() override;
feltaafecea2015-07-29 16:00:0038
Colin Blundelle4c1c642020-02-06 23:51:4939#if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
40 void StartRecordingCaptivePortalMetrics(
41 captive_portal::CaptivePortalService* captive_portal_service,
42 bool overridable);
43#endif
felt6913b842015-09-29 18:31:0544
feltaafecea2015-07-29 16:00:0045 protected:
46 // security_interstitials::MetricsHelper methods:
felt6913b842015-09-29 18:31:0547 void RecordExtraShutdownMetrics() override;
feltaafecea2015-07-29 16:00:0048
49 private:
Mikhail Lopatkind8b04d82018-03-20 20:11:1250#if BUILDFLAG(ENABLE_CAPTIVE_PORTAL_DETECTION)
dcheng4af48582016-04-19 00:29:3551 std::unique_ptr<CaptivePortalMetricsRecorder> captive_portal_recorder_;
tedchocbf696bf2015-09-29 20:44:3552#endif
feltaafecea2015-07-29 16:00:0053};
54
Colin Blundell11fbeaad2020-02-07 16:16:3655#endif // COMPONENTS_SECURITY_INTERSTITIALS_CONTENT_CONTENT_METRICS_HELPER_H_