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 "base/time/time.h" |
13 #include "chrome/browser/permissions/permission_request.h" | 13 #include "chrome/browser/permissions/permission_request.h" |
14 #include "chrome/browser/permissions/permission_result.h" | 14 #include "chrome/browser/permissions/permission_result.h" |
15 #include "chrome/browser/permissions/permission_util.h" | 15 #include "chrome/browser/permissions/permission_util.h" |
16 #include "content/public/browser/permission_type.h" | 16 #include "content/public/browser/permission_type.h" |
17 | 17 |
| 18 namespace content { |
| 19 class WebContents; |
| 20 } |
| 21 |
18 enum class PermissionRequestGestureType; | 22 enum class PermissionRequestGestureType; |
19 class GURL; | 23 class GURL; |
20 class PermissionRequest; | 24 class PermissionRequest; |
21 class Profile; | 25 class Profile; |
22 | 26 |
23 // This should stay in sync with the SourceUI enum in the permission report | 27 // This should stay in sync with the SourceUI enum in the permission report |
24 // protobuf (src/chrome/common/safe_browsing/permission_report.proto). | 28 // protobuf (src/chrome/common/safe_browsing/permission_report.proto). |
25 enum class PermissionSourceUI { | 29 enum class PermissionSourceUI { |
26 PROMPT = 0, | 30 PROMPT = 0, |
27 OIB = 1, | 31 OIB = 1, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // useful to have separate UMA to a few reasons: | 155 // useful to have separate UMA to a few reasons: |
152 // - to account for, and get data on coalesced permission bubbles | 156 // - to account for, and get data on coalesced permission bubbles |
153 // - there are other types of permissions prompts (e.g. download limiting) | 157 // - there are other types of permissions prompts (e.g. download limiting) |
154 // which don't go through PermissionContext | 158 // which don't go through PermissionContext |
155 // - the above metrics don't always add up (e.g. sum of | 159 // - the above metrics don't always add up (e.g. sum of |
156 // granted+denied+dismissed+ignored is not equal to requested), so it is | 160 // granted+denied+dismissed+ignored is not equal to requested), so it is |
157 // unclear from those metrics alone how many prompts are seen by users. | 161 // unclear from those metrics alone how many prompts are seen by users. |
158 static void PermissionPromptShown( | 162 static void PermissionPromptShown( |
159 const std::vector<PermissionRequest*>& requests); | 163 const std::vector<PermissionRequest*>& requests); |
160 | 164 |
161 // The following two functions can be combined with the PermissionPromptShown | 165 static void PermissionPromptResolved( |
162 // metrics to calculate accept, deny and ignore rates. | 166 const std::vector<PermissionRequest*>& requests, |
163 static void PermissionPromptAccepted( | 167 const content::WebContents* web_contents, |
164 const std::vector<PermissionRequest*>& requests); | 168 PermissionAction permission_action); |
165 | |
166 static void PermissionPromptDenied( | |
167 const std::vector<PermissionRequest*>& requests); | |
168 | 169 |
169 // Records the request type and gesture type for a shown, accepted, and denied | 170 // Records the request type and gesture type for a shown, accepted, and denied |
170 // prompt. Defined separately as Android must call this method explicitly | 171 // prompt. Defined separately as Android must call this method explicitly |
171 // until the removal of PermissionQueueController is completed. | 172 // until the removal of PermissionQueueController is completed. |
172 static void RecordPermissionPromptShown( | 173 static void RecordPermissionPromptShown( |
173 PermissionRequestType request_type, | 174 PermissionRequestType request_type, |
174 PermissionRequestGestureType gesture_type); | 175 PermissionRequestGestureType gesture_type); |
175 | 176 |
176 static void RecordPermissionPromptAccepted( | 177 static void RecordPermissionPromptAccepted( |
177 PermissionRequestType request_type, | 178 PermissionRequestType request_type, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 int count); | 217 int count); |
217 | 218 |
218 static void RecordPromptDecided( | 219 static void RecordPromptDecided( |
219 const std::vector<PermissionRequest*>& requests, | 220 const std::vector<PermissionRequest*>& requests, |
220 bool accepted); | 221 bool accepted); |
221 | 222 |
222 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); | 223 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); |
223 }; | 224 }; |
224 | 225 |
225 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ | 226 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ |
OLD | NEW |