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_util.h" | 12 #include "chrome/browser/permissions/permission_util.h" |
| 13 | 13 |
| 14 enum class PermissionRequestGestureType; | 14 enum class PermissionRequestGestureType; |
| 15 class GURL; | 15 class GURL; |
| 16 class PermissionRequest; | |
| 16 class Profile; | 17 class Profile; |
| 17 | 18 |
| 18 namespace content { | 19 namespace content { |
| 19 enum class PermissionType; | 20 enum class PermissionType; |
| 20 } // namespace content | 21 } // namespace content |
| 21 | 22 |
| 22 class PermissionRequest; | |
| 23 | |
| 24 // This should stay in sync with the SourceUI enum in the permission report | 23 // This should stay in sync with the SourceUI enum in the permission report |
| 25 // protobuf (src/chrome/common/safe_browsing/permission_report.proto). | 24 // protobuf (src/chrome/common/safe_browsing/permission_report.proto). |
| 26 enum class PermissionSourceUI { | 25 enum class PermissionSourceUI { |
| 27 PROMPT = 0, | 26 PROMPT = 0, |
| 28 OIB = 1, | 27 OIB = 1, |
| 29 SITE_SETTINGS = 2, | 28 SITE_SETTINGS = 2, |
| 30 PAGE_ACTION = 3, | 29 PAGE_ACTION = 3, |
| 31 | 30 |
| 32 // Always keep this at the end. | 31 // Always keep this at the end. |
| 33 SOURCE_UI_NUM, | 32 SOURCE_UI_NUM, |
| 34 }; | 33 }; |
| 35 | 34 |
| 35 // This should stay in sync with the PersistDecision enum in the permission | |
| 36 // report message (src/chrome/common/safe_browsing/permission_report.proto). | |
| 37 enum class PermissionPersistDecision { | |
| 38 UNSPECIFIED = 0, | |
| 39 PERSISTED = 1, | |
| 40 NOT_PERSISTED = 2, | |
| 41 }; | |
| 42 | |
| 43 // A bundle for the information sent in a PermissionReport. | |
| 44 struct PermissionReportInfo { | |
| 45 PermissionReportInfo( | |
|
Nathan Parker
2016/08/19 00:14:34
Having this constructor sort of defeats some of th
kcarattini
2016/08/19 01:00:39
True, but at least it only happens in one place no
| |
| 46 const GURL& origin, | |
| 47 content::PermissionType permission, | |
| 48 PermissionAction action, | |
| 49 PermissionSourceUI source_ui, | |
| 50 PermissionRequestGestureType gesture_type, | |
| 51 PermissionPersistDecision persist_decision, | |
| 52 int num_prior_dismissals, | |
| 53 int num_prior_ignores); | |
| 54 | |
| 55 PermissionReportInfo(const PermissionReportInfo& other); | |
| 56 | |
| 57 GURL origin; | |
| 58 content::PermissionType permission; | |
| 59 PermissionAction action; | |
| 60 PermissionSourceUI source_ui; | |
| 61 PermissionRequestGestureType gesture_type; | |
| 62 PermissionPersistDecision persist_decision; | |
| 63 int num_prior_dismissals; | |
| 64 int num_prior_ignores; | |
| 65 }; | |
| 66 | |
| 36 // Provides a convenient way of logging UMA for permission related operations. | 67 // Provides a convenient way of logging UMA for permission related operations. |
| 37 class PermissionUmaUtil { | 68 class PermissionUmaUtil { |
| 38 public: | 69 public: |
| 39 static const char kPermissionsPromptShown[]; | 70 static const char kPermissionsPromptShown[]; |
| 40 static const char kPermissionsPromptShownGesture[]; | 71 static const char kPermissionsPromptShownGesture[]; |
| 41 static const char kPermissionsPromptShownNoGesture[]; | 72 static const char kPermissionsPromptShownNoGesture[]; |
| 42 static const char kPermissionsPromptAccepted[]; | 73 static const char kPermissionsPromptAccepted[]; |
| 43 static const char kPermissionsPromptAcceptedGesture[]; | 74 static const char kPermissionsPromptAcceptedGesture[]; |
| 44 static const char kPermissionsPromptAcceptedNoGesture[]; | 75 static const char kPermissionsPromptAcceptedNoGesture[]; |
| 45 static const char kPermissionsPromptDenied[]; | 76 static const char kPermissionsPromptDenied[]; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 PermissionAction action, | 160 PermissionAction action, |
| 130 PermissionSourceUI source_ui, | 161 PermissionSourceUI source_ui, |
| 131 PermissionRequestGestureType gesture_type, | 162 PermissionRequestGestureType gesture_type, |
| 132 const GURL& requesting_origin, | 163 const GURL& requesting_origin, |
| 133 Profile* profile); | 164 Profile* profile); |
| 134 | 165 |
| 135 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); | 166 DISALLOW_IMPLICIT_CONSTRUCTORS(PermissionUmaUtil); |
| 136 }; | 167 }; |
| 137 | 168 |
| 138 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ | 169 #endif // CHROME_BROWSER_PERMISSIONS_PERMISSION_UMA_UTIL_H_ |
| OLD | NEW |