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" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 static const char kPermissionsPromptRequestsPerPrompt[]; | 44 static const char kPermissionsPromptRequestsPerPrompt[]; |
| 45 static const char kPermissionsPromptMergedBubbleTypes[]; | 45 static const char kPermissionsPromptMergedBubbleTypes[]; |
| 46 static const char kPermissionsPromptMergedBubbleAccepted[]; | 46 static const char kPermissionsPromptMergedBubbleAccepted[]; |
| 47 static const char kPermissionsPromptMergedBubbleDenied[]; | 47 static const char kPermissionsPromptMergedBubbleDenied[]; |
| 48 | 48 |
| 49 static void PermissionRequested(content::PermissionType permission, | 49 static void PermissionRequested(content::PermissionType permission, |
| 50 const GURL& requesting_origin, | 50 const GURL& requesting_origin, |
| 51 const GURL& embedding_origin, | 51 const GURL& embedding_origin, |
| 52 Profile* profile); | 52 Profile* profile); |
| 53 static void PermissionGranted(content::PermissionType permission, | 53 static void PermissionGranted(content::PermissionType permission, |
| 54 const GURL& requesting_origin); | 54 const GURL& requesting_origin, |
| 55 Profile* profile); | |
| 55 static void PermissionDenied(content::PermissionType permission, | 56 static void PermissionDenied(content::PermissionType permission, |
| 56 const GURL& requesting_origin); | 57 const GURL& requesting_origin, |
| 58 Profile* profile); | |
| 57 static void PermissionDismissed(content::PermissionType permission, | 59 static void PermissionDismissed(content::PermissionType permission, |
| 58 const GURL& requesting_origin); | 60 const GURL& requesting_origin, |
| 61 Profile* profile); | |
| 59 static void PermissionIgnored(content::PermissionType permission, | 62 static void PermissionIgnored(content::PermissionType permission, |
| 60 const GURL& requesting_origin); | 63 const GURL& requesting_origin, |
| 64 Profile* profile); | |
| 61 static void PermissionRevoked(content::PermissionType permission, | 65 static void PermissionRevoked(content::PermissionType permission, |
| 62 const GURL& revoked_origin); | 66 const GURL& revoked_origin, |
| 67 Profile* profile); | |
| 63 | 68 |
| 64 // UMA specifically for when permission prompts are shown. This should be | 69 // UMA specifically for when permission prompts are shown. This should be |
| 65 // roughly equivalent to the metrics above, however it is | 70 // roughly equivalent to the metrics above, however it is |
| 66 // useful to have separate UMA to a few reasons: | 71 // useful to have separate UMA to a few reasons: |
| 67 // - to account for, and get data on coalesced permission bubbles | 72 // - to account for, and get data on coalesced permission bubbles |
| 68 // - there are other types of permissions prompts (e.g. download limiting) | 73 // - there are other types of permissions prompts (e.g. download limiting) |
| 69 // which don't go through PermissionContext | 74 // which don't go through PermissionContext |
| 70 // - the above metrics don't always add up (e.g. sum of | 75 // - the above metrics don't always add up (e.g. sum of |
| 71 // granted+denied+dismissed+ignored is not equal to requested), so it is | 76 // granted+denied+dismissed+ignored is not equal to requested), so it is |
| 72 // unclear from those metrics alone how many prompts are seen by users. | 77 // unclear from those metrics alone how many prompts are seen by users. |
| 73 static void PermissionPromptShown( | 78 static void PermissionPromptShown( |
| 74 const std::vector<PermissionBubbleRequest*>& requests); | 79 const std::vector<PermissionBubbleRequest*>& requests); |
| 75 | 80 |
| 76 // The following two functions can be combined with the PermissionPromptShown | 81 // The following two functions can be combined with the PermissionPromptShown |
| 77 // metrics to calculate accept, deny and ignore rates. | 82 // metrics to calculate accept, deny and ignore rates. |
| 78 // Note that for coalesced permission bubbles, PermissionPromptAccepted will | 83 // Note that for coalesced permission bubbles, PermissionPromptAccepted will |
| 79 // always be called, with |accept_states| containing whether each request was | 84 // always be called, with |accept_states| containing whether each request was |
| 80 // accepted or denied. | 85 // accepted or denied. |
| 81 static void PermissionPromptAccepted( | 86 static void PermissionPromptAccepted( |
| 82 const std::vector<PermissionBubbleRequest*>& requests, | 87 const std::vector<PermissionBubbleRequest*>& requests, |
| 83 const std::vector<bool>& accept_states); | 88 const std::vector<bool>& accept_states); |
| 84 | 89 |
| 85 static void PermissionPromptDenied( | 90 static void PermissionPromptDenied( |
| 86 const std::vector<PermissionBubbleRequest*>& requests); | 91 const std::vector<PermissionBubbleRequest*>& requests); |
| 87 | 92 |
| 88 private: | 93 private: |
| 94 friend class PermissionUmaUtilTest; | |
| 95 | |
| 89 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); | 96 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); |
| 97 | |
| 98 static bool IsOptedInPermissionActionReporting(Profile* profile); | |
|
kcarattini
2016/07/06 01:44:34
nit:IsOptedInPermissionActionReporting -> IsOptedI
stefanocs
2016/07/06 04:25:45
Done.
| |
| 99 | |
| 100 static void RecordPermissionAction(content::PermissionType permission, | |
| 101 PermissionAction action, | |
| 102 const GURL& requesting_origin, | |
| 103 Profile* profile); | |
| 90 }; | 104 }; |
| 91 | 105 |
| 92 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ | 106 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ |
| OLD | NEW |