Chromium Code Reviews| Index: content/browser/bluetooth/web_bluetooth_service_impl.h |
| diff --git a/content/browser/bluetooth/web_bluetooth_service_impl.h b/content/browser/bluetooth/web_bluetooth_service_impl.h |
| index e044254563de5e54bc8724e16b1bc001b42aa96e..23df653a8ce05d4d394b7f830ff803c7230ba03a 100644 |
| --- a/content/browser/bluetooth/web_bluetooth_service_impl.h |
| +++ b/content/browser/bluetooth/web_bluetooth_service_impl.h |
| @@ -11,6 +11,7 @@ |
| #include "base/macros.h" |
| #include "content/browser/bad_message.h" |
| +#include "content/browser/bluetooth/cache_query_result.h" |
| #include "content/common/content_export.h" |
| #include "content/public/browser/web_contents_observer.h" |
| #include "device/bluetooth/bluetooth_adapter.h" |
| @@ -26,6 +27,8 @@ class Origin; |
| namespace content { |
| +struct CacheQueryResult; |
|
Jeffrey Yasskin
2016/04/22 01:16:38
You only need one of the #include or the forward d
ortuno
2016/04/25 15:29:45
Done.
|
| + |
| class BluetoothDispatcherHost; |
| class RenderFrameHost; |
| class RenderProcessHost; |
| @@ -77,8 +80,11 @@ class WebBluetoothServiceImpl : public blink::mojom::WebBluetoothService, |
| // WebBluetoothService methods: |
| void SetClient( |
| blink::mojom::WebBluetoothServiceClientAssociatedPtrInfo client) override; |
| - |
| - // WebBluetoothService methods: |
| + void RemoteServiceGetCharacteristics( |
| + const mojo::String& service_instance_id, |
| + bool single_characteristic, |
| + const mojo::String& characteristics_uuid, |
| + const RemoteServiceGetCharacteristicsCallback& callback) override; |
| void RemoteCharacteristicReadValue( |
| const mojo::String& characteristic_instance_id, |
| const RemoteCharacteristicReadValueCallback& callback) override; |
| @@ -120,6 +126,20 @@ class WebBluetoothServiceImpl : public blink::mojom::WebBluetoothService, |
| const std::string& characteristic_instance_id, |
| const RemoteCharacteristicStopNotificationsCallback& callback); |
| + // Functions to query the platform cache for the bluetooth object. |
| + // result.outcome == CacheQueryOutcome::SUCCESS if the object was found in the |
| + // cache. Otherwise result.outcome that can used to record the outcome and |
| + // result.error will contain the error that should be send to the renderer. |
| + // One of the possible outcomes is BAD_RENDERER. In this case we crash the |
| + // renderer, record the reason and close the pipe, so it's safe to drop |
| + // any callbacks. |
| + |
| + // Queries the platform cache for a characteristic with |
| + // |characteristic_instance_id|. Fills in the |outcome| field, and |device|, |
| + // |service| and |characteristic| fields if successful. |
| + CacheQueryResult QueryCacheForCharacteristic( |
| + const std::string& characteristic_instance_id); |
| + |
| RenderProcessHost* GetRenderProcessHost(); |
| BluetoothDispatcherHost* GetBluetoothDispatcherHost(); |
| void CrashRendererAndClosePipe(bad_message::BadMessageReason reason); |
| @@ -128,6 +148,10 @@ class WebBluetoothServiceImpl : public blink::mojom::WebBluetoothService, |
| // Clears all state (maps, sets, etc). |
| void ClearState(); |
| + // Maps to get the object's parent based on it's instanceID. |
| + // Map of characteristic_instance_id to service_instance_id. |
| + std::unordered_map<std::string, std::string> characteristic_to_service_; |
| + |
| // Map to keep track of the characteristics' notify sessions. |
| std::unordered_map<std::string, |
| std::unique_ptr<device::BluetoothGattNotifySession>> |