Commit 0b662d0f authored by Victor Hugo Vianna Silva's avatar Victor Hugo Vianna Silva Committed by Commit Bot

Add chrome://settings buttons to choose opt-in to account passwords storage

Feature kEnablePasswordsAccountStorage disabled:
https://screenshot.googleplex.com/AaNqS7OxpNw

Feature enabled, user not opted in:
https://screenshot.googleplex.com/RBR6E3yzmkk

Feature enabled, user opted in:
https://screenshot.googleplex.com/4GbzCGPeddp

On click of the opt-in button, a reauth flow will be triggered. On
click of the opt-out button, no reauth is triggered. The UI is only
temporary and will be updated once mocks are available.

Bug: 1049141
Change-Id: Iceb293f3809e8995056a7c36989a6abeb462db62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2108030Reviewed-by: default avatarEsmael Elmoslimany <aee@chromium.org>
Reviewed-by: default avatarMarc Treib <treib@chromium.org>
Commit-Queue: Victor Vianna <victorvianna@google.com>
Cr-Commit-Position: refs/heads/master@{#753165}
parent d0ad7cf8
...@@ -509,6 +509,14 @@ ...@@ -509,6 +509,14 @@
<message name="IDS_SETTINGS_PASSWORDS_MANAGE_PASSWORDS" desc="Shown in the passwords section of settings. Descriptive text to inform that passwords can be accessed online. Has a link."> <message name="IDS_SETTINGS_PASSWORDS_MANAGE_PASSWORDS" desc="Shown in the passwords section of settings. Descriptive text to inform that passwords can be accessed online. Has a link.">
View and manage saved passwords in your <ph name="BEGIN_LINK">&lt;a is="action-link" href="$1" target="_blank"&gt;</ph>Google Account<ph name="END_LINK">&lt;/a&gt;</ph> View and manage saved passwords in your <ph name="BEGIN_LINK">&lt;a is="action-link" href="$1" target="_blank"&gt;</ph>Google Account<ph name="END_LINK">&lt;/a&gt;</ph>
</message> </message>
<!-- TODO(crbug.com/1062344): Make it translateable and use definitive label once final mocks are available. -->
<message translateable="false" name="IDS_SETTINGS_PASSWORDS_OPT_IN_ACCOUNT_STORAGE_LABEL" desc="Label for a button in the passwords section of settings triggering opt in to passwords account storage.">
Opt-in to account storage
</message>
<!-- TODO(crbug.com/1062344): Make it translateable and use definitive label once final mocks are available. -->
<message translateable="false" name="IDS_SETTINGS_PASSWORDS_OPT_OUT_ACCOUNT_STORAGE_LABEL" desc="Label for a button in the passwords section of settings triggering opt out of passwords account storage.">
Opt-out of account storage
</message>
<message name="IDS_SETTINGS_PASSWORDS_EXPORT_MENU_ITEM" desc="A menu item in the More Actions menu above the password list in Chrome's settings. Selecting this action will open a dialog, through which the user can export their passwords outside of Chrome."> <message name="IDS_SETTINGS_PASSWORDS_EXPORT_MENU_ITEM" desc="A menu item in the More Actions menu above the password list in Chrome's settings. Selecting this action will open a dialog, through which the user can export their passwords outside of Chrome.">
Export passwords... Export passwords...
</message> </message>
......
...@@ -151,6 +151,12 @@ ...@@ -151,6 +151,12 @@
*/ */
isOptedInForAccountStorage() {} isOptedInForAccountStorage() {}
/**
* Triggers the opt-in or opt-out flow for the account storage.
* @param {boolean} optIn Whether the user wants to opt in or opt out.
*/
optInForAccountStorage(optIn) {}
/** /**
* Requests the start of the bulk password check. * Requests the start of the bulk password check.
*/ */
...@@ -382,6 +388,11 @@ PasswordManagerProxy.PasswordCheckStatus; ...@@ -382,6 +388,11 @@ PasswordManagerProxy.PasswordCheckStatus;
}); });
} }
/** @override */
optInForAccountStorage(optIn) {
chrome.passwordsPrivate.optInForAccountStorage(optIn);
}
/** @override */ /** @override */
startBulkPasswordCheck() { startBulkPasswordCheck() {
chrome.passwordsPrivate.startPasswordCheck(); chrome.passwordsPrivate.startPasswordCheck();
......
...@@ -158,6 +158,16 @@ ...@@ -158,6 +158,16 @@
<!-- This span lays out the url correctly, relative to the label. --> <!-- This span lays out the url correctly, relative to the label. -->
<span>$i18nRaw{managePasswordsLabel}</span> <span>$i18nRaw{managePasswordsLabel}</span>
</div> </div>
<template is="dom-if" if="[[enableAccountStorage_]]">
<cr-button on-click="onOptIn_"
hidden$="[[isOptedInForAccountStorage_]]">
$i18n{optInAccountStorageLabel}
</cr-button>
<cr-button on-click="onOptOut_"
hidden$="[[!isOptedInForAccountStorage_]]">
$i18n{optOutAccountStorageLabel}
</cr-button>
</template>
<div class="settings-box first"> <div class="settings-box first">
<h2 id="savedPasswordsHeading" class="start"> <h2 id="savedPasswordsHeading" class="start">
$i18n{savedPasswordsHeading} $i18n{savedPasswordsHeading}
......
...@@ -152,6 +152,14 @@ Polymer({ ...@@ -152,6 +152,14 @@ Polymer({
} }
}, },
/** @private */
enableAccountStorage_: {
type: Boolean,
value() {
return loadTimeData.getBoolean('enableAccountStorage');
}
},
/** @private */ /** @private */
showPasswordEditDialog_: Boolean, showPasswordEditDialog_: Boolean,
...@@ -594,6 +602,16 @@ Polymer({ ...@@ -594,6 +602,16 @@ Polymer({
cr.ui.focusWithoutInk(assert(this.activeDialogAnchorStack_.pop())); cr.ui.focusWithoutInk(assert(this.activeDialogAnchorStack_.pop()));
}, },
/** @private */
onOptIn_: function() {
this.passwordManager_.optInForAccountStorage(true);
},
/** @private */
onOptOut_: function() {
this.passwordManager_.optInForAccountStorage(false);
},
/** /**
* Returns true if the list exists and has items. * Returns true if the list exists and has items.
* @param {Array<Object>} list * @param {Array<Object>} list
......
...@@ -845,6 +845,10 @@ void AddAutofillStrings(content::WebUIDataSource* html_source, ...@@ -845,6 +845,10 @@ void AddAutofillStrings(content::WebUIDataSource* html_source,
{"noExceptionsFound", IDS_SETTINGS_PASSWORDS_EXCEPTIONS_NONE}, {"noExceptionsFound", IDS_SETTINGS_PASSWORDS_EXCEPTIONS_NONE},
{"import", IDS_PASSWORD_MANAGER_IMPORT_BUTTON}, {"import", IDS_PASSWORD_MANAGER_IMPORT_BUTTON},
{"exportMenuItem", IDS_SETTINGS_PASSWORDS_EXPORT_MENU_ITEM}, {"exportMenuItem", IDS_SETTINGS_PASSWORDS_EXPORT_MENU_ITEM},
{"optInAccountStorageLabel",
IDS_SETTINGS_PASSWORDS_OPT_IN_ACCOUNT_STORAGE_LABEL},
{"optOutAccountStorageLabel",
IDS_SETTINGS_PASSWORDS_OPT_OUT_ACCOUNT_STORAGE_LABEL},
{"undoRemovePassword", IDS_SETTINGS_PASSWORD_UNDO}, {"undoRemovePassword", IDS_SETTINGS_PASSWORD_UNDO},
{"passwordDeleted", IDS_SETTINGS_PASSWORD_DELETED_PASSWORD}, {"passwordDeleted", IDS_SETTINGS_PASSWORD_DELETED_PASSWORD},
{"passwordRowMoreActionsButton", IDS_SETTINGS_PASSWORD_ROW_MORE_ACTIONS}, {"passwordRowMoreActionsButton", IDS_SETTINGS_PASSWORD_ROW_MORE_ACTIONS},
......
...@@ -268,6 +268,11 @@ SettingsUI::SettingsUI(content::WebUI* web_ui) ...@@ -268,6 +268,11 @@ SettingsUI::SettingsUI(content::WebUI* web_ui)
base::FeatureList::IsEnabled( base::FeatureList::IsEnabled(
password_manager::features::kPasswordImport)); password_manager::features::kPasswordImport));
html_source->AddBoolean(
"enableAccountStorage",
base::FeatureList::IsEnabled(
password_manager::features::kEnablePasswordsAccountStorage));
html_source->AddBoolean( html_source->AddBoolean(
"syncSetupFriendlySettings", "syncSetupFriendlySettings",
base::FeatureList::IsEnabled(features::kSyncSetupFriendlySettings)); base::FeatureList::IsEnabled(features::kSyncSetupFriendlySettings));
......
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