| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/grouped_permission_infobar_delegate_android
.h" | 5 #include "chrome/browser/permissions/grouped_permission_infobar_delegate_android
.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/android/android_theme_resources.h" | 8 #include "chrome/browser/android/android_theme_resources.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "chrome/browser/permissions/permission_prompt_android.h" | 10 #include "chrome/browser/permissions/permission_prompt_android.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 if (permission_prompt_) | 76 if (permission_prompt_) |
| 77 permission_prompt_->Deny(); | 77 permission_prompt_->Deny(); |
| 78 return true; | 78 return true; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void GroupedPermissionInfoBarDelegate::InfoBarDismissed() { | 81 void GroupedPermissionInfoBarDelegate::InfoBarDismissed() { |
| 82 if (permission_prompt_) | 82 if (permission_prompt_) |
| 83 permission_prompt_->Closing(); | 83 permission_prompt_->Closing(); |
| 84 } | 84 } |
| 85 | 85 |
| 86 void GroupedPermissionInfoBarDelegate::PermissionPromptDestroyed() { | |
| 87 permission_prompt_ = nullptr; | |
| 88 } | |
| 89 | |
| 90 GroupedPermissionInfoBarDelegate::GroupedPermissionInfoBarDelegate( | 86 GroupedPermissionInfoBarDelegate::GroupedPermissionInfoBarDelegate( |
| 91 PermissionPromptAndroid* permission_prompt, | 87 PermissionPromptAndroid* permission_prompt, |
| 92 const GURL& requesting_origin) | 88 const GURL& requesting_origin) |
| 93 : requesting_origin_(requesting_origin), | 89 : requesting_origin_(requesting_origin), |
| 94 persist_(true), | 90 persist_(true), |
| 95 permission_prompt_(permission_prompt) { | 91 permission_prompt_(permission_prompt) { |
| 96 DCHECK(permission_prompt); | 92 DCHECK(permission_prompt); |
| 97 } | 93 } |
| 98 | 94 |
| 99 infobars::InfoBarDelegate::InfoBarIdentifier | 95 infobars::InfoBarDelegate::InfoBarIdentifier |
| (...skipping 17 matching lines...) Expand all Loading... |
| 117 base::string16 GroupedPermissionInfoBarDelegate::GetButtonLabel( | 113 base::string16 GroupedPermissionInfoBarDelegate::GetButtonLabel( |
| 118 InfoBarButton button) const { | 114 InfoBarButton button) const { |
| 119 if (PermissionCount() > 1) { | 115 if (PermissionCount() > 1) { |
| 120 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_APP_OK | 116 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_APP_OK |
| 121 : IDS_APP_CANCEL); | 117 : IDS_APP_CANCEL); |
| 122 } | 118 } |
| 123 | 119 |
| 124 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_PERMISSION_ALLOW | 120 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_PERMISSION_ALLOW |
| 125 : IDS_PERMISSION_DENY); | 121 : IDS_PERMISSION_DENY); |
| 126 } | 122 } |
| 123 |
| 124 bool GroupedPermissionInfoBarDelegate::EqualsDelegate( |
| 125 infobars::InfoBarDelegate* delegate) const { |
| 126 // The PermissionRequestManager doesn't create duplicate infobars so a pointer |
| 127 // equality check is sufficient. |
| 128 return this == delegate; |
| 129 } |
| OLD | NEW |