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

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

Issue 2226633002: Add a feature to display a persistence toggle for permission prompts on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits, verbal change to make it geolocation-only Created 4 years, 4 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"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "chrome/browser/permissions/permission_util.h"
12 13
13 enum class PermissionRequestGestureType; 14 enum class PermissionRequestGestureType;
14 class GURL; 15 class GURL;
15 class Profile; 16 class Profile;
16 17
17 namespace content { 18 namespace content {
18 enum class PermissionType; 19 enum class PermissionType;
19 } // namespace content 20 } // namespace content
20 21
21 class PermissionRequest; 22 class PermissionRequest;
22 23
23 // Enum for UMA purposes, make sure you update histograms.xml if you add new
24 // permission actions. Never delete or reorder an entry; only add new entries
25 // immediately before PERMISSION_NUM
26 enum PermissionAction {
27 GRANTED = 0,
28 DENIED = 1,
29 DISMISSED = 2,
30 IGNORED = 3,
31 REVOKED = 4,
32 REENABLED = 5,
33 REQUESTED = 6,
34
35 // Always keep this at the end.
36 PERMISSION_ACTION_NUM,
37 };
38
39 // This should stay in sync with the SourceUI enum in the permission report 24 // This should stay in sync with the SourceUI enum in the permission report
40 // protobuf (src/chrome/common/safe_browsing/permission_report.proto). 25 // protobuf (src/chrome/common/safe_browsing/permission_report.proto).
41 enum class PermissionSourceUI { 26 enum class PermissionSourceUI {
42 PROMPT = 0, 27 PROMPT = 0,
43 OIB = 1, 28 OIB = 1,
44 SITE_SETTINGS = 2, 29 SITE_SETTINGS = 2,
45 PAGE_ACTION = 3, 30 PAGE_ACTION = 3,
46 31
47 // Always keep this at the end. 32 // Always keep this at the end.
48 SOURCE_UI_NUM, 33 SOURCE_UI_NUM,
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Records |count| total dismissal actions for a prompt of type |permission| 102 // Records |count| total dismissal actions for a prompt of type |permission|
118 // for a single origin. 103 // for a single origin.
119 static void PermissionPromptDismissed(content::PermissionType permission, 104 static void PermissionPromptDismissed(content::PermissionType permission,
120 int count); 105 int count);
121 106
122 // Records |count| total ignore actions for a prompt of type |permission| for 107 // Records |count| total ignore actions for a prompt of type |permission| for
123 // a single origin. 108 // a single origin.
124 static void PermissionPromptIgnored(content::PermissionType permission, 109 static void PermissionPromptIgnored(content::PermissionType permission,
125 int count); 110 int count);
126 111
112 // A permission prompt was accepted or denied, and the prompt displayed a
113 // persistence toggle. Records whether the toggle was enabled (persist) or
114 // disabled (don't persist).
115 static void PermissionPromptAcceptedWithPersistenceToggle(
116 content::PermissionType permission,
117 bool toggle_enabled);
118
119 static void PermissionPromptDeniedWithPersistenceToggle(
120 content::PermissionType permission,
121 bool toggle_enabled);
122
127 private: 123 private:
128 friend class PermissionUmaUtilTest; 124 friend class PermissionUmaUtilTest;
129 125
130 static bool IsOptedIntoPermissionActionReporting(Profile* profile); 126 static bool IsOptedIntoPermissionActionReporting(Profile* profile);
131 127
132 static void RecordPermissionAction(content::PermissionType permission, 128 static void RecordPermissionAction(content::PermissionType permission,
133 PermissionAction action, 129 PermissionAction action,
134 PermissionSourceUI source_ui, 130 PermissionSourceUI source_ui,
135 PermissionRequestGestureType gesture_type, 131 PermissionRequestGestureType gesture_type,
136 const GURL& requesting_origin, 132 const GURL& requesting_origin,
137 Profile* profile); 133 Profile* profile);
138 134
139 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); 135 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil);
140 }; 136 };
141 137
142 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ 138 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698