| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_context_base.h" | 5 #include "chrome/browser/permissions/permission_context_base.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 bool user_gesture, | 209 bool user_gesture, |
| 210 const BrowserPermissionCallback& callback, | 210 const BrowserPermissionCallback& callback, |
| 211 bool persist, | 211 bool persist, |
| 212 ContentSetting content_setting) { | 212 ContentSetting content_setting) { |
| 213 #if !defined(OS_ANDROID) | 213 #if !defined(OS_ANDROID) |
| 214 // Infobar persistence and its related UMA is tracked on the infobar | 214 // Infobar persistence and its related UMA is tracked on the infobar |
| 215 // controller directly. | 215 // controller directly. |
| 216 PermissionRequestGestureType gesture_type = | 216 PermissionRequestGestureType gesture_type = |
| 217 user_gesture ? PermissionRequestGestureType::GESTURE | 217 user_gesture ? PermissionRequestGestureType::GESTURE |
| 218 : PermissionRequestGestureType::NO_GESTURE; | 218 : PermissionRequestGestureType::NO_GESTURE; |
| 219 |
| 220 // Check if we should convert a dismiss decision into a block decision. This |
| 221 // is gated on enabling the kBlockPromptsIfDismissedOften feature. |
| 222 if (!persist && |
| 223 prompt_decision_log_.Get().ShouldChangeDismissalToBlock( |
| 224 profile_, requesting_origin, permission_type_)) { |
| 225 persist = true; |
| 226 content_setting = CONTENT_SETTING_BLOCK; |
| 227 } |
| 228 |
| 219 if (persist) { | 229 if (persist) { |
| 220 DCHECK(content_setting == CONTENT_SETTING_ALLOW || | 230 DCHECK(content_setting == CONTENT_SETTING_ALLOW || |
| 221 content_setting == CONTENT_SETTING_BLOCK); | 231 content_setting == CONTENT_SETTING_BLOCK); |
| 222 if (content_setting == CONTENT_SETTING_ALLOW) { | 232 if (content_setting == CONTENT_SETTING_ALLOW) { |
| 223 PermissionUmaUtil::PermissionGranted(permission_type_, gesture_type, | 233 PermissionUmaUtil::PermissionGranted(permission_type_, gesture_type, |
| 224 requesting_origin, profile_); | 234 requesting_origin, profile_); |
| 225 } else { | 235 } else { |
| 226 PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type, | 236 PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type, |
| 227 requesting_origin, profile_); | 237 requesting_origin, profile_); |
| 228 } | 238 } |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 content_setting); | 302 content_setting); |
| 293 } | 303 } |
| 294 | 304 |
| 295 bool PermissionContextBase::IsPermissionKillSwitchOn() const { | 305 bool PermissionContextBase::IsPermissionKillSwitchOn() const { |
| 296 const std::string param = variations::GetVariationParamValue( | 306 const std::string param = variations::GetVariationParamValue( |
| 297 kPermissionsKillSwitchFieldStudy, | 307 kPermissionsKillSwitchFieldStudy, |
| 298 PermissionUtil::GetPermissionString(permission_type_)); | 308 PermissionUtil::GetPermissionString(permission_type_)); |
| 299 | 309 |
| 300 return param == kPermissionsKillSwitchBlockedValue; | 310 return param == kPermissionsKillSwitchBlockedValue; |
| 301 } | 311 } |
| OLD | NEW |