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

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

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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/value_control.js
diff --git a/chrome/browser/resources/bluetooth_internals/value_control.js b/chrome/browser/resources/bluetooth_internals/value_control.js
index 9146e59412c909f225cf254de3419bab58c1a8ef..04b5a4aabed9c830c3b8da39a94dcb776c4ec9a5 100644
--- a/chrome/browser/resources/bluetooth_internals/value_control.js
+++ b/chrome/browser/resources/bluetooth_internals/value_control.js
@@ -341,29 +341,33 @@ cr.define('value_control', function() {
readValue_: function() {
this.readBtn_.disabled = true;
- device_broker.connectToDevice(this.deviceAddress_).then(function(device) {
- if (this.descriptorId_) {
- return device.readValueForDescriptor(
- this.serviceId_, this.characteristicId_, this.descriptorId_);
- }
-
- return device.readValueForCharacteristic(
- this.serviceId_, this.characteristicId_);
- }.bind(this)).then(function(response) {
- this.readBtn_.disabled = false;
-
- if (response.result === interfaces.BluetoothDevice.GattResult.SUCCESS) {
- this.setValue(response.value);
- Snackbar.show(
- this.deviceAddress_ + ': Read succeeded', SnackbarType.SUCCESS);
- return;
- }
-
- var errorString = this.getErrorString_(response.result);
- Snackbar.show(
- this.deviceAddress_ + ': ' + errorString, SnackbarType.ERROR,
- 'Retry', this.readValue_.bind(this));
- }.bind(this));
+ device_broker.connectToDevice(this.deviceAddress_)
+ .then(function(device) {
+ if (this.descriptorId_) {
+ return device.readValueForDescriptor(
+ this.serviceId_, this.characteristicId_, this.descriptorId_);
+ }
+
+ return device.readValueForCharacteristic(
+ this.serviceId_, this.characteristicId_);
+ }.bind(this))
+ .then(function(response) {
+ this.readBtn_.disabled = false;
+
+ if (response.result ===
+ interfaces.BluetoothDevice.GattResult.SUCCESS) {
+ this.setValue(response.value);
+ Snackbar.show(
+ this.deviceAddress_ + ': Read succeeded',
+ SnackbarType.SUCCESS);
+ return;
+ }
+
+ var errorString = this.getErrorString_(response.result);
+ Snackbar.show(
+ this.deviceAddress_ + ': ' + errorString, SnackbarType.ERROR,
+ 'Retry', this.readValue_.bind(this));
+ }.bind(this));
},
/**
@@ -376,29 +380,34 @@ cr.define('value_control', function() {
writeValue_: function() {
this.writeBtn_.disabled = true;
- device_broker.connectToDevice(this.deviceAddress_).then(function(device) {
- if (this.descriptorId_) {
- return device.writeValueForDescriptor(
- this.serviceId_, this.characteristicId_, this.descriptorId_,
- this.value_.getArray());
- }
-
- return device.writeValueForCharacteristic(
- this.serviceId_, this.characteristicId_, this.value_.getArray());
- }.bind(this)).then(function(response) {
- this.writeBtn_.disabled = false;
-
- if (response.result === interfaces.BluetoothDevice.GattResult.SUCCESS) {
- Snackbar.show(
- this.deviceAddress_ + ': Write succeeded', SnackbarType.SUCCESS);
- return;
- }
-
- var errorString = this.getErrorString_(response.result);
- Snackbar.show(
- this.deviceAddress_ + ': ' + errorString, SnackbarType.ERROR,
- 'Retry', this.writeValue_.bind(this));
- }.bind(this));
+ device_broker.connectToDevice(this.deviceAddress_)
+ .then(function(device) {
+ if (this.descriptorId_) {
+ return device.writeValueForDescriptor(
+ this.serviceId_, this.characteristicId_, this.descriptorId_,
+ this.value_.getArray());
+ }
+
+ return device.writeValueForCharacteristic(
+ this.serviceId_, this.characteristicId_,
+ this.value_.getArray());
+ }.bind(this))
+ .then(function(response) {
+ this.writeBtn_.disabled = false;
+
+ if (response.result ===
+ interfaces.BluetoothDevice.GattResult.SUCCESS) {
+ Snackbar.show(
+ this.deviceAddress_ + ': Write succeeded',
+ SnackbarType.SUCCESS);
+ return;
+ }
+
+ var errorString = this.getErrorString_(response.result);
+ Snackbar.show(
+ this.deviceAddress_ + ': ' + errorString, SnackbarType.ERROR,
+ 'Retry', this.writeValue_.bind(this));
+ }.bind(this));
},
};

Powered by Google App Engine
This is Rietveld 408576698