Chromium Code Reviews| Index: chrome/browser/permissions/permission_queue_controller.cc |
| diff --git a/chrome/browser/permissions/permission_queue_controller.cc b/chrome/browser/permissions/permission_queue_controller.cc |
| index 13410430ec3ba5835de1ed94017b57d53c5e79ef..26921b1d6dc45fbb43d2647a1dfe6bf4dc944f42 100644 |
| --- a/chrome/browser/permissions/permission_queue_controller.cc |
| +++ b/chrome/browser/permissions/permission_queue_controller.cc |
| @@ -4,6 +4,7 @@ |
| #include "chrome/browser/permissions/permission_queue_controller.h" |
| +#include "build/build_config.h" |
| #include "chrome/browser/chrome_notification_types.h" |
| #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| #include "chrome/browser/infobars/infobar_service.h" |
| @@ -64,6 +65,30 @@ class PermissionQueueController::PendingInfobarRequest { |
| bool IsForPair(const GURL& requesting_frame, |
| const GURL& embedder) const; |
| + PermissionRequestType request_type() const { |
| + 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; |
|
benwells
2016/11/10 03:24:28
This switch already exists pretty much in permissi
dominickn
2016/11/10 04:27:07
Done.
|
| + default: |
| + NOTREACHED(); |
| + return PermissionRequestType::UNKNOWN; |
| + } |
| + } |
| + |
| + PermissionRequestGestureType gesture_type() const { |
| + return PermissionUtil::GetGestureType(user_gesture_); |
| + } |
| + |
| const PermissionRequestID& id() const { return id_; } |
| const GURL& requesting_frame() const { return requesting_frame_; } |
| bool has_gesture() const { return user_gesture_; } |
| @@ -211,17 +236,22 @@ void PermissionQueueController::OnPermissionSet(const PermissionRequestID& id, |
| // TODO(miguelg): move the permission persistence to |
|
benwells
2016/11/10 03:24:28
is this TODO still valid? Maybe it should move som
dominickn
2016/11/10 04:27:07
Moved down to the update content setting call.
|
| // PermissionContextBase once all the types are moved there. |
| + PermissionRequestType request_type = |
| + PermissionUtil::GetRequestType(permission_type_); |
| PermissionRequestGestureType gesture_type = |
| - user_gesture ? PermissionRequestGestureType::GESTURE |
| - : PermissionRequestGestureType::NO_GESTURE; |
| + PermissionUtil::GetGestureType(user_gesture); |
| switch (decision) { |
| case GRANTED: |
| PermissionUmaUtil::PermissionGranted(permission_type_, gesture_type, |
| requesting_frame, profile_); |
| + PermissionUmaUtil::RecordPermissionPromptAccepted(request_type, |
| + gesture_type); |
| break; |
| case DENIED: |
| PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type, |
| requesting_frame, profile_); |
| + PermissionUmaUtil::RecordPermissionPromptDenied(request_type, |
| + gesture_type); |
| break; |
| case DISMISSED: |
| PermissionUmaUtil::PermissionDismissed(permission_type_, gesture_type, |
| @@ -361,6 +391,8 @@ void PermissionQueueController::ShowQueuedInfoBarForTab( |
| if (!show_dialog) |
| RegisterForInfoBarNotifications(infobar_service); |
| + PermissionUmaUtil::RecordPermissionPromptShown(i->request_type(), |
| + i->gesture_type()); |
| i->CreatePrompt(this, show_dialog); |
| return; |
| } |