| 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 30 matching lines...) Expand all Loading... |
| 41 // Any new values should be inserted immediately prior to RESPONSE_NUM. | 41 // Any new values should be inserted immediately prior to RESPONSE_NUM. |
| 42 enum SafeBrowsingResponse { | 42 enum SafeBrowsingResponse { |
| 43 NOT_BLACKLISTED = 0, | 43 NOT_BLACKLISTED = 0, |
| 44 TIMEOUT = 1, | 44 TIMEOUT = 1, |
| 45 BLACKLISTED = 2, | 45 BLACKLISTED = 2, |
| 46 | 46 |
| 47 // Always keep this at the end. | 47 // Always keep this at the end. |
| 48 RESPONSE_NUM, | 48 RESPONSE_NUM, |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 // Any new values should be inserted immediately prior to STATUS_NUM. |
| 52 enum PermissionEmbargoStatus { |
| 53 NOT_EMBARGOED = 0, |
| 54 PERMISSIONS_BLACKLISTING = 1, |
| 55 REPEATED_DISMISSALS = 2, |
| 56 |
| 57 // Keep this at the end. |
| 58 STATUS_NUM, |
| 59 }; |
| 60 |
| 51 // A bundle for the information sent in a PermissionReport. | 61 // A bundle for the information sent in a PermissionReport. |
| 52 struct PermissionReportInfo { | 62 struct PermissionReportInfo { |
| 53 PermissionReportInfo( | 63 PermissionReportInfo( |
| 54 const GURL& origin, | 64 const GURL& origin, |
| 55 ContentSettingsType permission, | 65 ContentSettingsType permission, |
| 56 PermissionAction action, | 66 PermissionAction action, |
| 57 PermissionSourceUI source_ui, | 67 PermissionSourceUI source_ui, |
| 58 PermissionRequestGestureType gesture_type, | 68 PermissionRequestGestureType gesture_type, |
| 59 PermissionPersistDecision persist_decision, | 69 PermissionPersistDecision persist_decision, |
| 60 int num_prior_dismissals, | 70 int num_prior_dismissals, |
| 61 int num_prior_ignores); | 71 int num_prior_ignores); |
| 62 | 72 |
| 63 PermissionReportInfo(const PermissionReportInfo& other); | 73 PermissionReportInfo(const PermissionReportInfo& other); |
| 64 | 74 |
| 65 GURL origin; | 75 GURL origin; |
| 66 ContentSettingsType permission; | 76 ContentSettingsType permission; |
| 67 PermissionAction action; | 77 PermissionAction action; |
| 68 PermissionSourceUI source_ui; | 78 PermissionSourceUI source_ui; |
| 69 PermissionRequestGestureType gesture_type; | 79 PermissionRequestGestureType gesture_type; |
| 70 PermissionPersistDecision persist_decision; | 80 PermissionPersistDecision persist_decision; |
| 71 int num_prior_dismissals; | 81 int num_prior_dismissals; |
| 72 int num_prior_ignores; | 82 int num_prior_ignores; |
| 73 }; | 83 }; |
| 74 | 84 |
| 75 enum PermissionEmbargoStatus { | |
| 76 NOT_EMBARGOED = 0, | |
| 77 PERMISSIONS_BLACKLISTING = 1, | |
| 78 REPEATED_DISMISSALS = 2, | |
| 79 | |
| 80 // Keep this at the end. | |
| 81 STATUS_NUM, | |
| 82 }; | |
| 83 | |
| 84 // Provides a convenient way of logging UMA for permission related operations. | 85 // Provides a convenient way of logging UMA for permission related operations. |
| 85 class PermissionUmaUtil { | 86 class PermissionUmaUtil { |
| 86 public: | 87 public: |
| 87 static const char kPermissionsPromptShown[]; | 88 static const char kPermissionsPromptShown[]; |
| 88 static const char kPermissionsPromptShownGesture[]; | 89 static const char kPermissionsPromptShownGesture[]; |
| 89 static const char kPermissionsPromptShownNoGesture[]; | 90 static const char kPermissionsPromptShownNoGesture[]; |
| 90 static const char kPermissionsPromptAccepted[]; | 91 static const char kPermissionsPromptAccepted[]; |
| 91 static const char kPermissionsPromptAcceptedGesture[]; | 92 static const char kPermissionsPromptAcceptedGesture[]; |
| 92 static const char kPermissionsPromptAcceptedNoGesture[]; | 93 static const char kPermissionsPromptAcceptedNoGesture[]; |
| 93 static const char kPermissionsPromptDenied[]; | 94 static const char kPermissionsPromptDenied[]; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 124 Profile* profile); | 125 Profile* profile); |
| 125 static void PermissionIgnored(ContentSettingsType permission, | 126 static void PermissionIgnored(ContentSettingsType permission, |
| 126 PermissionRequestGestureType gesture_type, | 127 PermissionRequestGestureType gesture_type, |
| 127 const GURL& requesting_origin, | 128 const GURL& requesting_origin, |
| 128 Profile* profile); | 129 Profile* profile); |
| 129 static void PermissionRevoked(ContentSettingsType permission, | 130 static void PermissionRevoked(ContentSettingsType permission, |
| 130 PermissionSourceUI source_ui, | 131 PermissionSourceUI source_ui, |
| 131 const GURL& revoked_origin, | 132 const GURL& revoked_origin, |
| 132 Profile* profile); | 133 Profile* profile); |
| 133 | 134 |
| 134 static void RecordPermissionEmbargoStatus( | 135 static void RecordEmbargoPromptSuppression( |
| 135 PermissionEmbargoStatus embargo_status); | 136 PermissionEmbargoStatus embargo_status); |
| 136 | 137 |
| 138 static void RecordEmbargoPromptSuppressionFromSource( |
| 139 PermissionStatusSource source); |
| 140 |
| 141 static void RecordEmbargoStatus(PermissionEmbargoStatus embargo_status); |
| 142 |
| 137 static void RecordSafeBrowsingResponse(base::TimeDelta response_time, | 143 static void RecordSafeBrowsingResponse(base::TimeDelta response_time, |
| 138 SafeBrowsingResponse response); | 144 SafeBrowsingResponse response); |
| 139 | 145 |
| 140 // UMA specifically for when permission prompts are shown. This should be | 146 // UMA specifically for when permission prompts are shown. This should be |
| 141 // roughly equivalent to the metrics above, however it is | 147 // roughly equivalent to the metrics above, however it is |
| 142 // useful to have separate UMA to a few reasons: | 148 // useful to have separate UMA to a few reasons: |
| 143 // - to account for, and get data on coalesced permission bubbles | 149 // - to account for, and get data on coalesced permission bubbles |
| 144 // - there are other types of permissions prompts (e.g. download limiting) | 150 // - there are other types of permissions prompts (e.g. download limiting) |
| 145 // which don't go through PermissionContext | 151 // which don't go through PermissionContext |
| 146 // - 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 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 // for a single origin using |prefix| for the metric. | 209 // for a single origin using |prefix| for the metric. |
| 204 static void RecordPermissionPromptPriorCount( | 210 static void RecordPermissionPromptPriorCount( |
| 205 ContentSettingsType permission, | 211 ContentSettingsType permission, |
| 206 const std::string& prefix, | 212 const std::string& prefix, |
| 207 int count); | 213 int count); |
| 208 | 214 |
| 209 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); | 215 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); |
| 210 }; | 216 }; |
| 211 | 217 |
| 212 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ | 218 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ |
| OLD | NEW |