Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: chrome/browser/interstitials/security_interstitial_metrics_helper.h

Issue 872813003: Add Rappor metrics for Safe Browsing and SSL interstitials. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Actually fix nit Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/interstitials/security_interstitial_metrics_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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_SECURITY_INTERSTITIAL_UMA_HELPER_H_ 5 #ifndef CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_METRICS_HELPER_H_
6 #define CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_UMA_HELPER_H_ 6 #define CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_METRICS_HELPER_H_
7
8 #include <string>
7 9
8 #include "base/task/cancelable_task_tracker.h" 10 #include "base/task/cancelable_task_tracker.h"
9 #include "base/time/time.h" 11 #include "base/time/time.h"
10 #include "url/gurl.h" 12 #include "url/gurl.h"
11 13
12 namespace content { 14 namespace content {
13 class WebContents; 15 class WebContents;
14 } 16 }
15 17
16 namespace extensions { 18 namespace extensions {
17 class ExperienceSamplingEvent; 19 class ExperienceSamplingEvent;
18 } 20 }
19 21
20 // Most of the security interstitials share a common layout and set of 22 // Most of the security interstitials share a common layout and set of
21 // choices. SecurityInterstitialUmaHelper is intended to help the security 23 // choices. SecurityInterstitialMetricsHelper is intended to help the security
22 // interstitials record user choices in a common way via UMA histograms. 24 // interstitials record user choices in a common way via METRICS histograms
23 class SecurityInterstitialUmaHelper { 25 // and RAPPOR metrics.
26 class SecurityInterstitialMetricsHelper {
24 public: 27 public:
25 // These enums are used for histograms. Don't reorder, delete, or insert 28 // These enums are used for histograms. Don't reorder, delete, or insert
26 // elements. New elements should be added at the end (right before the max). 29 // elements. New elements should be added at the end (right before the max).
27 enum SecurityInterstitialDecision { 30 enum SecurityInterstitialDecision {
28 SHOW, 31 SHOW,
29 PROCEED, 32 PROCEED,
30 DONT_PROCEED, 33 DONT_PROCEED,
31 PROCEEDING_DISABLED, 34 PROCEEDING_DISABLED,
32 MAX_DECISION 35 MAX_DECISION
33 }; 36 };
34 enum SecurityInterstitialInteraction { 37 enum SecurityInterstitialInteraction {
35 TOTAL_VISITS, 38 TOTAL_VISITS,
36 SHOW_ADVANCED, 39 SHOW_ADVANCED,
37 SHOW_PRIVACY_POLICY, 40 SHOW_PRIVACY_POLICY,
38 SHOW_DIAGNOSTIC, 41 SHOW_DIAGNOSTIC,
39 SHOW_LEARN_MORE, 42 SHOW_LEARN_MORE,
40 RELOAD, 43 RELOAD,
41 OPEN_TIME_SETTINGS, 44 OPEN_TIME_SETTINGS,
42 MAX_INTERACTION 45 MAX_INTERACTION
43 }; 46 };
44 47
45 SecurityInterstitialUmaHelper(content::WebContents* web_contents, 48 // Args:
46 const GURL& url, 49 // url: URL of page that triggered the interstitial. Only origin is used.
47 const std::string& histogram_prefix, 50 // uma_prefix: Histogram prefix for UMA.
48 const std::string& sampling_event_name); 51 // examples: "phishing", "ssl_overridable"
49 ~SecurityInterstitialUmaHelper(); 52 // rappor_prefix: Metric prefix for Rappor. Leave empty to skip Rappor.
53 // examples: "phishing", "ssl"
felt 2015/02/03 07:28:04 I'm a little uncomfortable about using a string st
Alexei Svitkine (slow) 2015/02/03 14:58:25 Actually that's a good point. If the prefixes wil
Nathan Parker 2015/02/03 21:01:00 That would just muddle the reports in this case (r
Nathan Parker 2015/02/03 21:01:00 Sounds good. I've made it far more explicit.
54 // sampling_event_name: Event name for Experience Sampling.
55 // e.g. "phishing_interstitial_"
56 SecurityInterstitialMetricsHelper(content::WebContents* web_contents,
57 const GURL& url,
58 const std::string& uma_prefix,
59 const std::string& rappor_prefix,
60 const std::string& sampling_event_name);
61 ~SecurityInterstitialMetricsHelper();
50 62
51 // Record a user decision or interaction to the appropriate UMA histogram. 63 // Record a user decision or interaction to the appropriate UMA histogram
64 // and potentially in a RAPPOR metric.
52 void RecordUserDecision(SecurityInterstitialDecision decision); 65 void RecordUserDecision(SecurityInterstitialDecision decision);
53 void RecordUserInteraction(SecurityInterstitialInteraction interaction); 66 void RecordUserInteraction(SecurityInterstitialInteraction interaction);
54 67
55 private: 68 private:
56 // Used to query the HistoryService to see if the URL is in history. 69 // Used to query the HistoryService to see if the URL is in history.
57 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit); 70 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit);
58 71
59 content::WebContents* web_contents_; 72 content::WebContents* web_contents_;
60 const GURL request_url_; 73 const GURL request_url_;
61 const std::string histogram_prefix_; 74 const std::string uma_prefix_;
75 const std::string rappor_prefix_;
62 const std::string sampling_event_name_; 76 const std::string sampling_event_name_;
63 int num_visits_; 77 int num_visits_;
64 base::CancelableTaskTracker request_tracker_; 78 base::CancelableTaskTracker request_tracker_;
65 #if defined(ENABLE_EXTENSIONS) 79 #if defined(ENABLE_EXTENSIONS)
66 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_; 80 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_;
67 #endif 81 #endif
68 82
69 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialUmaHelper); 83 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialMetricsHelper);
70 }; 84 };
71 85
72 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_UMA_HELPER_H_ 86 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_METRICS_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/interstitials/security_interstitial_metrics_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698