Chromium Code Reviews| 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() { return []; }, |
| 17 }, | 17 }, |
| 18 | 18 |
| 19 /** @type {!CertificateType} */ | 19 /** @type {!CertificateType} */ |
| 20 certificateType: String, | 20 certificateType: String, |
| 21 | |
| 22 // <if expr="chromeos"> | |
| 23 /** @private */ | |
| 24 isGuest_: { | |
| 25 type: Boolean, | |
| 26 value: function() { | |
| 27 return loadTimeData.getBoolean('isGuest'); | |
| 28 } | |
| 29 }, | |
| 30 // </if> | |
| 21 }, | 31 }, |
| 22 | 32 |
| 23 behaviors: [I18nBehavior], | 33 behaviors: [I18nBehavior], |
| 24 | 34 |
| 25 /** | 35 /** |
| 26 * @return {string} | 36 * @return {string} |
| 27 * @private | 37 * @private |
| 28 */ | 38 */ |
| 29 getDescription_: function() { | 39 getDescription_: function() { |
| 30 if (this.certificates.length == 0) | 40 if (this.certificates.length == 0) |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 51 canImport_: function() { | 61 canImport_: function() { |
| 52 return this.certificateType != CertificateType.OTHER; | 62 return this.certificateType != CertificateType.OTHER; |
| 53 }, | 63 }, |
| 54 | 64 |
| 55 // <if expr="chromeos"> | 65 // <if expr="chromeos"> |
| 56 /** | 66 /** |
| 57 * @return {boolean} | 67 * @return {boolean} |
| 58 * @private | 68 * @private |
| 59 */ | 69 */ |
| 60 canImportAndBind_: function() { | 70 canImportAndBind_: function() { |
| 61 return this.certificateType == CertificateType.PERSONAL; | 71 return !this.isGuest_ && this.certificateType == CertificateType.PERSONAL; |
|
dpapad
2017/05/04 23:35:40
Optional: If you think this functionality is impor
stevenjb
2017/05/08 16:44:43
We don't currently have any "guest mode" tests tha
| |
| 62 }, | 72 }, |
| 63 // </if> | 73 // </if> |
| 64 | 74 |
| 65 /** | 75 /** |
| 66 * Handles a rejected Promise returned from |browserProxy_|. | 76 * Handles a rejected Promise returned from |browserProxy_|. |
| 67 * @param {!HTMLElement} anchor | 77 * @param {!HTMLElement} anchor |
| 68 * @param {*} error Expects {!CertificatesError|!CertificatesImportError}. | 78 * @param {*} error Expects {!CertificatesError|!CertificatesImportError}. |
| 69 * @private | 79 * @private |
| 70 */ | 80 */ |
| 71 onRejected_: function(anchor, error) { | 81 onRejected_: function(anchor, error) { |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 }.bind(this), | 148 }.bind(this), |
| 139 this.onRejected_.bind(this, anchor)); | 149 this.onRejected_.bind(this, anchor)); |
| 140 } else if (this.certificateType == CertificateType.SERVER) { | 150 } else if (this.certificateType == CertificateType.SERVER) { |
| 141 browserProxy.importServerCertificate().catch( | 151 browserProxy.importServerCertificate().catch( |
| 142 this.onRejected_.bind(this, anchor)); | 152 this.onRejected_.bind(this, anchor)); |
| 143 } else { | 153 } else { |
| 144 assertNotReached(); | 154 assertNotReached(); |
| 145 } | 155 } |
| 146 }, | 156 }, |
| 147 }); | 157 }); |
| OLD | NEW |