| Index: chrome/browser/resources/settings/certificate_manager_page/certificate_manager_page.js
|
| diff --git a/chrome/browser/resources/settings/certificate_manager_page/certificate_manager_page.js b/chrome/browser/resources/settings/certificate_manager_page/certificate_manager_page.js
|
| index afa70a9b5d8bd4549374686e448f9242bbc98772..d48ce13c304e2903d1adf96b97f0b014c6bf88e5 100644
|
| --- a/chrome/browser/resources/settings/certificate_manager_page/certificate_manager_page.js
|
| +++ b/chrome/browser/resources/settings/certificate_manager_page/certificate_manager_page.js
|
| @@ -82,6 +82,13 @@ Polymer({
|
| * @private {null|!CertificatesError|!CertificatesImportError}
|
| */
|
| errorDialogModel_: Object,
|
| +
|
| + /**
|
| + * The element to return focus to, when the currently shown dialog is
|
| + * closed.
|
| + * @private {?HTMLElement}
|
| + */
|
| + activeDialogAnchor_: Object,
|
| },
|
|
|
| /** @override */
|
| @@ -110,25 +117,28 @@ Polymer({
|
| if (event.detail.certificateType == CertificateType.PERSONAL) {
|
| this.openDialog_(
|
| 'settings-certificate-password-decryption-dialog',
|
| - 'showPasswordDecryptionDialog_');
|
| + 'showPasswordDecryptionDialog_',
|
| + event.detail.anchor);
|
| } else if (event.detail.certificateType ==
|
| CertificateType.CA) {
|
| this.openDialog_(
|
| - 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_');
|
| + 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_',
|
| + event.detail.anchor);
|
| }
|
| } else {
|
| if (event.detail.action == CertificateAction.EDIT) {
|
| this.openDialog_(
|
| - 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_');
|
| + 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_',
|
| + event.detail.anchor);
|
| } else if (event.detail.action == CertificateAction.DELETE) {
|
| this.openDialog_(
|
| 'settings-certificate-delete-confirmation-dialog',
|
| - 'showDeleteConfirmationDialog_');
|
| + 'showDeleteConfirmationDialog_', event.detail.anchor);
|
| } else if (event.detail.action ==
|
| CertificateAction.EXPORT_PERSONAL) {
|
| this.openDialog_(
|
| 'settings-certificate-password-encryption-dialog',
|
| - 'showPasswordEncryptionDialog_');
|
| + 'showPasswordEncryptionDialog_', event.detail.anchor);
|
| }
|
| }
|
|
|
| @@ -136,10 +146,12 @@ Polymer({
|
| }.bind(this));
|
|
|
| this.addEventListener('certificates-error', function(event) {
|
| - this.errorDialogModel_ = event.detail;
|
| + var detail = /** @type {!CertificatesErrorEventDetail} */ (event.detail);
|
| + this.errorDialogModel_ = detail.error;
|
| this.openDialog_(
|
| 'settings-certificates-error-dialog',
|
| - 'showErrorDialog_');
|
| + 'showErrorDialog_',
|
| + detail.anchor);
|
| event.stopPropagation();
|
| }.bind(this));
|
| },
|
| @@ -152,14 +164,22 @@ Polymer({
|
| * @param {string} dialogTagName The tag name of the dialog to be shown.
|
| * @param {string} domIfBooleanName The name of the boolean variable
|
| * corresponding to the dialog.
|
| + * @param {?HTMLElement} anchor The element to focus when the dialog is
|
| + * closed. If null, the previous anchor element should be reused. This
|
| + * happens when a 'settings-certificates-error-dialog' is opened,
|
| + * which when closed should focus the anchor of the previous dialog (the
|
| + * one that generated the error).
|
| * @private
|
| */
|
| - openDialog_: function(dialogTagName, domIfBooleanName) {
|
| + openDialog_: function(dialogTagName, domIfBooleanName, anchor) {
|
| + if (anchor)
|
| + this.activeDialogAnchor_ = anchor;
|
| this.set(domIfBooleanName, true);
|
| this.async(function() {
|
| var dialog = this.$$(dialogTagName);
|
| dialog.addEventListener('close', function() {
|
| this.set(domIfBooleanName, false);
|
| + this.activeDialogAnchor_.focus();
|
| }.bind(this));
|
| }.bind(this));
|
| },
|
|
|