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

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: Report on PROCEED/DONT_PROCEED, and make explicit Rappor switch 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_METRICS_HELPER_H_
6 #define CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_METRICS_HELPER_H_
7
8 #include <string>
9
10 #include "base/task/cancelable_task_tracker.h"
11 #include "base/time/time.h"
12 #include "url/gurl.h"
13
14 namespace content {
15 class WebContents;
16 }
17
18 namespace extensions {
19 class ExperienceSamplingEvent;
20 }
21
22 // Most of the security interstitials share a common layout and set of
23 // choices. SecurityInterstitialMetricsHelper is intended to help the security
24 // interstitials record user choices in a common way via METRICS histograms
25 // and RAPPOR metrics.
26 class SecurityInterstitialMetricsHelper {
27 public:
28 // These enums are used for histograms. Don't reorder, delete, or insert
29 // elements. New elements should be added at the end (right before the max).
30 enum SecurityInterstitialDecision {
31 SHOW,
32 PROCEED,
33 DONT_PROCEED,
34 PROCEEDING_DISABLED,
35 MAX_DECISION
36 };
37 enum SecurityInterstitialInteraction {
38 TOTAL_VISITS,
39 SHOW_ADVANCED,
40 SHOW_PRIVACY_POLICY,
41 SHOW_DIAGNOSTIC,
42 SHOW_LEARN_MORE,
43 RELOAD,
44 OPEN_TIME_SETTINGS,
45 MAX_INTERACTION
46 };
47
48 enum RapporReporting {
49 REPORT_RAPPOR,
50 SKIP_RAPPOR,
51 MAX_RAPPOR_REPORTING
mattm 2015/02/03 22:25:54 nit: max value isn't needed for this enum
Nathan Parker 2015/02/03 22:43:03 Done.
52 };
53
54 // Args:
55 // url: URL of page that triggered the interstitial. Only origin is used.
56 // uma_prefix: Histogram prefix for UMA.
57 // examples: "phishing", "ssl_overridable"
58 // rappor_prefix: Metric prefix for Rappor.
59 // examples: "phishing", "ssl"
60 // rappor_reporting: Used to skip rappor rapporting if desired.
61 // sampling_event_name: Event name for Experience Sampling.
62 // e.g. "phishing_interstitial_"
63 SecurityInterstitialMetricsHelper(content::WebContents* web_contents,
64 const GURL& url,
65 const std::string& uma_prefix,
66 const std::string& rappor_prefix,
67 RapporReporting rappor_reporting,
68 const std::string& sampling_event_name);
69 ~SecurityInterstitialMetricsHelper();
70
71 // Record a user decision or interaction to the appropriate UMA histogram
72 // and potentially in a RAPPOR metric.
73 void RecordUserDecision(SecurityInterstitialDecision decision);
74 void RecordUserInteraction(SecurityInterstitialInteraction interaction);
75
76 private:
77 // Used to query the HistoryService to see if the URL is in history.
78 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit);
79
80 content::WebContents* web_contents_;
81 const GURL request_url_;
82 const std::string uma_prefix_;
83 const std::string rappor_prefix_;
84 const RapporReporting rappor_reporting_;
85 const std::string sampling_event_name_;
86 int num_visits_;
87 base::CancelableTaskTracker request_tracker_;
88 #if defined(ENABLE_EXTENSIONS)
89 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_;
90 #endif
91
92 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialMetricsHelper);
93 };
94
95 #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