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 4a126626edb7195011b91c3f910c805f7e4c6884..6c79f43536b8d366eda6a2e7d1b716617deaf110 100644 |
| --- a/chrome/browser/permissions/permission_queue_controller.cc |
| +++ b/chrome/browser/permissions/permission_queue_controller.cc |
| @@ -53,7 +53,7 @@ bool ArePermissionRequestsForSameTab( |
| class PermissionQueueController::PendingInfobarRequest { |
| public: |
| - PendingInfobarRequest(content::PermissionType type, |
| + PendingInfobarRequest(ContentSettingsType type, |
| const PermissionRequestID& id, |
| const GURL& requesting_frame, |
| const GURL& embedder, |
| @@ -84,7 +84,7 @@ class PermissionQueueController::PendingInfobarRequest { |
| void CreatePrompt(PermissionQueueController* controller, bool show_dialog); |
| private: |
| - content::PermissionType type_; |
| + ContentSettingsType type_; |
| PermissionRequestID id_; |
| GURL requesting_frame_; |
| GURL embedder_; |
| @@ -98,7 +98,7 @@ class PermissionQueueController::PendingInfobarRequest { |
| }; |
| PermissionQueueController::PendingInfobarRequest::PendingInfobarRequest( |
| - content::PermissionType type, |
| + ContentSettingsType type, |
| const PermissionRequestID& id, |
| const GURL& requesting_frame, |
| const GURL& embedder, |
| @@ -159,10 +159,8 @@ void PermissionQueueController::PendingInfobarRequest::CreatePrompt( |
| PermissionQueueController::PermissionQueueController( |
| Profile* profile, |
| - content::PermissionType permission_type, |
| ContentSettingsType content_settings_type) |
| : profile_(profile), |
| - permission_type_(permission_type), |
| content_settings_type_(content_settings_type), |
| in_shutdown_(false) {} |
| @@ -186,8 +184,8 @@ void PermissionQueueController::CreateInfoBarRequest( |
| return; |
| pending_infobar_requests_.push_back( |
| - PendingInfobarRequest(permission_type_, id, requesting_frame, embedder, |
| - user_gesture, profile_, callback)); |
| + PendingInfobarRequest(content_settings_type_, id, requesting_frame, |
| + embedder, user_gesture, profile_, callback)); |
| if (!AlreadyShowingInfoBarForTab(id)) |
| ShowQueuedInfoBarForTab(id); |
| } |
| @@ -219,25 +217,25 @@ void PermissionQueueController::OnPermissionSet(const PermissionRequestID& id, |
| DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| PermissionRequestType request_type = |
| - PermissionUtil::GetRequestType(permission_type_); |
| + PermissionUtil::GetRequestType(content_settings_type_); |
| PermissionRequestGestureType gesture_type = |
| PermissionUtil::GetGestureType(user_gesture); |
| switch (decision) { |
| case GRANTED: |
| - PermissionUmaUtil::PermissionGranted(permission_type_, gesture_type, |
| + PermissionUmaUtil::PermissionGranted(content_settings_type_, gesture_type, |
| requesting_frame, profile_); |
| PermissionUmaUtil::RecordPermissionPromptAccepted(request_type, |
| gesture_type); |
| break; |
| case DENIED: |
| - PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type, |
| + PermissionUmaUtil::PermissionDenied(content_settings_type_, gesture_type, |
| requesting_frame, profile_); |
| PermissionUmaUtil::RecordPermissionPromptDenied(request_type, |
| gesture_type); |
| break; |
| case DISMISSED: |
| - PermissionUmaUtil::PermissionDismissed(permission_type_, gesture_type, |
| - requesting_frame, profile_); |
| + PermissionUmaUtil::PermissionDismissed( |
| + content_settings_type_, gesture_type, requesting_frame, profile_); |
| break; |
| default: |
| NOTREACHED(); |
| @@ -435,8 +433,13 @@ void PermissionQueueController::UpdateContentSetting( |
| ContentSetting content_setting = |
| (decision == GRANTED) ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| + // TODO(timloh): Remove this logic when push and notification permissions |
| + // are reconciled. |
|
raymes
2017/02/09 00:39:57
nit: you can add that bug here too
|
| + ContentSettingsType type_for_map = content_settings_type_; |
| + if (type_for_map == CONTENT_SETTINGS_TYPE_PUSH_MESSAGING) |
| + type_for_map = CONTENT_SETTINGS_TYPE_NOTIFICATIONS; |
| HostContentSettingsMapFactory::GetForProfile(profile_) |
| ->SetContentSettingDefaultScope( |
| requesting_frame.GetOrigin(), embedder.GetOrigin(), |
| - content_settings_type_, std::string(), content_setting); |
| + type_for_map, std::string(), content_setting); |
| } |