| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 Profile* profile); | 131 Profile* profile); |
| 131 static void PermissionIgnored(ContentSettingsType permission, | 132 static void PermissionIgnored(ContentSettingsType permission, |
| 132 PermissionRequestGestureType gesture_type, | 133 PermissionRequestGestureType gesture_type, |
| 133 const GURL& requesting_origin, | 134 const GURL& requesting_origin, |
| 134 Profile* profile); | 135 Profile* profile); |
| 135 static void PermissionRevoked(ContentSettingsType permission, | 136 static void PermissionRevoked(ContentSettingsType permission, |
| 136 PermissionSourceUI source_ui, | 137 PermissionSourceUI source_ui, |
| 137 const GURL& revoked_origin, | 138 const GURL& revoked_origin, |
| 138 Profile* profile); | 139 Profile* profile); |
| 139 | 140 |
| 140 static void RecordPermissionEmbargoStatus( | 141 static void RecordEmbargoPromptSuppression( |
| 141 PermissionEmbargoStatus embargo_status); | 142 PermissionEmbargoStatus embargo_status); |
| 142 | 143 |
| 144 static void RecordEmbargoStatus(PermissionEmbargoStatus embargo_status); |
| 145 |
| 143 static void RecordSafeBrowsingResponse(base::TimeDelta response_time, | 146 static void RecordSafeBrowsingResponse(base::TimeDelta response_time, |
| 144 SafeBrowsingResponse response); | 147 SafeBrowsingResponse response); |
| 145 | 148 |
| 146 // UMA specifically for when permission prompts are shown. This should be | 149 // UMA specifically for when permission prompts are shown. This should be |
| 147 // roughly equivalent to the metrics above, however it is | 150 // roughly equivalent to the metrics above, however it is |
| 148 // useful to have separate UMA to a few reasons: | 151 // useful to have separate UMA to a few reasons: |
| 149 // - to account for, and get data on coalesced permission bubbles | 152 // - to account for, and get data on coalesced permission bubbles |
| 150 // - there are other types of permissions prompts (e.g. download limiting) | 153 // - there are other types of permissions prompts (e.g. download limiting) |
| 151 // which don't go through PermissionContext | 154 // which don't go through PermissionContext |
| 152 // - the above metrics don't always add up (e.g. sum of | 155 // - 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... |
| 209 // for a single origin using |prefix| for the metric. | 212 // for a single origin using |prefix| for the metric. |
| 210 static void RecordPermissionPromptPriorCount( | 213 static void RecordPermissionPromptPriorCount( |
| 211 ContentSettingsType permission, | 214 ContentSettingsType permission, |
| 212 const std::string& prefix, | 215 const std::string& prefix, |
| 213 int count); | 216 int count); |
| 214 | 217 |
| 215 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); | 218 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); |
| 216 }; | 219 }; |
| 217 | 220 |
| 218 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ | 221 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ |
| OLD | NEW |