Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 29 #if defined(OS_ANDROID) | 29 #if defined(OS_ANDROID) |
| 30 #include "chrome/browser/permissions/permission_queue_controller.h" | 30 #include "chrome/browser/permissions/permission_queue_controller.h" |
| 31 #else | 31 #else |
| 32 #include "chrome/browser/permissions/permission_request_impl.h" | 32 #include "chrome/browser/permissions/permission_request_impl.h" |
| 33 #include "chrome/browser/permissions/permission_request_manager.h" | 33 #include "chrome/browser/permissions/permission_request_manager.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 // static | 36 // static |
| 37 const char PermissionContextBase::kPermissionsKillSwitchFieldStudy[] = | 37 const char PermissionContextBase::kPermissionsKillSwitchFieldStudy[] = |
| 38 "PermissionsKillSwitch"; | 38 "PermissionsKillSwitch"; |
| 39 // static | |
|
raymes
2016/08/06 00:50:21
nit: probably leave this // static as I think it i
dominickn
2016/08/08 02:18:28
Done.
| |
| 40 const char PermissionContextBase::kPermissionsKillSwitchBlockedValue[] = | 39 const char PermissionContextBase::kPermissionsKillSwitchBlockedValue[] = |
| 41 "blocked"; | 40 "blocked"; |
| 42 | 41 |
| 43 PermissionContextBase::PermissionContextBase( | 42 PermissionContextBase::PermissionContextBase( |
| 44 Profile* profile, | 43 Profile* profile, |
| 45 const content::PermissionType permission_type, | 44 const content::PermissionType permission_type, |
| 46 const ContentSettingsType content_settings_type) | 45 const ContentSettingsType content_settings_type) |
| 47 : profile_(profile), | 46 : profile_(profile), |
| 48 permission_type_(permission_type), | 47 permission_type_(permission_type), |
| 49 content_settings_type_(content_settings_type), | 48 content_settings_type_(content_settings_type), |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type, | 225 PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type, |
| 227 requesting_origin, profile_); | 226 requesting_origin, profile_); |
| 228 } | 227 } |
| 229 } else { | 228 } else { |
| 230 DCHECK_EQ(content_setting, CONTENT_SETTING_DEFAULT); | 229 DCHECK_EQ(content_setting, CONTENT_SETTING_DEFAULT); |
| 231 PermissionUmaUtil::PermissionDismissed(permission_type_, gesture_type, | 230 PermissionUmaUtil::PermissionDismissed(permission_type_, gesture_type, |
| 232 requesting_origin, profile_); | 231 requesting_origin, profile_); |
| 233 } | 232 } |
| 234 #endif | 233 #endif |
| 235 | 234 |
| 235 // Check if we should convert a dismiss decision into a block decision. This | |
| 236 // is gated on enabling the kBlockPromptsIfDismissedOften feature. | |
| 237 if (!persist && | |
| 238 decision_auto_blocker_.Get().ShouldChangeDismissalToBlock( | |
| 239 profile_, requesting_origin, permission_type_)) { | |
| 240 persist = true; | |
| 241 content_setting = CONTENT_SETTING_BLOCK; | |
| 242 } | |
| 243 | |
| 236 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, | 244 NotifyPermissionSet(id, requesting_origin, embedding_origin, callback, |
| 237 persist, content_setting); | 245 persist, content_setting); |
| 238 } | 246 } |
| 239 | 247 |
| 240 #if defined(OS_ANDROID) | 248 #if defined(OS_ANDROID) |
| 241 PermissionQueueController* PermissionContextBase::GetQueueController() { | 249 PermissionQueueController* PermissionContextBase::GetQueueController() { |
| 242 return permission_queue_controller_.get(); | 250 return permission_queue_controller_.get(); |
| 243 } | 251 } |
| 244 #endif | 252 #endif |
| 245 | 253 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 content_setting); | 300 content_setting); |
| 293 } | 301 } |
| 294 | 302 |
| 295 bool PermissionContextBase::IsPermissionKillSwitchOn() const { | 303 bool PermissionContextBase::IsPermissionKillSwitchOn() const { |
| 296 const std::string param = variations::GetVariationParamValue( | 304 const std::string param = variations::GetVariationParamValue( |
| 297 kPermissionsKillSwitchFieldStudy, | 305 kPermissionsKillSwitchFieldStudy, |
| 298 PermissionUtil::GetPermissionString(permission_type_)); | 306 PermissionUtil::GetPermissionString(permission_type_)); |
| 299 | 307 |
| 300 return param == kPermissionsKillSwitchBlockedValue; | 308 return param == kPermissionsKillSwitchBlockedValue; |
| 301 } | 309 } |
| OLD | NEW |