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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/infobar/GroupedPermissionInfoBar.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/GroupedPermissionInfoBar.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/GroupedPermissionInfoBar.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/GroupedPermissionInfoBar.java
index 8ccf47b891d4b62635340dd4d47950cd8523ba3a..1b869b8fe8c7c5b1f4a76cd23b3a7e2f74d90613 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/GroupedPermissionInfoBar.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/GroupedPermissionInfoBar.java
@@ -27,8 +27,8 @@ public class GroupedPermissionInfoBar extends PermissionInfoBar {
GroupedPermissionInfoBar(String message, String buttonOk, String buttonCancel,
int[] permissionIcons, String[] permissionText, WindowAndroid windowAndroid,
- int[] contentSettings) {
- super(0, null, message, null, buttonOk, buttonCancel);
+ int[] contentSettings, boolean showPersistenceToggle) {
+ super(0, null, message, null, buttonOk, buttonCancel, showPersistenceToggle);
mPermissionIcons = permissionIcons;
mPermissionText = permissionText;
mWindowAndroid = windowAndroid;
@@ -37,7 +37,6 @@ public class GroupedPermissionInfoBar extends PermissionInfoBar {
@Override
public void createContent(InfoBarLayout layout) {
- super.createContent(layout);
InfoBarControlLayout control = layout.addControlLayout();
if (mPermissionIcons.length == 1) {
@@ -49,6 +48,9 @@ public class GroupedPermissionInfoBar extends PermissionInfoBar {
R.color.light_normal_color, mPermissionText[i], i, true);
}
}
+
+ // Call this last to ensure that if a persistence toggle is added, it's added last.
+ super.createContent(layout);
}
@Override
@@ -90,6 +92,11 @@ public class GroupedPermissionInfoBar extends PermissionInfoBar {
super.onButtonClicked(isPrimaryButton);
}
+ @CalledByNative
+ protected boolean isPersistSwitchOn() {
+ return super.isPersistSwitchOn();
+ }
+
/**
* Create an infobar for a given set of permission requests.
*
@@ -101,13 +108,16 @@ public class GroupedPermissionInfoBar extends PermissionInfoBar {
* @param permissionText String to display for each permission request.
* @param windowAndroid The window which owns the infobar.
* @param contentSettings The list of ContentSettingsTypes requested by the infobar.
+ * @param showPersistenceToggle Whether or not a toggle to opt-out of persisting a decision
+ * should be displayed.
*/
@CalledByNative
private static InfoBar create(String message, String buttonOk, String buttonCancel,
int[] permissionIcons, String[] permissionText, WindowAndroid windowAndroid,
- int[] contentSettings) {
- GroupedPermissionInfoBar infobar = new GroupedPermissionInfoBar(message, buttonOk,
- buttonCancel, permissionIcons, permissionText, windowAndroid, contentSettings);
+ int[] contentSettings, boolean showPersistenceToggle) {
+ GroupedPermissionInfoBar infobar =
+ new GroupedPermissionInfoBar(message, buttonOk, buttonCancel, permissionIcons,
+ permissionText, windowAndroid, contentSettings, showPersistenceToggle);
return infobar;
}
« no previous file with comments | « chrome/android/BUILD.gn ('k') | chrome/android/java/src/org/chromium/chrome/browser/infobar/PermissionInfoBar.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698