diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 17:21:03 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-01-23 16:25:15 +0000 |
commit | c551f43206405019121bd2b2c93714319a0a3300 (patch) | |
tree | 1f48c30631c421fd4bbb3c36da20183c8a2ed7d7 /chromium/chrome/browser/resources/settings/autofill_page | |
parent | 7961cea6d1041e3e454dae6a1da660b453efd238 (diff) |
BASELINE: Update Chromium to 79.0.3945.139
Change-Id: I336b7182fab9bca80b709682489c07db112eaca5
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/chrome/browser/resources/settings/autofill_page')
6 files changed, 147 insertions, 113 deletions
diff --git a/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.js b/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.js index 652a4aa59c3..ba786243f76 100644 --- a/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.js +++ b/chromium/chrome/browser/resources/settings/autofill_page/autofill_section.js @@ -13,16 +13,18 @@ */ class AutofillManager { /** - * Add an observer to the list of addresses. - * @param {function(!Array<!AutofillManager.AddressEntry>):void} listener + * Add an observer to the list of personal data. + * @param {function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>):void} listener */ - addAddressListChangedListener(listener) {} + setPersonalDataManagerListener(listener) {} /** - * Remove an observer from the list of addresses. - * @param {function(!Array<!AutofillManager.AddressEntry>):void} listener + * Remove an observer from the list of personal data. + * @param {function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>):void} listener */ - removeAddressListChangedListener(listener) {} + removePersonalDataManagerListener(listener) {} /** * Request the list of addresses. @@ -49,13 +51,13 @@ AutofillManager.AddressEntry; */ class AutofillManagerImpl { /** @override */ - addAddressListChangedListener(listener) { - chrome.autofillPrivate.onAddressListChanged.addListener(listener); + setPersonalDataManagerListener(listener) { + chrome.autofillPrivate.onPersonalDataChanged.addListener(listener); } /** @override */ - removeAddressListChangedListener(listener) { - chrome.autofillPrivate.onAddressListChanged.removeListener(listener); + removePersonalDataManagerListener(listener) { + chrome.autofillPrivate.onPersonalDataChanged.removeListener(listener); } /** @override */ @@ -117,21 +119,30 @@ Polymer({ autofillManager_: null, /** - * @type {?function(!Array<!AutofillManager.AddressEntry>)} + * @type {?function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>)} * @private */ - setAddressesListener_: null, + setPersonalDataListener_: null, /** @override */ attached: function() { // Create listener functions. /** @type {function(!Array<!AutofillManager.AddressEntry>)} */ - const setAddressesListener = list => { - this.addresses = list; + const setAddressesListener = addressList => { + this.addresses = addressList; + }; + + /** + * @type {function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>)} + */ + const setPersonalDataListener = (addressList, cardList) => { + this.addresses = addressList; }; // Remember the bound reference in order to detach. - this.setAddressesListener_ = setAddressesListener; + this.setPersonalDataListener_ = setPersonalDataListener; // Set the managers. These can be overridden by tests. this.autofillManager_ = AutofillManagerImpl.getInstance(); @@ -140,7 +151,8 @@ Polymer({ this.autofillManager_.getAddressList(setAddressesListener); // Listen for changes. - this.autofillManager_.addAddressListChangedListener(setAddressesListener); + this.autofillManager_.setPersonalDataManagerListener( + setPersonalDataListener); // Record that the user opened the address settings. chrome.metricsPrivate.recordUserAction('AutofillAddressesViewed'); @@ -148,9 +160,12 @@ Polymer({ /** @override */ detached: function() { - this.autofillManager_.removeAddressListChangedListener( - /** @type {function(!Array<!AutofillManager.AddressEntry>)} */ ( - this.setAddressesListener_)); + this.autofillManager_.removePersonalDataManagerListener( + /** + @type {function(!Array<!AutofillManager.AddressEntry>, + !Array<!PaymentsManager.CreditCardEntry>)} + */ + (this.setPersonalDataListener_)); }, /** diff --git a/chromium/chrome/browser/resources/settings/autofill_page/password_list_item.html b/chromium/chrome/browser/resources/settings/autofill_page/password_list_item.html index 847f192031d..922166b2951 100644 --- a/chromium/chrome/browser/resources/settings/autofill_page/password_list_item.html +++ b/chromium/chrome/browser/resources/settings/autofill_page/password_list_item.html @@ -50,8 +50,7 @@ } </style> <div class="list-item" focus-row-container> - <div class="website-column no-min-width" - title="[[item.entry.urls.link]]"> + <div class="website-column no-min-width"> <site-favicon url="[[item.entry.urls.link]]"></site-favicon> <a id="originUrl" target="_blank" class="no-min-width" href="[[item.entry.urls.link]]" @@ -64,14 +63,17 @@ </a> </div> <input id="username" class="username-column password-field" - readonly tabindex="-1" value="[[item.entry.username]]"> + aria-label="$i18n{editPasswordUsernameLabel}" + readonly value="[[item.entry.username]]" + focus-row-control focus-type="username"> <div class="password-column"> <template is="dom-if" if="[[!item.entry.federationText]]"> <input id="password" aria-label=$i18n{editPasswordPasswordLabel} type="[[getPasswordInputType_(item.password)]]" on-click="onReadonlyInputTap_" class="password-field" readonly disabled$="[[!item.password]]" - value="[[getPassword_(item.password)]]"> + value="[[getPassword_(item.password)]]" + focus-row-control focus-type="passwordField"> <cr-icon-button id="showPasswordButton" class$="[[getIconClass_(item.password)]]" on-click="onShowPasswordButtonTap_" diff --git a/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html b/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html index 58e376e7433..2f569d3e4dc 100644 --- a/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html +++ b/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.html @@ -10,12 +10,14 @@ <link rel="import" href="chrome://resources/html/i18n_behavior.html"> <link rel="import" href="chrome://resources/html/list_property_update_behavior.html"> <link rel="import" href="chrome://resources/html/util.html"> +<link rel="import" href="chrome://resources/html/web_ui_listener_behavior.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-announcer/iron-a11y-announcer.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html"> <link rel="import" href="chrome://resources/polymer/v1_0/iron-list/iron-list.html"> -<link rel="import" href="../controls/settings_toggle_button.html"> <link rel="import" href="../controls/extension_controlled_indicator.html"> +<link rel="import" href="../controls/settings_toggle_button.html"> <link rel="import" href="../global_scroll_target_behavior.html"> +<link rel="import" href="../people_page/sync_browser_proxy.html"> <link rel="import" href="../prefs/prefs.html"> <link rel="import" href="../prefs/prefs_behavior.html"> <link rel="import" href="../settings_shared_css.html"> @@ -73,16 +75,6 @@ </extension-controlled-indicator> </div> </template> - <settings-toggle-button id="passwordsLeakDetectionCheckbox" - pref="{{prefs.profile.password_manager_leak_detection}}" - checked="[[getCheckedLeakDetection_( - userSignedIn_, prefs.profile.password_manager_leak_detection)]]" - label="$i18n{passwordsLeakDetectionLabel}" - sub-label="[[getPasswordsLeakDetectionSubLabel_( - userSignedIn_, prefs.profile.password_manager_leak_detection)]]" - hidden$="[[!passwordsLeakDetectionEnabled_]]" - disabled="[[!userSignedIn_]]"> - </settings-toggle-button> <settings-toggle-button id="autosigninCheckbox" pref="{{prefs.credentials_enable_autosignin}}" label="$i18n{passwordsAutosigninLabel}" @@ -108,7 +100,8 @@ </div> <div class="list-frame"> <div id="savedPasswordsHeaders" class="list-item column-header" - hidden$="[[!hasSome_(savedPasswords, savedPasswords.splices)]]"> + hidden$="[[!hasSome_(savedPasswords, savedPasswords.splices)]]" + aria-hidden="true"> <div class="website-column">$i18n{editPasswordWebsiteLabel}</div> <div class="username-column"> $i18n{editPasswordUsernameLabel} diff --git a/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js b/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js index a98d69646d4..0eabb41138a 100644 --- a/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js +++ b/chromium/chrome/browser/resources/settings/autofill_page/passwords_section.js @@ -102,12 +102,6 @@ Polymer({ }, /** @private */ - passwordsLeakDetectionEnabled_: { - type: Boolean, - value: loadTimeData.getBoolean('passwordsLeakDetectionEnabled'), - }, - - /** @private */ showExportPasswords_: { type: Boolean, computed: 'hasPasswords_(savedPasswords.splices)', @@ -125,23 +119,12 @@ Polymer({ /** @private */ showPasswordEditDialog_: Boolean, - // <if expr="not chromeos"> - /** @private {Array<!settings.StoredAccount>} */ - storedAccounts_: Object, - // </if> - /** @private {settings.SyncPrefs} */ syncPrefs_: Object, /** @private {settings.SyncStatus} */ syncStatus_: Object, - /** @private */ - userSignedIn_: { - type: Boolean, - computed: 'computeUserSignedIn_(syncStatus_, storedAccounts_)', - }, - /** Filter on the saved passwords and exceptions. */ filter: { type: String, @@ -266,13 +249,6 @@ Polymer({ syncBrowserProxy.getSyncStatus().then(syncStatusChanged); this.addWebUIListener('sync-status-changed', syncStatusChanged); - // <if expr="not chromeos"> - const storedAccountsChanged = storedAccounts => this.storedAccounts_ = - storedAccounts; - syncBrowserProxy.getStoredAccounts().then(storedAccountsChanged); - this.addWebUIListener('stored-accounts-updated', storedAccountsChanged); - // </if> - const syncPrefsChanged = syncPrefs => this.syncPrefs_ = syncPrefs; syncBrowserProxy.sendSyncPrefsChanged(); this.addWebUIListener('sync-prefs-changed', syncPrefsChanged); @@ -363,24 +339,6 @@ Polymer({ }, /** - * @return {boolean} - * @private - */ - computeUserSignedIn_: function() { - return (!!this.syncStatus_ && !!this.syncStatus_.signedIn) || - (!!this.storedAccounts_ && this.storedAccounts_.length > 0); - }, - - /** - * @return {boolean} - * @private - */ - getCheckedLeakDetection_: function() { - return this.userSignedIn_ && - !!this.getPref('profile.password_manager_leak_detection').value; - }, - - /** * @param {string} filter * @return {!Array<!PasswordManagerProxy.UiEntryWithPassword>} * @private @@ -396,20 +354,6 @@ Polymer({ }, /** - * @return {string} - * @private - */ - getPasswordsLeakDetectionSubLabel_: function() { - if (this.userSignedIn_) { - return this.i18n('passwordsLeakDetectionSignedInDescription'); - } - if (this.getPref('profile.password_manager_leak_detection').value) { - return this.i18n('passwordsLeakDetectionSignedOutEnabledDescription'); - } - return this.i18n('passwordsLeakDetectionSignedOutDisabledDescription'); - }, - - /** * @param {string} filter * @return {function(!chrome.passwordsPrivate.ExceptionEntry): boolean} * @private @@ -426,7 +370,9 @@ Polymer({ onMenuRemovePasswordTap_: function() { this.passwordManager_.removeSavedPassword( this.activePassword.item.entry.id); - cr.toastManager.getInstance().show(this.i18n('passwordDeleted'), false); + cr.toastManager.getInstance().show( + this.i18n('passwordDeleted'), + /* showUndo */ true); /** @type {CrActionMenuElement} */ (this.$.menu).close(); }, @@ -544,6 +490,6 @@ Polymer({ showImportOrExportPasswords_: function( showExportPasswords, showImportPasswords) { return showExportPasswords || showImportPasswords; - } + }, }); })(); diff --git a/chromium/chrome/browser/resources/settings/autofill_page/payments_section.html b/chromium/chrome/browser/resources/settings/autofill_page/payments_section.html index 5836b23e617..2109d3395fd 100644 --- a/chromium/chrome/browser/resources/settings/autofill_page/payments_section.html +++ b/chromium/chrome/browser/resources/settings/autofill_page/payments_section.html @@ -42,6 +42,20 @@ pref="{{prefs.autofill.credit_card_enabled}}"> </settings-toggle-button> <template is="dom-if" + if="[[shouldShowFidoToggle_( + prefs.autofill.credit_card_enabled.value, + userIsFidoVerifiable_)]]"> + <settings-toggle-button + class="settings-box first" + id="autofillCreditCardFIDOAuthToggle" + aria-label="$i18n{creditCards}" no-extension-indicator + label="$i18n{enableCreditCardFIDOAuthLabel}" + sub-label="$i18n{enableCreditCardFIDOAuthSublabel}" + pref="{{prefs.autofill.credit_card_fido_auth_enabled}}" + on-change="setFIDOAuthenticationEnabledState_"> + </settings-toggle-button> + </template> + <template is="dom-if" if="[[prefs.autofill.credit_card_enabled.extensionId]]"> <div class="settings-box continuation"> <extension-controlled-indicator class="start" diff --git a/chromium/chrome/browser/resources/settings/autofill_page/payments_section.js b/chromium/chrome/browser/resources/settings/autofill_page/payments_section.js index 03d51d23ebf..0c71a4b46c6 100644 --- a/chromium/chrome/browser/resources/settings/autofill_page/payments_section.js +++ b/chromium/chrome/browser/resources/settings/autofill_page/payments_section.js @@ -13,16 +13,18 @@ */ class PaymentsManager { /** - * Add an observer to the list of credit cards. - * @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} listener + * Add an observer to the list of personal data. + * @param {function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>):void} listener */ - addCreditCardListChangedListener(listener) {} + setPersonalDataManagerListener(listener) {} /** - * Remove an observer from the list of credit cards. - * @param {function(!Array<!PaymentsManager.CreditCardEntry>):void} listener + * Remove an observer from the list of personal data. + * @param {function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>):void} listener */ - removeCreditCardListChangedListener(listener) {} + removePersonalDataManagerListener(listener) {} /** * Request the list of credit cards. @@ -51,6 +53,11 @@ class PaymentsManager { * Logs that the server cards edit link was clicked. */ logServerCardLinkClicked() {} + + /** + * Enables FIDO authentication for card unmasking. + */ + setCreditCardFIDOAuthEnabledState(enabled) {} } /** @typedef {chrome.autofillPrivate.CreditCardEntry} */ @@ -62,13 +69,13 @@ PaymentsManager.CreditCardEntry; */ class PaymentsManagerImpl { /** @override */ - addCreditCardListChangedListener(listener) { - chrome.autofillPrivate.onCreditCardListChanged.addListener(listener); + setPersonalDataManagerListener(listener) { + chrome.autofillPrivate.onPersonalDataChanged.addListener(listener); } /** @override */ - removeCreditCardListChangedListener(listener) { - chrome.autofillPrivate.onCreditCardListChanged.removeListener(listener); + removePersonalDataManagerListener(listener) { + chrome.autofillPrivate.onPersonalDataChanged.removeListener(listener); } /** @override */ @@ -100,6 +107,11 @@ class PaymentsManagerImpl { logServerCardLinkClicked() { chrome.autofillPrivate.logServerCardLinkClicked(); } + + /** @override */ + setCreditCardFIDOAuthEnabledState(enabled) { + chrome.autofillPrivate.setCreditCardFIDOAuthEnabledState(enabled); + } } cr.addSingletonGetter(PaymentsManagerImpl); @@ -126,6 +138,18 @@ Polymer({ }, /** + * Set to true if user can be verified through FIDO authentication. + * @private + */ + userIsFidoVerifiable_: { + type: Boolean, + value: function() { + return loadTimeData.getBoolean( + 'fidoAuthenticationAvailableForAutofill'); + }, + }, + + /** * The model for any credit card related action menus or dialogs. * @private {?chrome.autofillPrivate.CreditCardEntry} */ @@ -170,21 +194,39 @@ Polymer({ PaymentsManager_: null, /** - * @type {?function(!Array<!PaymentsManager.CreditCardEntry>)} + * @type {?function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>)} * @private */ - setCreditCardsListener_: null, + setPersonalDataListener_: null, /** @override */ attached: function() { // Create listener function. /** @type {function(!Array<!PaymentsManager.CreditCardEntry>)} */ - const setCreditCardsListener = list => { - this.creditCards = list; + const setCreditCardsListener = cardList => { + this.creditCards = cardList; + }; + + // Update |userIsFidoVerifiable_| based on the availability of a platform + // authenticator. + if (window.PublicKeyCredential) { + window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable() + .then(r => { + this.userIsFidoVerifiable_ = this.userIsFidoVerifiable_ && r; + }); + } + + /** + * @type {function(!Array<!AutofillManager.AddressEntry>, + * !Array<!PaymentsManager.CreditCardEntry>)} + */ + const setPersonalDataListener = (addressList, cardList) => { + this.creditCards = cardList; }; // Remember the bound reference in order to detach. - this.setCreditCardsListener_ = setCreditCardsListener; + this.setPersonalDataListener_ = setPersonalDataListener; // Set the managers. These can be overridden by tests. this.paymentsManager_ = PaymentsManagerImpl.getInstance(); @@ -193,8 +235,8 @@ Polymer({ this.paymentsManager_.getCreditCardList(setCreditCardsListener); // Listen for changes. - this.paymentsManager_.addCreditCardListChangedListener( - setCreditCardsListener); + this.paymentsManager_.setPersonalDataManagerListener( + setPersonalDataListener); // Record that the user opened the payments settings. chrome.metricsPrivate.recordUserAction('AutofillCreditCardsViewed'); @@ -202,9 +244,12 @@ Polymer({ /** @override */ detached: function() { - this.paymentsManager_.removeCreditCardListChangedListener( - /** @type {function(!Array<!PaymentsManager.CreditCardEntry>)} */ ( - this.setCreditCardsListener_)); + this.paymentsManager_.removePersonalDataManagerListener( + /** + @type {function(!Array<!AutofillManager.AddressEntry>, + !Array<!PaymentsManager.CreditCardEntry>)} + */ + (this.setPersonalDataListener_)); }, /** @@ -311,6 +356,25 @@ Polymer({ }, /** + * @param {boolean} creditCardEnabled + * @return {boolean} Whether or not the user is verifiable through FIDO + * authentication. + * @private + */ + shouldShowFidoToggle_: function(creditCardEnabled, userIsFidoVerifiable) { + return creditCardEnabled && userIsFidoVerifiable; + }, + + /** + * Listens for the enable-authentication event, and calls the private API. + * @private + */ + setFIDOAuthenticationEnabledState_: function() { + this.paymentsManager_.setCreditCardFIDOAuthEnabledState( + this.$$('#autofillCreditCardFIDOAuthToggle').checked); + }, + + /** * @param {!Array<!PaymentsManager.CreditCardEntry>} creditCards * @param {boolean} creditCardEnabled * @return {boolean} Whether to show the migration button. |