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 | |
felt | 20e0f200 | 2015-07-31 15:27:36 | [diff] [blame] | 10 | #include "components/security_interstitials/core/metrics_helper.h" |
felt | aafecea | 2015-07-29 16:00:00 | [diff] [blame] | 11 | #include "url/gurl.h" |
| 12 | |
| 13 | namespace content { |
| 14 | class WebContents; |
| 15 | } |
| 16 | |
| 17 | namespace extensions { |
| 18 | class ExperienceSamplingEvent; |
| 19 | } |
| 20 | |
felt | 6913b84 | 2015-09-29 18:31:05 | [diff] [blame^] | 21 | class CaptivePortalMetricsRecorder; |
| 22 | |
felt | aafecea | 2015-07-29 16:00:00 | [diff] [blame] | 23 | // 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. |
felt | 6913b84 | 2015-09-29 18:31:05 | [diff] [blame^] | 26 | |
| 27 | // 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] | 28 | class 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 | |
felt | 6913b84 | 2015-09-29 18:31:05 | [diff] [blame^] | 37 | void StartRecordingCaptivePortalMetrics(bool overridable); |
| 38 | |
felt | aafecea | 2015-07-29 16:00:00 | [diff] [blame] | 39 | 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; |
felt | 6913b84 | 2015-09-29 18:31:05 | [diff] [blame^] | 45 | void RecordExtraShutdownMetrics() override; |
felt | aafecea | 2015-07-29 16:00:00 | [diff] [blame] | 46 | |
| 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 |
felt | 6913b84 | 2015-09-29 18:31:05 | [diff] [blame^] | 54 | scoped_ptr<CaptivePortalMetricsRecorder> captive_portal_recorder_; |
felt | aafecea | 2015-07-29 16:00:00 | [diff] [blame] | 55 | |
| 56 | DISALLOW_COPY_AND_ASSIGN(ChromeMetricsHelper); |
| 57 | }; |
| 58 | |
| 59 | #endif // CHROME_BROWSER_INTERSTITIALS_CHROME_METRICS_HELPER_H_ |