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

Side by Side Diff: content/browser/bluetooth/cache_query_result.h

Issue 1861013005: bluetooth: Move GetCharacteristic(s) over to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-separate-tests-read-value
Patch Set: Merge Created 4 years, 8 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_
6 #define CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_
7
8 #include "content/browser/bluetooth/bluetooth_metrics.h"
9 #include "content/common/bluetooth/bluetooth_messages.h"
10
11 namespace device {
12 class BluetoothDevice;
13 class BluetoothGattService;
14 class BluetoothGattCharacteristic;
15 }
16
17 namespace content {
18
19 // Struct that holds the result of a cache query.
20 //
21 // WebBluetoothServiceImpl and BluetoothDispatcherHost have functions
22 // that return a CacheQueryResult so we make a separate header for it.
23 // TODO(ortuno): Move into WebBluetoothServiceImpl once we move all functions
24 // off BluetoothDispatcherHost.
25 // https://crbug.com/508771
26 struct CacheQueryResult {
27 CacheQueryResult() : outcome(CacheQueryOutcome::SUCCESS) {}
28
29 explicit CacheQueryResult(CacheQueryOutcome outcome) : outcome(outcome) {}
30
31 ~CacheQueryResult() {}
32
33 blink::WebBluetoothError GetWebError() const {
34 switch (outcome) {
35 case CacheQueryOutcome::SUCCESS:
36 case CacheQueryOutcome::BAD_RENDERER:
37 NOTREACHED();
38 return blink::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE;
39 case CacheQueryOutcome::NO_DEVICE:
40 return blink::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE;
41 case CacheQueryOutcome::NO_SERVICE:
42 return blink::WebBluetoothError::SERVICE_NO_LONGER_EXISTS;
43 case CacheQueryOutcome::NO_CHARACTERISTIC:
44 return blink::WebBluetoothError::CHARACTERISTIC_NO_LONGER_EXISTS;
45 }
46 NOTREACHED();
47 return blink::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE;
48 }
49
50 device::BluetoothDevice* device = nullptr;
51 device::BluetoothGattService* service = nullptr;
52 device::BluetoothGattCharacteristic* characteristic = nullptr;
53 CacheQueryOutcome outcome;
54 };
55
56 } // namespace content
57
58 #endif // CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698