| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/permissions/permission_queue_controller.h" | 5 #include "chrome/browser/permissions/permission_queue_controller.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| 11 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" |
| 11 #include "chrome/browser/permissions/permission_dialog_delegate.h" | 12 #include "chrome/browser/permissions/permission_dialog_delegate.h" |
| 12 #include "chrome/browser/permissions/permission_infobar_delegate.h" | 13 #include "chrome/browser/permissions/permission_infobar_delegate.h" |
| 13 #include "chrome/browser/permissions/permission_request.h" | 14 #include "chrome/browser/permissions/permission_request.h" |
| 14 #include "chrome/browser/permissions/permission_request_id.h" | 15 #include "chrome/browser/permissions/permission_request_id.h" |
| 15 #include "chrome/browser/permissions/permission_uma_util.h" | 16 #include "chrome/browser/permissions/permission_uma_util.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/tab_contents/tab_util.h" | 18 #include "chrome/browser/tab_contents/tab_util.h" |
| 18 #include "components/content_settings/core/browser/host_content_settings_map.h" | 19 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 19 #include "components/content_settings/core/common/content_settings.h" | 20 #include "components/content_settings/core/common/content_settings.h" |
| 20 #include "components/infobars/core/infobar.h" | 21 #include "components/infobars/core/infobar.h" |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 PermissionRequestType request_type = | 222 PermissionRequestType request_type = |
| 222 PermissionUtil::GetRequestType(permission_type_); | 223 PermissionUtil::GetRequestType(permission_type_); |
| 223 PermissionRequestGestureType gesture_type = | 224 PermissionRequestGestureType gesture_type = |
| 224 PermissionUtil::GetGestureType(user_gesture); | 225 PermissionUtil::GetGestureType(user_gesture); |
| 225 switch (decision) { | 226 switch (decision) { |
| 226 case GRANTED: | 227 case GRANTED: |
| 227 PermissionUmaUtil::PermissionGranted(permission_type_, gesture_type, | 228 PermissionUmaUtil::PermissionGranted(permission_type_, gesture_type, |
| 228 requesting_frame, profile_); | 229 requesting_frame, profile_); |
| 229 PermissionUmaUtil::RecordPermissionPromptAccepted(request_type, | 230 PermissionUmaUtil::RecordPermissionPromptAccepted(request_type, |
| 230 gesture_type); | 231 gesture_type); |
| 232 PermissionUmaUtil::RecordPermissionEmbargoStatus( |
| 233 PermissionEmbargoStatus::NOT_EMBARGOED); |
| 231 break; | 234 break; |
| 232 case DENIED: | 235 case DENIED: |
| 233 PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type, | 236 PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type, |
| 234 requesting_frame, profile_); | 237 requesting_frame, profile_); |
| 235 PermissionUmaUtil::RecordPermissionPromptDenied(request_type, | 238 PermissionUmaUtil::RecordPermissionPromptDenied(request_type, |
| 236 gesture_type); | 239 gesture_type); |
| 240 PermissionUmaUtil::RecordPermissionEmbargoStatus( |
| 241 PermissionEmbargoStatus::NOT_EMBARGOED); |
| 237 break; | 242 break; |
| 238 case DISMISSED: | 243 case DISMISSED: |
| 239 PermissionUmaUtil::PermissionDismissed(permission_type_, gesture_type, | 244 PermissionUmaUtil::PermissionDismissed(permission_type_, gesture_type, |
| 240 requesting_frame, profile_); | 245 requesting_frame, profile_); |
| 246 if (PermissionDecisionAutoBlocker::GetForProfile(profile_) |
| 247 ->RecordDismissAndEmbargo(requesting_frame, permission_type_)) { |
| 248 PermissionUmaUtil::RecordPermissionEmbargoStatus( |
| 249 PermissionEmbargoStatus::REPEATED_DISMISSALS); |
| 250 } else { |
| 251 PermissionUmaUtil::RecordPermissionEmbargoStatus( |
| 252 PermissionEmbargoStatus::NOT_EMBARGOED); |
| 253 } |
| 241 break; | 254 break; |
| 242 default: | 255 default: |
| 243 NOTREACHED(); | 256 NOTREACHED(); |
| 244 } | 257 } |
| 245 | 258 |
| 246 // TODO(miguelg): move the permission persistence to | 259 // TODO(miguelg): move the permission persistence to |
| 247 // PermissionContextBase once all the types are moved there. | 260 // PermissionContextBase once all the types are moved there. |
| 248 if (update_content_setting) | 261 if (update_content_setting) |
| 249 UpdateContentSetting(requesting_frame, embedder, decision); | 262 UpdateContentSetting(requesting_frame, embedder, decision); |
| 250 | 263 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 } | 446 } |
| 434 | 447 |
| 435 ContentSetting content_setting = | 448 ContentSetting content_setting = |
| 436 (decision == GRANTED) ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 449 (decision == GRANTED) ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| 437 | 450 |
| 438 HostContentSettingsMapFactory::GetForProfile(profile_) | 451 HostContentSettingsMapFactory::GetForProfile(profile_) |
| 439 ->SetContentSettingDefaultScope( | 452 ->SetContentSettingDefaultScope( |
| 440 requesting_frame.GetOrigin(), embedder.GetOrigin(), | 453 requesting_frame.GetOrigin(), embedder.GetOrigin(), |
| 441 content_settings_type_, std::string(), content_setting); | 454 content_settings_type_, std::string(), content_setting); |
| 442 } | 455 } |
| OLD | NEW |