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

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

Issue 2075523002: Add SourceUI field to permission report (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 6 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
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 17 matching lines...) Expand all
28 DISMISSED = 2, 28 DISMISSED = 2,
29 IGNORED = 3, 29 IGNORED = 3,
30 REVOKED = 4, 30 REVOKED = 4,
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 enum SourceUI {
kcarattini 2016/07/06 06:54:08 Add a comment to keep this in sync with the Report
stefanocs 2016/07/07 01:26:03 Done.
39 PROMPT = 0,
40 OIB = 1,
41 SITE_SETTINGS = 2,
42 PAGE_ACTION = 3,
43
44 // Always keep this at the end.
45 SOURCE_UI_NUM,
46 };
47
38 // Provides a convenient way of logging UMA for permission related operations. 48 // Provides a convenient way of logging UMA for permission related operations.
39 class PermissionUmaUtil { 49 class PermissionUmaUtil {
40 public: 50 public:
41 static const char kPermissionsPromptShown[]; 51 static const char kPermissionsPromptShown[];
42 static const char kPermissionsPromptAccepted[]; 52 static const char kPermissionsPromptAccepted[];
43 static const char kPermissionsPromptDenied[]; 53 static const char kPermissionsPromptDenied[];
44 static const char kPermissionsPromptRequestsPerPrompt[]; 54 static const char kPermissionsPromptRequestsPerPrompt[];
45 static const char kPermissionsPromptMergedBubbleTypes[]; 55 static const char kPermissionsPromptMergedBubbleTypes[];
46 static const char kPermissionsPromptMergedBubbleAccepted[]; 56 static const char kPermissionsPromptMergedBubbleAccepted[];
47 static const char kPermissionsPromptMergedBubbleDenied[]; 57 static const char kPermissionsPromptMergedBubbleDenied[];
48 58
49 static void PermissionRequested(content::PermissionType permission, 59 static void PermissionRequested(content::PermissionType permission,
50 const GURL& requesting_origin, 60 const GURL& requesting_origin,
51 const GURL& embedding_origin, 61 const GURL& embedding_origin,
52 Profile* profile); 62 Profile* profile);
53 static void PermissionGranted(content::PermissionType permission, 63 static void PermissionGranted(content::PermissionType permission,
54 const GURL& requesting_origin, 64 const GURL& requesting_origin,
65 SourceUI source_ui,
55 Profile* profile); 66 Profile* profile);
56 static void PermissionDenied(content::PermissionType permission, 67 static void PermissionDenied(content::PermissionType permission,
57 const GURL& requesting_origin, 68 const GURL& requesting_origin,
69 SourceUI source_ui,
58 Profile* profile); 70 Profile* profile);
59 static void PermissionDismissed(content::PermissionType permission, 71 static void PermissionDismissed(content::PermissionType permission,
60 const GURL& requesting_origin, 72 const GURL& requesting_origin,
73 SourceUI source_ui,
61 Profile* profile); 74 Profile* profile);
62 static void PermissionIgnored(content::PermissionType permission, 75 static void PermissionIgnored(content::PermissionType permission,
63 const GURL& requesting_origin, 76 const GURL& requesting_origin,
77 SourceUI source_ui,
64 Profile* profile); 78 Profile* profile);
65 static void PermissionRevoked(content::PermissionType permission, 79 static void PermissionRevoked(content::PermissionType permission,
66 const GURL& revoked_origin, 80 const GURL& revoked_origin,
81 SourceUI source_ui,
67 Profile* profile); 82 Profile* profile);
68 83
69 // UMA specifically for when permission prompts are shown. This should be 84 // UMA specifically for when permission prompts are shown. This should be
70 // roughly equivalent to the metrics above, however it is 85 // roughly equivalent to the metrics above, however it is
71 // useful to have separate UMA to a few reasons: 86 // useful to have separate UMA to a few reasons:
72 // - to account for, and get data on coalesced permission bubbles 87 // - to account for, and get data on coalesced permission bubbles
73 // - there are other types of permissions prompts (e.g. download limiting) 88 // - there are other types of permissions prompts (e.g. download limiting)
74 // which don't go through PermissionContext 89 // which don't go through PermissionContext
75 // - the above metrics don't always add up (e.g. sum of 90 // - the above metrics don't always add up (e.g. sum of
76 // granted+denied+dismissed+ignored is not equal to requested), so it is 91 // granted+denied+dismissed+ignored is not equal to requested), so it is
(...skipping 16 matching lines...) Expand all
93 private: 108 private:
94 friend class PermissionUmaUtilTest; 109 friend class PermissionUmaUtilTest;
95 110
96 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); 111 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil);
97 112
98 static bool IsOptedInPermissionActionReporting(Profile* profile); 113 static bool IsOptedInPermissionActionReporting(Profile* profile);
99 114
100 static void RecordPermissionAction(content::PermissionType permission, 115 static void RecordPermissionAction(content::PermissionType permission,
101 PermissionAction action, 116 PermissionAction action,
102 const GURL& requesting_origin, 117 const GURL& requesting_origin,
118 SourceUI source_ui,
103 Profile* profile); 119 Profile* profile);
104 }; 120 };
105 121
106 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ 122 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698