| 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', |
| 11 | 11 |
| 12 properties: { | 12 properties: { |
| 13 /** @type {!Array<!Certificate>} */ | 13 /** @type {!Array<!Certificate>} */ |
| 14 certificates: { | 14 certificates: { |
| 15 type: Array, | 15 type: Array, |
| 16 value: function() { return []; }, | 16 value: function() { |
| 17 return []; |
| 18 }, |
| 17 }, | 19 }, |
| 18 | 20 |
| 19 /** @type {!CertificateType} */ | 21 /** @type {!CertificateType} */ |
| 20 certificateType: String, | 22 certificateType: String, |
| 21 }, | 23 }, |
| 22 | 24 |
| 23 behaviors: [I18nBehavior], | 25 behaviors: [I18nBehavior], |
| 24 | 26 |
| 25 /** | 27 /** |
| 26 * @return {string} | 28 * @return {string} |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 action: CertificateAction.IMPORT, | 83 action: CertificateAction.IMPORT, |
| 82 subnode: subnode, | 84 subnode: subnode, |
| 83 certificateType: this.certificateType, | 85 certificateType: this.certificateType, |
| 84 })); | 86 })); |
| 85 }, | 87 }, |
| 86 | 88 |
| 87 /** @private */ | 89 /** @private */ |
| 88 onImportTap_: function() { | 90 onImportTap_: function() { |
| 89 var browserProxy = settings.CertificatesBrowserProxyImpl.getInstance(); | 91 var browserProxy = settings.CertificatesBrowserProxyImpl.getInstance(); |
| 90 if (this.certificateType == CertificateType.PERSONAL) { | 92 if (this.certificateType == CertificateType.PERSONAL) { |
| 91 browserProxy.importPersonalCertificate(false).then( | 93 browserProxy.importPersonalCertificate(false) |
| 92 function(showPasswordPrompt) { | 94 .then(function(showPasswordPrompt) { |
| 93 if (showPasswordPrompt) | 95 if (showPasswordPrompt) |
| 94 this.dispatchImportActionEvent_(null); | 96 this.dispatchImportActionEvent_(null); |
| 95 }.bind(this), | 97 }.bind(this), this.onRejected_.bind(this)); |
| 96 this.onRejected_.bind(this)); | |
| 97 } else if (this.certificateType == CertificateType.CA) { | 98 } else if (this.certificateType == CertificateType.CA) { |
| 98 browserProxy.importCaCertificate().then( | 99 browserProxy.importCaCertificate().then(function(certificateName) { |
| 99 function(certificateName) { | 100 this.dispatchImportActionEvent_({name: certificateName}); |
| 100 this.dispatchImportActionEvent_({name: certificateName}); | 101 }.bind(this), this.onRejected_.bind(this)); |
| 101 }.bind(this), | |
| 102 this.onRejected_.bind(this)); | |
| 103 } else if (this.certificateType == CertificateType.SERVER) { | 102 } else if (this.certificateType == CertificateType.SERVER) { |
| 104 browserProxy.importServerCertificate().catch( | 103 browserProxy.importServerCertificate().catch(this.onRejected_.bind(this)); |
| 105 this.onRejected_.bind(this)); | |
| 106 } else { | 104 } else { |
| 107 assertNotReached(); | 105 assertNotReached(); |
| 108 } | 106 } |
| 109 }, | 107 }, |
| 110 }); | 108 }); |
| OLD | NEW |