| 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" | |
| 10 | 9 |
| 11 namespace blink { | 10 namespace blink { |
| 12 | 11 |
| 13 DOMException* BluetoothError::take( | 12 DOMException* BluetoothError::take(ScriptPromiseResolver*, |
| 14 ScriptPromiseResolver*, | 13 mojom::blink::WebBluetoothResult error) { |
| 15 int32_t | 14 switch (error) { |
| 16 webError /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */)
{ | |
| 17 switch (static_cast<mojom::blink::WebBluetoothResult>(webError)) { | |
| 18 case mojom::blink::WebBluetoothResult::SUCCESS: | 15 case mojom::blink::WebBluetoothResult::SUCCESS: |
| 19 ASSERT_NOT_REACHED(); | 16 ASSERT_NOT_REACHED(); |
| 20 return DOMException::create(UnknownError); | 17 return DOMException::create(UnknownError); |
| 21 #define MAP_ERROR(enumeration, name, message) \ | 18 #define MAP_ERROR(enumeration, name, message) \ |
| 22 case mojom::blink::WebBluetoothResult::enumeration: \ | 19 case mojom::blink::WebBluetoothResult::enumeration: \ |
| 23 return DOMException::create(name, message) | 20 return DOMException::create(name, message) |
| 24 | 21 |
| 25 // InvalidModificationErrors: | 22 // InvalidModificationErrors: |
| 26 MAP_ERROR(GATT_INVALID_ATTRIBUTE_LENGTH, InvalidModificationError, | 23 MAP_ERROR(GATT_INVALID_ATTRIBUTE_LENGTH, InvalidModificationError, |
| 27 "GATT Error: invalid attribute length."); | 24 "GATT Error: invalid attribute length."); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 "No window to show the requestDevice() dialog."); | 135 "No window to show the requestDevice() dialog."); |
| 139 | 136 |
| 140 #undef MAP_ERROR | 137 #undef MAP_ERROR |
| 141 } | 138 } |
| 142 | 139 |
| 143 ASSERT_NOT_REACHED(); | 140 ASSERT_NOT_REACHED(); |
| 144 return DOMException::create(UnknownError); | 141 return DOMException::create(UnknownError); |
| 145 } | 142 } |
| 146 | 143 |
| 147 } // namespace blink | 144 } // namespace blink |
| OLD | NEW |