Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1027)

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothError.cpp

Issue 2142813003: bluetooth: Avoid including non-blink mojo bindings in blink code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Go back to static cast Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 {
11 11
12 DOMException* BluetoothError::take(ScriptPromiseResolver*, const WebBluetoothErr or& webError) 12 DOMException* BluetoothError::take(ScriptPromiseResolver*, int32_t webError)
13 { 13 {
14 switch (webError) { 14 switch (static_cast<mojom::blink::WebBluetoothError>(webError)) {
15 case WebBluetoothError::SUCCESS: 15 case mojom::blink::WebBluetoothError::SUCCESS:
16 ASSERT_NOT_REACHED(); 16 ASSERT_NOT_REACHED();
17 return DOMException::create(UnknownError); 17 return DOMException::create(UnknownError);
18 #define MAP_ERROR(enumeration, name, message) \ 18 #define MAP_ERROR(enumeration, name, message) \
19 case WebBluetoothError::enumeration: \ 19 case mojom::blink::WebBluetoothError::enumeration: \
20 return DOMException::create(name, message) 20 return DOMException::create(name, message)
21 21
22 // InvalidModificationErrors: 22 // InvalidModificationErrors:
23 MAP_ERROR(GATT_INVALID_ATTRIBUTE_LENGTH, InvalidModificationError, "GATT Error: invalid attribute length."); 23 MAP_ERROR(GATT_INVALID_ATTRIBUTE_LENGTH, InvalidModificationError, "GATT Error: invalid attribute length.");
24 24
25 // InvalidStateErrors: 25 // InvalidStateErrors:
26 MAP_ERROR(SERVICE_NO_LONGER_EXISTS, InvalidStateError, "GATT Service no longer exists."); 26 MAP_ERROR(SERVICE_NO_LONGER_EXISTS, InvalidStateError, "GATT Service no longer exists.");
27 MAP_ERROR(CHARACTERISTIC_NO_LONGER_EXISTS, InvalidStateError, "GATT Char acteristic no longer exists."); 27 MAP_ERROR(CHARACTERISTIC_NO_LONGER_EXISTS, InvalidStateError, "GATT Char acteristic no longer exists.");
28 28
29 // NetworkErrors: 29 // NetworkErrors:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 MAP_ERROR(REQUEST_DEVICE_WITHOUT_FRAME, SecurityError, "No window to sho w the requestDevice() dialog."); 78 MAP_ERROR(REQUEST_DEVICE_WITHOUT_FRAME, SecurityError, "No window to sho w the requestDevice() dialog.");
79 79
80 #undef MAP_ERROR 80 #undef MAP_ERROR
81 } 81 }
82 82
83 ASSERT_NOT_REACHED(); 83 ASSERT_NOT_REACHED();
84 return DOMException::create(UnknownError); 84 return DOMException::create(UnknownError);
85 } 85 }
86 86
87 } // namespace blink 87 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698