| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview 'settings-certificate-list' is an element that displays a list | 6 * @fileoverview 'settings-certificate-list' is an element that displays a list |
| 7 * of certificates. | 7 * of certificates. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-certificate-list', | 10 is: 'settings-certificate-list', |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // a native file chooser dialog. | 60 // a native file chooser dialog. |
| 61 return; | 61 return; |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Otherwise propagate the error to the parents, such that a dialog | 64 // Otherwise propagate the error to the parents, such that a dialog |
| 65 // displaying the error will be shown. | 65 // displaying the error will be shown. |
| 66 this.fire('certificates-error', error); | 66 this.fire('certificates-error', error); |
| 67 }, | 67 }, |
| 68 | 68 |
| 69 | 69 |
| 70 /** @private */ | 70 /** |
| 71 dispatchImportActionEvent_: function() { | 71 * @param {?NewCertificateSubNode} subnode |
| 72 * @private |
| 73 */ |
| 74 dispatchImportActionEvent_: function(subnode) { |
| 72 this.fire( | 75 this.fire( |
| 73 settings.CertificateActionEvent, | 76 settings.CertificateActionEvent, |
| 74 /** @type {!CertificateActionEventDetail} */ ({ | 77 /** @type {!CertificateActionEventDetail} */ ({ |
| 75 action: settings.CertificateAction.IMPORT, | 78 action: settings.CertificateAction.IMPORT, |
| 76 subnode: null, | 79 subnode: subnode, |
| 77 certificateType: this.certificateType, | 80 certificateType: this.certificateType, |
| 78 })); | 81 })); |
| 79 }, | 82 }, |
| 80 | 83 |
| 81 /** @private */ | 84 /** @private */ |
| 82 onImportTap_: function() { | 85 onImportTap_: function() { |
| 83 var browserProxy = settings.CertificatesBrowserProxyImpl.getInstance(); | 86 var browserProxy = settings.CertificatesBrowserProxyImpl.getInstance(); |
| 84 if (this.certificateType == settings.CertificateType.PERSONAL) { | 87 if (this.certificateType == settings.CertificateType.PERSONAL) { |
| 85 browserProxy.importPersonalCertificate(false).then( | 88 browserProxy.importPersonalCertificate(false).then( |
| 86 function(showPasswordPrompt) { | 89 function(showPasswordPrompt) { |
| 87 if (showPasswordPrompt) | 90 if (showPasswordPrompt) |
| 88 this.dispatchImportActionEvent_(); | 91 this.dispatchImportActionEvent_(null); |
| 89 }.bind(this), | 92 }.bind(this), |
| 90 this.onRejected_.bind(this)); | 93 this.onRejected_.bind(this)); |
| 91 } else if (this.certificateType == settings.CertificateType.CA) { | 94 } else if (this.certificateType == settings.CertificateType.CA) { |
| 92 browserProxy.importCaCertificate().then( | 95 browserProxy.importCaCertificate().then( |
| 93 function(certificateName) { | 96 function(certificateName) { |
| 94 this.dispatchImportActionEvent_(); | 97 this.dispatchImportActionEvent_({name: certificateName}); |
| 95 }.bind(this), | 98 }.bind(this), |
| 96 this.onRejected_.bind(this)); | 99 this.onRejected_.bind(this)); |
| 97 } else if (this.certificateType == settings.CertificateType.SERVER) { | 100 } else if (this.certificateType == settings.CertificateType.SERVER) { |
| 98 browserProxy.importServerCertificate().catch( | 101 browserProxy.importServerCertificate().catch( |
| 99 this.onRejected_.bind(this)); | 102 this.onRejected_.bind(this)); |
| 100 } else { | 103 } else { |
| 101 assertNotReached(); | 104 assertNotReached(); |
| 102 } | 105 } |
| 103 }, | 106 }, |
| 104 }); | 107 }); |
| OLD | NEW |