| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "modules/bluetooth/BluetoothError.h" | 5 #include "modules/bluetooth/BluetoothError.h" |
| 6 | 6 |
| 7 #include "core/dom/DOMException.h" | 7 #include "core/dom/DOMException.h" |
| 8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
| 9 | 9 |
| 10 namespace blink { | 10 namespace blink { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 MAP_ERROR(CONNECT_WRITE_NOT_PERMITTED, NetworkError, "GATT write operati
on is not permitted."); | 44 MAP_ERROR(CONNECT_WRITE_NOT_PERMITTED, NetworkError, "GATT write operati
on is not permitted."); |
| 45 MAP_ERROR(DEVICE_NO_LONGER_IN_RANGE, NetworkError, "Bluetooth Device is
no longer in range."); | 45 MAP_ERROR(DEVICE_NO_LONGER_IN_RANGE, NetworkError, "Bluetooth Device is
no longer in range."); |
| 46 MAP_ERROR(GATT_NOT_PAIRED, NetworkError, "GATT Error: Not paired."); | 46 MAP_ERROR(GATT_NOT_PAIRED, NetworkError, "GATT Error: Not paired."); |
| 47 MAP_ERROR(GATT_OPERATION_IN_PROGRESS, NetworkError, "GATT operation alre
ady in progress."); | 47 MAP_ERROR(GATT_OPERATION_IN_PROGRESS, NetworkError, "GATT operation alre
ady in progress."); |
| 48 MAP_ERROR(UNTRANSLATED_CONNECT_ERROR_CODE, NetworkError, "Unknown Connec
tErrorCode."); | 48 MAP_ERROR(UNTRANSLATED_CONNECT_ERROR_CODE, NetworkError, "Unknown Connec
tErrorCode."); |
| 49 | 49 |
| 50 // NotFoundErrors: | 50 // NotFoundErrors: |
| 51 MAP_ERROR(NO_BLUETOOTH_ADAPTER, NotFoundError, "Bluetooth adapter not av
ailable."); | 51 MAP_ERROR(NO_BLUETOOTH_ADAPTER, NotFoundError, "Bluetooth adapter not av
ailable."); |
| 52 MAP_ERROR(CHOSEN_DEVICE_VANISHED, NotFoundError, "User selected a device
that doesn't exist anymore."); | 52 MAP_ERROR(CHOSEN_DEVICE_VANISHED, NotFoundError, "User selected a device
that doesn't exist anymore."); |
| 53 MAP_ERROR(CHOOSER_CANCELLED, NotFoundError, "User cancelled the requestD
evice() chooser."); | 53 MAP_ERROR(CHOOSER_CANCELLED, NotFoundError, "User cancelled the requestD
evice() chooser."); |
| 54 MAP_ERROR(CHOOSER_DISABLED, NotFoundError, "User or their enterprise pol
icy has disabled Web Bluetooth globally."); | 54 MAP_ERROR(CHOOSER_NOT_SHOWN_API_GLOBALLY_DISABLED, NotFoundError, "Web B
luetooth API globally disabled."); |
| 55 MAP_ERROR(CHOOSER_DENIED_PERMISSION, NotFoundError, "User denied the bro
wser permission to scan for Bluetooth devices."); | 55 MAP_ERROR(CHOOSER_NOT_SHOWN_API_LOCALLY_DISABLED, NotFoundError, "User o
r their enterprise policy has disabled Web Bluetooth."); |
| 56 MAP_ERROR(CHOOSER_NOT_SHOWN_USER_DENIED_PERMISSION_TO_SCAN, NotFoundErro
r, "User denied the browser permission to scan for Bluetooth devices."); |
| 56 MAP_ERROR(SERVICE_NOT_FOUND, NotFoundError, "Service not found in device
."); | 57 MAP_ERROR(SERVICE_NOT_FOUND, NotFoundError, "Service not found in device
."); |
| 57 MAP_ERROR(CHARACTERISTIC_NOT_FOUND, NotFoundError, "No Characteristics w
ith specified UUID found in Service."); | 58 MAP_ERROR(CHARACTERISTIC_NOT_FOUND, NotFoundError, "No Characteristics w
ith specified UUID found in Service."); |
| 58 MAP_ERROR(NO_CHARACTERISTICS_FOUND, NotFoundError, "No Characteristics f
ound in service."); | 59 MAP_ERROR(NO_CHARACTERISTICS_FOUND, NotFoundError, "No Characteristics f
ound in service."); |
| 59 | 60 |
| 60 // NotSupportedErrors: | 61 // NotSupportedErrors: |
| 61 MAP_ERROR(GATT_UNKNOWN_ERROR, NotSupportedError, "GATT Error Unknown."); | 62 MAP_ERROR(GATT_UNKNOWN_ERROR, NotSupportedError, "GATT Error Unknown."); |
| 62 MAP_ERROR(GATT_UNKNOWN_FAILURE, NotSupportedError, "GATT operation faile
d for unknown reason."); | 63 MAP_ERROR(GATT_UNKNOWN_FAILURE, NotSupportedError, "GATT operation faile
d for unknown reason."); |
| 63 MAP_ERROR(GATT_NOT_PERMITTED, NotSupportedError, "GATT operation not per
mitted."); | 64 MAP_ERROR(GATT_NOT_PERMITTED, NotSupportedError, "GATT operation not per
mitted."); |
| 64 MAP_ERROR(GATT_NOT_SUPPORTED, NotSupportedError, "GATT Error: Not suppor
ted."); | 65 MAP_ERROR(GATT_NOT_SUPPORTED, NotSupportedError, "GATT Error: Not suppor
ted."); |
| 65 MAP_ERROR(GATT_UNTRANSLATED_ERROR_CODE, NotSupportedError, "GATT Error:
Unknown GattErrorCode."); | 66 MAP_ERROR(GATT_UNTRANSLATED_ERROR_CODE, NotSupportedError, "GATT Error:
Unknown GattErrorCode."); |
| 66 | 67 |
| 67 // SecurityErrors: | 68 // SecurityErrors: |
| 68 MAP_ERROR(GATT_NOT_AUTHORIZED, SecurityError, "GATT operation not author
ized."); | 69 MAP_ERROR(GATT_NOT_AUTHORIZED, SecurityError, "GATT operation not author
ized."); |
| 69 MAP_ERROR(BLACKLISTED_CHARACTERISTIC_UUID, SecurityError, "getCharacteri
stic(s) called with blacklisted UUID. https://goo.gl/4NeimX"); | 70 MAP_ERROR(BLACKLISTED_CHARACTERISTIC_UUID, SecurityError, "getCharacteri
stic(s) called with blacklisted UUID. https://goo.gl/4NeimX"); |
| 70 MAP_ERROR(BLACKLISTED_READ, SecurityError, "readValue() called on blackl
isted object marked exclude-reads. https://goo.gl/4NeimX"); | 71 MAP_ERROR(BLACKLISTED_READ, SecurityError, "readValue() called on blackl
isted object marked exclude-reads. https://goo.gl/4NeimX"); |
| 71 MAP_ERROR(BLACKLISTED_WRITE, SecurityError, "writeValue() called on blac
klisted object marked exclude-writes. https://goo.gl/4NeimX"); | 72 MAP_ERROR(BLACKLISTED_WRITE, SecurityError, "writeValue() called on blac
klisted object marked exclude-writes. https://goo.gl/4NeimX"); |
| 72 MAP_ERROR(NOT_ALLOWED_TO_ACCESS_SERVICE, SecurityError, "Origin is not a
llowed to access the service. Remember to add the service to a filter or to opti
onalServices in requestDevice()."); | 73 MAP_ERROR(NOT_ALLOWED_TO_ACCESS_SERVICE, SecurityError, "Origin is not a
llowed to access the service. Remember to add the service to a filter or to opti
onalServices in requestDevice()."); |
| 73 MAP_ERROR(REQUEST_DEVICE_WITH_BLACKLISTED_UUID, SecurityError, "requestD
evice() called with a filter containing a blacklisted UUID. https://goo.gl/4Neim
X"); | 74 MAP_ERROR(REQUEST_DEVICE_WITH_BLACKLISTED_UUID, SecurityError, "requestD
evice() called with a filter containing a blacklisted UUID. https://goo.gl/4Neim
X"); |
| 74 MAP_ERROR(REQUEST_DEVICE_WITH_UNIQUE_ORIGIN, SecurityError, "requestDevi
ce() called from sandboxed or otherwise unique origin."); | 75 MAP_ERROR(REQUEST_DEVICE_WITH_UNIQUE_ORIGIN, SecurityError, "requestDevi
ce() called from sandboxed or otherwise unique origin."); |
| 75 MAP_ERROR(REQUEST_DEVICE_WITHOUT_FRAME, SecurityError, "No window to sho
w the requestDevice() dialog."); | 76 MAP_ERROR(REQUEST_DEVICE_WITHOUT_FRAME, SecurityError, "No window to sho
w the requestDevice() dialog."); |
| 76 | 77 |
| 77 #undef MAP_ERROR | 78 #undef MAP_ERROR |
| 78 } | 79 } |
| 79 | 80 |
| 80 ASSERT_NOT_REACHED(); | 81 ASSERT_NOT_REACHED(); |
| 81 return DOMException::create(UnknownError); | 82 return DOMException::create(UnknownError); |
| 82 } | 83 } |
| 83 | 84 |
| 84 } // namespace blink | 85 } // namespace blink |
| OLD | NEW |