Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Unified Diff: chrome/browser/resources/settings/certificate_manager_page/certificate_list.js

Issue 2792663002: MD Settings: Restore focus after closing dialogs, for certificate page. (Closed)
Patch Set: Update error dialog. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/certificate_manager_page/certificate_list.js
diff --git a/chrome/browser/resources/settings/certificate_manager_page/certificate_list.js b/chrome/browser/resources/settings/certificate_manager_page/certificate_list.js
index 82b261fd8cd1e92346d04facebc4549300248a05..f13138a08f5e34a58f2f64a43202b8c1796a1c9f 100644
--- a/chrome/browser/resources/settings/certificate_manager_page/certificate_list.js
+++ b/chrome/browser/resources/settings/certificate_manager_page/certificate_list.js
@@ -64,10 +64,11 @@ Polymer({
/**
* Handles a rejected Promise returned from |browserProxy_|.
+ * @param {!HTMLElement} anchor
* @param {*} error Expects {!CertificatesError|!CertificatesImportError}.
* @private
*/
- onRejected_: function(error) {
+ onRejected_: function(anchor, error) {
if (error === null) {
// Nothing to do here. Null indicates that the user clicked "cancel" on
// a native file chooser dialog.
@@ -76,58 +77,69 @@ Polymer({
// Otherwise propagate the error to the parents, such that a dialog
// displaying the error will be shown.
- this.fire('certificates-error', error);
+ this.fire('certificates-error', {error: error, anchor: anchor});
},
/**
* @param {?NewCertificateSubNode} subnode
+ * @param {!HTMLElement} anchor
* @private
*/
- dispatchImportActionEvent_: function(subnode) {
+ dispatchImportActionEvent_: function(subnode, anchor) {
this.fire(
settings.CertificateActionEvent,
/** @type {!CertificateActionEventDetail} */ ({
action: CertificateAction.IMPORT,
subnode: subnode,
certificateType: this.certificateType,
+ anchor: anchor,
}));
},
- /** @private */
- onImportTap_: function() {
- this.handleImport_(false);
+ /**
+ * @param {!Event} e
+ * @private
+ */
+ onImportTap_: function(e) {
+ this.handleImport_(false, /** @type {!HTMLElement} */ (
+ Polymer.dom(e).localTarget));
},
// <if expr="chromeos">
- /** @private */
- onImportAndBindTap_: function() {
- this.handleImport_(true);
+ /**
+ * @private
+ * @param {!Event} e
+ */
+ onImportAndBindTap_: function(e) {
+ this.handleImport_(true, /** @type {!HTMLElement} */ (
+ Polymer.dom(e).localTarget));
},
// </if>
/**
* @param {boolean} useHardwareBacked
+ * @param {!HTMLElement} anchor
* @private
*/
- handleImport_: function(useHardwareBacked) {
+ handleImport_: function(useHardwareBacked, anchor) {
var browserProxy = settings.CertificatesBrowserProxyImpl.getInstance();
if (this.certificateType == CertificateType.PERSONAL) {
browserProxy.importPersonalCertificate(useHardwareBacked).then(
function(showPasswordPrompt) {
if (showPasswordPrompt)
- this.dispatchImportActionEvent_(null);
+ this.dispatchImportActionEvent_(null, anchor);
}.bind(this),
- this.onRejected_.bind(this));
+ this.onRejected_.bind(this, anchor));
} else if (this.certificateType == CertificateType.CA) {
browserProxy.importCaCertificate().then(
function(certificateName) {
- this.dispatchImportActionEvent_({name: certificateName});
+ this.dispatchImportActionEvent_({name: certificateName}, anchor);
}.bind(this),
- this.onRejected_.bind(this));
+ this.onRejected_.bind(this, anchor));
} else if (this.certificateType == CertificateType.SERVER) {
browserProxy.importServerCertificate().catch(
- this.onRejected_.bind(this));
+ this.onRejected_.bind(this, anchor));
tommycli 2017/04/04 22:42:29 Nice partially applied function.
dpapad 2017/04/04 23:15:42 Ack!
} else {
assertNotReached();
}

Powered by Google App Engine
This is Rietveld 408576698