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

Side by Side Diff: chrome/browser/resources/settings/people_page/fingerprint_list.js

Issue 2538303002: md-settings: Added settings for fingerprint unlock. (Closed)
Patch Set: Rebased. Created 3 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 (function() {
6 'use strict';
7
8 /**
9 * The max number of fingerprints this list can hold.
10 * @const {number}
11 */
12 var MAX_NUMBER_FINGERPRINTS_ALLOWED = 5;
13
14 Polymer({
15 is: 'settings-fingerprint-list',
16
17 behaviors: [
18 I18nBehavior,
19 ],
20
21 properties: {
22 /**
23 * The list of fingerprint objects.
24 * @private {!Array<string>}
25 */
26 fingerprints_: {
27 type: Array,
28 value: function() {
29 return [];
30 }
31 }
32 },
33
34 /**
35 * Adds a fingerprint with a default name.
36 * @private
37 */
38 onAddFingerprint_: function() {
39 // Determines what the newly added fingerprint's name should be.
40 // TODO(sammiequon): Add fingerprint using private API once it is ready.
41
42 var fingerprintName;
43 for (var i = 1; i <= MAX_NUMBER_FINGERPRINTS_ALLOWED; ++i) {
44 fingerprintName = this.i18n('lockScreenFingerprintNewName', i);
45 if (this.fingerprints_.includes(fingerprintName))
46 continue;
47 break;
48 }
49 this.push('fingerprints_', fingerprintName);
Dan Beam 2017/01/26 00:27:27 this.push('fingerprints_', this.i18n('lockScre
sammiequon 2017/01/26 00:48:23 This is a bit different behavior. For example if w
Dan Beam 2017/01/26 04:12:04 how can you rename fingerprints?
sammiequon 2017/01/26 15:56:45 The fingerprint names on displayed on paper-inputs
50 },
51
52 /**
53 * Deletes a fingerprint from |fingerprints_|.
54 * @private
55 */
56 onFingerprintDelete_: function(e) {
57 // TODO(sammiequon): Remove fingerprint using private API once it is ready.
58 this.splice('fingerprints_', e.model.index, 1);
59 },
60
61 /**
62 * Returns the text to be displayed for the add fingerprint button.
63 * @param {number} numFingerprints
64 * @return {string}
65 * @private
66 */
67 getFingerprintButtonText_: function(numFingerprints) {
68 if (this.canAddNewFingerprint_(numFingerprints))
69 return this.i18n('lockScreenAddFingerprint');
70
71 return this.i18n('lockScreenCannotAddFingerprint',
72 MAX_NUMBER_FINGERPRINTS_ALLOWED);
73 },
74
75 /**
76 * Checks whether another fingerprint can be added.
77 * @param {number} numFingerprints
78 * @return {boolean}
79 * @private
80 */
81 canAddNewFingerprint_: function(numFingerprints) {
Dan Beam 2017/01/26 00:27:27 canAddNewFingerprint_: function() { return this.
sammiequon 2017/01/26 00:48:23 I tried that but this function does not fire when
Dan Beam 2017/01/26 04:12:04 fingerprints_.*?
sammiequon 2017/01/26 15:56:45 Done.
Dan Beam 2017/01/27 01:14:15 no, i mean, in the binding, [[canAddNewFingerprint
sammiequon 2017/01/27 23:04:58 Done.
82 return numFingerprints < MAX_NUMBER_FINGERPRINTS_ALLOWED;
83 }
84 });
85 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698