Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Unified Diff: chrome/browser/resources/bluetooth_internals/descriptor_list.js

Issue 2649473002: bluetooth: Add control for reading/writing of descriptor values to internals page. (Closed)
Patch Set: Merge upstream Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/bluetooth_internals/descriptor_list.js
diff --git a/chrome/browser/resources/bluetooth_internals/descriptor_list.js b/chrome/browser/resources/bluetooth_internals/descriptor_list.js
index 3b026c30af0915d383741bf0162ea2b99f272d10..13d646b1147f21e342c0e71845cc546d7a0cb1dd 100644
--- a/chrome/browser/resources/bluetooth_internals/descriptor_list.js
+++ b/chrome/browser/resources/bluetooth_internals/descriptor_list.js
@@ -26,13 +26,23 @@ cr.define('descriptor_list', function() {
* properties, 'id' and 'uuid' within the DescriptorInfo object.
* @constructor
* @param {!interfaces.BluetoothDevice.DescriptorInfo} descriptorInfo
+ * @param {string} deviceAddress
+ * @param {string} serviceId
+ * @param {string} characteristicId
*/
- function DescriptorListItem(descriptorInfo) {
+ function DescriptorListItem(
+ descriptorInfo, deviceAddress, serviceId, characteristicId) {
var listItem = new ExpandableListItem();
listItem.__proto__ = DescriptorListItem.prototype;
/** @type {!interfaces.BluetoothDevice.DescriptorInfo} */
listItem.info = descriptorInfo;
+ /** @private {string} */
+ listItem.deviceAddress_ = deviceAddress;
+ /** @private {string} */
+ listItem.serviceId_ = serviceId;
+ /** @private {string} */
+ listItem.characteristicId_ = characteristicId;
listItem.decorate();
return listItem;
@@ -57,6 +67,15 @@ cr.define('descriptor_list', function() {
'uuid.uuid': this.info.uuid.uuid,
});
+ /** @private {!value_control.ValueControl} */
+ this.valueControl_ = new value_control.ValueControl();
+ this.valueControl_.load({
+ deviceAddress: this.deviceAddress_,
+ serviceId: this.serviceId_,
+ characteristicId: this.characteristicId_,
+ descriptorId: this.info.id,
+ });
+
// Create content for display in brief content container.
var descriptorHeaderText = document.createElement('div');
descriptorHeaderText.textContent = 'Descriptor:';
@@ -77,10 +96,15 @@ cr.define('descriptor_list', function() {
descriptorDiv.classList.add('flex');
descriptorDiv.appendChild(this.descriptorFieldSet_);
+ var valueHeader = document.createElement('h4');
+ valueHeader.textContent = 'Value';
+
var infoDiv = document.createElement('div');
infoDiv.classList.add('info-container');
infoDiv.appendChild(descriptorInfoHeader);
infoDiv.appendChild(descriptorDiv);
+ infoDiv.appendChild(valueHeader);
+ infoDiv.appendChild(this.valueControl_);
this.expandedContent_.appendChild(infoDiv);
},
@@ -99,6 +123,12 @@ cr.define('descriptor_list', function() {
decorate: function() {
ExpandableList.prototype.decorate.call(this);
+ /** @private {?string} */
+ this.deviceAddress_ = null;
+ /** @private {?string} */
+ this.serviceId_ = null;
+ /** @private {?string} */
+ this.characteristicId_ = null;
/** @private {boolean} */
this.descriptorsRequested_ = false;
@@ -108,7 +138,8 @@ cr.define('descriptor_list', function() {
/** @override */
createItem: function(data) {
- return new DescriptorListItem(data);
+ return new DescriptorListItem(
+ data, this.deviceAddress_, this.serviceId_, this.characteristicId_);
},
/**
@@ -124,6 +155,9 @@ cr.define('descriptor_list', function() {
if (this.descriptorsRequested_ || !this.isSpinnerShowing())
return;
+ this.deviceAddress_ = deviceAddress;
+ this.serviceId_ = serviceId;
+ this.characteristicId_ = characteristicId;
this.descriptorsRequested_ = true;
device_broker.connectToDevice(deviceAddress)

Powered by Google App Engine
This is Rietveld 408576698