blob: bba24c201560b880c8846bc71be44d452b6817a2 [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
felt20e0f2002015-07-31 15:27:3610#include "components/security_interstitials/core/metrics_helper.h"
feltaafecea2015-07-29 16:00:0011#include "url/gurl.h"
12
13namespace content {
14class WebContents;
15}
16
17namespace extensions {
18class ExperienceSamplingEvent;
19}
20
felt6913b842015-09-29 18:31:0521class CaptivePortalMetricsRecorder;
22
feltaafecea2015-07-29 16:00:0023// This class adds desktop-Chrome-specific metrics (extension experience
24// sampling) to the security_interstitials::MetricsHelper. Together, they
25// record UMA, Rappor, and experience sampling metrics.
felt6913b842015-09-29 18:31:0526
27// This class is meant to be used on the UI thread for captive portal metrics.
feltaafecea2015-07-29 16:00:0028class ChromeMetricsHelper : public security_interstitials::MetricsHelper {
29 public:
30 ChromeMetricsHelper(
31 content::WebContents* web_contents,
32 const GURL& url,
33 const security_interstitials::MetricsHelper::ReportDetails settings,
34 const std::string& sampling_event_name);
35 ~ChromeMetricsHelper() override;
36
felt6913b842015-09-29 18:31:0537 void StartRecordingCaptivePortalMetrics(bool overridable);
38
feltaafecea2015-07-29 16:00:0039 protected:
40 // security_interstitials::MetricsHelper methods:
41 void RecordExtraUserDecisionMetrics(
42 security_interstitials::MetricsHelper::Decision decision) override;
43 void RecordExtraUserInteractionMetrics(
44 security_interstitials::MetricsHelper::Interaction interaction) override;
felt6913b842015-09-29 18:31:0545 void RecordExtraShutdownMetrics() override;
feltaafecea2015-07-29 16:00:0046
47 private:
48 content::WebContents* web_contents_;
49 const GURL request_url_;
50 const std::string sampling_event_name_;
51#if defined(ENABLE_EXTENSIONS)
52 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_;
53#endif
felt6913b842015-09-29 18:31:0554 scoped_ptr<CaptivePortalMetricsRecorder> captive_portal_recorder_;
feltaafecea2015-07-29 16:00:0055
56 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsHelper);
57};
58
59#endif // CHROME_BROWSER_INTERSTITIALS_CHROME_METRICS_HELPER_H_