1 // Copyright 2015 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.
6 is: 'eligible-devices',
10 * List of devices that are eligible to be used as an unlock key.
11 * @type {Array<DeviceInfo>}
20 * List of devices that are ineligible to be used as an unlock key.
21 * @type {Array<DeviceInfo>}
30 * Whether the findEligibleUnlockDevices request is in progress.
34 requestInProgress_: Boolean,
38 * Called when this element is added to the DOM.
40 attached: function() {
41 CryptAuthInterface.addObserver(this);
45 * Called when this element is removed from the DOM.
47 detatched: function() {
48 CryptAuthInterface.removeObserver(this);
52 * Called when the page is about to be shown.
54 activate: function() {
55 this.requestInProgress_ = true;
56 this.eligibleDevices_ = null;
57 this.ineligibleDevices_ = null;
58 CryptAuthInterface.findEligibleUnlockDevices();
62 * Called when eligible devices are found.
63 * @param {Array<EligibleDevice>} eligibleDevices
64 * @param {Array<IneligibleDevice>} ineligibleDevices_
66 onGotEligibleDevices: function(eligibleDevices, ineligibleDevices) {
67 this.requestInProgress_ = false;
68 this.eligibleDevices_ = eligibleDevices;
69 this.ineligibleDevices_ = ineligibleDevices;
73 * Called when the CryptAuth request fails.
74 * @param {string} errorMessage
76 onCryptAuthError: function(errorMessage) {
77 console.error('CryptAuth request failed: ' + errorMessage);
78 this.requestInProgress_ = false;
79 this.eligibleDevices_ = null;
80 this.ineligibleDevices_ = null;