| Index: chrome/browser/permissions/grouped_permission_infobar_delegate.cc
|
| diff --git a/chrome/browser/permissions/grouped_permission_infobar_delegate.cc b/chrome/browser/permissions/grouped_permission_infobar_delegate.cc
|
| index 6ea8084bb31673e93eb5b64aec9129488334cd86..b33f36788de6766bad0eb971a2c45542805e9f85 100644
|
| --- a/chrome/browser/permissions/grouped_permission_infobar_delegate.cc
|
| +++ b/chrome/browser/permissions/grouped_permission_infobar_delegate.cc
|
| @@ -3,6 +3,7 @@
|
| // found in the LICENSE file.
|
|
|
| #include "chrome/browser/permissions/grouped_permission_infobar_delegate.h"
|
| +#include "chrome/browser/permissions/permission_request.h"
|
| #include "chrome/browser/permissions/permission_util.h"
|
| #include "chrome/grit/generated_resources.h"
|
| #include "chrome/grit/theme_resources.h"
|
| @@ -11,10 +12,10 @@
|
|
|
| GroupedPermissionInfoBarDelegate::GroupedPermissionInfoBarDelegate(
|
| const GURL& requesting_origin,
|
| - const std::vector<ContentSettingsType>& types)
|
| + const std::vector<PermissionRequest*>& requests)
|
| : requesting_origin_(requesting_origin),
|
| - types_(types),
|
| - accept_states_(types_.size(), true),
|
| + requests_(requests),
|
| + accept_states_(requests_.size(), true),
|
| persist_(true) {}
|
|
|
| GroupedPermissionInfoBarDelegate::~GroupedPermissionInfoBarDelegate() {}
|
| @@ -52,49 +53,33 @@ base::string16 GroupedPermissionInfoBarDelegate::GetMessageText() const {
|
| }
|
|
|
| int GroupedPermissionInfoBarDelegate::GetPermissionCount() const {
|
| - return types_.size();
|
| + return requests_.size();
|
| }
|
|
|
| ContentSettingsType GroupedPermissionInfoBarDelegate::GetContentSettingType(
|
| int index) const {
|
| - DCHECK(index >= 0 && index < static_cast<int>(types_.size()));
|
| - return types_[index];
|
| + DCHECK(index >= 0 && index < static_cast<int>(requests_.size()));
|
| + return requests_[index]->GetContentSettingsType();
|
| }
|
|
|
| int GroupedPermissionInfoBarDelegate::GetIconIdForPermission(int index) const {
|
| - DCHECK(index >= 0 && index < static_cast<int>(types_.size()));
|
| - ContentSettingsType type = types_[index];
|
| - if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) {
|
| - return IDR_INFOBAR_MEDIA_STREAM_MIC;
|
| - } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) {
|
| - return IDR_INFOBAR_MEDIA_STREAM_CAMERA;
|
| - }
|
| - return IDR_INFOBAR_WARNING;
|
| + DCHECK(index >= 0 && index < static_cast<int>(requests_.size()));
|
| + return requests_[index]->GetIconId();
|
| }
|
|
|
| base::string16 GroupedPermissionInfoBarDelegate::GetMessageTextFragment(
|
| int index) const {
|
| - DCHECK(index >= 0 && index < static_cast<int>(types_.size()));
|
| - ContentSettingsType type = types_[index];
|
| - int message_id;
|
| - if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC) {
|
| - message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY_PERMISSION_FRAGMENT;
|
| - } else if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA) {
|
| - message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY_PERMISSION_FRAGMENT;
|
| - } else {
|
| - NOTREACHED();
|
| - return base::string16();
|
| - }
|
| - return l10n_util::GetStringUTF16(message_id);
|
| + DCHECK(index >= 0 && index < static_cast<int>(requests_.size()));
|
| + return requests_[index]->GetMessageTextFragment();
|
| }
|
|
|
| void GroupedPermissionInfoBarDelegate::ToggleAccept(int position,
|
| bool new_value) {
|
| - DCHECK(position >= 0 && position < static_cast<int>(types_.size()));
|
| + DCHECK(position >= 0 && position < static_cast<int>(requests_.size()));
|
| accept_states_[position] = new_value;
|
| }
|
|
|
| bool GroupedPermissionInfoBarDelegate::GetAcceptState(int position) {
|
| - DCHECK(position >= 0 && position < static_cast<int>(types_.size()));
|
| + DCHECK(position >= 0 && position < static_cast<int>(requests_.size()));
|
| return accept_states_[position];
|
| }
|
|
|