| OLD | NEW |
| 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 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 5 #ifndef CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ |
| 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 6 #define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "base/id_map.h" | 12 #include "base/id_map.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/memory/scoped_vector.h" | 14 #include "base/memory/scoped_vector.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "content/browser/bluetooth/bluetooth_allowed_devices_map.h" | 16 #include "content/browser/bluetooth/bluetooth_allowed_devices_map.h" |
| 17 #include "content/browser/bluetooth/bluetooth_metrics.h" | 17 #include "content/browser/bluetooth/bluetooth_metrics.h" |
| 18 #include "content/common/bluetooth/bluetooth_messages.h" | 18 #include "content/common/bluetooth/bluetooth_messages.h" |
| 19 #include "content/public/browser/bluetooth_chooser.h" | 19 #include "content/public/browser/bluetooth_chooser.h" |
| 20 #include "content/public/browser/browser_message_filter.h" | 20 #include "content/public/browser/browser_message_filter.h" |
| 21 #include "device/bluetooth/bluetooth_adapter.h" | 21 #include "device/bluetooth/bluetooth_adapter.h" |
| 22 #include "device/bluetooth/bluetooth_gatt_connection.h" | 22 #include "device/bluetooth/bluetooth_gatt_connection.h" |
| 23 #include "device/bluetooth/bluetooth_gatt_notify_session.h" | 23 #include "device/bluetooth/bluetooth_gatt_notify_session.h" |
| 24 #include "device/bluetooth/bluetooth_gatt_service.h" | 24 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
| 25 | 25 |
| 26 namespace device { | 26 namespace device { |
| 27 class BluetoothUUID; | 27 class BluetoothUUID; |
| 28 } | 28 } |
| 29 | 29 |
| 30 namespace content { | 30 namespace content { |
| 31 | 31 |
| 32 struct BluetoothScanFilter; | 32 struct BluetoothScanFilter; |
| 33 | 33 |
| 34 // Dispatches and sends bluetooth related messages sent to/from a child | 34 // Dispatches and sends bluetooth related messages sent to/from a child |
| (...skipping 24 matching lines...) Expand all Loading... |
| 59 // both BluetoothDispatcherHost and WebBluetoothServiceImpl can use it, | 59 // both BluetoothDispatcherHost and WebBluetoothServiceImpl can use it, |
| 60 // while we move functions from BluetoothDispatcherHost to | 60 // while we move functions from BluetoothDispatcherHost to |
| 61 // WebBluetoothServiceImpl. | 61 // WebBluetoothServiceImpl. |
| 62 // https://crbug.com/508771 | 62 // https://crbug.com/508771 |
| 63 struct CacheQueryResult { | 63 struct CacheQueryResult { |
| 64 CacheQueryResult(); | 64 CacheQueryResult(); |
| 65 CacheQueryResult(CacheQueryOutcome outcome); | 65 CacheQueryResult(CacheQueryOutcome outcome); |
| 66 ~CacheQueryResult(); | 66 ~CacheQueryResult(); |
| 67 blink::WebBluetoothError GetWebError() const; | 67 blink::WebBluetoothError GetWebError() const; |
| 68 device::BluetoothDevice* device = nullptr; | 68 device::BluetoothDevice* device = nullptr; |
| 69 device::BluetoothGattService* service = nullptr; | 69 device::BluetoothRemoteGattService* service = nullptr; |
| 70 device::BluetoothGattCharacteristic* characteristic = nullptr; | 70 device::BluetoothRemoteGattCharacteristic* characteristic = nullptr; |
| 71 CacheQueryOutcome outcome = CacheQueryOutcome::SUCCESS; | 71 CacheQueryOutcome outcome = CacheQueryOutcome::SUCCESS; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 // Queries the platform cache for a characteristic with | 74 // Queries the platform cache for a characteristic with |
| 75 // |characteristic_instance_id|. Fills in the |outcome| field, and |device|, | 75 // |characteristic_instance_id|. Fills in the |outcome| field, and |device|, |
| 76 // |service| and |characteristic| fields if successful. | 76 // |service| and |characteristic| fields if successful. |
| 77 CacheQueryResult QueryCacheForCharacteristic( | 77 CacheQueryResult QueryCacheForCharacteristic( |
| 78 const url::Origin& origin, | 78 const url::Origin& origin, |
| 79 const std::string& characteristic_instance_id); | 79 const std::string& characteristic_instance_id); |
| 80 | 80 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 void OnCreateGATTConnectionError( | 218 void OnCreateGATTConnectionError( |
| 219 int thread_id, | 219 int thread_id, |
| 220 int request_id, | 220 int request_id, |
| 221 const std::string& device_id, | 221 const std::string& device_id, |
| 222 base::TimeTicks start_time, | 222 base::TimeTicks start_time, |
| 223 device::BluetoothDevice::ConnectErrorCode error_code); | 223 device::BluetoothDevice::ConnectErrorCode error_code); |
| 224 | 224 |
| 225 // Adds the service to the map of services' instance ids to devices' instance | 225 // Adds the service to the map of services' instance ids to devices' instance |
| 226 // ids and sends the service to the renderer. | 226 // ids and sends the service to the renderer. |
| 227 void AddToServicesMapAndSendGetPrimaryServiceSuccess( | 227 void AddToServicesMapAndSendGetPrimaryServiceSuccess( |
| 228 const device::BluetoothGattService& service, | 228 const device::BluetoothRemoteGattService& service, |
| 229 int thread_id, | 229 int thread_id, |
| 230 int request_id); | 230 int request_id); |
| 231 | 231 |
| 232 // Functions to query the platform cache for the bluetooth object. | 232 // Functions to query the platform cache for the bluetooth object. |
| 233 // result.outcome == CacheQueryOutcome::SUCCESS if the object was found in the | 233 // result.outcome == CacheQueryOutcome::SUCCESS if the object was found in the |
| 234 // cache. Otherwise result.outcome that can used to record the outcome and | 234 // cache. Otherwise result.outcome that can used to record the outcome and |
| 235 // result.error will contain the error that should be send to the renderer. | 235 // result.error will contain the error that should be send to the renderer. |
| 236 // One of the possible outcomes is BAD_RENDERER. In this case the outcome | 236 // One of the possible outcomes is BAD_RENDERER. In this case the outcome |
| 237 // was already recorded and since there renderer crashed there is no need to | 237 // was already recorded and since there renderer crashed there is no need to |
| 238 // send a response. | 238 // send a response. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 // copies verify they are also used on the UI thread. | 300 // copies verify they are also used on the UI thread. |
| 301 base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_; | 301 base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_; |
| 302 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; | 302 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; |
| 303 | 303 |
| 304 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); | 304 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); |
| 305 }; | 305 }; |
| 306 | 306 |
| 307 } // namespace content | 307 } // namespace content |
| 308 | 308 |
| 309 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 309 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ |
| OLD | NEW |