| 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_infobar_delegate.h" | 5 #include "chrome/browser/permissions/permission_infobar_delegate.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h" | 10 #include "chrome/browser/geolocation/geolocation_infobar_delegate_android.h" |
| 11 #include "chrome/browser/infobars/infobar_service.h" | 11 #include "chrome/browser/infobars/infobar_service.h" |
| 12 #include "chrome/browser/media/midi_permission_infobar_delegate_android.h" | 12 #include "chrome/browser/media/midi_permission_infobar_delegate_android.h" |
| 13 #include "chrome/browser/media/protected_media_identifier_infobar_delegate_andro
id.h" | 13 #include "chrome/browser/media/protected_media_identifier_infobar_delegate_andro
id.h" |
| 14 #include "chrome/browser/notifications/notification_permission_infobar_delegate.
h" | 14 #include "chrome/browser/notifications/notification_permission_infobar_delegate.
h" |
| 15 #include "chrome/browser/permissions/permission_decision_auto_blocker.h" |
| 15 #include "chrome/browser/permissions/permission_request.h" | 16 #include "chrome/browser/permissions/permission_request.h" |
| 16 #include "chrome/browser/permissions/permission_uma_util.h" | 17 #include "chrome/browser/permissions/permission_uma_util.h" |
| 17 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 18 #include "components/infobars/core/infobar.h" | 19 #include "components/infobars/core/infobar.h" |
| 19 #include "components/url_formatter/elide_url.h" | 20 #include "components/url_formatter/elide_url.h" |
| 20 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
| 21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 22 | 23 |
| 23 // static | 24 // static |
| 24 infobars::InfoBar* PermissionInfoBarDelegate::Create( | 25 infobars::InfoBar* PermissionInfoBarDelegate::Create( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 73 } |
| 73 | 74 |
| 74 PermissionInfoBarDelegate::~PermissionInfoBarDelegate() { | 75 PermissionInfoBarDelegate::~PermissionInfoBarDelegate() { |
| 75 if (!action_taken_) { | 76 if (!action_taken_) { |
| 76 PermissionUmaUtil::PermissionIgnored( | 77 PermissionUmaUtil::PermissionIgnored( |
| 77 content_settings_type_, | 78 content_settings_type_, |
| 78 user_gesture_ ? PermissionRequestGestureType::GESTURE | 79 user_gesture_ ? PermissionRequestGestureType::GESTURE |
| 79 : PermissionRequestGestureType::NO_GESTURE, | 80 : PermissionRequestGestureType::NO_GESTURE, |
| 80 requesting_origin_, profile_); | 81 requesting_origin_, profile_); |
| 81 | 82 |
| 82 PermissionUmaUtil::RecordEmbargoStatus( | 83 PermissionEmbargoStatus embargo_status = |
| 83 PermissionEmbargoStatus::NOT_EMBARGOED); | 84 PermissionEmbargoStatus::NOT_EMBARGOED; |
| 85 if (PermissionDecisionAutoBlocker::GetForProfile(profile_) |
| 86 ->RecordIgnoreAndEmbargo(requesting_origin_, |
| 87 content_settings_type_)) { |
| 88 embargo_status = PermissionEmbargoStatus::REPEATED_IGNORES; |
| 89 } |
| 90 PermissionUmaUtil::RecordEmbargoStatus(embargo_status); |
| 84 } | 91 } |
| 85 } | 92 } |
| 86 | 93 |
| 87 std::vector<int> PermissionInfoBarDelegate::content_settings_types() const { | 94 std::vector<int> PermissionInfoBarDelegate::content_settings_types() const { |
| 88 return std::vector<int>{content_settings_type_}; | 95 return std::vector<int>{content_settings_type_}; |
| 89 } | 96 } |
| 90 | 97 |
| 91 bool PermissionInfoBarDelegate::ShouldShowPersistenceToggle() const { | 98 bool PermissionInfoBarDelegate::ShouldShowPersistenceToggle() const { |
| 92 return (content_settings_type_ == CONTENT_SETTINGS_TYPE_GEOLOCATION || | 99 return (content_settings_type_ == CONTENT_SETTINGS_TYPE_GEOLOCATION || |
| 93 content_settings_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || | 100 content_settings_type_ == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC || |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 PermissionInfoBarDelegate* | 166 PermissionInfoBarDelegate* |
| 160 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() { | 167 PermissionInfoBarDelegate::AsPermissionInfoBarDelegate() { |
| 161 return this; | 168 return this; |
| 162 } | 169 } |
| 163 | 170 |
| 164 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, | 171 void PermissionInfoBarDelegate::SetPermission(bool update_content_setting, |
| 165 PermissionAction decision) { | 172 PermissionAction decision) { |
| 166 action_taken_ = true; | 173 action_taken_ = true; |
| 167 callback_.Run(update_content_setting, decision); | 174 callback_.Run(update_content_setting, decision); |
| 168 } | 175 } |
| OLD | NEW |