Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: chrome/browser/permissions/permission_context_base.cc

Issue 2184823007: Add a feature which, when enabled, blocks permissions after X prompt dismissals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve test Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 && PermissionUtil::ShouldChangeDismissalToBlock(
223 profile_, requesting_origin, permission_type_)) {
224 persist = true;
raymes 2016/07/28 08:07:50 Hmm I think right now this will cause PermissionUm
kcarattini 2016/07/28 08:54:49 Is that not what we want? Do we want to measure so
dominickn 2016/08/01 01:08:51 With respect to metrics, we have a couple of paths
dominickn 2016/08/01 01:08:51 This was a deliberate choice - I wanted the trigge
raymes 2016/08/01 05:09:11 This is supposed to measure a user's action on the
kcarattini 2016/08/01 07:09:52 As discussed, I think we should move this discussi
225 content_setting = CONTENT_SETTING_BLOCK;
226 }
227
219 if (persist) { 228 if (persist) {
220 DCHECK(content_setting == CONTENT_SETTING_ALLOW || 229 DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
221 content_setting == CONTENT_SETTING_BLOCK); 230 content_setting == CONTENT_SETTING_BLOCK);
222 if (content_setting == CONTENT_SETTING_ALLOW) { 231 if (content_setting == CONTENT_SETTING_ALLOW) {
223 PermissionUmaUtil::PermissionGranted(permission_type_, gesture_type, 232 PermissionUmaUtil::PermissionGranted(permission_type_, gesture_type,
224 requesting_origin, profile_); 233 requesting_origin, profile_);
225 } else { 234 } else {
226 PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type, 235 PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type,
227 requesting_origin, profile_); 236 requesting_origin, profile_);
228 } 237 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 content_setting); 301 content_setting);
293 } 302 }
294 303
295 bool PermissionContextBase::IsPermissionKillSwitchOn() const { 304 bool PermissionContextBase::IsPermissionKillSwitchOn() const {
296 const std::string param = variations::GetVariationParamValue( 305 const std::string param = variations::GetVariationParamValue(
297 kPermissionsKillSwitchFieldStudy, 306 kPermissionsKillSwitchFieldStudy,
298 PermissionUtil::GetPermissionString(permission_type_)); 307 PermissionUtil::GetPermissionString(permission_type_));
299 308
300 return param == kPermissionsKillSwitchBlockedValue; 309 return param == kPermissionsKillSwitchBlockedValue;
301 } 310 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698