Commit d21e8981 authored by Jarryd's avatar Jarryd Committed by Commit Bot

AllSites: Dynamically warn about clearing installed apps data.

Remove the third line in the clear data dialog warning about clearing
data for installed apps, and instead warn about that in the main label
on the dialog.

This also changes the main label to only dynamically warn about
installed apps data, depending on whether or not there is an
associated installed app, and whether a SiteGroup has more
than one installed app.

Bug: 997258
Change-Id: Ibc31b233283ced6caecd9b51878e70ff1abdb877
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2003082Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Reviewed-by: default avatarEsmael Elmoslimany <aee@chromium.org>
Commit-Queue: Jarryd Goodman <jarrydg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736565}
parent 8976e096
...@@ -3818,7 +3818,10 @@ ...@@ -3818,7 +3818,10 @@
Clear all data Clear all data
</message> </message>
<message name="IDS_SETTINGS_SITE_SETTINGS_CLEAR_ALL_STORAGE_CONFIRMATION" desc="Text for the dialog that warns about clearing storage used by all sites."> <message name="IDS_SETTINGS_SITE_SETTINGS_CLEAR_ALL_STORAGE_CONFIRMATION" desc="Text for the dialog that warns about clearing storage used by all sites.">
This will clear <ph name="TOTAL_USAGE">$1<ex>8 GB</ex></ph> of stored site data. This will clear <ph name="TOTAL_USAGE">$1<ex>8 GB</ex></ph> of data stored by sites.
</message>
<message name="IDS_SETTINGS_SITE_SETTINGS_CLEAR_ALL_STORAGE_CONFIRMATION_INSTALLED" desc="Text for the dialog that warns about clearing storage used by all sites, shown when there are installed apps.">
This will clear <ph name="TOTAL_USAGE">$1<ex>8 GB</ex></ph> of data stored by sites and installed apps.
</message> </message>
<message name="IDS_SETTINGS_SITE_SETTINGS_CLEAR_ALL_STORAGE_SIGN_OUT" desc="Text for the dialog that warns about being signed out when clearing storage used by all sites."> <message name="IDS_SETTINGS_SITE_SETTINGS_CLEAR_ALL_STORAGE_SIGN_OUT" desc="Text for the dialog that warns about being signed out when clearing storage used by all sites.">
You'll be signed out of all sites, including in any open tabs. You'll be signed out of all sites, including in any open tabs.
...@@ -3863,10 +3866,13 @@ ...@@ -3863,10 +3866,13 @@
All data stored by <ph name="SITE_GROUP_NAME">$1<ex>google.co.uk</ex></ph> and any sites under it will be deleted. This includes cookies. You'll be signed out of these sites, including in open tabs. All data stored by <ph name="SITE_GROUP_NAME">$1<ex>google.co.uk</ex></ph> and any sites under it will be deleted. This includes cookies. You'll be signed out of these sites, including in open tabs.
</message> </message>
<message name="IDS_SETTINGS_SITE_SETTINGS_SITE_GROUP_DELETE_CONFIRMATION_NEW" desc="Text for the dialog that warns about clearing all storage data for a group of sites."> <message name="IDS_SETTINGS_SITE_SETTINGS_SITE_GROUP_DELETE_CONFIRMATION_NEW" desc="Text for the dialog that warns about clearing all storage data for a group of sites.">
All data and cookies stored by <ph name="SITE_GROUP_NAME">$1<ex>google.co.uk</ex></ph> and any sites under it will be cleared. This will clear all data and cookies stored by <ph name="SITE_GROUP_NAME">$1<ex>google.co.uk</ex></ph> and any sites under it.
</message>
<message name="IDS_SETTINGS_SITE_SETTINGS_SITE_GROUP_DELETE_CONFIRMATION_INSTALLED" desc="Text for the dialog that warns about clearing all storage data for a group of sites that has only one installed app.">
This will clear all data and cookies stored by <ph name="SITE_GROUP_NAME">$1<ex>google.co.uk</ex></ph>, any sites under it, and its installed app.
</message> </message>
<message name="IDS_SETTINGS_SITE_SETTINGS_SITE_GROUP_DELETE_CONFIRMATION_INSTALLED" desc="Text for the dialog that warns about clearing all storage data for a group of sites that have one or more installed apps."> <message name="IDS_SETTINGS_SITE_SETTINGS_SITE_GROUP_DELETE_CONFIRMATION_INSTALLED_PLURAL" desc="Text for the dialog that warns about clearing all storage data for a group of sites that have more than one installed apps.">
All data and cookies stored by <ph name="SITE_GROUP_NAME">$1<ex>google.co.uk</ex></ph>, any sites under it, and its installed apps will be cleared. This will clear all data and cookies stored by <ph name="SITE_GROUP_NAME">$1<ex>google.co.uk</ex></ph>, any sites under it, and its installed apps.
</message> </message>
<message name="IDS_SETTINGS_SITE_SETTINGS_SITE_GROUP_DELETE_SIGN_OUT" desc="Text for the dialog that warns about being signed out when clearing all storage data."> <message name="IDS_SETTINGS_SITE_SETTINGS_SITE_GROUP_DELETE_SIGN_OUT" desc="Text for the dialog that warns about being signed out when clearing all storage data.">
You’ll be signed out of these sites, including in open tabs You’ll be signed out of these sites, including in open tabs
......
...@@ -177,10 +177,6 @@ ...@@ -177,10 +177,6 @@
<iron-icon icon="all-sites:offline"></iron-icon> <iron-icon icon="all-sites:offline"></iron-icon>
$i18n{siteSettingsSiteGroupDeleteOfflineData} $i18n{siteSettingsSiteGroupDeleteOfflineData}
</div> </div>
<div class="detail">
<iron-icon icon="all-sites:apps"></iron-icon>
$i18n{siteSettingsSiteGroupDeleteApps}
</div>
</div> </div>
</div> </div>
<div slot="button-container"> <div slot="button-container">
...@@ -204,7 +200,7 @@ ...@@ -204,7 +200,7 @@
$i18n{siteSettingsClearAllStorageDialogTitle} $i18n{siteSettingsClearAllStorageDialogTitle}
</div> </div>
<div slot="body"> <div slot="body">
[[i18n('siteSettingsClearAllStorageConfirmation', totalUsage_)]] [[getClearAllDataLabel_(totalUsage_)]]
<div class="detail-list"> <div class="detail-list">
<div class="detail"> <div class="detail">
<iron-icon icon="all-sites:logout"></iron-icon> <iron-icon icon="all-sites:logout"></iron-icon>
...@@ -214,10 +210,6 @@ ...@@ -214,10 +210,6 @@
<iron-icon icon="all-sites:offline"></iron-icon> <iron-icon icon="all-sites:offline"></iron-icon>
$i18n{siteSettingsSiteGroupDeleteOfflineData} $i18n{siteSettingsSiteGroupDeleteOfflineData}
</div> </div>
<div class="detail">
<iron-icon icon="all-sites:apps"></iron-icon>
$i18n{siteSettingsSiteGroupDeleteApps}
</div>
</div> </div>
</div> </div>
<div slot="button-container"> <div slot="button-container">
......
...@@ -480,7 +480,7 @@ Polymer({ ...@@ -480,7 +480,7 @@ Polymer({
* @return {string} * @return {string}
* @private * @private
*/ */
getConfirmClearDataLabel_: function() { getClearDataLabel_: function() {
// actionMenuModel_ will be null when dialog closes // actionMenuModel_ will be null when dialog closes
if (this.actionMenuModel_ === null) { if (this.actionMenuModel_ === null) {
return ''; return '';
...@@ -500,9 +500,19 @@ Polymer({ ...@@ -500,9 +500,19 @@ Polymer({
return loadTimeData.substituteString(this.i18n(messageId), origin); return loadTimeData.substituteString(this.i18n(messageId), origin);
} else { } else {
// Clear SiteGroup // Clear SiteGroup
const messageId = hasInstalledPWA ? let messageId;
'siteSettingsSiteGroupDeleteConfirmationInstalled' : if (hasInstalledPWA) {
'siteSettingsSiteGroupDeleteConfirmationNew'; const multipleAppsInstalled =
(this.filteredList_[index].origins || [])
.filter(o => o.isInstalled)
.length > 1;
messageId = multipleAppsInstalled ?
'siteSettingsSiteGroupDeleteConfirmationInstalledPlural' :
'siteSettingsSiteGroupDeleteConfirmationInstalled';
} else {
messageId = 'siteSettingsSiteGroupDeleteConfirmationNew';
}
return loadTimeData.substituteString( return loadTimeData.substituteString(
this.i18n(messageId), this.actionMenuModel_.item.etldPlus1); this.i18n(messageId), this.actionMenuModel_.item.etldPlus1);
} }
...@@ -535,6 +545,20 @@ Polymer({ ...@@ -535,6 +545,20 @@ Polymer({
this.i18n('siteSettingsSiteGroupResetConfirmation'), this.i18n('siteSettingsSiteGroupResetConfirmation'),
this.actionMenuModel_.item.etldPlus1); this.actionMenuModel_.item.etldPlus1);
}, },
/**
* Get the appropriate label for the clear all data confirmation
* dialog, depending on whether or not any apps are installed.
* @return {string}
* @private
*/
getClearAllDataLabel_: function() {
const anyAppsInstalled = this.filteredList_.some(g => g.hasInstalledPWA);
const messageId = anyAppsInstalled ?
'siteSettingsClearAllStorageConfirmationInstalled' :
'siteSettingsClearAllStorageConfirmation';
return loadTimeData.substituteString(
this.i18n(messageId), this.totalUsage_);
},
/** /**
* Resets permission settings for a single origin. * Resets permission settings for a single origin.
......
...@@ -15,12 +15,6 @@ ...@@ -15,12 +15,6 @@
fill="#757575"> fill="#757575">
<path clip-path="url(#b)" d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm5 16H7v-2h10v2zm-6.7-4L7 10.7l1.4-1.4 1.9 1.9 5.3-5.3L17 7.3 10.3 14z"></path> <path clip-path="url(#b)" d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm5 16H7v-2h10v2zm-6.7-4L7 10.7l1.4-1.4 1.9 1.9 5.3-5.3L17 7.3 10.3 14z"></path>
</g> </g>
<g id="apps" width="24px" height="24px" viewBox="0 0 24 24"
fill="#757575">
<path d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"></path>
<path d="M0 0h24v24H0z" fill="none"></path>
</g>
</defs> </defs>
</svg> </svg>
</iron-iconset-svg> </iron-iconset-svg>
...@@ -96,45 +96,6 @@ ...@@ -96,45 +96,6 @@
<iron-icon icon="all-sites:offline"></iron-icon> <iron-icon icon="all-sites:offline"></iron-icon>
$i18n{siteSettingsSiteClearStorageOfflineData} $i18n{siteSettingsSiteClearStorageOfflineData}
</div> </div>
<div class="detail">
<iron-icon icon="all-sites:apps"></iron-icon>
$i18n{siteSettingsSiteClearStorageApps}
</div>
</div>
</div>
<div slot="button-container">
<cr-button class="cancel-button" on-click="onCloseDialog_">
$i18n{cancel}
</cr-button>
<cr-button class="action-button" on-click="onClearStorage_">
$i18n{siteSettingsSiteClearStorage}
</cr-button>
</div>
</cr-dialog>
<!-- New version of confirm clear data dialog to show if storage
pressure UI flag is enabled. -->
<cr-dialog id="confirmClearStorageNew" close-text="$i18n{close}"
on-close="onClearStorageDialogClosed_">
<style include="clear-storage-dialog-shared"></style>
<div slot="title">
$i18n{siteSettingsSiteClearStorageDialogTitle}
</div>
<div slot="body">
[[i18n('siteSettingsSiteClearStorageConfirmationNew', pageTitle)]]
<div class="detail-list">
<div class="detail">
<iron-icon icon="all-sites:logout"></iron-icon>
$i18n{siteSettingsSiteClearStorageSignOut}
</div>
<div class="detail">
<iron-icon icon="all-sites:offline"></iron-icon>
$i18n{siteSettingsSiteClearStorageOfflineData}
</div>
<div class="detail">
<iron-icon icon="all-sites:apps"></iron-icon>
$i18n{siteSettingsSiteClearStorageApps}
</div>
</div> </div>
</div> </div>
<div slot="button-container"> <div slot="button-container">
......
...@@ -2102,12 +2102,16 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source, ...@@ -2102,12 +2102,16 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
IDS_SETTINGS_SITE_SETTINGS_CLEAR_ALL_STORAGE_LABEL}, IDS_SETTINGS_SITE_SETTINGS_CLEAR_ALL_STORAGE_LABEL},
{"siteSettingsClearAllStorageConfirmation", {"siteSettingsClearAllStorageConfirmation",
IDS_SETTINGS_SITE_SETTINGS_CLEAR_ALL_STORAGE_CONFIRMATION}, IDS_SETTINGS_SITE_SETTINGS_CLEAR_ALL_STORAGE_CONFIRMATION},
{"siteSettingsClearAllStorageConfirmationInstalled",
IDS_SETTINGS_SITE_SETTINGS_CLEAR_ALL_STORAGE_CONFIRMATION_INSTALLED},
{"siteSettingsClearAllStorageSignOut", {"siteSettingsClearAllStorageSignOut",
IDS_SETTINGS_SITE_SETTINGS_CLEAR_ALL_STORAGE_SIGN_OUT}, IDS_SETTINGS_SITE_SETTINGS_CLEAR_ALL_STORAGE_SIGN_OUT},
{"siteSettingsOriginDeleteConfirmation", {"siteSettingsOriginDeleteConfirmation",
IDS_SETTINGS_SITE_SETTINGS_ORIGIN_DELETE_CONFIRMATION}, IDS_SETTINGS_SITE_SETTINGS_ORIGIN_DELETE_CONFIRMATION},
{"siteSettingsOriginDeleteConfirmationInstalled", {"siteSettingsOriginDeleteConfirmationInstalled",
IDS_SETTINGS_SITE_SETTINGS_ORIGIN_DELETE_CONFIRMATION_INSTALLED}, IDS_SETTINGS_SITE_SETTINGS_ORIGIN_DELETE_CONFIRMATION_INSTALLED},
{"siteSettingsSiteGroupDeleteConfirmationInstalledPlural",
IDS_SETTINGS_SITE_SETTINGS_SITE_GROUP_DELETE_CONFIRMATION_INSTALLED_PLURAL},
{"siteSettingsSiteClearStorage", {"siteSettingsSiteClearStorage",
IDS_SETTINGS_SITE_SETTINGS_SITE_CLEAR_STORAGE}, IDS_SETTINGS_SITE_SETTINGS_SITE_CLEAR_STORAGE},
{"siteSettingsSiteClearStorageConfirmation", {"siteSettingsSiteClearStorageConfirmation",
......
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