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

Unified Diff: chrome/browser/permissions/permission_util.cc

Issue 2463393003: Record permission prompt gesture metrics on Android. (Closed)
Patch Set: Address comments Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/permissions/permission_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/permissions/permission_util.cc
diff --git a/chrome/browser/permissions/permission_util.cc b/chrome/browser/permissions/permission_util.cc
index a9580cee53ec966e4c21d633c619b332623f2b10..3048533bb95a59ea6b259799669f1921d9a2da1b 100644
--- a/chrome/browser/permissions/permission_util.cc
+++ b/chrome/browser/permissions/permission_util.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/permissions/permission_util.h"
+#include "build/build_config.h"
#include "base/feature_list.h"
#include "base/logging.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
@@ -54,6 +55,34 @@ std::string PermissionUtil::GetPermissionString(
return std::string();
}
+PermissionRequestType PermissionUtil::GetRequestType(
+ content::PermissionType type) {
+ switch (type) {
+ case content::PermissionType::GEOLOCATION:
+ return PermissionRequestType::PERMISSION_GEOLOCATION;
+#if defined(ENABLE_NOTIFICATIONS)
+ case content::PermissionType::NOTIFICATIONS:
+ return PermissionRequestType::PERMISSION_NOTIFICATIONS;
+#endif
+ case content::PermissionType::MIDI_SYSEX:
+ return PermissionRequestType::PERMISSION_MIDI_SYSEX;
+ case content::PermissionType::PUSH_MESSAGING:
+ return PermissionRequestType::PERMISSION_PUSH_MESSAGING;
+ case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER:
+ return PermissionRequestType::PERMISSION_PROTECTED_MEDIA_IDENTIFIER;
+ case content::PermissionType::FLASH:
+ return PermissionRequestType::PERMISSION_FLASH;
+ default:
+ NOTREACHED();
+ return PermissionRequestType::UNKNOWN;
+ }
+}
+
+PermissionRequestGestureType PermissionUtil::GetGestureType(bool user_gesture) {
+ return user_gesture ? PermissionRequestGestureType::GESTURE
+ : PermissionRequestGestureType::NO_GESTURE;
+}
+
bool PermissionUtil::GetPermissionType(ContentSettingsType type,
PermissionType* out) {
if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) {
« no previous file with comments | « chrome/browser/permissions/permission_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698