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

Side by Side Diff: chrome/browser/interstitials/security_interstitial_uma_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: Fit nit: Remove _MAX from enum 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
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_UMA_HELPER_H_
6 #define CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_UMA_HELPER_H_
7
8 #include "base/task/cancelable_task_tracker.h"
9 #include "base/time/time.h"
10 #include "url/gurl.h"
11
12 namespace content {
13 class WebContents;
14 }
15
16 namespace extensions {
17 class ExperienceSamplingEvent;
18 }
19
20 // Most of the security interstitials share a common layout and set of
21 // choices. SecurityInterstitialUmaHelper is intended to help the security
22 // interstitials record user choices in a common way via UMA histograms.
23 class SecurityInterstitialUmaHelper {
24 public:
25 // 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).
27 enum SecurityInterstitialDecision {
28 SHOW,
29 PROCEED,
30 DONT_PROCEED,
31 PROCEEDING_DISABLED,
32 MAX_DECISION
33 };
34 enum SecurityInterstitialInteraction {
35 TOTAL_VISITS,
36 SHOW_ADVANCED,
37 SHOW_PRIVACY_POLICY,
38 SHOW_DIAGNOSTIC,
39 SHOW_LEARN_MORE,
40 RELOAD,
41 OPEN_TIME_SETTINGS,
42 MAX_INTERACTION
43 };
44
45 SecurityInterstitialUmaHelper(content::WebContents* web_contents,
46 const GURL& url,
47 const std::string& histogram_prefix,
48 const std::string& sampling_event_name);
49 ~SecurityInterstitialUmaHelper();
50
51 // Record a user decision or interaction to the appropriate UMA histogram.
52 void RecordUserDecision(SecurityInterstitialDecision decision);
53 void RecordUserInteraction(SecurityInterstitialInteraction interaction);
54
55 private:
56 // 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);
58
59 content::WebContents* web_contents_;
60 const GURL request_url_;
61 const std::string histogram_prefix_;
62 const std::string sampling_event_name_;
63 int num_visits_;
64 base::CancelableTaskTracker request_tracker_;
65 #if defined(ENABLE_EXTENSIONS)
66 scoped_ptr<extensions::ExperienceSamplingEvent> sampling_event_;
67 #endif
68
69 DISALLOW_COPY_AND_ASSIGN(SecurityInterstitialUmaHelper);
70 };
71
72 #endif // CHROME_BROWSER_INTERSTITIALS_SECURITY_INTERSTITIAL_UMA_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698