Chromium Code Reviews| 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" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 GURL origin; | 58 GURL origin; |
| 59 content::PermissionType permission; | 59 content::PermissionType permission; |
| 60 PermissionAction action; | 60 PermissionAction action; |
| 61 PermissionSourceUI source_ui; | 61 PermissionSourceUI source_ui; |
| 62 PermissionRequestGestureType gesture_type; | 62 PermissionRequestGestureType gesture_type; |
| 63 PermissionPersistDecision persist_decision; | 63 PermissionPersistDecision persist_decision; |
| 64 int num_prior_dismissals; | 64 int num_prior_dismissals; |
| 65 int num_prior_ignores; | 65 int num_prior_ignores; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 enum PermissionEmbargoReason { | |
|
kcarattini
2017/02/09 00:17:33
Nit: What about PermissionEmbargoStatus instead of
meredithl
2017/02/09 02:58:28
Done.
| |
| 69 NOT_EMBARGOED = 0, | |
| 70 BLACKLISTED = 1, | |
| 71 REPEATED_DISMISSALS = 2, | |
| 72 | |
| 73 // Keep this at the end. | |
| 74 REASON_NUM, | |
| 75 }; | |
| 76 | |
| 68 // Provides a convenient way of logging UMA for permission related operations. | 77 // Provides a convenient way of logging UMA for permission related operations. |
| 69 class PermissionUmaUtil { | 78 class PermissionUmaUtil { |
| 70 public: | 79 public: |
| 71 static const char kPermissionsPromptShown[]; | 80 static const char kPermissionsPromptShown[]; |
| 72 static const char kPermissionsPromptShownGesture[]; | 81 static const char kPermissionsPromptShownGesture[]; |
| 73 static const char kPermissionsPromptShownNoGesture[]; | 82 static const char kPermissionsPromptShownNoGesture[]; |
| 74 static const char kPermissionsPromptAccepted[]; | 83 static const char kPermissionsPromptAccepted[]; |
| 75 static const char kPermissionsPromptAcceptedGesture[]; | 84 static const char kPermissionsPromptAcceptedGesture[]; |
| 76 static const char kPermissionsPromptAcceptedNoGesture[]; | 85 static const char kPermissionsPromptAcceptedNoGesture[]; |
| 77 static const char kPermissionsPromptDenied[]; | 86 static const char kPermissionsPromptDenied[]; |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 107 const GURL& requesting_origin, | 116 const GURL& requesting_origin, |
| 108 Profile* profile); | 117 Profile* profile); |
| 109 static void PermissionIgnored(content::PermissionType permission, | 118 static void PermissionIgnored(content::PermissionType permission, |
| 110 PermissionRequestGestureType gesture_type, | 119 PermissionRequestGestureType gesture_type, |
| 111 const GURL& requesting_origin, | 120 const GURL& requesting_origin, |
| 112 Profile* profile); | 121 Profile* profile); |
| 113 static void PermissionRevoked(content::PermissionType permission, | 122 static void PermissionRevoked(content::PermissionType permission, |
| 114 PermissionSourceUI source_ui, | 123 PermissionSourceUI source_ui, |
| 115 const GURL& revoked_origin, | 124 const GURL& revoked_origin, |
| 116 Profile* profile); | 125 Profile* profile); |
| 117 | 126 static void RecordPermissionEmbargoReason( |
| 127 PermissionEmbargoReason embargo_reason); | |
|
raymes
2017/02/08 23:20:09
nit: please add a newline after this
meredithl
2017/02/09 00:15:37
Done.
| |
| 118 // UMA specifically for when permission prompts are shown. This should be | 128 // UMA specifically for when permission prompts are shown. This should be |
| 119 // roughly equivalent to the metrics above, however it is | 129 // roughly equivalent to the metrics above, however it is |
| 120 // useful to have separate UMA to a few reasons: | 130 // useful to have separate UMA to a few reasons: |
| 121 // - to account for, and get data on coalesced permission bubbles | 131 // - to account for, and get data on coalesced permission bubbles |
| 122 // - there are other types of permissions prompts (e.g. download limiting) | 132 // - there are other types of permissions prompts (e.g. download limiting) |
| 123 // which don't go through PermissionContext | 133 // which don't go through PermissionContext |
| 124 // - the above metrics don't always add up (e.g. sum of | 134 // - 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 | 135 // 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. | 136 // unclear from those metrics alone how many prompts are seen by users. |
| 127 static void PermissionPromptShown( | 137 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. | 191 // for a single origin using |prefix| for the metric. |
| 182 static void RecordPermissionPromptPriorCount( | 192 static void RecordPermissionPromptPriorCount( |
| 183 content::PermissionType permission, | 193 content::PermissionType permission, |
| 184 const std::string& prefix, | 194 const std::string& prefix, |
| 185 int count); | 195 int count); |
| 186 | 196 |
| 187 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); | 197 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); |
| 188 }; | 198 }; |
| 189 | 199 |
| 190 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ | 200 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ |
| OLD | NEW |