felt | aafecea | 2015-07-29 16:00:00 | [diff] [blame] | 1 | // 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 | |
avi | 6846aef | 2015-12-26 01:09:38 | [diff] [blame^] | 10 | #include "base/macros.h" |
felt | 20e0f200 | 2015-07-31 15:27:36 | [diff] [blame] | 11 | #include "components/security_interstitials/core/metrics_helper.h" |
felt | aafecea | 2015-07-29 16:00:00 | [diff] [blame] | 12 | #include "url/gurl.h" |
| 13 | |
| 14 | namespace content { |
| 15 | class WebContents; |
| 16 | } |
| 17 | |
| 18 | namespace extensions { |
| 19 | class ExperienceSamplingEvent; |
| 20 | } |
| 21 | |
felt | 6913b84 | 2015-09-29 18:31:05 | [diff] [blame] | 22 | class CaptivePortalMetricsRecorder; |
| 23 | |
felt | aafecea | 2015-07-29 16:00:00 | [diff] [blame] | 24 | // 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. |
felt | 6913b84 | 2015-09-29 18:31:05 | [diff] [blame] | 27 | |
| 28 | // This class is meant to be used on the UI thread for captive portal metrics. |
felt | aafecea | 2015-07-29 16:00:00 | [diff] [blame] | 29 | class 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 | |
felt | 6913b84 | 2015-09-29 18:31:05 | [diff] [blame] | 38 | void StartRecordingCaptivePortalMetrics(bool overridable); |
| 39 | |
felt | aafecea | 2015-07-29 16:00:00 | [diff] [blame] | 40 | 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; |
felt | 6913b84 | 2015-09-29 18:31:05 | [diff] [blame] | 46 | void RecordExtraShutdownMetrics() override; |
felt | aafecea | 2015-07-29 16:00:00 | [diff] [blame] | 47 | |
| 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 |
tedchoc | bf696bf | 2015-09-29 20:44:35 | [diff] [blame] | 55 | #if defined(ENABLE_CAPTIVE_PORTAL_DETECTION) |
felt | 6913b84 | 2015-09-29 18:31:05 | [diff] [blame] | 56 | scoped_ptr<CaptivePortalMetricsRecorder> captive_portal_recorder_; |
tedchoc | bf696bf | 2015-09-29 20:44:35 | [diff] [blame] | 57 | #endif |
felt | aafecea | 2015-07-29 16:00:00 | [diff] [blame] | 58 | |
| 59 | DISALLOW_COPY_AND_ASSIGN(ChromeMetricsHelper); |
| 60 | }; |
| 61 | |
| 62 | #endif // CHROME_BROWSER_INTERSTITIALS_CHROME_METRICS_HELPER_H_ |