OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_INTERSTITIALS_CHROME_METRICS_HELPER_H_ | 5 #ifndef CHROME_BROWSER_INTERSTITIALS_CHROME_METRICS_HELPER_H_ |
6 #define CHROME_BROWSER_INTERSTITIALS_CHROME_METRICS_HELPER_H_ | 6 #define CHROME_BROWSER_INTERSTITIALS_CHROME_METRICS_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "components/security_interstitials/core/metrics_helper.h" | 10 #include "components/security_interstitials/core/metrics_helper.h" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class WebContents; | 14 class WebContents; |
15 } | 15 } |
16 | 16 |
17 namespace extensions { | 17 namespace extensions { |
18 class ExperienceSamplingEvent; | 18 class ExperienceSamplingEvent; |
19 } | 19 } |
20 | 20 |
| 21 class CaptivePortalMetricsRecorder; |
| 22 |
21 // This class adds desktop-Chrome-specific metrics (extension experience | 23 // This class adds desktop-Chrome-specific metrics (extension experience |
22 // sampling) to the security_interstitials::MetricsHelper. Together, they | 24 // sampling) to the security_interstitials::MetricsHelper. Together, they |
23 // record UMA, Rappor, and experience sampling metrics. | 25 // record UMA, Rappor, and experience sampling metrics. |
| 26 |
| 27 // This class is meant to be used on the UI thread for captive portal metrics. |
24 class ChromeMetricsHelper : public security_interstitials::MetricsHelper { | 28 class ChromeMetricsHelper : public security_interstitials::MetricsHelper { |
25 public: | 29 public: |
26 ChromeMetricsHelper( | 30 ChromeMetricsHelper( |
27 content::WebContents* web_contents, | 31 content::WebContents* web_contents, |
28 const GURL& url, | 32 const GURL& url, |
29 const security_interstitials::MetricsHelper::ReportDetails settings, | 33 const security_interstitials::MetricsHelper::ReportDetails settings, |
30 const std::string& sampling_event_name); | 34 const std::string& sampling_event_name); |
31 ~ChromeMetricsHelper() override; | 35 ~ChromeMetricsHelper() override; |
32 | 36 |
| 37 void StartRecordingCaptivePortalMetrics(bool overridable); |
| 38 |
33 protected: | 39 protected: |
34 // security_interstitials::MetricsHelper methods: | 40 // security_interstitials::MetricsHelper methods: |
35 void RecordExtraUserDecisionMetrics( | 41 void RecordExtraUserDecisionMetrics( |
36 security_interstitials::MetricsHelper::Decision decision) override; | 42 security_interstitials::MetricsHelper::Decision decision) override; |
37 void RecordExtraUserInteractionMetrics( | 43 void RecordExtraUserInteractionMetrics( |
38 security_interstitials::MetricsHelper::Interaction interaction) override; | 44 security_interstitials::MetricsHelper::Interaction interaction) override; |
| 45 void RecordExtraShutdownMetrics() override; |
39 | 46 |
40 private: | 47 private: |
41 content::WebContents* web_contents_; | 48 content::WebContents* web_contents_; |
42 const GURL request_url_; | 49 const GURL request_url_; |
43 const std::string sampling_event_name_; | 50 const std::string sampling_event_name_; |
44 #if defined(ENABLE_EXTENSIONS) | 51 #if defined(ENABLE_EXTENSIONS) |
45 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; | 52 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; |
46 #endif | 53 #endif |
| 54 scoped_ptr<CaptivePortalMetricsRecorder> captive_portal_recorder_; |
47 | 55 |
48 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsHelper); | 56 DISALLOW_COPY_AND_ASSIGN(ChromeMetricsHelper); |
49 }; | 57 }; |
50 | 58 |
51 #endif // CHROME_BROWSER_INTERSTITIALS_CHROME_METRICS_HELPER_H_ | 59 #endif // CHROME_BROWSER_INTERSTITIALS_CHROME_METRICS_HELPER_H_ |
OLD | NEW |