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

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

Issue 2537083002: Make dismiss works for PermissionPromptAndroid (Closed)
Patch Set: Created 4 years 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/callback.h" 10 #include "base/callback.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 217 }
218 218
219 void PermissionContextBase::PermissionDecided( 219 void PermissionContextBase::PermissionDecided(
220 const PermissionRequestID& id, 220 const PermissionRequestID& id,
221 const GURL& requesting_origin, 221 const GURL& requesting_origin,
222 const GURL& embedding_origin, 222 const GURL& embedding_origin,
223 bool user_gesture, 223 bool user_gesture,
224 const BrowserPermissionCallback& callback, 224 const BrowserPermissionCallback& callback,
225 bool persist, 225 bool persist,
226 ContentSetting content_setting) { 226 ContentSetting content_setting) {
227 #if !defined(OS_ANDROID)
raymes 2016/11/30 02:21:48 Hmm - I think currently the permission queue contr
lshang 2016/11/30 04:59:00 Done.
228 // Infobar persistence and its related UMA is tracked on the infobar 227 // Infobar persistence and its related UMA is tracked on the infobar
229 // controller directly. 228 // controller directly.
230 PermissionRequestGestureType gesture_type = 229 PermissionRequestGestureType gesture_type =
231 user_gesture ? PermissionRequestGestureType::GESTURE 230 user_gesture ? PermissionRequestGestureType::GESTURE
232 : PermissionRequestGestureType::NO_GESTURE; 231 : PermissionRequestGestureType::NO_GESTURE;
233 DCHECK(content_setting == CONTENT_SETTING_ALLOW || 232 DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
234 content_setting == CONTENT_SETTING_BLOCK || 233 content_setting == CONTENT_SETTING_BLOCK ||
235 content_setting == CONTENT_SETTING_DEFAULT); 234 content_setting == CONTENT_SETTING_DEFAULT);
236 if (content_setting == CONTENT_SETTING_ALLOW) { 235 if (content_setting == CONTENT_SETTING_ALLOW) {
237 PermissionUmaUtil::PermissionGranted(permission_type_, gesture_type, 236 PermissionUmaUtil::PermissionGranted(permission_type_, gesture_type,
238 requesting_origin, profile_); 237 requesting_origin, profile_);
239 } else if (content_setting == CONTENT_SETTING_BLOCK) { 238 } else if (content_setting == CONTENT_SETTING_BLOCK) {
240 PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type, 239 PermissionUmaUtil::PermissionDenied(permission_type_, gesture_type,
241 requesting_origin, profile_); 240 requesting_origin, profile_);
242 } else { 241 } else {
243 PermissionUmaUtil::PermissionDismissed(permission_type_, gesture_type, 242 PermissionUmaUtil::PermissionDismissed(permission_type_, gesture_type,
244 requesting_origin, profile_); 243 requesting_origin, profile_);
245 } 244 }
246 #endif
247 245
248 // Check if we should convert a dismiss decision into a block decision. This 246 // Check if we should convert a dismiss decision into a block decision. This
249 // is gated on enabling the kBlockPromptsIfDismissedOften feature. 247 // is gated on enabling the kBlockPromptsIfDismissedOften feature.
250 if (content_setting == CONTENT_SETTING_DEFAULT && 248 if (content_setting == CONTENT_SETTING_DEFAULT &&
251 PermissionDecisionAutoBlocker::ShouldChangeDismissalToBlock( 249 PermissionDecisionAutoBlocker::ShouldChangeDismissalToBlock(
252 requesting_origin, permission_type_, profile_)) { 250 requesting_origin, permission_type_, profile_)) {
253 persist = true; 251 persist = true;
254 content_setting = CONTENT_SETTING_BLOCK; 252 content_setting = CONTENT_SETTING_BLOCK;
255 } 253 }
256 254
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 content_setting); 309 content_setting);
312 } 310 }
313 311
314 bool PermissionContextBase::IsPermissionKillSwitchOn() const { 312 bool PermissionContextBase::IsPermissionKillSwitchOn() const {
315 const std::string param = variations::GetVariationParamValue( 313 const std::string param = variations::GetVariationParamValue(
316 kPermissionsKillSwitchFieldStudy, 314 kPermissionsKillSwitchFieldStudy,
317 PermissionUtil::GetPermissionString(permission_type_)); 315 PermissionUtil::GetPermissionString(permission_type_));
318 316
319 return param == kPermissionsKillSwitchBlockedValue; 317 return param == kPermissionsKillSwitchBlockedValue;
320 } 318 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698