| 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 "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 } | 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 // TODO(ortuno): Move into WebBluetoothServiceImpl. | 21 // TODO(ortuno): Move into WebBluetoothServiceImpl. |
| 22 // https://crbug.com/508771 | 22 // https://crbug.com/508771 |
| 23 struct CacheQueryResult { | 23 struct CacheQueryResult { |
| 24 CacheQueryResult() : outcome(CacheQueryOutcome::SUCCESS) {} | 24 CacheQueryResult() : outcome(CacheQueryOutcome::SUCCESS) {} |
| 25 | 25 |
| 26 explicit CacheQueryResult(CacheQueryOutcome outcome) : outcome(outcome) {} | 26 explicit CacheQueryResult(CacheQueryOutcome outcome) : outcome(outcome) {} |
| 27 | 27 |
| 28 ~CacheQueryResult() {} | 28 ~CacheQueryResult() {} |
| 29 | 29 |
| 30 blink::mojom::WebBluetoothError GetWebError() const { | 30 blink::mojom::WebBluetoothResult GetWebResult() const { |
| 31 switch (outcome) { | 31 switch (outcome) { |
| 32 case CacheQueryOutcome::SUCCESS: | 32 case CacheQueryOutcome::SUCCESS: |
| 33 case CacheQueryOutcome::BAD_RENDERER: | 33 case CacheQueryOutcome::BAD_RENDERER: |
| 34 NOTREACHED(); | 34 NOTREACHED(); |
| 35 return blink::mojom::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE; | 35 return blink::mojom::WebBluetoothResult::DEVICE_NO_LONGER_IN_RANGE; |
| 36 case CacheQueryOutcome::NO_DEVICE: | 36 case CacheQueryOutcome::NO_DEVICE: |
| 37 return blink::mojom::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE; | 37 return blink::mojom::WebBluetoothResult::DEVICE_NO_LONGER_IN_RANGE; |
| 38 case CacheQueryOutcome::NO_SERVICE: | 38 case CacheQueryOutcome::NO_SERVICE: |
| 39 return blink::mojom::WebBluetoothError::SERVICE_NO_LONGER_EXISTS; | 39 return blink::mojom::WebBluetoothResult::SERVICE_NO_LONGER_EXISTS; |
| 40 case CacheQueryOutcome::NO_CHARACTERISTIC: | 40 case CacheQueryOutcome::NO_CHARACTERISTIC: |
| 41 return blink::mojom::WebBluetoothError::CHARACTERISTIC_NO_LONGER_EXISTS; | 41 return blink::mojom::WebBluetoothResult:: |
| 42 CHARACTERISTIC_NO_LONGER_EXISTS; |
| 42 } | 43 } |
| 43 NOTREACHED(); | 44 NOTREACHED(); |
| 44 return blink::mojom::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE; | 45 return blink::mojom::WebBluetoothResult::DEVICE_NO_LONGER_IN_RANGE; |
| 45 } | 46 } |
| 46 | 47 |
| 47 device::BluetoothDevice* device = nullptr; | 48 device::BluetoothDevice* device = nullptr; |
| 48 device::BluetoothRemoteGattService* service = nullptr; | 49 device::BluetoothRemoteGattService* service = nullptr; |
| 49 device::BluetoothRemoteGattCharacteristic* characteristic = nullptr; | 50 device::BluetoothRemoteGattCharacteristic* characteristic = nullptr; |
| 50 CacheQueryOutcome outcome; | 51 CacheQueryOutcome outcome; |
| 51 }; | 52 }; |
| 52 | 53 |
| 53 } // namespace content | 54 } // namespace content |
| 54 | 55 |
| 55 #endif // CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_ | 56 #endif // CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_ |
| OLD | NEW |