Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Side by Side Diff: chrome/browser/permissions/permission_uma_util.h

Issue 1977693003: Add metrics for permission prompt acceptance / denial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clarify histogram descriptions Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/permissions/permission_uma_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
31 REENABLED = 5, 31 REENABLED = 5,
32 REQUESTED = 6, 32 REQUESTED = 6,
33 33
34 // Always keep this at the end. 34 // Always keep this at the end.
35 PERMISSION_ACTION_NUM, 35 PERMISSION_ACTION_NUM,
36 }; 36 };
37 37
38 // Provides a convenient way of logging UMA for permission related operations. 38 // Provides a convenient way of logging UMA for permission related operations.
39 class PermissionUmaUtil { 39 class PermissionUmaUtil {
40 public: 40 public:
41 static const char kPermissionsPromptShown[];
42 static const char kPermissionsPromptAccepted[];
43 static const char kPermissionsPromptDenied[];
44 static const char kPermissionsPromptRequestsPerPrompt[];
45 static const char kPermissionsPromptMergedBubbleTypes[];
46 static const char kPermissionsPromptMergedBubbleAccepted[];
47 static const char kPermissionsPromptMergedBubbleDenied[];
48
41 static void PermissionRequested(content::PermissionType permission, 49 static void PermissionRequested(content::PermissionType permission,
42 const GURL& requesting_origin, 50 const GURL& requesting_origin,
43 const GURL& embedding_origin, 51 const GURL& embedding_origin,
44 Profile* profile); 52 Profile* profile);
45 static void PermissionGranted(content::PermissionType permission, 53 static void PermissionGranted(content::PermissionType permission,
46 const GURL& requesting_origin); 54 const GURL& requesting_origin);
47 static void PermissionDenied(content::PermissionType permission, 55 static void PermissionDenied(content::PermissionType permission,
48 const GURL& requesting_origin); 56 const GURL& requesting_origin);
49 static void PermissionDismissed(content::PermissionType permission, 57 static void PermissionDismissed(content::PermissionType permission,
50 const GURL& requesting_origin); 58 const GURL& requesting_origin);
51 static void PermissionIgnored(content::PermissionType permission, 59 static void PermissionIgnored(content::PermissionType permission,
52 const GURL& requesting_origin); 60 const GURL& requesting_origin);
53 static void PermissionRevoked(content::PermissionType permission, 61 static void PermissionRevoked(content::PermissionType permission,
54 const GURL& revoked_origin); 62 const GURL& revoked_origin);
55 63
56 // UMA specifically for when permission prompts are shown. This should be 64 // UMA specifically for when permission prompts are shown. This should be
57 // roughly equivalent to the metrics above, however it is 65 // roughly equivalent to the metrics above, however it is
58 // useful to have separate UMA to a few reasons: 66 // useful to have separate UMA to a few reasons:
59 // - to account for, and get data on coalesced permission bubbles 67 // - to account for, and get data on coalesced permission bubbles
60 // - there are other types of permissions prompts (e.g. download limiting) 68 // - there are other types of permissions prompts (e.g. download limiting)
61 // which don't go through PermissionContext 69 // which don't go through PermissionContext
62 // - the above metrics don't always add up (e.g. sum of 70 // - the above metrics don't always add up (e.g. sum of
63 // granted+denied+dismissed+ignored is not equal to requested), so it is 71 // granted+denied+dismissed+ignored is not equal to requested), so it is
64 // unclear from those metrics alone how many prompts are seen by users. 72 // unclear from those metrics alone how many prompts are seen by users.
65 static void PermissionPromptShown( 73 static void PermissionPromptShown(
66 const std::vector<PermissionBubbleRequest*>& requests); 74 const std::vector<PermissionBubbleRequest*>& requests);
67 75
76 // The following two functions can be combined with the PermissionPromptShown
77 // metrics to calculate accept, deny and ignore rates.
78 // Note that for coalesced permission bubbles, PermissionPromptAccepted will
79 // always be called, with |accept_states| containing whether each request was
80 // accepted or denied.
81 static void PermissionPromptAccepted(
82 const std::vector<PermissionBubbleRequest*>& requests,
83 const std::vector<bool>& accept_states);
84
85 static void PermissionPromptDenied(
86 const std::vector<PermissionBubbleRequest*>& requests);
87
68 private: 88 private:
69 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); 89 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil);
70 }; 90 };
71 91
72 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ 92 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/permissions/permission_uma_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698