Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(600)

Side by Side Diff: chrome/browser/permissions/grouped_permission_infobar_delegate.cc

Issue 2277733002: Revert of Enable the optional permission prompt persistence toggle on grouped infobars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-infobardelegate-clean
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.h" 5 #include "chrome/browser/permissions/grouped_permission_infobar_delegate.h"
6 #include "chrome/browser/permissions/permission_util.h"
7 #include "chrome/grit/generated_resources.h" 6 #include "chrome/grit/generated_resources.h"
8 #include "components/url_formatter/elide_url.h" 7 #include "components/url_formatter/elide_url.h"
9 #include "grit/theme_resources.h" 8 #include "grit/theme_resources.h"
10 #include "ui/base/l10n/l10n_util.h" 9 #include "ui/base/l10n/l10n_util.h"
11 10
12 GroupedPermissionInfoBarDelegate::GroupedPermissionInfoBarDelegate( 11 GroupedPermissionInfoBarDelegate::GroupedPermissionInfoBarDelegate(
13 const GURL& requesting_origin, 12 const GURL& requesting_origin,
14 const std::vector<ContentSettingsType>& types) 13 const std::vector<ContentSettingsType>& types)
15 : requesting_origin_(requesting_origin), 14 : requesting_origin_(requesting_origin),
16 types_(types), 15 types_(types),
17 accept_states_(types_.size(), true), 16 accept_states_(types_.size(), true) {}
18 persist_(true) {}
19 17
20 GroupedPermissionInfoBarDelegate::~GroupedPermissionInfoBarDelegate() {} 18 GroupedPermissionInfoBarDelegate::~GroupedPermissionInfoBarDelegate() {}
21 19
22 infobars::InfoBarDelegate::Type 20 infobars::InfoBarDelegate::Type
23 GroupedPermissionInfoBarDelegate::GetInfoBarType() const { 21 GroupedPermissionInfoBarDelegate::GetInfoBarType() const {
24 return PAGE_ACTION_TYPE; 22 return PAGE_ACTION_TYPE;
25 } 23 }
26 24
27 bool GroupedPermissionInfoBarDelegate::ShouldShowPersistenceToggle() const {
28 return PermissionUtil::ShouldShowPersistenceToggle();
29 }
30
31 int GroupedPermissionInfoBarDelegate::GetButtons() const { 25 int GroupedPermissionInfoBarDelegate::GetButtons() const {
32 if (GetPermissionCount() >= 2) 26 if (GetPermissionCount() >= 2)
33 return ConfirmInfoBarDelegate::InfoBarButton::BUTTON_OK; 27 return ConfirmInfoBarDelegate::InfoBarButton::BUTTON_OK;
34 else 28 else
35 return ConfirmInfoBarDelegate::GetButtons(); 29 return ConfirmInfoBarDelegate::GetButtons();
36 } 30 }
37 31
38 base::string16 GroupedPermissionInfoBarDelegate::GetButtonLabel( 32 base::string16 GroupedPermissionInfoBarDelegate::GetButtonLabel(
39 InfoBarButton button) const { 33 InfoBarButton button) const {
40 if (GetPermissionCount() >= 2) { 34 if (GetPermissionCount() >= 2) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 void GroupedPermissionInfoBarDelegate::ToggleAccept(int position, 85 void GroupedPermissionInfoBarDelegate::ToggleAccept(int position,
92 bool new_value) { 86 bool new_value) {
93 DCHECK(position >= 0 && position < static_cast<int>(types_.size())); 87 DCHECK(position >= 0 && position < static_cast<int>(types_.size()));
94 accept_states_[position] = new_value; 88 accept_states_[position] = new_value;
95 } 89 }
96 90
97 bool GroupedPermissionInfoBarDelegate::GetAcceptState(int position) { 91 bool GroupedPermissionInfoBarDelegate::GetAcceptState(int position) {
98 DCHECK(position >= 0 && position < static_cast<int>(types_.size())); 92 DCHECK(position >= 0 && position < static_cast<int>(types_.size()));
99 return accept_states_[position]; 93 return accept_states_[position];
100 } 94 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698