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 "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 Loading... |
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 RESPONSE_NUM. |
| 46 enum SafeBrowsingResponse { |
| 47 NOT_BLACKLISTED = 0, |
| 48 TIMEOUT = 1, |
| 49 BLACKLISTED = 2, |
| 50 |
| 51 // Always keep this at the end. |
| 52 RESPONSE_NUM, |
| 53 }; |
| 54 |
44 // A bundle for the information sent in a PermissionReport. | 55 // A bundle for the information sent in a PermissionReport. |
45 struct PermissionReportInfo { | 56 struct PermissionReportInfo { |
46 PermissionReportInfo( | 57 PermissionReportInfo( |
47 const GURL& origin, | 58 const GURL& origin, |
48 content::PermissionType permission, | 59 content::PermissionType permission, |
49 PermissionAction action, | 60 PermissionAction action, |
50 PermissionSourceUI source_ui, | 61 PermissionSourceUI source_ui, |
51 PermissionRequestGestureType gesture_type, | 62 PermissionRequestGestureType gesture_type, |
52 PermissionPersistDecision persist_decision, | 63 PermissionPersistDecision persist_decision, |
53 int num_prior_dismissals, | 64 int num_prior_dismissals, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 const GURL& requesting_origin, | 118 const GURL& requesting_origin, |
108 Profile* profile); | 119 Profile* profile); |
109 static void PermissionIgnored(content::PermissionType permission, | 120 static void PermissionIgnored(content::PermissionType permission, |
110 PermissionRequestGestureType gesture_type, | 121 PermissionRequestGestureType gesture_type, |
111 const GURL& requesting_origin, | 122 const GURL& requesting_origin, |
112 Profile* profile); | 123 Profile* profile); |
113 static void PermissionRevoked(content::PermissionType permission, | 124 static void PermissionRevoked(content::PermissionType permission, |
114 PermissionSourceUI source_ui, | 125 PermissionSourceUI source_ui, |
115 const GURL& revoked_origin, | 126 const GURL& revoked_origin, |
116 Profile* profile); | 127 Profile* profile); |
117 | 128 static void RecordSafeBrowsingResponse(base::TimeDelta response_time, |
| 129 SafeBrowsingResponse response); |
118 // UMA specifically for when permission prompts are shown. This should be | 130 // UMA specifically for when permission prompts are shown. This should be |
119 // roughly equivalent to the metrics above, however it is | 131 // roughly equivalent to the metrics above, however it is |
120 // useful to have separate UMA to a few reasons: | 132 // useful to have separate UMA to a few reasons: |
121 // - to account for, and get data on coalesced permission bubbles | 133 // - to account for, and get data on coalesced permission bubbles |
122 // - there are other types of permissions prompts (e.g. download limiting) | 134 // - there are other types of permissions prompts (e.g. download limiting) |
123 // which don't go through PermissionContext | 135 // which don't go through PermissionContext |
124 // - the above metrics don't always add up (e.g. sum of | 136 // - 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 | 137 // 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. | 138 // unclear from those metrics alone how many prompts are seen by users. |
127 static void PermissionPromptShown( | 139 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. | 193 // for a single origin using |prefix| for the metric. |
182 static void RecordPermissionPromptPriorCount( | 194 static void RecordPermissionPromptPriorCount( |
183 content::PermissionType permission, | 195 content::PermissionType permission, |
184 const std::string& prefix, | 196 const std::string& prefix, |
185 int count); | 197 int count); |
186 | 198 |
187 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); | 199 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); |
188 }; | 200 }; |
189 | 201 |
190 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ | 202 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ |
OLD | NEW |