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

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

Issue 2394423002: bluetooth: Rename blink::mojom::WebBluetoothError (Closed)
Patch Set: bluetooth: Rename blink::mojom::WebBluetoothError Created 4 years, 2 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 #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
11 namespace blink { 11 namespace blink {
12 12
13 DOMException* BluetoothError::take( 13 DOMException* BluetoothError::take(
14 ScriptPromiseResolver*, 14 ScriptPromiseResolver*,
15 int32_t 15 int32_t
16 webError /* Corresponds to WebBluetoothError in web_bluetooth.mojom */) { 16 webError /* Corresponds to WebBluetoothResult in web_bluetooth.mojom */) {
17 switch (static_cast<mojom::blink::WebBluetoothError>(webError)) { 17 switch (static_cast<mojom::blink::WebBluetoothResult>(webError)) {
18 case mojom::blink::WebBluetoothError::SUCCESS: 18 case mojom::blink::WebBluetoothResult::SUCCESS:
19 ASSERT_NOT_REACHED(); 19 ASSERT_NOT_REACHED();
20 return DOMException::create(UnknownError); 20 return DOMException::create(UnknownError);
21 #define MAP_ERROR(enumeration, name, message) \ 21 #define MAP_ERROR(enumeration, name, message) \
22 case mojom::blink::WebBluetoothError::enumeration: \ 22 case mojom::blink::WebBluetoothResult::enumeration: \
23 return DOMException::create(name, message) 23 return DOMException::create(name, message)
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,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 "No window to show the requestDevice() dialog."); 134 "No window to show the requestDevice() dialog.");
135 135
136 #undef MAP_ERROR 136 #undef MAP_ERROR
137 } 137 }
138 138
139 ASSERT_NOT_REACHED(); 139 ASSERT_NOT_REACHED();
140 return DOMException::create(UnknownError); 140 return DOMException::create(UnknownError);
141 } 141 }
142 142
143 } // namespace blink 143 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698