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: 'reachable-devices',
10 * List of devices that recently responded to a CryptAuth ping.
11 * @type {Array<DeviceInfo>}
20 * Whether the findEligibleUnlockDevices request is in progress.
24 requestInProgress_: Boolean,
28 * Called when this element is added to the DOM.
30 attached: function() {
31 CryptAuthInterface.addObserver(this);
35 * Called when this element is removed from the DOM.
37 detatched: function() {
38 CryptAuthInterface.removeObserver(this);
42 * Called when the page is about to be shown.
44 activate: function() {
45 this.requestInProgress_ = true;
46 this.reachableDevices_ = null;
47 CryptAuthInterface.findReachableDevices();
51 * Called when reachable devices are found.
52 * @param {Array<EligibleDevice>} reachableDevices
54 onGotReachableDevices: function(reachableDevices) {
55 this.requestInProgress_ = false;
56 this.reachableDevices_ = reachableDevices;
60 * Called when the CryptAuth request fails.
61 * @param {string} errorMessage
63 onCryptAuthError: function(errorMessage) {
64 console.error('CryptAuth request failed: ' + errorMessage);
65 this.requestInProgress_ = false;
66 this.reachableDevices_ = null;