Commit d010ca32 authored by Ehimare Okoyomon's avatar Ehimare Okoyomon Committed by Commit Bot

[Android] Add page info clear permissions dialog

Screenshot: https://crbug.com/1077766#c54
Bug: 1077766
Change-Id: I623a2b2e206b5b9471ed11c46af811c7786ba4b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2428895Reviewed-by: default avatarChristian Dullweber <dullweber@chromium.org>
Commit-Queue: Ehimare Okoyomon <eokoyomon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810549}
parent e54136de
......@@ -87,6 +87,5 @@
android:key="idle_detection_permission_list" />
<org.chromium.components.browser_ui.settings.ButtonPreference
android:key="reset_site_button"
android:title="@string/website_reset" />
android:key="reset_site_button" />
</PreferenceScreen>
......@@ -446,6 +446,9 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
}
private void setupResetSitePreference(Preference preference) {
int titleResId = mHideNonPermissionPreferences ? R.string.page_info_permissions_reset
: R.string.website_reset;
preference.setTitle(titleResId);
preference.setOnPreferenceClickListener(this);
if (WebsitePreferenceBridge.isCookieDeletionDisabled(
getSiteSettingsClient().getBrowserContextHandle(),
......@@ -1014,11 +1017,17 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
@Override
public boolean onPreferenceClick(Preference preference) {
int titleResId = mHideNonPermissionPreferences ? R.string.page_info_permissions_reset
: R.string.website_reset;
int confirmationResId = mHideNonPermissionPreferences
? R.string.page_info_permissions_reset_confirmation
: R.string.website_reset_confirmation;
preference.setTitle(titleResId);
// Handle the Clear & Reset preference click by showing a confirmation.
new AlertDialog.Builder(getActivity(), R.style.Theme_Chromium_AlertDialog)
.setTitle(R.string.website_reset)
.setMessage(R.string.website_reset_confirmation)
.setPositiveButton(R.string.website_reset,
.setTitle(titleResId)
.setMessage(confirmationResId)
.setPositiveButton(titleResId,
(dialog, which) -> {
if (mHideNonPermissionPreferences) {
mSiteDataCleaner.resetPermissions(
......
......@@ -435,6 +435,12 @@
<message name="IDS_PAGE_INFO_PERMISSIONS_TITLE" desc="Label used in the Page Info dialog above the permissions list.">
Permissions
</message>
<message name="IDS_PAGE_INFO_PERMISSIONS_RESET" desc="The label for the button allowing users to reset the permissions for a website.">
Reset permissions
</message>
<message name="IDS_PAGE_INFO_PERMISSIONS_RESET_CONFIRMATION" desc="The confirmation text asking if the user is sure about resetting the permissions for a site.">
Are you sure you want to reset all permissions for this website?
</message>
<message name="IDS_PAGE_INFO_PERMISSIONS_OS_WARNING" desc="Text to show an OS-level permission warning.">
<ph name="PERMISSION">%1$s<ex>Location</ex></ph> - <ph name="WARNING_MESSAGE">%2$s<ex>Turned off for this device</ex></ph>
</message>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment