| 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 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj
om-blink.h" | 9 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj
om-blink.h" |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // InvalidModificationErrors: | 25 // InvalidModificationErrors: |
| 26 MAP_ERROR(GATT_INVALID_ATTRIBUTE_LENGTH, InvalidModificationError, | 26 MAP_ERROR(GATT_INVALID_ATTRIBUTE_LENGTH, InvalidModificationError, |
| 27 "GATT Error: invalid attribute length."); | 27 "GATT Error: invalid attribute length."); |
| 28 | 28 |
| 29 // InvalidStateErrors: | 29 // InvalidStateErrors: |
| 30 MAP_ERROR(SERVICE_NO_LONGER_EXISTS, InvalidStateError, | 30 MAP_ERROR(SERVICE_NO_LONGER_EXISTS, InvalidStateError, |
| 31 "GATT Service no longer exists."); | 31 "GATT Service no longer exists."); |
| 32 MAP_ERROR(CHARACTERISTIC_NO_LONGER_EXISTS, InvalidStateError, | 32 MAP_ERROR(CHARACTERISTIC_NO_LONGER_EXISTS, InvalidStateError, |
| 33 "GATT Characteristic no longer exists."); | 33 "GATT Characteristic no longer exists."); |
| 34 MAP_ERROR(DESCRIPTOR_NO_LONGER_EXISTS, InvalidStateError, |
| 35 "GATT Descriptor no longer exists."); |
| 34 | 36 |
| 35 // NetworkErrors: | 37 // NetworkErrors: |
| 36 MAP_ERROR(CONNECT_ALREADY_IN_PROGRESS, NetworkError, | 38 MAP_ERROR(CONNECT_ALREADY_IN_PROGRESS, NetworkError, |
| 37 "Connection already in progress."); | 39 "Connection already in progress."); |
| 38 MAP_ERROR(CONNECT_ATTRIBUTE_LENGTH_INVALID, NetworkError, | 40 MAP_ERROR(CONNECT_ATTRIBUTE_LENGTH_INVALID, NetworkError, |
| 39 "Write operation exceeds the maximum length of the attribute."); | 41 "Write operation exceeds the maximum length of the attribute."); |
| 40 MAP_ERROR(CONNECT_AUTH_CANCELED, NetworkError, | 42 MAP_ERROR(CONNECT_AUTH_CANCELED, NetworkError, |
| 41 "Authentication canceled."); | 43 "Authentication canceled."); |
| 42 MAP_ERROR(CONNECT_AUTH_FAILED, NetworkError, "Authentication failed."); | 44 MAP_ERROR(CONNECT_AUTH_FAILED, NetworkError, "Authentication failed."); |
| 43 MAP_ERROR(CONNECT_AUTH_REJECTED, NetworkError, | 45 MAP_ERROR(CONNECT_AUTH_REJECTED, NetworkError, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 CHOOSER_NOT_SHOWN_USER_DENIED_PERMISSION_TO_SCAN, NotFoundError, | 90 CHOOSER_NOT_SHOWN_USER_DENIED_PERMISSION_TO_SCAN, NotFoundError, |
| 89 "User denied the browser permission to scan for Bluetooth devices."); | 91 "User denied the browser permission to scan for Bluetooth devices."); |
| 90 MAP_ERROR(SERVICE_NOT_FOUND, NotFoundError, | 92 MAP_ERROR(SERVICE_NOT_FOUND, NotFoundError, |
| 91 "No Services with specified UUID found in Device."); | 93 "No Services with specified UUID found in Device."); |
| 92 MAP_ERROR(NO_SERVICES_FOUND, NotFoundError, | 94 MAP_ERROR(NO_SERVICES_FOUND, NotFoundError, |
| 93 "No Services found in device."); | 95 "No Services found in device."); |
| 94 MAP_ERROR(CHARACTERISTIC_NOT_FOUND, NotFoundError, | 96 MAP_ERROR(CHARACTERISTIC_NOT_FOUND, NotFoundError, |
| 95 "No Characteristics with specified UUID found in Service."); | 97 "No Characteristics with specified UUID found in Service."); |
| 96 MAP_ERROR(NO_CHARACTERISTICS_FOUND, NotFoundError, | 98 MAP_ERROR(NO_CHARACTERISTICS_FOUND, NotFoundError, |
| 97 "No Characteristics found in service."); | 99 "No Characteristics found in service."); |
| 100 MAP_ERROR(DESCRIPTOR_NOT_FOUND, NotFoundError, |
| 101 "No Descriptors with specified UUID found in Characteristic."); |
| 102 MAP_ERROR(NO_DESCRIPTORS_FOUND, NotFoundError, |
| 103 "No Descriptors found in Characteristic."); |
| 98 MAP_ERROR(BLUETOOTH_LOW_ENERGY_NOT_AVAILABLE, NotFoundError, | 104 MAP_ERROR(BLUETOOTH_LOW_ENERGY_NOT_AVAILABLE, NotFoundError, |
| 99 "Bluetooth Low Energy not available."); | 105 "Bluetooth Low Energy not available."); |
| 100 | 106 |
| 101 // NotSupportedErrors: | 107 // NotSupportedErrors: |
| 102 MAP_ERROR(GATT_UNKNOWN_ERROR, NotSupportedError, "GATT Error Unknown."); | 108 MAP_ERROR(GATT_UNKNOWN_ERROR, NotSupportedError, "GATT Error Unknown."); |
| 103 MAP_ERROR(GATT_UNKNOWN_FAILURE, NotSupportedError, | 109 MAP_ERROR(GATT_UNKNOWN_FAILURE, NotSupportedError, |
| 104 "GATT operation failed for unknown reason."); | 110 "GATT operation failed for unknown reason."); |
| 105 MAP_ERROR(GATT_NOT_PERMITTED, NotSupportedError, | 111 MAP_ERROR(GATT_NOT_PERMITTED, NotSupportedError, |
| 106 "GATT operation not permitted."); | 112 "GATT operation not permitted."); |
| 107 MAP_ERROR(GATT_NOT_SUPPORTED, NotSupportedError, | 113 MAP_ERROR(GATT_NOT_SUPPORTED, NotSupportedError, |
| 108 "GATT Error: Not supported."); | 114 "GATT Error: Not supported."); |
| 109 MAP_ERROR(GATT_UNTRANSLATED_ERROR_CODE, NotSupportedError, | 115 MAP_ERROR(GATT_UNTRANSLATED_ERROR_CODE, NotSupportedError, |
| 110 "GATT Error: Unknown GattErrorCode."); | 116 "GATT Error: Unknown GattErrorCode."); |
| 111 | 117 |
| 112 // SecurityErrors: | 118 // SecurityErrors: |
| 113 MAP_ERROR(GATT_NOT_AUTHORIZED, SecurityError, | 119 MAP_ERROR(GATT_NOT_AUTHORIZED, SecurityError, |
| 114 "GATT operation not authorized."); | 120 "GATT operation not authorized."); |
| 121 MAP_ERROR(BLACKLISTED_DESCRIPTOR_UUID, SecurityError, |
| 122 "getDescriptor(s) called with blacklisted UUID. " |
| 123 "https://goo.gl/4NeimX"); |
| 115 MAP_ERROR(BLACKLISTED_CHARACTERISTIC_UUID, SecurityError, | 124 MAP_ERROR(BLACKLISTED_CHARACTERISTIC_UUID, SecurityError, |
| 116 "getCharacteristic(s) called with blacklisted UUID. " | 125 "getCharacteristic(s) called with blacklisted UUID. " |
| 117 "https://goo.gl/4NeimX"); | 126 "https://goo.gl/4NeimX"); |
| 118 MAP_ERROR(BLACKLISTED_READ, SecurityError, | 127 MAP_ERROR(BLACKLISTED_READ, SecurityError, |
| 119 "readValue() called on blacklisted object marked " | 128 "readValue() called on blacklisted object marked " |
| 120 "exclude-reads. https://goo.gl/4NeimX"); | 129 "exclude-reads. https://goo.gl/4NeimX"); |
| 121 MAP_ERROR(BLACKLISTED_WRITE, SecurityError, | 130 MAP_ERROR(BLACKLISTED_WRITE, SecurityError, |
| 122 "writeValue() called on blacklisted object marked " | 131 "writeValue() called on blacklisted object marked " |
| 123 "exclude-writes. https://goo.gl/4NeimX"); | 132 "exclude-writes. https://goo.gl/4NeimX"); |
| 124 MAP_ERROR(NOT_ALLOWED_TO_ACCESS_ANY_SERVICE, SecurityError, | 133 MAP_ERROR(NOT_ALLOWED_TO_ACCESS_ANY_SERVICE, SecurityError, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 138 "No window to show the requestDevice() dialog."); | 147 "No window to show the requestDevice() dialog."); |
| 139 | 148 |
| 140 #undef MAP_ERROR | 149 #undef MAP_ERROR |
| 141 } | 150 } |
| 142 | 151 |
| 143 ASSERT_NOT_REACHED(); | 152 ASSERT_NOT_REACHED(); |
| 144 return DOMException::create(UnknownError); | 153 return DOMException::create(UnknownError); |
| 145 } | 154 } |
| 146 | 155 |
| 147 } // namespace blink | 156 } // namespace blink |
| OLD | NEW |