| 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 (function() { | 5 (function() { |
| 6 'use strict'; | 6 'use strict'; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * The duration in ms of a background flash when a user touches the fingerprint | 9 * The duration in ms of a background flash when a user touches the fingerprint |
| 10 * sensor on this page. | 10 * sensor on this page. |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 // corresponds to the attempted finger. | 89 // corresponds to the attempted finger. |
| 90 filteredIndexes.forEach(function(index) { | 90 filteredIndexes.forEach(function(index) { |
| 91 var listItem = listItems[index]; | 91 var listItem = listItems[index]; |
| 92 var ripple = listItem.querySelector('paper-ripple'); | 92 var ripple = listItem.querySelector('paper-ripple'); |
| 93 | 93 |
| 94 // Activate the ripple. | 94 // Activate the ripple. |
| 95 if (ripple) | 95 if (ripple) |
| 96 ripple.simulatedRipple(); | 96 ripple.simulatedRipple(); |
| 97 | 97 |
| 98 // Flash the background. | 98 // Flash the background. |
| 99 listItem.animate({ | 99 listItem.animate( |
| 100 backgroundColor: ['var(--google-grey-300)', 'white'], | 100 { |
| 101 }, FLASH_DURATION_MS); | 101 backgroundColor: ['var(--google-grey-300)', 'white'], |
| 102 }, |
| 103 FLASH_DURATION_MS); |
| 102 }); | 104 }); |
| 103 }, | 105 }, |
| 104 | 106 |
| 105 /** @private */ | 107 /** @private */ |
| 106 updateFingerprintsList_: function() { | 108 updateFingerprintsList_: function() { |
| 107 this.browserProxy_.getFingerprintsList().then( | 109 this.browserProxy_.getFingerprintsList().then( |
| 108 this.onFingerprintsChanged_.bind(this)); | 110 this.onFingerprintsChanged_.bind(this)); |
| 109 }, | 111 }, |
| 110 | 112 |
| 111 /** | 113 /** |
| 112 * @param {!settings.FingerprintInfo} fingerprintInfo | 114 * @param {!settings.FingerprintInfo} fingerprintInfo |
| 113 * @private | 115 * @private |
| 114 */ | 116 */ |
| 115 onFingerprintsChanged_: function(fingerprintInfo) { | 117 onFingerprintsChanged_: function(fingerprintInfo) { |
| 116 // Update iron-list. | 118 // Update iron-list. |
| 117 this.fingerprints_ = fingerprintInfo.fingerprintsList.slice(); | 119 this.fingerprints_ = fingerprintInfo.fingerprintsList.slice(); |
| 118 this.$$('.action-button').disabled = fingerprintInfo.isMaxed; | 120 this.$$('.action-button').disabled = fingerprintInfo.isMaxed; |
| 119 }, | 121 }, |
| 120 | 122 |
| 121 /** | 123 /** |
| 122 * Deletes a fingerprint from |fingerprints_|. | 124 * Deletes a fingerprint from |fingerprints_|. |
| 123 * @param {!{model: !{index: !number}}} e | 125 * @param {!{model: !{index: !number}}} e |
| 124 * @private | 126 * @private |
| 125 */ | 127 */ |
| 126 onFingerprintDeleteTapped_: function(e) { | 128 onFingerprintDeleteTapped_: function(e) { |
| 127 this.browserProxy_.removeEnrollment(e.model.index).then( | 129 this.browserProxy_.removeEnrollment(e.model.index).then(function(success) { |
| 128 function(success) { | 130 if (success) |
| 129 if (success) | 131 this.updateFingerprintsList_(); |
| 130 this.updateFingerprintsList_(); | 132 }.bind(this)); |
| 131 }.bind(this)); | |
| 132 }, | 133 }, |
| 133 | 134 |
| 134 /** | 135 /** |
| 135 * @param {!{model: !{index: !number, item: !string}}} e | 136 * @param {!{model: !{index: !number, item: !string}}} e |
| 136 * @private | 137 * @private |
| 137 */ | 138 */ |
| 138 onFingerprintLabelChanged_: function(e) { | 139 onFingerprintLabelChanged_: function(e) { |
| 139 this.browserProxy_.changeEnrollmentLabel(e.model.index, e.model.item).then( | 140 this.browserProxy_.changeEnrollmentLabel(e.model.index, e.model.item) |
| 140 function(success) { | 141 .then(function(success) { |
| 141 if (success) | 142 if (success) |
| 142 this.updateFingerprintsList_(); | 143 this.updateFingerprintsList_(); |
| 143 }.bind(this)); | 144 }.bind(this)); |
| 144 }, | 145 }, |
| 145 | 146 |
| 146 /** | 147 /** |
| 147 * Opens the setup fingerprint dialog. | 148 * Opens the setup fingerprint dialog. |
| 148 * @private | 149 * @private |
| 149 */ | 150 */ |
| 150 openAddFingerprintDialog_: function() { | 151 openAddFingerprintDialog_: function() { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 164 * @private | 165 * @private |
| 165 */ | 166 */ |
| 166 onScreenLocked_: function(screenIsLocked) { | 167 onScreenLocked_: function(screenIsLocked) { |
| 167 if (!screenIsLocked && | 168 if (!screenIsLocked && |
| 168 settings.getCurrentRoute() == settings.Route.FINGERPRINT) { | 169 settings.getCurrentRoute() == settings.Route.FINGERPRINT) { |
| 169 this.onSetupFingerprintDialogClose_(); | 170 this.onSetupFingerprintDialogClose_(); |
| 170 } | 171 } |
| 171 }, | 172 }, |
| 172 }); | 173 }); |
| 173 })(); | 174 })(); |
| OLD | NEW |