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

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

Issue 839183002: Remove redundancy in security interstitial UMA logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error for platforms w/o extensions Created 5 years, 11 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/time/time.h"
9 #include "chrome/browser/history/history_service.h"
mattm 2015/01/14 00:33:03 This could be in the .cc?
felt 2015/01/14 00:55:18 You're right, moved. However I had to add: #inclu
10 #include "url/gurl.h"
11
12 #if defined(ENABLE_EXTENSIONS)
13 #include "chrome/browser/extensions/api/experience_sampling_private/experience_s ampling.h"
mattm 2015/01/14 00:33:03 I think you could forward declare extensions::Expe
felt 2015/01/14 00:55:18 Done.
14 #endif
15
16 namespace content {
17 class WebContents;
18 }
19
20 class SecurityInterstitialUmaHelper {
21 public:
22 // These enums are used for histograms. Don't reorder, delete, or insert
23 // elements. New elements should be added at the end (right before the max).
24 enum SecurityInterstitialDecision {
25 SHOW,
26 PROCEED,
27 DONT_PROCEED,
28 PROCEEDING_DISABLED,
29 MAX_DECISION
30 };
31 enum SecurityInterstitialInteraction {
32 TOTAL_VISITS,
33 SHOW_ADVANCED,
34 SHOW_PRIVACY_POLICY,
35 SHOW_DIAGNOSTIC,
36 SHOW_LEARN_MORE,
37 RELOAD,
38 OPEN_TIME_SETTINGS,
39 MAX_INTERACTION
40 };
41
42 SecurityInterstitialUmaHelper(content::WebContents* web_contents,
43 const GURL& url,
44 const std::string& histogram_prefix,
45 const std::string& sampling_event_name);
46 ~SecurityInterstitialUmaHelper();
47
48 // Record a user decision or interaction to the appropriate UMA histogram.
49 void RecordUserDecision(SecurityInterstitialDecision decision);
50 void RecordUserInteraction(SecurityInterstitialInteraction interaction);
51
52 private:
mattm 2015/01/14 00:33:04 indentation
felt 2015/01/14 00:55:18 Done.
53 // Used to query the HistoryService to see if the URL is in history.
54 void OnGotHistoryCount(bool success, int num_visits, base::Time first_visit);
55
56 content::WebContents* web_contents() const;
57 GURL request_url() const;
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