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" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "chrome/browser/permissions/permission_request.h" | |
| 12 #include "chrome/browser/permissions/permission_util.h" | 13 #include "chrome/browser/permissions/permission_util.h" |
| 13 | 14 |
| 14 enum class PermissionRequestGestureType; | 15 enum class PermissionRequestGestureType; |
| 15 class GURL; | 16 class GURL; |
| 16 class PermissionRequest; | 17 class PermissionRequest; |
| 17 class Profile; | 18 class Profile; |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 enum class PermissionType; | 21 enum class PermissionType; |
| 21 } // namespace content | 22 } // namespace content |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 // useful to have separate UMA to a few reasons: | 120 // useful to have separate UMA to a few reasons: |
| 120 // - to account for, and get data on coalesced permission bubbles | 121 // - to account for, and get data on coalesced permission bubbles |
| 121 // - there are other types of permissions prompts (e.g. download limiting) | 122 // - there are other types of permissions prompts (e.g. download limiting) |
| 122 // which don't go through PermissionContext | 123 // which don't go through PermissionContext |
| 123 // - the above metrics don't always add up (e.g. sum of | 124 // - the above metrics don't always add up (e.g. sum of |
| 124 // granted+denied+dismissed+ignored is not equal to requested), so it is | 125 // granted+denied+dismissed+ignored is not equal to requested), so it is |
| 125 // unclear from those metrics alone how many prompts are seen by users. | 126 // unclear from those metrics alone how many prompts are seen by users. |
| 126 static void PermissionPromptShown( | 127 static void PermissionPromptShown( |
| 127 const std::vector<PermissionRequest*>& requests); | 128 const std::vector<PermissionRequest*>& requests); |
| 128 | 129 |
| 130 // Records the request type and gesture type for a shown prompt. Defined | |
| 131 // separately as Android must call this method explicitly until the | |
| 132 // PermissionRequestManager refactoring is completed. | |
| 133 static void RecordPermissionPromptTypeAndGesture( | |
|
benwells
2016/11/02 06:39:35
Are you planning to add analogs for PermissionProm
dominickn
2016/11/03 02:18:21
Oh crud, they're recorded separately too. This is
| |
| 134 PermissionRequestType request_type, | |
| 135 PermissionRequestGestureType gesture_type); | |
| 136 | |
| 129 // The following two functions can be combined with the PermissionPromptShown | 137 // The following two functions can be combined with the PermissionPromptShown |
| 130 // metrics to calculate accept, deny and ignore rates. | 138 // metrics to calculate accept, deny and ignore rates. |
| 131 // Note that for coalesced permission bubbles, PermissionPromptAccepted will | 139 // Note that for coalesced permission bubbles, PermissionPromptAccepted will |
| 132 // always be called, with |accept_states| containing whether each request was | 140 // always be called, with |accept_states| containing whether each request was |
| 133 // accepted or denied. | 141 // accepted or denied. |
| 134 static void PermissionPromptAccepted( | 142 static void PermissionPromptAccepted( |
| 135 const std::vector<PermissionRequest*>& requests, | 143 const std::vector<PermissionRequest*>& requests, |
| 136 const std::vector<bool>& accept_states); | 144 const std::vector<bool>& accept_states); |
| 137 | 145 |
| 138 static void PermissionPromptDenied( | 146 static void PermissionPromptDenied( |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 165 // for a single origin using |prefix| for the metric. | 173 // for a single origin using |prefix| for the metric. |
| 166 static void RecordPermissionPromptPriorCount( | 174 static void RecordPermissionPromptPriorCount( |
| 167 content::PermissionType permission, | 175 content::PermissionType permission, |
| 168 const std::string& prefix, | 176 const std::string& prefix, |
| 169 int count); | 177 int count); |
| 170 | 178 |
| 171 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); | 179 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); |
| 172 }; | 180 }; |
| 173 | 181 |
| 174 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ | 182 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ |
| OLD | NEW |