| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 int GroupedPermissionInfoBarDelegate::GetIconIdForPermission( | 45 int GroupedPermissionInfoBarDelegate::GetIconIdForPermission( |
| 46 size_t position) const { | 46 size_t position) const { |
| 47 return permission_prompt_->GetIconIdForPermission(position); | 47 return permission_prompt_->GetIconIdForPermission(position); |
| 48 } | 48 } |
| 49 | 49 |
| 50 base::string16 GroupedPermissionInfoBarDelegate::GetMessageTextFragment( | 50 base::string16 GroupedPermissionInfoBarDelegate::GetMessageTextFragment( |
| 51 size_t position) const { | 51 size_t position) const { |
| 52 return permission_prompt_->GetMessageTextFragment(position); | 52 return permission_prompt_->GetMessageTextFragment(position); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void GroupedPermissionInfoBarDelegate::ToggleAccept(size_t position, | |
| 56 bool new_value) { | |
| 57 DCHECK_LT(position, PermissionCount()); | |
| 58 if (permission_prompt_) | |
| 59 permission_prompt_->ToggleAccept(position, new_value); | |
| 60 } | |
| 61 | |
| 62 base::string16 GroupedPermissionInfoBarDelegate::GetMessageText() const { | 55 base::string16 GroupedPermissionInfoBarDelegate::GetMessageText() const { |
| 63 return l10n_util::GetStringFUTF16( | 56 return l10n_util::GetStringFUTF16( |
| 64 IDS_PERMISSIONS_BUBBLE_PROMPT, | 57 IDS_PERMISSIONS_BUBBLE_PROMPT, |
| 65 url_formatter::FormatUrlForSecurityDisplay(requesting_origin_)); | 58 url_formatter::FormatUrlForSecurityDisplay(requesting_origin_)); |
| 66 } | 59 } |
| 67 | 60 |
| 68 bool GroupedPermissionInfoBarDelegate::Accept() { | 61 bool GroupedPermissionInfoBarDelegate::Accept() { |
| 69 if (permission_prompt_) { | 62 if (permission_prompt_) { |
| 70 if (permission_prompt_->ShouldShowPersistenceToggle()) | 63 if (permission_prompt_->ShouldShowPersistenceToggle()) |
| 71 permission_prompt_->TogglePersist(persist_); | 64 permission_prompt_->TogglePersist(persist_); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_PERMISSION_ALLOW | 118 return l10n_util::GetStringUTF16((button == BUTTON_OK) ? IDS_PERMISSION_ALLOW |
| 126 : IDS_PERMISSION_DENY); | 119 : IDS_PERMISSION_DENY); |
| 127 } | 120 } |
| 128 | 121 |
| 129 bool GroupedPermissionInfoBarDelegate::EqualsDelegate( | 122 bool GroupedPermissionInfoBarDelegate::EqualsDelegate( |
| 130 infobars::InfoBarDelegate* delegate) const { | 123 infobars::InfoBarDelegate* delegate) const { |
| 131 // The PermissionRequestManager doesn't create duplicate infobars so a pointer | 124 // The PermissionRequestManager doesn't create duplicate infobars so a pointer |
| 132 // equality check is sufficient. | 125 // equality check is sufficient. |
| 133 return this == delegate; | 126 return this == delegate; |
| 134 } | 127 } |
| OLD | NEW |