OLD | NEW |
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 "content/common/bluetooth/bluetooth_messages.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 } | 15 } |
16 | 16 |
17 namespace content { | 17 namespace content { |
18 | 18 |
19 // Struct that holds the result of a cache query. | 19 // Struct that holds the result of a cache query. |
20 // | 20 // |
21 // WebBluetoothServiceImpl and BluetoothDispatcherHost have functions | 21 // TODO(ortuno): Move into WebBluetoothServiceImpl. |
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 | 22 // https://crbug.com/508771 |
26 struct CacheQueryResult { | 23 struct CacheQueryResult { |
27 CacheQueryResult() : outcome(CacheQueryOutcome::SUCCESS) {} | 24 CacheQueryResult() : outcome(CacheQueryOutcome::SUCCESS) {} |
28 | 25 |
29 explicit CacheQueryResult(CacheQueryOutcome outcome) : outcome(outcome) {} | 26 explicit CacheQueryResult(CacheQueryOutcome outcome) : outcome(outcome) {} |
30 | 27 |
31 ~CacheQueryResult() {} | 28 ~CacheQueryResult() {} |
32 | 29 |
33 blink::WebBluetoothError GetWebError() const { | 30 blink::mojom::WebBluetoothError GetWebError() const { |
34 switch (outcome) { | 31 switch (outcome) { |
35 case CacheQueryOutcome::SUCCESS: | 32 case CacheQueryOutcome::SUCCESS: |
36 case CacheQueryOutcome::BAD_RENDERER: | 33 case CacheQueryOutcome::BAD_RENDERER: |
37 NOTREACHED(); | 34 NOTREACHED(); |
38 return blink::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE; | 35 return blink::mojom::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE; |
39 case CacheQueryOutcome::NO_DEVICE: | 36 case CacheQueryOutcome::NO_DEVICE: |
40 return blink::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE; | 37 return blink::mojom::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE; |
41 case CacheQueryOutcome::NO_SERVICE: | 38 case CacheQueryOutcome::NO_SERVICE: |
42 return blink::WebBluetoothError::SERVICE_NO_LONGER_EXISTS; | 39 return blink::mojom::WebBluetoothError::SERVICE_NO_LONGER_EXISTS; |
43 case CacheQueryOutcome::NO_CHARACTERISTIC: | 40 case CacheQueryOutcome::NO_CHARACTERISTIC: |
44 return blink::WebBluetoothError::CHARACTERISTIC_NO_LONGER_EXISTS; | 41 return blink::mojom::WebBluetoothError::CHARACTERISTIC_NO_LONGER_EXISTS; |
45 } | 42 } |
46 NOTREACHED(); | 43 NOTREACHED(); |
47 return blink::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE; | 44 return blink::mojom::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE; |
48 } | 45 } |
49 | 46 |
50 device::BluetoothDevice* device = nullptr; | 47 device::BluetoothDevice* device = nullptr; |
51 device::BluetoothRemoteGattService* service = nullptr; | 48 device::BluetoothRemoteGattService* service = nullptr; |
52 device::BluetoothRemoteGattCharacteristic* characteristic = nullptr; | 49 device::BluetoothRemoteGattCharacteristic* characteristic = nullptr; |
53 CacheQueryOutcome outcome; | 50 CacheQueryOutcome outcome; |
54 }; | 51 }; |
55 | 52 |
56 } // namespace content | 53 } // namespace content |
57 | 54 |
58 #endif // CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_ | 55 #endif // CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_ |
OLD | NEW |