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

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

Issue 2790493002: Implement permissions embargo for prompts which are repeatedly ignored. (Closed)
Patch Set: Not for plugins Created 3 years, 8 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_request_impl.h" 5 #include "chrome/browser/permissions/permission_request_impl.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 #include "chrome/browser/permissions/permission_decision_auto_blocker.h"
8 #include "chrome/browser/permissions/permission_uma_util.h" 9 #include "chrome/browser/permissions/permission_uma_util.h"
9 #include "chrome/browser/permissions/permission_util.h" 10 #include "chrome/browser/permissions/permission_util.h"
10 #include "chrome/grit/generated_resources.h" 11 #include "chrome/grit/generated_resources.h"
11 #include "components/url_formatter/elide_url.h" 12 #include "components/url_formatter/elide_url.h"
12 #include "net/base/escape.h" 13 #include "net/base/escape.h"
13 #include "ui/base/l10n/l10n_util.h" 14 #include "ui/base/l10n/l10n_util.h"
14 15
15 #if defined(OS_ANDROID) 16 #if defined(OS_ANDROID)
16 #include "chrome/browser/android/android_theme_resources.h" 17 #include "chrome/browser/android/android_theme_resources.h"
17 #else 18 #else
(...skipping 15 matching lines...) Expand all
33 permission_decided_callback_(permission_decided_callback), 34 permission_decided_callback_(permission_decided_callback),
34 delete_callback_(delete_callback), 35 delete_callback_(delete_callback),
35 is_finished_(false), 36 is_finished_(false),
36 action_taken_(false) {} 37 action_taken_(false) {}
37 38
38 PermissionRequestImpl::~PermissionRequestImpl() { 39 PermissionRequestImpl::~PermissionRequestImpl() {
39 DCHECK(is_finished_); 40 DCHECK(is_finished_);
40 if (!action_taken_) { 41 if (!action_taken_) {
41 PermissionUmaUtil::PermissionIgnored( 42 PermissionUmaUtil::PermissionIgnored(
42 content_settings_type_, GetGestureType(), request_origin_, profile_); 43 content_settings_type_, GetGestureType(), request_origin_, profile_);
43 PermissionUmaUtil::RecordEmbargoStatus( 44
44 PermissionEmbargoStatus::NOT_EMBARGOED); 45 PermissionEmbargoStatus embargo_status =
46 PermissionEmbargoStatus::NOT_EMBARGOED;
47 if (PermissionDecisionAutoBlocker::GetForProfile(profile_)
48 ->RecordIgnoreAndEmbargo(request_origin_, content_settings_type_)) {
49 embargo_status = PermissionEmbargoStatus::REPEATED_IGNORES;
50 }
51 PermissionUmaUtil::RecordEmbargoStatus(embargo_status);
45 } 52 }
46 } 53 }
47 54
48 PermissionRequest::IconId PermissionRequestImpl::GetIconId() const { 55 PermissionRequest::IconId PermissionRequestImpl::GetIconId() const {
49 #if defined(OS_ANDROID) 56 #if defined(OS_ANDROID)
50 switch (content_settings_type_) { 57 switch (content_settings_type_) {
51 case CONTENT_SETTINGS_TYPE_GEOLOCATION: 58 case CONTENT_SETTINGS_TYPE_GEOLOCATION:
52 return IDR_ANDROID_INFOBAR_GEOLOCATION; 59 return IDR_ANDROID_INFOBAR_GEOLOCATION;
53 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: 60 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
54 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: 61 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 150
144 PermissionRequestType PermissionRequestImpl::GetPermissionRequestType() 151 PermissionRequestType PermissionRequestImpl::GetPermissionRequestType()
145 const { 152 const {
146 return PermissionUtil::GetRequestType(content_settings_type_); 153 return PermissionUtil::GetRequestType(content_settings_type_);
147 } 154 }
148 155
149 PermissionRequestGestureType PermissionRequestImpl::GetGestureType() 156 PermissionRequestGestureType PermissionRequestImpl::GetGestureType()
150 const { 157 const {
151 return PermissionUtil::GetGestureType(has_gesture_); 158 return PermissionUtil::GetGestureType(has_gesture_);
152 } 159 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_infobar_delegate.cc ('k') | chrome/browser/permissions/permission_result.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698