blob: 5206a9eda94248f64e3a3a08df0d3d26bf585cb0 [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"
felt20e0f2002015-07-31 15:27:3611#include "components/security_interstitials/core/metrics_helper.h"
feltaafecea2015-07-29 16:00:0012#include "url/gurl.h"
13
14namespace content {
15class WebContents;
16}
17
18namespace extensions {
19class ExperienceSamplingEvent;
20}
21
felt6913b842015-09-29 18:31:0522class CaptivePortalMetricsRecorder;
23
feltaafecea2015-07-29 16:00:0024// This class adds desktop-Chrome-specific metrics (extension experience
25// sampling) to the security_interstitials::MetricsHelper. Together, they
26// record UMA, Rappor, and experience sampling metrics.
felt6913b842015-09-29 18:31:0527
28// This class is meant to be used on the UI thread for captive portal metrics.
feltaafecea2015-07-29 16:00:0029class ChromeMetricsHelper : public security_interstitials::MetricsHelper {
30 public:
31 ChromeMetricsHelper(
32 content::WebContents* web_contents,
33 const GURL& url,
34 const security_interstitials::MetricsHelper::ReportDetails settings,
35 const std::string& sampling_event_name);
36 ~ChromeMetricsHelper() override;
37
felt6913b842015-09-29 18:31:0538 void StartRecordingCaptivePortalMetrics(bool overridable);
39
feltaafecea2015-07-29 16:00:0040 protected:
41 // security_interstitials::MetricsHelper methods:
42 void RecordExtraUserDecisionMetrics(
43 security_interstitials::MetricsHelper::Decision decision) override;
44 void RecordExtraUserInteractionMetrics(
45 security_interstitials::MetricsHelper::Interaction interaction) override;
felt6913b842015-09-29 18:31:0546 void RecordExtraShutdownMetrics() override;
feltaafecea2015-07-29 16:00:0047
48 private:
49 content::WebContents* web_contents_;
50 const GURL request_url_;
51 const std::string sampling_event_name_;
52#if defined(ENABLE_EXTENSIONS)
53 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_;
54#endif
tedchocbf696bf2015-09-29 20:44:3555#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
felt6913b842015-09-29 18:31:0556 scoped_ptr<CaptivePortalMetricsRecorder> captive_portal_recorder_;
tedchocbf696bf2015-09-29 20:44:3557#endif
feltaafecea2015-07-29 16:00:0058
59 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsHelper);
60};
61
62#endif // CHROME_BROWSER_INTERSTITIALS_CHROME_METRICS_HELPER_H_