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

Side by Side Diff: chrome/browser/permissions/permission_uma_util.h

Issue 2651163002: Add UMA for autoblocking and embargoing. (Closed)
Patch Set: Review comments, add histogram checks Created 3 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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 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_PERMISSIONS_PERMISSION_UMA_UTIL_H_ 5 #ifndef CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_
6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ 6 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "chrome/browser/permissions/permission_request.h" 12 #include "chrome/browser/permissions/permission_request.h"
13 #include "chrome/browser/permissions/permission_util.h" 13 #include "chrome/browser/permissions/permission_util.h"
14 14
15 enum class PermissionRequestGestureType; 15 enum class PermissionRequestGestureType;
16 class GURL; 16 class GURL;
17 class PermissionRequest; 17 class PermissionRequest;
18 class Profile; 18 class Profile;
19 19
20 namespace content { 20 namespace content {
21 enum class PermissionType; 21 enum class PermissionType;
22 } // namespace content 22 } // namespace content
23 23
24 namespace base {
25 class TimeDelta;
dominickn 2017/01/30 04:55:26 This doesn't work - you're passing base::TimeDelta
meredithl 2017/01/30 05:37:40 Done.
26 } // namespace base
27
24 // This should stay in sync with the SourceUI enum in the permission report 28 // This should stay in sync with the SourceUI enum in the permission report
25 // protobuf (src/chrome/common/safe_browsing/permission_report.proto). 29 // protobuf (src/chrome/common/safe_browsing/permission_report.proto).
26 enum class PermissionSourceUI { 30 enum class PermissionSourceUI {
27 PROMPT = 0, 31 PROMPT = 0,
28 OIB = 1, 32 OIB = 1,
29 SITE_SETTINGS = 2, 33 SITE_SETTINGS = 2,
30 PAGE_ACTION = 3, 34 PAGE_ACTION = 3,
31 35
32 // Always keep this at the end. 36 // Always keep this at the end.
33 SOURCE_UI_NUM, 37 SOURCE_UI_NUM,
34 }; 38 };
35 39
36 // This should stay in sync with the PersistDecision enum in the permission 40 // This should stay in sync with the PersistDecision enum in the permission
37 // report message (src/chrome/common/safe_browsing/permission_report.proto). 41 // report message (src/chrome/common/safe_browsing/permission_report.proto).
38 enum class PermissionPersistDecision { 42 enum class PermissionPersistDecision {
39 UNSPECIFIED = 0, 43 UNSPECIFIED = 0,
40 PERSISTED = 1, 44 PERSISTED = 1,
41 NOT_PERSISTED = 2, 45 NOT_PERSISTED = 2,
42 }; 46 };
43 47
48 // Any new values should be inserted immediately prior to REASON_NUM.
49 enum PermissionEmbargoReason {
50 REPEATED_DISMISSALS = 0,
51 PERMISSIONS_BLACKLISTING = 1,
52 NOT_EMBARGOED = 2,
53
54 // Always keep this at the end.
55 REASON_NUM,
56 };
57
58 // Any new values should be inserted immediately prior to RESPONSE_NUM.
59 enum SafeBrowsingResponse {
60 NOT_BLACKLISTED = 0,
61 TIMEOUT = 1,
62 BLACKLISTED = 2,
63
64 // Always keep this at the end.
65 RESPONSE_NUM,
66 };
67
44 // A bundle for the information sent in a PermissionReport. 68 // A bundle for the information sent in a PermissionReport.
45 struct PermissionReportInfo { 69 struct PermissionReportInfo {
46 PermissionReportInfo( 70 PermissionReportInfo(
47 const GURL& origin, 71 const GURL& origin,
48 content::PermissionType permission, 72 content::PermissionType permission,
49 PermissionAction action, 73 PermissionAction action,
50 PermissionSourceUI source_ui, 74 PermissionSourceUI source_ui,
51 PermissionRequestGestureType gesture_type, 75 PermissionRequestGestureType gesture_type,
52 PermissionPersistDecision persist_decision, 76 PermissionPersistDecision persist_decision,
53 int num_prior_dismissals, 77 int num_prior_dismissals,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 const GURL& requesting_origin, 131 const GURL& requesting_origin,
108 Profile* profile); 132 Profile* profile);
109 static void PermissionIgnored(content::PermissionType permission, 133 static void PermissionIgnored(content::PermissionType permission,
110 PermissionRequestGestureType gesture_type, 134 PermissionRequestGestureType gesture_type,
111 const GURL& requesting_origin, 135 const GURL& requesting_origin,
112 Profile* profile); 136 Profile* profile);
113 static void PermissionRevoked(content::PermissionType permission, 137 static void PermissionRevoked(content::PermissionType permission,
114 PermissionSourceUI source_ui, 138 PermissionSourceUI source_ui,
115 const GURL& revoked_origin, 139 const GURL& revoked_origin,
116 Profile* profile); 140 Profile* profile);
117 141 static void RecordPermissionEmbargoReason(
142 PermissionEmbargoReason embargo_reason);
143 static void RecordSafeBrowsingResponse(base::TimeDelta response_time,
144 SafeBrowsingResponse response);
145 static void RecordRepeatedEmbargo(PermissionEmbargoReason embargo_reason);
118 // UMA specifically for when permission prompts are shown. This should be 146 // UMA specifically for when permission prompts are shown. This should be
119 // roughly equivalent to the metrics above, however it is 147 // roughly equivalent to the metrics above, however it is
120 // useful to have separate UMA to a few reasons: 148 // useful to have separate UMA to a few reasons:
121 // - to account for, and get data on coalesced permission bubbles 149 // - to account for, and get data on coalesced permission bubbles
122 // - there are other types of permissions prompts (e.g. download limiting) 150 // - there are other types of permissions prompts (e.g. download limiting)
123 // which don't go through PermissionContext 151 // which don't go through PermissionContext
124 // - the above metrics don't always add up (e.g. sum of 152 // - the above metrics don't always add up (e.g. sum of
125 // granted+denied+dismissed+ignored is not equal to requested), so it is 153 // granted+denied+dismissed+ignored is not equal to requested), so it is
126 // unclear from those metrics alone how many prompts are seen by users. 154 // unclear from those metrics alone how many prompts are seen by users.
127 static void PermissionPromptShown( 155 static void PermissionPromptShown(
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // for a single origin using |prefix| for the metric. 209 // for a single origin using |prefix| for the metric.
182 static void RecordPermissionPromptPriorCount( 210 static void RecordPermissionPromptPriorCount(
183 content::PermissionType permission, 211 content::PermissionType permission,
184 const std::string& prefix, 212 const std::string& prefix,
185 int count); 213 int count);
186 214
187 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); 215 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil);
188 }; 216 };
189 217
190 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ 218 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698