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

Unified Diff: chrome/browser/ui/android/infobars/grouped_permission_infobar.cc

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/browser/ui/android/infobars/grouped_permission_infobar.cc
diff --git a/chrome/browser/ui/android/infobars/grouped_permission_infobar.cc b/chrome/browser/ui/android/infobars/grouped_permission_infobar.cc
index 7f8249f65b4032af6dce6a25c9cb8e502ef7ed90..8f3065532a50d09f84d1b1780eb927f965948b60 100644
--- a/chrome/browser/ui/android/infobars/grouped_permission_infobar.cc
+++ b/chrome/browser/ui/android/infobars/grouped_permission_infobar.cc
@@ -34,6 +34,18 @@ void GroupedPermissionInfoBar::SetPermissionState(
}
}
+void GroupedPermissionInfoBar::ProcessButton(int action) {
+ // Check if the delegate asked us to display a persistence toggle. If so,
+ // inform it of the toggle state.
+ GroupedPermissionInfoBarDelegate* delegate = GetDelegate();
+ if (delegate->ShouldShowPersistenceToggle()) {
+ delegate->set_persist(Java_GroupedPermissionInfoBar_isPersistSwitchOn(
+ base::android::AttachCurrentThread(), GetJavaInfoBar()));
+ }
+
+ ConfirmInfoBar::ProcessButton(action);
+}
+
base::android::ScopedJavaLocalRef<jobject>
GroupedPermissionInfoBar::CreateRenderInfoBar(JNIEnv* env) {
GroupedPermissionInfoBarDelegate* delegate = GetDelegate();
@@ -64,7 +76,8 @@ GroupedPermissionInfoBar::CreateRenderInfoBar(JNIEnv* env) {
base::android::ToJavaIntArray(env, permission_icons),
base::android::ToJavaArrayOfStrings(env, permission_strings),
GetWindowAndroid(),
- base::android::ToJavaIntArray(env, content_settings_types));
+ base::android::ToJavaIntArray(env, content_settings_types),
+ delegate->ShouldShowPersistenceToggle());
}
void GroupedPermissionInfoBar::SetJavaInfoBar(
« no previous file with comments | « chrome/browser/ui/android/infobars/grouped_permission_infobar.h ('k') | content/test/data/android/media_permissions.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698