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

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

Issue 2466223002: Implement WebBluetooth getDescriptor[s] (Closed)
Patch Set: Rebase Created 4 years 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 2016 The Chromium Authors. All rights reserved. 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 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 #ifndef CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_ 5 #ifndef CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_
6 #define CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_ 6 #define CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_
7 7
8 #include "content/browser/bluetooth/bluetooth_metrics.h" 8 #include "content/browser/bluetooth/bluetooth_metrics.h"
9 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h" 9 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj om.h"
10 10
11 namespace device { 11 namespace device {
12 class BluetoothDevice; 12 class BluetoothDevice;
13 class BluetoothRemoteGattService; 13 class BluetoothRemoteGattService;
14 class BluetoothRemoteGattCharacteristic; 14 class BluetoothRemoteGattCharacteristic;
15 class BluetoothRemoteGattDescriptor;
ortuno 2016/12/02 06:14:50 nit: Similarly here. I don't think we need these c
dougt 2016/12/02 18:31:27 Done.
15 } 16 }
16 17
17 namespace content { 18 namespace content {
18 19
19 // Struct that holds the result of a cache query. 20 // Struct that holds the result of a cache query.
20 // 21 //
21 // TODO(ortuno): Move into WebBluetoothServiceImpl. 22 // TODO(ortuno): Move into WebBluetoothServiceImpl.
22 // https://crbug.com/508771 23 // https://crbug.com/508771
23 struct CacheQueryResult { 24 struct CacheQueryResult {
24 CacheQueryResult() : outcome(CacheQueryOutcome::SUCCESS) {} 25 CacheQueryResult() : outcome(CacheQueryOutcome::SUCCESS) {}
25 26
26 explicit CacheQueryResult(CacheQueryOutcome outcome) : outcome(outcome) {} 27 explicit CacheQueryResult(CacheQueryOutcome outcome) : outcome(outcome) {}
27 28
28 ~CacheQueryResult() {} 29 ~CacheQueryResult() {}
29 30
30 blink::mojom::WebBluetoothResult GetWebResult() const { 31 blink::mojom::WebBluetoothResult GetWebResult() const {
31 switch (outcome) { 32 switch (outcome) {
32 case CacheQueryOutcome::SUCCESS: 33 case CacheQueryOutcome::SUCCESS:
33 case CacheQueryOutcome::BAD_RENDERER: 34 case CacheQueryOutcome::BAD_RENDERER:
34 NOTREACHED(); 35 NOTREACHED();
35 return blink::mojom::WebBluetoothResult::DEVICE_NO_LONGER_IN_RANGE; 36 return blink::mojom::WebBluetoothResult::DEVICE_NO_LONGER_IN_RANGE;
36 case CacheQueryOutcome::NO_DEVICE: 37 case CacheQueryOutcome::NO_DEVICE:
37 return blink::mojom::WebBluetoothResult::DEVICE_NO_LONGER_IN_RANGE; 38 return blink::mojom::WebBluetoothResult::DEVICE_NO_LONGER_IN_RANGE;
38 case CacheQueryOutcome::NO_SERVICE: 39 case CacheQueryOutcome::NO_SERVICE:
39 return blink::mojom::WebBluetoothResult::SERVICE_NO_LONGER_EXISTS; 40 return blink::mojom::WebBluetoothResult::SERVICE_NO_LONGER_EXISTS;
40 case CacheQueryOutcome::NO_CHARACTERISTIC: 41 case CacheQueryOutcome::NO_CHARACTERISTIC:
41 return blink::mojom::WebBluetoothResult:: 42 return blink::mojom::WebBluetoothResult::
42 CHARACTERISTIC_NO_LONGER_EXISTS; 43 CHARACTERISTIC_NO_LONGER_EXISTS;
44 case CacheQueryOutcome::NO_DESCRIPTOR:
45 return blink::mojom::WebBluetoothResult::DESCRIPTOR_NO_LONGER_EXISTS;
43 } 46 }
44 NOTREACHED(); 47 NOTREACHED();
45 return blink::mojom::WebBluetoothResult::DEVICE_NO_LONGER_IN_RANGE; 48 return blink::mojom::WebBluetoothResult::DEVICE_NO_LONGER_IN_RANGE;
46 } 49 }
47 50
48 device::BluetoothDevice* device = nullptr; 51 device::BluetoothDevice* device = nullptr;
49 device::BluetoothRemoteGattService* service = nullptr; 52 device::BluetoothRemoteGattService* service = nullptr;
50 device::BluetoothRemoteGattCharacteristic* characteristic = nullptr; 53 device::BluetoothRemoteGattCharacteristic* characteristic = nullptr;
54 device::BluetoothRemoteGattDescriptor* descriptor = nullptr;
51 CacheQueryOutcome outcome; 55 CacheQueryOutcome outcome;
52 }; 56 };
53 57
54 } // namespace content 58 } // namespace content
55 59
56 #endif // CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_ 60 #endif // CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698