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

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

Issue 2651163002: Add UMA for autoblocking and embargoing. (Closed)
Patch Set: Review 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 "base/time/time.h"
12 #include "chrome/browser/permissions/permission_request.h" 13 #include "chrome/browser/permissions/permission_request.h"
13 #include "chrome/browser/permissions/permission_util.h" 14 #include "chrome/browser/permissions/permission_util.h"
14 15
15 enum class PermissionRequestGestureType; 16 enum class PermissionRequestGestureType;
16 class GURL; 17 class GURL;
17 class PermissionRequest; 18 class PermissionRequest;
18 class Profile; 19 class Profile;
19 20
20 namespace content { 21 namespace content {
21 enum class PermissionType; 22 enum class PermissionType;
(...skipping 12 matching lines...) Expand all
34 }; 35 };
35 36
36 // This should stay in sync with the PersistDecision enum in the permission 37 // This should stay in sync with the PersistDecision enum in the permission
37 // report message (src/chrome/common/safe_browsing/permission_report.proto). 38 // report message (src/chrome/common/safe_browsing/permission_report.proto).
38 enum class PermissionPersistDecision { 39 enum class PermissionPersistDecision {
39 UNSPECIFIED = 0, 40 UNSPECIFIED = 0,
40 PERSISTED = 1, 41 PERSISTED = 1,
41 NOT_PERSISTED = 2, 42 NOT_PERSISTED = 2,
42 }; 43 };
43 44
45 // Any new values should be inserted immediately prior to REASON_NUM.
46 enum PermissionEmbargoReason {
47 REPEATED_DISMISSALS = 0,
48 PERMISSIONS_BLACKLISTING = 1,
49 NOT_EMBARGOED = 2,
50
51 // Always keep this at the end.
52 REASON_NUM,
53 };
54
55 // Any new values should be inserted immediately prior to RESPONSE_NUM.
56 enum SafeBrowsingResponse {
57 NOT_BLACKLISTED = 0,
58 TIMEOUT = 1,
59 BLACKLISTED = 2,
60
61 // Always keep this at the end.
62 RESPONSE_NUM,
63 };
64
44 // A bundle for the information sent in a PermissionReport. 65 // A bundle for the information sent in a PermissionReport.
45 struct PermissionReportInfo { 66 struct PermissionReportInfo {
46 PermissionReportInfo( 67 PermissionReportInfo(
47 const GURL& origin, 68 const GURL& origin,
48 content::PermissionType permission, 69 content::PermissionType permission,
49 PermissionAction action, 70 PermissionAction action,
50 PermissionSourceUI source_ui, 71 PermissionSourceUI source_ui,
51 PermissionRequestGestureType gesture_type, 72 PermissionRequestGestureType gesture_type,
52 PermissionPersistDecision persist_decision, 73 PermissionPersistDecision persist_decision,
53 int num_prior_dismissals, 74 int num_prior_dismissals,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 const GURL& requesting_origin, 128 const GURL& requesting_origin,
108 Profile* profile); 129 Profile* profile);
109 static void PermissionIgnored(content::PermissionType permission, 130 static void PermissionIgnored(content::PermissionType permission,
110 PermissionRequestGestureType gesture_type, 131 PermissionRequestGestureType gesture_type,
111 const GURL& requesting_origin, 132 const GURL& requesting_origin,
112 Profile* profile); 133 Profile* profile);
113 static void PermissionRevoked(content::PermissionType permission, 134 static void PermissionRevoked(content::PermissionType permission,
114 PermissionSourceUI source_ui, 135 PermissionSourceUI source_ui,
115 const GURL& revoked_origin, 136 const GURL& revoked_origin,
116 Profile* profile); 137 Profile* profile);
117 138 static void RecordPermissionEmbargoReason(
139 PermissionEmbargoReason embargo_reason);
140 static void RecordSafeBrowsingResponse(base::TimeDelta response_time,
141 SafeBrowsingResponse response);
142 static void RecordRepeatedEmbargo(PermissionEmbargoReason embargo_reason);
118 // UMA specifically for when permission prompts are shown. This should be 143 // UMA specifically for when permission prompts are shown. This should be
119 // roughly equivalent to the metrics above, however it is 144 // roughly equivalent to the metrics above, however it is
120 // useful to have separate UMA to a few reasons: 145 // useful to have separate UMA to a few reasons:
121 // - to account for, and get data on coalesced permission bubbles 146 // - to account for, and get data on coalesced permission bubbles
122 // - there are other types of permissions prompts (e.g. download limiting) 147 // - there are other types of permissions prompts (e.g. download limiting)
123 // which don't go through PermissionContext 148 // which don't go through PermissionContext
124 // - the above metrics don't always add up (e.g. sum of 149 // - 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 150 // 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. 151 // unclear from those metrics alone how many prompts are seen by users.
127 static void PermissionPromptShown( 152 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. 206 // for a single origin using |prefix| for the metric.
182 static void RecordPermissionPromptPriorCount( 207 static void RecordPermissionPromptPriorCount(
183 content::PermissionType permission, 208 content::PermissionType permission,
184 const std::string& prefix, 209 const std::string& prefix,
185 int count); 210 int count);
186 211
187 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); 212 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil);
188 }; 213 };
189 214
190 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ 215 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698