Chromium Code Reviews| 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" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 221 PermissionRequestType request_type = | 221 PermissionRequestType request_type = |
| 222 PermissionUtil::GetRequestType(permission_type_); | 222 PermissionUtil::GetRequestType(permission_type_); |
| 223 PermissionRequestGestureType gesture_type = | 223 PermissionRequestGestureType gesture_type = |
| 224 PermissionUtil::GetGestureType(user_gesture); | 224 PermissionUtil::GetGestureType(user_gesture); |
| 225 switch (decision) { | 225 switch (decision) { |
| 226 case GRANTED: | 226 case GRANTED: |
| 227 PermissionUmaUtil::PermissionGranted(permission_type_, gesture_type, | 227 PermissionUmaUtil::PermissionGranted(permission_type_, gesture_type, |
| 228 requesting_frame, profile_); | 228 requesting_frame, profile_); |
| 229 PermissionUmaUtil::RecordPermissionPromptAccepted(request_type, | 229 PermissionUmaUtil::RecordPermissionPromptAccepted(request_type, |
| 230 gesture_type); | 230 gesture_type); |
| 231 PermissionUmaUtil::RecordPermissionEmbargoStatus( | |
| 232 PermissionEmbargoStatus::NOT_EMBARGOED); | |
| 231 break; | 233 break; |
| 232 case DENIED: | 234 case DENIED: |
| 233 PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type, | 235 PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type, |
| 234 requesting_frame, profile_); | 236 requesting_frame, profile_); |
| 235 PermissionUmaUtil::RecordPermissionPromptDenied(request_type, | 237 PermissionUmaUtil::RecordPermissionPromptDenied(request_type, |
| 236 gesture_type); | 238 gesture_type); |
| 239 PermissionUmaUtil::RecordPermissionEmbargoStatus( | |
| 240 PermissionEmbargoStatus::NOT_EMBARGOED); | |
| 237 break; | 241 break; |
| 238 case DISMISSED: | 242 case DISMISSED: |
| 239 PermissionUmaUtil::PermissionDismissed(permission_type_, gesture_type, | 243 PermissionUmaUtil::PermissionDismissed(permission_type_, gesture_type, |
| 240 requesting_frame, profile_); | 244 requesting_frame, profile_); |
| 245 if (PermissionDecisionAutoBlocker::GetForProfile(profile_) | |
| 246 ->RecordDismissAndEmbargo(requesting_origin, permission_type_)) { | |
|
raymes
2017/02/09 05:46:39
Unfortunately this is going to be untested code :(
dominickn
2017/02/10 03:12:33
We could look at adding Java side tests for this.
| |
| 247 PermissionUmaUtil::RecordPermissionEmbargoStatus( | |
| 248 PermissionEmbargoStatus::REPEATED_DISMISSALS); | |
| 249 } else { | |
| 250 PermissionUmaUtil::RecordPermissionEmbargoStatus( | |
| 251 PermissionEmbargoStatus::NOT_EMBARGOED); | |
| 252 } | |
| 241 break; | 253 break; |
| 242 default: | 254 default: |
| 243 NOTREACHED(); | 255 NOTREACHED(); |
| 244 } | 256 } |
| 245 | 257 |
| 246 // TODO(miguelg): move the permission persistence to | 258 // TODO(miguelg): move the permission persistence to |
| 247 // PermissionContextBase once all the types are moved there. | 259 // PermissionContextBase once all the types are moved there. |
| 248 if (update_content_setting) | 260 if (update_content_setting) |
| 249 UpdateContentSetting(requesting_frame, embedder, decision); | 261 UpdateContentSetting(requesting_frame, embedder, decision); |
| 250 | 262 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 433 } | 445 } |
| 434 | 446 |
| 435 ContentSetting content_setting = | 447 ContentSetting content_setting = |
| 436 (decision == GRANTED) ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; | 448 (decision == GRANTED) ? CONTENT_SETTING_ALLOW : CONTENT_SETTING_BLOCK; |
| 437 | 449 |
| 438 HostContentSettingsMapFactory::GetForProfile(profile_) | 450 HostContentSettingsMapFactory::GetForProfile(profile_) |
| 439 ->SetContentSettingDefaultScope( | 451 ->SetContentSettingDefaultScope( |
| 440 requesting_frame.GetOrigin(), embedder.GetOrigin(), | 452 requesting_frame.GetOrigin(), embedder.GetOrigin(), |
| 441 content_settings_type_, std::string(), content_setting); | 453 content_settings_type_, std::string(), content_setting); |
| 442 } | 454 } |
| OLD | NEW |