| 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> |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 void OnRequestDevice( | 100 void OnRequestDevice( |
| 101 int thread_id, | 101 int thread_id, |
| 102 int request_id, | 102 int request_id, |
| 103 int frame_routing_id, | 103 int frame_routing_id, |
| 104 const std::vector<content::BluetoothScanFilter>& filters, | 104 const std::vector<content::BluetoothScanFilter>& filters, |
| 105 const std::vector<device::BluetoothUUID>& optional_services); | 105 const std::vector<device::BluetoothUUID>& optional_services); |
| 106 void OnConnectGATT(int thread_id, | 106 void OnConnectGATT(int thread_id, |
| 107 int request_id, | 107 int request_id, |
| 108 int frame_routing_id, | 108 int frame_routing_id, |
| 109 const std::string& device_id); | 109 const std::string& device_id); |
| 110 void OnDisconnect(int thread_id, |
| 111 int frame_routing_id, |
| 112 const std::string& device_id); |
| 110 void OnGetPrimaryService(int thread_id, | 113 void OnGetPrimaryService(int thread_id, |
| 111 int request_id, | 114 int request_id, |
| 112 int frame_routing_id, | 115 int frame_routing_id, |
| 113 const std::string& device_id, | 116 const std::string& device_id, |
| 114 const std::string& service_uuid); | 117 const std::string& service_uuid); |
| 115 void OnGetCharacteristic(int thread_id, | 118 void OnGetCharacteristic(int thread_id, |
| 116 int request_id, | 119 int request_id, |
| 117 int frame_routing_id, | 120 int frame_routing_id, |
| 118 const std::string& service_instance_id, | 121 const std::string& service_instance_id, |
| 119 const std::string& characteristic_uuid); | 122 const std::string& characteristic_uuid); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 scoped_refptr<device::BluetoothAdapter> adapter_; | 294 scoped_refptr<device::BluetoothAdapter> adapter_; |
| 292 | 295 |
| 293 // Automatically stops Bluetooth discovery a set amount of time after it was | 296 // Automatically stops Bluetooth discovery a set amount of time after it was |
| 294 // started. We have a single timer for all of Web Bluetooth because it's | 297 // started. We have a single timer for all of Web Bluetooth because it's |
| 295 // simpler than tracking timeouts for each RequestDeviceSession individually, | 298 // simpler than tracking timeouts for each RequestDeviceSession individually, |
| 296 // and because there's no harm in extending the length of a few discovery | 299 // and because there's no harm in extending the length of a few discovery |
| 297 // sessions when other sessions are active. | 300 // sessions when other sessions are active. |
| 298 base::Timer discovery_session_timer_; | 301 base::Timer discovery_session_timer_; |
| 299 | 302 |
| 300 // Retain BluetoothGattConnection objects to keep connections open. | 303 // Retain BluetoothGattConnection objects to keep connections open. |
| 301 // TODO(scheib): Destroy as connections are closed. http://crbug.com/539643 | 304 std::map<std::string, scoped_ptr<device::BluetoothGattConnection>> |
| 302 ScopedVector<device::BluetoothGattConnection> connections_; | 305 device_id_to_connection_map_; |
| 303 | 306 |
| 304 // Keeps track of which devices have had their services discovered. | 307 // Keeps track of which devices have had their services discovered. |
| 305 std::set<std::string> devices_with_discovered_services_; | 308 std::set<std::string> devices_with_discovered_services_; |
| 306 | 309 |
| 307 // Map of device_address's to primary-services requests that need responses | 310 // Map of device_address's to primary-services requests that need responses |
| 308 // when that device's service discovery completes. | 311 // when that device's service discovery completes. |
| 309 std::map<std::string, std::vector<PrimaryServicesRequest>> | 312 std::map<std::string, std::vector<PrimaryServicesRequest>> |
| 310 pending_primary_services_requests_; | 313 pending_primary_services_requests_; |
| 311 | 314 |
| 312 // |weak_ptr_on_ui_thread_| provides weak pointers, e.g. for callbacks, and | 315 // |weak_ptr_on_ui_thread_| provides weak pointers, e.g. for callbacks, and |
| 313 // because it exists and has been bound to the UI thread enforces that all | 316 // because it exists and has been bound to the UI thread enforces that all |
| 314 // copies verify they are also used on the UI thread. | 317 // copies verify they are also used on the UI thread. |
| 315 base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_; | 318 base::WeakPtr<BluetoothDispatcherHost> weak_ptr_on_ui_thread_; |
| 316 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; | 319 base::WeakPtrFactory<BluetoothDispatcherHost> weak_ptr_factory_; |
| 317 | 320 |
| 318 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); | 321 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcherHost); |
| 319 }; | 322 }; |
| 320 | 323 |
| 321 } // namespace content | 324 } // namespace content |
| 322 | 325 |
| 323 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ | 326 #endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_DISPATCHER_HOST_H_ |
| OLD | NEW |