Chromium Code Reviews| Index: chrome/browser/resources/bluetooth_internals/characteristic_list.js |
| diff --git a/chrome/browser/resources/bluetooth_internals/characteristic_list.js b/chrome/browser/resources/bluetooth_internals/characteristic_list.js |
| index faa7f9d013b346557a03080c93f8d20791a70f47..bc24215233b4439b788fdc6ccf5797404792e8a2 100644 |
| --- a/chrome/browser/resources/bluetooth_internals/characteristic_list.js |
| +++ b/chrome/browser/resources/bluetooth_internals/characteristic_list.js |
| @@ -45,12 +45,17 @@ cr.define('characteristic_list', function() { |
| * CharacteristicInfo object. |
| * @constructor |
| * @param {!interfaces.BluetoothDevice.CharacteristicInfo} characteristicInfo |
| + * @param {string} deviceAddress |
| + * @param {string} serviceId |
| */ |
| - function CharacteristicListItem(characteristicInfo) { |
| + function CharacteristicListItem( |
| + characteristicInfo, deviceAddress, serviceId) { |
| var listItem = new ExpandableListItem(); |
| listItem.__proto__ = CharacteristicListItem.prototype; |
| listItem.info = characteristicInfo; |
| + listItem.deviceAddress_ = deviceAddress; |
|
Dan Beam
2017/01/24 06:07:29
can we add type definitions for these properties i
mbrunson
2017/01/24 21:29:46
Done.
|
| + listItem.serviceId_ = serviceId; |
| listItem.decorate(); |
| return listItem; |
| @@ -103,6 +108,9 @@ cr.define('characteristic_list', function() { |
| Property.WRITE_ENCRYPTED_AUTHENTICATED) > 0, |
| }); |
| + /** @private {!descriptor_list.DescriptorList} */ |
| + this.descriptorList_ = new descriptor_list.DescriptorList(); |
| + |
| // Create content for display in brief content container. |
| var characteristicHeaderText = document.createElement('div'); |
| characteristicHeaderText.textContent = 'Characteristic:'; |
| @@ -130,15 +138,26 @@ cr.define('characteristic_list', function() { |
| propertiesDiv.classList.add('flex'); |
| propertiesDiv.appendChild(this.propertiesFieldSet_); |
| + var descriptorsHeader = document.createElement('h4'); |
| + descriptorsHeader.textContent = 'Descriptors'; |
| + |
| var infoDiv = document.createElement('div'); |
| infoDiv.classList.add('info-container'); |
| infoDiv.appendChild(characteristicInfoHeader); |
| infoDiv.appendChild(characteristicDiv); |
| infoDiv.appendChild(propertiesHeader); |
| infoDiv.appendChild(propertiesDiv); |
| + infoDiv.appendChild(descriptorsHeader); |
| + infoDiv.appendChild(this.descriptorList_); |
| this.expandedContent_.appendChild(infoDiv); |
| }, |
| + |
| + /** @override */ |
| + onExpandInternal: function(expanded) { |
| + this.descriptorList_.load( |
| + this.deviceAddress_, this.serviceId_, this.info.id); |
| + }, |
| }; |
| /** |
| @@ -163,7 +182,8 @@ cr.define('characteristic_list', function() { |
| /** @override */ |
| createItem: function(data) { |
| - return new CharacteristicListItem(data); |
| + return new CharacteristicListItem( |
| + data, this.deviceAddress_, this.serviceId_); |
| }, |
| /** |
| @@ -177,6 +197,8 @@ cr.define('characteristic_list', function() { |
| if (this.characteristicsRequested_ || !this.isLoading()) |
| return; |
| + this.deviceAddress_ = deviceAddress; |
| + this.serviceId_ = serviceId; |
| this.characteristicsRequested_ = true; |
| device_broker.connectToDevice(deviceAddress).then(function(device) { |
| @@ -200,4 +222,4 @@ cr.define('characteristic_list', function() { |
| CharacteristicList: CharacteristicList, |
| CharacteristicListItem: CharacteristicListItem, |
| }; |
| -}); |
| +}); |