| 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 "chrome/browser/permissions/permission_request.h" |
| 7 #include "chrome/browser/permissions/permission_uma_util.h" | 8 #include "chrome/browser/permissions/permission_uma_util.h" |
| 8 #include "chrome/grit/generated_resources.h" | 9 #include "chrome/grit/generated_resources.h" |
| 9 #include "components/infobars/core/infobar.h" | 10 #include "components/infobars/core/infobar.h" |
| 10 #include "components/url_formatter/elide_url.h" | 11 #include "components/url_formatter/elide_url.h" |
| 11 #include "ui/base/l10n/l10n_util.h" | 12 #include "ui/base/l10n/l10n_util.h" |
| 12 | 13 |
| 13 PermissionInfobarDelegate::~PermissionInfobarDelegate() { | 14 PermissionInfobarDelegate::~PermissionInfobarDelegate() { |
| 14 if (!action_taken_) | 15 // TODO(stefanocs): Pass the actual |gesture_type| value to PermissionUmaUtil. |
| 15 PermissionUmaUtil::PermissionIgnored(permission_type_, requesting_origin_, | 16 if (!action_taken_) { |
| 16 profile_); | 17 PermissionUmaUtil::PermissionIgnored(permission_type_, |
| 18 PermissionRequestGestureType::UNKNOWN, |
| 19 requesting_origin_, profile_); |
| 20 } |
| 17 } | 21 } |
| 18 | 22 |
| 19 PermissionInfobarDelegate::PermissionInfobarDelegate( | 23 PermissionInfobarDelegate::PermissionInfobarDelegate( |
| 20 const GURL& requesting_origin, | 24 const GURL& requesting_origin, |
| 21 content::PermissionType permission_type, | 25 content::PermissionType permission_type, |
| 22 ContentSettingsType content_settings_type, | 26 ContentSettingsType content_settings_type, |
| 23 Profile* profile, | 27 Profile* profile, |
| 24 const base::Callback<void(bool, bool)>& callback) | 28 const base::Callback<void(bool, bool)>& callback) |
| 25 : requesting_origin_(requesting_origin), | 29 : requesting_origin_(requesting_origin), |
| 26 action_taken_(false), | 30 action_taken_(false), |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 bool PermissionInfobarDelegate::Cancel() { | 69 bool PermissionInfobarDelegate::Cancel() { |
| 66 SetPermission(true, false); | 70 SetPermission(true, false); |
| 67 return true; | 71 return true; |
| 68 } | 72 } |
| 69 | 73 |
| 70 void PermissionInfobarDelegate::SetPermission(bool update_content_setting, | 74 void PermissionInfobarDelegate::SetPermission(bool update_content_setting, |
| 71 bool allowed) { | 75 bool allowed) { |
| 72 action_taken_ = true; | 76 action_taken_ = true; |
| 73 callback_.Run(update_content_setting, allowed); | 77 callback_.Run(update_content_setting, allowed); |
| 74 } | 78 } |
| OLD | NEW |