Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Unified Diff: content/browser/bluetooth/bluetooth_dispatcher_host.h

Issue 1397983004: bluetooth: Refactor repeated code used to find a Bluetooth object from its ID. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-characteristic-changed-1
Patch Set: Clean up Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/bluetooth/bluetooth_dispatcher_host.h
diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.h b/content/browser/bluetooth/bluetooth_dispatcher_host.h
index d84a8b3dc0b38462612fa856dcc7d03c27654467..6ddd39ee903534ab4aaf5668cb2cda7bb8672079 100644
--- a/content/browser/bluetooth/bluetooth_dispatcher_host.h
+++ b/content/browser/bluetooth/bluetooth_dispatcher_host.h
@@ -56,6 +56,7 @@ class CONTENT_EXPORT BluetoothDispatcherHost final
friend class base::DeleteHelper<BluetoothDispatcherHost>;
friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
+ struct CacheQueryResult;
struct RequestDeviceSession;
// Set |adapter_| to a BluetoothAdapter instance and register observers,
@@ -195,6 +196,28 @@ class CONTENT_EXPORT BluetoothDispatcherHost final
int request_id,
const std::string& characteristic_instance_id);
+ // 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.
+
+ // Queries the platform cache for a Device with |device_instance_id|. If
+ // successful the device will be in result.device
+ void QueryCacheForDevice(const std::string& device_instance_id,
+ CacheQueryResult& result);
+ // Queries the platform cache for a Service with |service_instance_id|.
+ // Returns true if we made the renderer crash due to a bad message. If
+ // successfull the service will be in result.service.
+ bool QueryCacheForService(const std::string& service_instance_id,
+ CacheQueryResult& result);
+ // Queries the platform cache for a characteristic with
+ // |characteristic_instance_id|. Returns true if we made the renderer crash
+ // due to a bad message. If successfull the characteristic will be in
+ // result.characteristic.
+ bool QueryCacheForCharacteristic(
+ const std::string& characteristic_instance_id,
+ CacheQueryResult& result);
+
// Show help pages from the chooser dialog.
void ShowBluetoothOverviewLink();
void ShowBluetoothPairingLink();

Powered by Google App Engine
This is Rietveld 408576698