Chromium Code Reviews| 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( |
| 14 ScriptPromiseResolver*, | 13 ScriptPromiseResolver*, |
| 15 int32_t | 14 mojom::blink::WebBluetoothResult |
| 16 webError /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */) { | 15 error /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */) { |
|
Reilly Grant (use Gerrit)
2016/12/20 02:08:17
Same here.
juncai
2016/12/20 22:33:42
Done.
| |
| 17 switch (static_cast<mojom::blink::WebBluetoothResult>(webError)) { | 16 switch (error) { |
| 18 case mojom::blink::WebBluetoothResult::SUCCESS: | 17 case mojom::blink::WebBluetoothResult::SUCCESS: |
| 19 ASSERT_NOT_REACHED(); | 18 ASSERT_NOT_REACHED(); |
| 20 return DOMException::create(UnknownError); | 19 return DOMException::create(UnknownError); |
| 21 #define MAP_ERROR(enumeration, name, message) \ | 20 #define MAP_ERROR(enumeration, name, message) \ |
| 22 case mojom::blink::WebBluetoothResult::enumeration: \ | 21 case mojom::blink::WebBluetoothResult::enumeration: \ |
| 23 return DOMException::create(name, message) | 22 return DOMException::create(name, message) |
| 24 | 23 |
| 25 // InvalidModificationErrors: | 24 // InvalidModificationErrors: |
| 26 MAP_ERROR(GATT_INVALID_ATTRIBUTE_LENGTH, InvalidModificationError, | 25 MAP_ERROR(GATT_INVALID_ATTRIBUTE_LENGTH, InvalidModificationError, |
| 27 "GATT Error: invalid attribute length."); | 26 "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."); | 137 "No window to show the requestDevice() dialog."); |
| 139 | 138 |
| 140 #undef MAP_ERROR | 139 #undef MAP_ERROR |
| 141 } | 140 } |
| 142 | 141 |
| 143 ASSERT_NOT_REACHED(); | 142 ASSERT_NOT_REACHED(); |
| 144 return DOMException::create(UnknownError); | 143 return DOMException::create(UnknownError); |
| 145 } | 144 } |
| 146 | 145 |
| 147 } // namespace blink | 146 } // namespace blink |
| OLD | NEW |