| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 void PermissionContextBase::PermissionDecided( | 204 void PermissionContextBase::PermissionDecided( |
| 205 const PermissionRequestID& id, | 205 const PermissionRequestID& id, |
| 206 const GURL& requesting_origin, | 206 const GURL& requesting_origin, |
| 207 const GURL& embedding_origin, | 207 const GURL& embedding_origin, |
| 208 const BrowserPermissionCallback& callback, | 208 const BrowserPermissionCallback& callback, |
| 209 bool persist, | 209 bool persist, |
| 210 ContentSetting content_setting) { | 210 ContentSetting content_setting) { |
| 211 #if !defined(OS_ANDROID) | 211 #if !defined(OS_ANDROID) |
| 212 // Infobar persistence and its related UMA is tracked on the infobar | 212 // Infobar persistence and its related UMA is tracked on the infobar |
| 213 // controller directly. | 213 // controller directly. |
| 214 |
| 215 // Check if we should convert a dismiss decision into a block decision. This |
| 216 // is gated on enabling the kBlockPromptsIfDismissedOften feature. |
| 217 if (!persist && PermissionUtil::ShouldChangeDismissalToBlock( |
| 218 profile_, requesting_origin, permission_type_)) { |
| 219 persist = true; |
| 220 content_setting = CONTENT_SETTING_BLOCK; |
| 221 } |
| 222 |
| 214 if (persist) { | 223 if (persist) { |
| 215 DCHECK(content_setting == CONTENT_SETTING_ALLOW || | 224 DCHECK(content_setting == CONTENT_SETTING_ALLOW || |
| 216 content_setting == CONTENT_SETTING_BLOCK); | 225 content_setting == CONTENT_SETTING_BLOCK); |
| 217 if (content_setting == CONTENT_SETTING_ALLOW) | 226 if (content_setting == CONTENT_SETTING_ALLOW) |
| 218 PermissionUmaUtil::PermissionGranted(permission_type_, requesting_origin, | 227 PermissionUmaUtil::PermissionGranted(permission_type_, requesting_origin, |
| 219 profile_); | 228 profile_); |
| 220 else | 229 else |
| 221 PermissionUmaUtil::PermissionDenied(permission_type_, requesting_origin, | 230 PermissionUmaUtil::PermissionDenied(permission_type_, requesting_origin, |
| 222 profile_); | 231 profile_); |
| 223 } else { | 232 } else { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 content_setting); | 295 content_setting); |
| 287 } | 296 } |
| 288 | 297 |
| 289 bool PermissionContextBase::IsPermissionKillSwitchOn() const { | 298 bool PermissionContextBase::IsPermissionKillSwitchOn() const { |
| 290 const std::string param = variations::GetVariationParamValue( | 299 const std::string param = variations::GetVariationParamValue( |
| 291 kPermissionsKillSwitchFieldStudy, | 300 kPermissionsKillSwitchFieldStudy, |
| 292 PermissionUtil::GetPermissionString(permission_type_)); | 301 PermissionUtil::GetPermissionString(permission_type_)); |
| 293 | 302 |
| 294 return param == kPermissionsKillSwitchBlockedValue; | 303 return param == kPermissionsKillSwitchBlockedValue; |
| 295 } | 304 } |
| OLD | NEW |