| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 remove: function(deviceInfo) { | 80 remove: function(deviceInfo) { |
| 81 var device = this.getByAddress(deviceInfo.address); | 81 var device = this.getByAddress(deviceInfo.address); |
| 82 assert(device, 'Device does not exist.'); | 82 assert(device, 'Device does not exist.'); |
| 83 device.removed = true; | 83 device.removed = true; |
| 84 this.updateIndex(this.indexOf(device)); | 84 this.updateIndex(this.indexOf(device)); |
| 85 }, | 85 }, |
| 86 | 86 |
| 87 /** | 87 /** |
| 88 * Updates the device connection status. | 88 * Updates the device connection status. |
| 89 * @param {string} address The address of the device. | 89 * @param {string} address The address of the device. |
| 90 * @param {number} status . | 90 * @param {number} status The new connection status. |
| 91 * @param {?Error} opt_error Optional Error from connection. | |
| 92 */ | 91 */ |
| 93 updateConnectionStatus: function(address, status, opt_error) { | 92 updateConnectionStatus: function(address, status, opt_error) { |
| 94 var message = (opt_error && opt_error.message) || ''; | |
| 95 | |
| 96 var device = assert(this.getByAddress(address), 'Device does not exist'); | 93 var device = assert(this.getByAddress(address), 'Device does not exist'); |
| 97 device.connectionStatus = status; | 94 device.connectionStatus = status; |
| 98 | |
| 99 // TODO(crbug.com/663830): Replace connection error column with better | |
| 100 // notification system. | |
| 101 device.connectionMessage = message; | |
| 102 this.updateIndex(this.indexOf(device)); | 95 this.updateIndex(this.indexOf(device)); |
| 103 }, | 96 }, |
| 104 }; | 97 }; |
| 105 | 98 |
| 106 return { | 99 return { |
| 107 ConnectionStatus: ConnectionStatus, | 100 ConnectionStatus: ConnectionStatus, |
| 108 DeviceCollection: DeviceCollection, | 101 DeviceCollection: DeviceCollection, |
| 109 }; | 102 }; |
| 110 }); | 103 }); |
| OLD | NEW |