| 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 * Javascript for DeviceCollection, served from | 6 * Javascript for DeviceCollection, served from |
| 7 * chrome://bluetooth-internals/. | 7 * chrome://bluetooth-internals/. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 cr.define('device_collection', function() { | 10 cr.define('device_collection', function() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 | 58 |
| 59 if (oldDeviceInfo) { | 59 if (oldDeviceInfo) { |
| 60 // Update rssi if it's valid | 60 // Update rssi if it's valid |
| 61 var rssi = (deviceInfo.rssi && deviceInfo.rssi.value) || | 61 var rssi = (deviceInfo.rssi && deviceInfo.rssi.value) || |
| 62 (oldDeviceInfo.rssi && oldDeviceInfo.rssi.value); | 62 (oldDeviceInfo.rssi && oldDeviceInfo.rssi.value); |
| 63 | 63 |
| 64 // The connectionStatus and connectionMessage properties may not exist | 64 // The connectionStatus and connectionMessage properties may not exist |
| 65 // on |deviceInfo|. The rssi property may be null, so it must be | 65 // on |deviceInfo|. The rssi property may be null, so it must be |
| 66 // re-assigned. | 66 // re-assigned. |
| 67 Object.assign(oldDeviceInfo, deviceInfo); | 67 Object.assign(oldDeviceInfo, deviceInfo); |
| 68 oldDeviceInfo.rssi = { value: rssi }; | 68 oldDeviceInfo.rssi = {value: rssi}; |
| 69 this.updateIndex(this.indexOf(oldDeviceInfo)); | 69 this.updateIndex(this.indexOf(oldDeviceInfo)); |
| 70 } else { | 70 } else { |
| 71 deviceInfo.connectionStatus = ConnectionStatus.DISCONNECTED; | 71 deviceInfo.connectionStatus = ConnectionStatus.DISCONNECTED; |
| 72 this.push(deviceInfo); | 72 this.push(deviceInfo); |
| 73 } | 73 } |
| 74 }, | 74 }, |
| 75 | 75 |
| 76 /** | 76 /** |
| 77 * Marks the Device as removed. | 77 * Marks the Device as removed. |
| 78 * @param {!interfaces.bluetoothDevice.DeviceInfo} deviceInfo | 78 * @param {!interfaces.bluetoothDevice.DeviceInfo} deviceInfo |
| (...skipping 15 matching lines...) Expand all Loading... |
| 94 device.connectionStatus = status; | 94 device.connectionStatus = status; |
| 95 this.updateIndex(this.indexOf(device)); | 95 this.updateIndex(this.indexOf(device)); |
| 96 }, | 96 }, |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 return { | 99 return { |
| 100 ConnectionStatus: ConnectionStatus, | 100 ConnectionStatus: ConnectionStatus, |
| 101 DeviceCollection: DeviceCollection, | 101 DeviceCollection: DeviceCollection, |
| 102 }; | 102 }; |
| 103 }); | 103 }); |
| OLD | NEW |