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

Unified Diff: chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc

Issue 1464443002: bluetooth: android: Add BluetoothDevice::ConnectErrorCode enums (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: VI Created 4 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/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
diff --git a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
index 81a3c702ea8fbcdd1c4fea042b6f31d0830c4363..7b257fdbed2b94c1ae1359718f3abc8fec791e79 100644
--- a/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
+++ b/chrome/browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_event_router.cc
@@ -1309,19 +1309,57 @@ void BluetoothLowEnergyEventRouter::OnConnectError(
connecting_devices_.erase(connect_id);
Status error_status = kStatusErrorFailed;
- if (error_code == BluetoothDevice::ERROR_INPROGRESS) {
- error_status = kStatusErrorInProgress;
- } else if (error_code == BluetoothDevice::ERROR_AUTH_FAILED ||
- error_code == BluetoothDevice::ERROR_AUTH_REJECTED) {
- error_status = kStatusErrorAuthenticationFailed;
- } else if (error_code == BluetoothDevice::ERROR_AUTH_CANCELED) {
- error_status = kStatusErrorCanceled;
- } else if (error_code == BluetoothDevice::ERROR_AUTH_TIMEOUT) {
- error_status = kStatusErrorTimeout;
- } else if (error_code == BluetoothDevice::ERROR_UNSUPPORTED_DEVICE) {
- error_status = kStatusErrorUnsupportedDevice;
- }
- // ERROR_UNKNOWN and ERROR_FAILED defaulted to kStatusErrorFailed
+ switch (error_code) {
+ case BluetoothDevice::ERROR_ATTRIBUTE_LENGTH_INVALID:
+ error_status = kStatusErrorAttributeLengthInvalid;
+ break;
+ case BluetoothDevice::ERROR_AUTH_CANCELED:
+ error_status = kStatusErrorCanceled;
+ break;
+ case BluetoothDevice::ERROR_AUTH_FAILED:
+ error_status = kStatusErrorAuthenticationFailed;
+ break;
+ case BluetoothDevice::ERROR_AUTH_REJECTED:
+ error_status = kStatusErrorAuthenticationFailed;
+ break;
+ case BluetoothDevice::ERROR_AUTH_TIMEOUT:
+ error_status = kStatusErrorTimeout;
+ break;
+ case BluetoothDevice::ERROR_CONNECTION_CONGESTED:
+ error_status = kStatusErrorConnectionCongested;
+ break;
+ case BluetoothDevice::ERROR_FAILED:
+ error_status = kStatusErrorFailed;
+ break;
+ case BluetoothDevice::ERROR_INPROGRESS:
+ error_status = kStatusErrorInProgress;
+ break;
+ case BluetoothDevice::ERROR_INSUFFICIENT_ENCRYPTION:
+ error_status = kStatusErrorInsufficientEncryption;
+ break;
+ case BluetoothDevice::ERROR_OFFSET_INVALID:
+ error_status = kStatusErrorOffsetInvalid;
+ break;
+ case BluetoothDevice::ERROR_READ_NOT_PERMITTED:
+ error_status = kStatusErrorPermissionDenied;
+ break;
+ case BluetoothDevice::ERROR_REQUEST_NOT_SUPPORTED:
+ error_status = kStatusErrorRequestNotSupported;
+ break;
+ case BluetoothDevice::ERROR_UNKNOWN:
+ error_status = kStatusErrorFailed;
+ break;
+ case BluetoothDevice::ERROR_UNSUPPORTED_DEVICE:
+ error_status = kStatusErrorUnsupportedDevice;
+ break;
+ case BluetoothDevice::ERROR_WRITE_NOT_PERMITTED:
+ error_status = kStatusErrorPermissionDenied;
+ break;
+ case BluetoothDevice::NUM_CONNECT_ERROR_CODES:
+ NOTREACHED();
+ error_status = kStatusErrorInvalidArguments;
+ break;
+ }
error_callback.Run(error_status);
}

Powered by Google App Engine
This is Rietveld 408576698