| 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_WEB_BLUETOOTH_SERVICE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ | 6 #define CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/optional.h" | 13 #include "base/optional.h" |
| 14 #include "content/browser/bad_message.h" | 14 #include "content/browser/bad_message.h" |
| 15 #include "content/browser/bluetooth/bluetooth_allowed_devices_map.h" | 15 #include "content/browser/bluetooth/bluetooth_allowed_devices.h" |
| 16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
| 17 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
| 18 #include "device/bluetooth/bluetooth_adapter.h" | 18 #include "device/bluetooth/bluetooth_adapter.h" |
| 19 #include "device/bluetooth/bluetooth_gatt_connection.h" | 19 #include "device/bluetooth/bluetooth_gatt_connection.h" |
| 20 #include "device/bluetooth/bluetooth_gatt_notify_session.h" | 20 #include "device/bluetooth/bluetooth_gatt_notify_session.h" |
| 21 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" | 21 #include "device/bluetooth/bluetooth_remote_gatt_characteristic.h" |
| 22 #include "device/bluetooth/bluetooth_remote_gatt_service.h" | 22 #include "device/bluetooth/bluetooth_remote_gatt_service.h" |
| 23 #include "mojo/public/cpp/bindings/binding.h" | 23 #include "mojo/public/cpp/bindings/binding.h" |
| 24 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj
om.h" | 24 #include "third_party/WebKit/public/platform/modules/bluetooth/web_bluetooth.moj
om.h" |
| 25 | 25 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 230 |
| 231 // Queries the platform cache for a descriptor with |descriptor_instance_id|. | 231 // Queries the platform cache for a descriptor with |descriptor_instance_id|. |
| 232 // Fills in the |outcome| field, and |device|, |service|, |characteristic|, | 232 // Fills in the |outcome| field, and |device|, |service|, |characteristic|, |
| 233 // |descriptor| fields if successful. | 233 // |descriptor| fields if successful. |
| 234 CacheQueryResult QueryCacheForDescriptor( | 234 CacheQueryResult QueryCacheForDescriptor( |
| 235 const std::string& descriptor_instance_id); | 235 const std::string& descriptor_instance_id); |
| 236 | 236 |
| 237 RenderProcessHost* GetRenderProcessHost(); | 237 RenderProcessHost* GetRenderProcessHost(); |
| 238 device::BluetoothAdapter* GetAdapter(); | 238 device::BluetoothAdapter* GetAdapter(); |
| 239 url::Origin GetOrigin(); | 239 url::Origin GetOrigin(); |
| 240 BluetoothAllowedDevices* allowed_devices(); |
| 240 | 241 |
| 241 // Clears all state (maps, sets, etc). | 242 // Clears all state (maps, sets, etc). |
| 242 void ClearState(); | 243 void ClearState(); |
| 243 | 244 |
| 244 // Used to open a BluetoothChooser and start a device discovery session. | 245 // Used to open a BluetoothChooser and start a device discovery session. |
| 245 std::unique_ptr<BluetoothDeviceChooserController> device_chooser_controller_; | 246 std::unique_ptr<BluetoothDeviceChooserController> device_chooser_controller_; |
| 246 | 247 |
| 247 // Keeps track of which devices the frame's origin is allowed to access. | 248 // Keeps track of which devices the frame's origin is allowed to access. |
| 248 BluetoothAllowedDevicesMap allowed_devices_map_; | 249 BluetoothAllowedDevices* allowed_devices_ = nullptr; |
| 249 | 250 |
| 250 // Maps to get the object's parent based on its instanceID. | 251 // Maps to get the object's parent based on its instanceID. |
| 251 std::unordered_map<std::string, std::string> service_id_to_device_address_; | 252 std::unordered_map<std::string, std::string> service_id_to_device_address_; |
| 252 std::unordered_map<std::string, std::string> characteristic_id_to_service_id_; | 253 std::unordered_map<std::string, std::string> characteristic_id_to_service_id_; |
| 253 std::unordered_map<std::string, std::string> | 254 std::unordered_map<std::string, std::string> |
| 254 descriptor_id_to_characteristic_id_; | 255 descriptor_id_to_characteristic_id_; |
| 255 | 256 |
| 256 // Map to keep track of the connected Bluetooth devices. | 257 // Map to keep track of the connected Bluetooth devices. |
| 257 std::unique_ptr<FrameConnectedBluetoothDevices> connected_devices_; | 258 std::unique_ptr<FrameConnectedBluetoothDevices> connected_devices_; |
| 258 | 259 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 278 mojo::Binding<blink::mojom::WebBluetoothService> binding_; | 279 mojo::Binding<blink::mojom::WebBluetoothService> binding_; |
| 279 | 280 |
| 280 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_; | 281 base::WeakPtrFactory<WebBluetoothServiceImpl> weak_ptr_factory_; |
| 281 | 282 |
| 282 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl); | 283 DISALLOW_COPY_AND_ASSIGN(WebBluetoothServiceImpl); |
| 283 }; | 284 }; |
| 284 | 285 |
| 285 } // namespace content | 286 } // namespace content |
| 286 | 287 |
| 287 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ | 288 #endif // CONTENT_BROWSER_BLUETOOTH_WEB_BLUETOOTH_SERVICE_IMPL_H_ |
| OLD | NEW |