| 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 | 6 * @fileoverview |
| 7 * Contains utilities that help identify the current way that the lock screen | 7 * Contains utilities that help identify the current way that the lock screen |
| 8 * will be displayed. | 8 * will be displayed. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 /** @enum {string} */ | 11 /** @enum {string} */ |
| 12 var LockScreenUnlockType = { | 12 var LockScreenUnlockType = { |
| 13 VALUE_PENDING: 'value_pending', | 13 VALUE_PENDING: 'value_pending', |
| 14 PASSWORD: 'password', | 14 PASSWORD: 'password', |
| 15 PIN_PASSWORD: 'pin+password' | 15 PIN_PASSWORD: 'pin+password' |
| 16 }; | 16 }; |
| 17 | 17 |
| 18 /** @polymerBehavior */ | 18 /** @polymerBehavior */ |
| 19 var LockStateBehavior = { | 19 var LockStateBehavior = { |
| 20 properties: { | 20 properties: { |
| 21 /** | 21 /** |
| 22 * The currently selected unlock type. | 22 * The currently selected unlock type. |
| 23 * @type {!LockScreenUnlockType} | 23 * @type {!LockScreenUnlockType} |
| 24 */ | 24 */ |
| 25 selectedUnlockType: { | 25 selectedUnlockType: |
| 26 type: String, | 26 {type: String, notify: true, value: LockScreenUnlockType.VALUE_PENDING}, |
| 27 notify: true, | |
| 28 value: LockScreenUnlockType.VALUE_PENDING | |
| 29 }, | |
| 30 | 27 |
| 31 /** | 28 /** |
| 32 * True/false if there is a PIN set; undefined if the computation is still | 29 * True/false if there is a PIN set; undefined if the computation is still |
| 33 * pending. This is a separate value from selectedUnlockType because the UI | 30 * pending. This is a separate value from selectedUnlockType because the UI |
| 34 * can change the selectedUnlockType before setting up a PIN. | 31 * can change the selectedUnlockType before setting up a PIN. |
| 35 * @type {boolean|undefined} | 32 * @type {boolean|undefined} |
| 36 */ | 33 */ |
| 37 hasPin: { | 34 hasPin: {type: Boolean, notify: true}, |
| 38 type: Boolean, | |
| 39 notify: true | |
| 40 }, | |
| 41 | 35 |
| 42 /** | 36 /** |
| 43 * Interface for chrome.quickUnlockPrivate calls. May be overriden by tests. | 37 * Interface for chrome.quickUnlockPrivate calls. May be overriden by tests. |
| 44 * @private | 38 * @private |
| 45 */ | 39 */ |
| 46 quickUnlockPrivate_: { | 40 quickUnlockPrivate_: {type: Object, value: chrome.quickUnlockPrivate}, |
| 47 type: Object, | |
| 48 value: chrome.quickUnlockPrivate | |
| 49 }, | |
| 50 }, | 41 }, |
| 51 | 42 |
| 52 /** @override */ | 43 /** @override */ |
| 53 attached: function() { | 44 attached: function() { |
| 54 this.boundOnActiveModesChanged_ = this.updateUnlockType_.bind(this); | 45 this.boundOnActiveModesChanged_ = this.updateUnlockType_.bind(this); |
| 55 this.quickUnlockPrivate_.onActiveModesChanged.addListener( | 46 this.quickUnlockPrivate_.onActiveModesChanged.addListener( |
| 56 this.boundOnActiveModesChanged_); | 47 this.boundOnActiveModesChanged_); |
| 57 | 48 |
| 58 this.updateUnlockType_(); | 49 this.updateUnlockType_(); |
| 59 }, | 50 }, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 76 if (modes.includes(chrome.quickUnlockPrivate.QuickUnlockMode.PIN)) { | 67 if (modes.includes(chrome.quickUnlockPrivate.QuickUnlockMode.PIN)) { |
| 77 this.hasPin = true; | 68 this.hasPin = true; |
| 78 this.selectedUnlockType = LockScreenUnlockType.PIN_PASSWORD; | 69 this.selectedUnlockType = LockScreenUnlockType.PIN_PASSWORD; |
| 79 } else { | 70 } else { |
| 80 this.hasPin = false; | 71 this.hasPin = false; |
| 81 this.selectedUnlockType = LockScreenUnlockType.PASSWORD; | 72 this.selectedUnlockType = LockScreenUnlockType.PASSWORD; |
| 82 } | 73 } |
| 83 }.bind(this)); | 74 }.bind(this)); |
| 84 }, | 75 }, |
| 85 }; | 76 }; |
| OLD | NEW |