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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/PermissionInfoBar.java

Issue 2254763002: 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: DCHECK -> CHECK Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/infobar/PermissionInfoBar.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/PermissionInfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/PermissionInfoBar.java
index 1762e30aa0cd1cd0fde8421b8555a188e207ee33..06b96190c33b04f15504340f35089695ba46e35b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/PermissionInfoBar.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/PermissionInfoBar.java
@@ -42,10 +42,11 @@ public class PermissionInfoBar extends ConfirmInfoBar {
private SparseArray<String> mContentSettingsToPermissionsMap;
protected PermissionInfoBar(int iconDrawableId, Bitmap iconBitmap, String message,
- String linkText, String primaryButtonText, String secondaryButtonText) {
+ String linkText, String primaryButtonText, String secondaryButtonText,
+ boolean showPersistenceToggle) {
super(iconDrawableId, iconBitmap, message, linkText, primaryButtonText,
secondaryButtonText);
- mShowPersistenceToggle = false;
+ mShowPersistenceToggle = showPersistenceToggle;
}
@Override
@@ -83,16 +84,6 @@ public class PermissionInfoBar extends ConfirmInfoBar {
mContentSettingsToPermissionsMap = generatePermissionsMapping(contentSettings);
}
- /**
- * Specifies whether or not this infobar should display a toggle asking the user if they want to
- * save their choice.
- *
- * @param showPersistenceToggle True if the toggle should be displayed.
- */
- private void setShowPersistenceToggle(boolean showPersistenceToggle) {
- mShowPersistenceToggle = showPersistenceToggle;
- }
-
private SparseArray<String> generatePermissionsMapping(int[] contentSettings) {
SparseArray<String> permissionsToRequest = new SparseArray<String>();
for (int i = 0; i < contentSettings.length; i++) {
@@ -210,7 +201,7 @@ public class PermissionInfoBar extends ConfirmInfoBar {
* Returns true if the persist switch exists and is toggled on.
*/
@CalledByNative
- private boolean isPersistSwitchOn() {
+ protected boolean isPersistSwitchOn() {
SwitchCompat persistSwitch = (SwitchCompat) getView().findViewById(
R.id.permission_infobar_persist_toggle);
if (mShowPersistenceToggle && persistSwitch != null) {
@@ -242,9 +233,8 @@ public class PermissionInfoBar extends ConfirmInfoBar {
int drawableId = ResourceId.mapToDrawableId(enumeratedIconId);
PermissionInfoBar infoBar = new PermissionInfoBar(drawableId, iconBitmap, message, linkText,
- buttonOk, buttonCancel);
+ buttonOk, buttonCancel, showPersistenceToggle);
infoBar.setContentSettings(windowAndroid, contentSettings);
- infoBar.setShowPersistenceToggle(showPersistenceToggle);
return infoBar;
}

Powered by Google App Engine
This is Rietveld 408576698