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

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

Issue 1861013005: bluetooth: Move GetCharacteristic(s) over to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-separate-tests-read-value
Patch Set: Address palmer's comments Created 4 years, 8 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/cache_query_result.h
diff --git a/content/browser/bluetooth/cache_query_result.h b/content/browser/bluetooth/cache_query_result.h
new file mode 100644
index 0000000000000000000000000000000000000000..076c5e90624f7ebd41b260dfd2b03d2e554707f0
--- /dev/null
+++ b/content/browser/bluetooth/cache_query_result.h
@@ -0,0 +1,58 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_
+#define CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_
+
+#include "content/browser/bluetooth/bluetooth_metrics.h"
+#include "content/common/bluetooth/bluetooth_messages.h"
+
+namespace device {
+class BluetoothDevice;
+class BluetoothRemoteGattService;
+class BluetoothRemoteGattCharacteristic;
+}
+
+namespace content {
+
+// Struct that holds the result of a cache query.
+//
+// WebBluetoothServiceImpl and BluetoothDispatcherHost have functions
+// that return a CacheQueryResult so we make a separate header for it.
+// TODO(ortuno): Move into WebBluetoothServiceImpl once we move all functions
+// off BluetoothDispatcherHost.
+// https://crbug.com/508771
+struct CacheQueryResult {
+ CacheQueryResult() : outcome(CacheQueryOutcome::SUCCESS) {}
+
+ explicit CacheQueryResult(CacheQueryOutcome outcome) : outcome(outcome) {}
+
+ ~CacheQueryResult() {}
+
+ blink::WebBluetoothError GetWebError() const {
+ switch (outcome) {
+ case CacheQueryOutcome::SUCCESS:
+ case CacheQueryOutcome::BAD_RENDERER:
+ NOTREACHED();
+ return blink::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE;
+ case CacheQueryOutcome::NO_DEVICE:
+ return blink::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE;
+ case CacheQueryOutcome::NO_SERVICE:
+ return blink::WebBluetoothError::SERVICE_NO_LONGER_EXISTS;
+ case CacheQueryOutcome::NO_CHARACTERISTIC:
+ return blink::WebBluetoothError::CHARACTERISTIC_NO_LONGER_EXISTS;
+ }
+ NOTREACHED();
+ return blink::WebBluetoothError::DEVICE_NO_LONGER_IN_RANGE;
+ }
+
+ device::BluetoothDevice* device = nullptr;
+ device::BluetoothRemoteGattService* service = nullptr;
+ device::BluetoothRemoteGattCharacteristic* characteristic = nullptr;
+ CacheQueryOutcome outcome;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_BLUETOOTH_CACHE_QUERY_RESULT_H_
« no previous file with comments | « content/browser/bluetooth/bluetooth_metrics.cc ('k') | content/browser/bluetooth/web_bluetooth_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698