Roll src/third_party/WebKit eac3800:0237a66 (svn 202606:202607)
[chromium-blink-merge.git] / components / proximity_auth / webui / resources / reachable-devices.js
bloba247c4001ec12067b8691928174d8f85fc4c25e0
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.
5 Polymer({
6 is: 'reachable-devices',
8 properties: {
9 /**
10 * List of devices that recently responded to a CryptAuth ping.
11 * @type {Array<DeviceInfo>}
12 * @private
14 reachableDevices_: {
15 type: Array,
16 value: null,
19 /**
20 * Whether the findEligibleUnlockDevices request is in progress.
21 * @type {boolean}
22 * @private
24 requestInProgress_: Boolean,
27 /**
28 * Called when this element is added to the DOM.
30 attached: function() {
31 CryptAuthInterface.addObserver(this);
34 /**
35 * Called when this element is removed from the DOM.
37 detatched: function() {
38 CryptAuthInterface.removeObserver(this);
41 /**
42 * Called when the page is about to be shown.
44 activate: function() {
45 this.requestInProgress_ = true;
46 this.reachableDevices_ = null;
47 CryptAuthInterface.findReachableDevices();
50 /**
51 * Called when reachable devices are found.
52 * @param {Array<EligibleDevice>} reachableDevices
54 onGotReachableDevices: function(reachableDevices) {
55 this.requestInProgress_ = false;
56 this.reachableDevices_ = reachableDevices;
59 /**
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;
68 });