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

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

Issue 1775953004: bluetooth: Move writeValue to mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Moar cleanup Created 4 years, 9 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_service_impl.h
diff --git a/content/browser/bluetooth/bluetooth_service_impl.h b/content/browser/bluetooth/bluetooth_service_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..9c8bca6b462a922528d878fd19fe7d88c6c935f1
--- /dev/null
+++ b/content/browser/bluetooth/bluetooth_service_impl.h
@@ -0,0 +1,67 @@
+// 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_BLUETOOTH_SERVICE_IMPL_H
+#define CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_SERVICE_IMPL_H
+
+#include "base/macros.h"
+#include "content/browser/bad_message.h"
+#include "content/common/bluetooth/bluetooth_service.mojom.h"
+#include "content/common/content_export.h"
+#include "device/bluetooth/bluetooth_adapter.h"
+#include "device/bluetooth/bluetooth_gatt_service.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
+
+namespace url {
+class Origin;
+} // namespace url
+
+namespace content {
+
+class BluetoothDispatcherHost;
+
+class BluetoothServiceImpl : public mojom::BluetoothService {
+ public:
+ static void Create(int render_process_id,
+ mojo::InterfaceRequest<mojom::BluetoothService> request);
+
+ private:
+ BluetoothServiceImpl(mojo::InterfaceRequest<mojom::BluetoothService> request,
+ int render_process_id);
+ ~BluetoothServiceImpl() override;
+
+ // WebBluetoothService methods:
+ void RemoteCharacteristicWriteValue(
+ int frame_routing_id,
+ const mojo::String& characteristic_instance_id,
+ mojo::Array<uint8_t> value,
+ const RemoteCharacteristicWriteValueCallback& callback) override;
+
+ void OnWriteValueSuccess(
+ const RemoteCharacteristicWriteValueCallback& callback);
+ void OnWriteValueFailed(
+ const RemoteCharacteristicWriteValueCallback& callback,
+ device::BluetoothGattService::GattErrorCode error_code);
+
+ BluetoothDispatcherHost* GetBluetoothDispatcherHost();
+ void CrashRenderer(bad_message::BadMessageReason reason);
+ url::Origin GetOrigin(int frame_routing_id);
+
+ int render_process_id_;
+ scoped_refptr<device::BluetoothAdapter> adapter_;
+
+ mojo::StrongBinding<BluetoothService> binding_;
+
+ // |weak_ptr_on_ui_thread_| provides weak pointers, e.g. for callbacks, and
+ // because it exists and has been bound to the UI thread enforces that all
+ // copies verify they are also used on the UI thread.
+ base::WeakPtr<BluetoothServiceImpl> weak_ptr_on_ui_thread_;
+ base::WeakPtrFactory<BluetoothServiceImpl> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(BluetoothServiceImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_BLUETOOTH_BLUETOOTH_SERVICE_IMPL_H

Powered by Google App Engine
This is Rietveld 408576698