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_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_decision_auto_blocker.h" |
| 9 #include "chrome/browser/permissions/permission_uma_util.h" | 9 #include "chrome/browser/permissions/permission_uma_util.h" |
| 10 #include "chrome/grit/generated_resources.h" | 10 #include "chrome/grit/generated_resources.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 profile_(profile), | 26 profile_(profile), |
| 27 has_gesture_(has_gesture), | 27 has_gesture_(has_gesture), |
| 28 permission_decided_callback_(permission_decided_callback), | 28 permission_decided_callback_(permission_decided_callback), |
| 29 delete_callback_(delete_callback), | 29 delete_callback_(delete_callback), |
| 30 is_finished_(false), | 30 is_finished_(false), |
| 31 action_taken_(false) {} | 31 action_taken_(false) {} |
| 32 | 32 |
| 33 PermissionRequestImpl::~PermissionRequestImpl() { | 33 PermissionRequestImpl::~PermissionRequestImpl() { |
| 34 DCHECK(is_finished_); | 34 DCHECK(is_finished_); |
| 35 if (!action_taken_) { | 35 if (!action_taken_) { |
| 36 // PermissionIgnored needs to be called before RecordIgnore in the blocker | |
| 37 // because it gets the number of prior ignore and dismiss values from the | |
| 38 // blocker and we don't want to include the current ignore. | |
| 39 PermissionUmaUtil::PermissionIgnored(permission_type_, GetGestureType(), | |
| 40 request_origin_, profile_); | |
| 41 | |
| 36 PermissionDecisionAutoBlocker(profile_).RecordIgnore(request_origin_, | 42 PermissionDecisionAutoBlocker(profile_).RecordIgnore(request_origin_, |
| 37 permission_type_); | 43 permission_type_); |
|
raymes
2016/08/23 06:01:48
Could we instead move this into PermissionUmaUtil:
kcarattini
2016/08/23 07:19:50
Done. I like this, but I don't like that of symmet
raymes
2016/08/23 08:14:58
Were you thinking we should record the dismiss in
kcarattini
2016/08/23 10:00:58
Yes, that's what I meant :).
| |
| 38 | |
| 39 PermissionUmaUtil::PermissionIgnored(permission_type_, GetGestureType(), | |
| 40 request_origin_, profile_); | |
| 41 } | 44 } |
| 42 } | 45 } |
| 43 | 46 |
| 44 gfx::VectorIconId PermissionRequestImpl::GetVectorIconId() const { | 47 gfx::VectorIconId PermissionRequestImpl::GetVectorIconId() const { |
| 45 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 48 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 46 switch (permission_type_) { | 49 switch (permission_type_) { |
| 47 case content::PermissionType::GEOLOCATION: | 50 case content::PermissionType::GEOLOCATION: |
| 48 return gfx::VectorIconId::LOCATION_ON; | 51 return gfx::VectorIconId::LOCATION_ON; |
| 49 #if defined(ENABLE_NOTIFICATIONS) | 52 #if defined(ENABLE_NOTIFICATIONS) |
| 50 case content::PermissionType::NOTIFICATIONS: | 53 case content::PermissionType::NOTIFICATIONS: |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 162 NOTREACHED(); | 165 NOTREACHED(); |
| 163 return PermissionRequestType::UNKNOWN; | 166 return PermissionRequestType::UNKNOWN; |
| 164 } | 167 } |
| 165 } | 168 } |
| 166 | 169 |
| 167 PermissionRequestGestureType PermissionRequestImpl::GetGestureType() | 170 PermissionRequestGestureType PermissionRequestImpl::GetGestureType() |
| 168 const { | 171 const { |
| 169 return has_gesture_ ? PermissionRequestGestureType::GESTURE | 172 return has_gesture_ ? PermissionRequestGestureType::GESTURE |
| 170 : PermissionRequestGestureType::NO_GESTURE; | 173 : PermissionRequestGestureType::NO_GESTURE; |
| 171 } | 174 } |
| OLD | NEW |