Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | |
|
ortuno
2016/10/07 05:32:52
nit: I think you added this line by accident :)
dougt
2016/10/07 05:44:38
Acknowledged.
| |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 4 | 5 |
| 5 #include "modules/bluetooth/BluetoothError.h" | 6 #include "modules/bluetooth/BluetoothError.h" |
| 6 | 7 |
| 7 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
| 8 #include "core/dom/ExceptionCode.h" | 9 #include "core/dom/ExceptionCode.h" |
| 9 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om-blink.h" | 10 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om-blink.h" |
| 10 | 11 |
| 11 namespace blink { | 12 namespace blink { |
| 12 | 13 |
| 13 DOMException* BluetoothError::take( | 14 DOMException* BluetoothError::take( |
| 14 ScriptPromiseResolver*, | 15 ScriptPromiseResolver*, |
| 15 int32_t | 16 int32_t |
| 16 webError /* Corresponds to WebBluetoothError in web_bluetooth.mojom */) { | 17 webError /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */) { |
| 17 switch (static_cast<mojom::blink::WebBluetoothError>(webError)) { | 18 switch (static_cast<mojom::blink::WebBluetoothResult>(webError)) { |
| 18 case mojom::blink::WebBluetoothError::SUCCESS: | 19 case mojom::blink::WebBluetoothResult::SUCCESS: |
| 19 ASSERT_NOT_REACHED(); | 20 ASSERT_NOT_REACHED(); |
| 20 return DOMException::create(UnknownError); | 21 return DOMException::create(UnknownError); |
| 21 #define MAP_ERROR(enumeration, name, message) \ | 22 #define MAP_ERROR(enumeration, name, message) \ |
| 22 case mojom::blink::WebBluetoothError::enumeration: \ | 23 case mojom::blink::WebBluetoothResult::enumeration: \ |
| 23 return DOMException::create(name, message) | 24 return DOMException::create(name, message) |
| 24 | 25 |
| 25 // InvalidModificationErrors: | 26 // InvalidModificationErrors: |
| 26 MAP_ERROR(GATT_INVALID_ATTRIBUTE_LENGTH, InvalidModificationError, | 27 MAP_ERROR(GATT_INVALID_ATTRIBUTE_LENGTH, InvalidModificationError, |
| 27 "GATT Error: invalid attribute length."); | 28 "GATT Error: invalid attribute length."); |
| 28 | 29 |
| 29 // InvalidStateErrors: | 30 // InvalidStateErrors: |
| 30 MAP_ERROR(SERVICE_NO_LONGER_EXISTS, InvalidStateError, | 31 MAP_ERROR(SERVICE_NO_LONGER_EXISTS, InvalidStateError, |
| 31 "GATT Service no longer exists."); | 32 "GATT Service no longer exists."); |
| 32 MAP_ERROR(CHARACTERISTIC_NO_LONGER_EXISTS, InvalidStateError, | 33 MAP_ERROR(CHARACTERISTIC_NO_LONGER_EXISTS, InvalidStateError, |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 "No window to show the requestDevice() dialog."); | 133 "No window to show the requestDevice() dialog."); |
| 133 | 134 |
| 134 #undef MAP_ERROR | 135 #undef MAP_ERROR |
| 135 } | 136 } |
| 136 | 137 |
| 137 ASSERT_NOT_REACHED(); | 138 ASSERT_NOT_REACHED(); |
| 138 return DOMException::create(UnknownError); | 139 return DOMException::create(UnknownError); |
| 139 } | 140 } |
| 140 | 141 |
| 141 } // namespace blink | 142 } // namespace blink |
| OLD | NEW |