| 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 6f12eb470f49a761e9ae0eda98b5ab19b7407054..c56db61969d0b90f05b32ce2cef90e6dc22cdb1a 100644
|
| --- a/chrome/browser/permissions/permission_queue_controller.cc
|
| +++ b/chrome/browser/permissions/permission_queue_controller.cc
|
| @@ -54,7 +54,7 @@ bool ArePermissionRequestsForSameTab(
|
|
|
| class PermissionQueueController::PendingInfobarRequest {
|
| public:
|
| - PendingInfobarRequest(content::PermissionType type,
|
| + PendingInfobarRequest(ContentSettingsType type,
|
| const PermissionRequestID& id,
|
| const GURL& requesting_frame,
|
| const GURL& embedder,
|
| @@ -85,7 +85,7 @@ class PermissionQueueController::PendingInfobarRequest {
|
| void CreatePrompt(PermissionQueueController* controller, bool show_dialog);
|
|
|
| private:
|
| - content::PermissionType type_;
|
| + ContentSettingsType type_;
|
| PermissionRequestID id_;
|
| GURL requesting_frame_;
|
| GURL embedder_;
|
| @@ -99,7 +99,7 @@ class PermissionQueueController::PendingInfobarRequest {
|
| };
|
|
|
| PermissionQueueController::PendingInfobarRequest::PendingInfobarRequest(
|
| - content::PermissionType type,
|
| + ContentSettingsType type,
|
| const PermissionRequestID& id,
|
| const GURL& requesting_frame,
|
| const GURL& embedder,
|
| @@ -160,10 +160,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) {}
|
|
|
| @@ -187,8 +185,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);
|
| }
|
| @@ -220,12 +218,12 @@ 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);
|
| @@ -233,7 +231,7 @@ void PermissionQueueController::OnPermissionSet(const PermissionRequestID& id,
|
| PermissionEmbargoStatus::NOT_EMBARGOED);
|
| 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);
|
| @@ -241,10 +239,11 @@ void PermissionQueueController::OnPermissionSet(const PermissionRequestID& id,
|
| PermissionEmbargoStatus::NOT_EMBARGOED);
|
| break;
|
| case DISMISSED:
|
| - PermissionUmaUtil::PermissionDismissed(permission_type_, gesture_type,
|
| - requesting_frame, profile_);
|
| + PermissionUmaUtil::PermissionDismissed(
|
| + content_settings_type_, gesture_type, requesting_frame, profile_);
|
| if (PermissionDecisionAutoBlocker::GetForProfile(profile_)
|
| - ->RecordDismissAndEmbargo(requesting_frame, permission_type_)) {
|
| + ->RecordDismissAndEmbargo(requesting_frame,
|
| + content_settings_type_)) {
|
| PermissionUmaUtil::RecordPermissionEmbargoStatus(
|
| PermissionEmbargoStatus::REPEATED_DISMISSALS);
|
| } else {
|
| @@ -448,8 +447,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, see crbug.com/563297.
|
| + 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);
|
| }
|
|
|