OLD | NEW |
---|---|
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; | |
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 // This is used to back a UMA histogram, so it should be treated as append-only. | |
49 // Any new values should be inserted immediately prior to REPEATED_DISMISSALS. | |
50 enum PermissionEmbargoReason { | |
51 REPEATED_DISMISSALS = 0, | |
52 PERMISSIONS_BLACKLISTING = 1, | |
dominickn
2017/01/27 06:05:47
This can probably just be called BLACKLISTED
meredithl
2017/01/29 23:48:30
I get a name collision with SafeBrowsingResponse,
dominickn
2017/01/30 00:06:20
Ah, I see. Leave it as is then. :)
meredithl
2017/01/30 00:34:33
Acknowledged.
| |
53 NOT_EMBARGOED = 2, | |
54 | |
55 // Always keep this at the end. | |
56 EMBARGO_NUM, | |
dominickn
2017/01/27 06:05:47
REASON_NUM
meredithl
2017/01/29 23:48:30
Done.
| |
57 }; | |
58 | |
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 Loading... | |
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 Loading... | |
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_ |
OLD | NEW |