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

Unified Diff: device/bluetooth/adapter_factory.h

Issue 2379573006: bluetooth: Standardize Bluetooth adapter access in Adapter service. (Closed)
Patch Set: dcheng fixes Created 4 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
« no previous file with comments | « device/bluetooth/adapter.cc ('k') | device/bluetooth/adapter_factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/bluetooth/adapter_factory.h
diff --git a/device/bluetooth/adapter_factory.h b/device/bluetooth/adapter_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..a7f1d2dfd8bcca35a58d6d88b25dacab3d23fab4
--- /dev/null
+++ b/device/bluetooth/adapter_factory.h
@@ -0,0 +1,41 @@
+// 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 DEVICE_BLUETOOTH_ADAPTER_FACTORY_H_
+#define DEVICE_BLUETOOTH_ADAPTER_FACTORY_H_
+
+#include "base/macros.h"
+#include "device/bluetooth/bluetooth_adapter.h"
+#include "device/bluetooth/public/interfaces/adapter.mojom.h"
+
+namespace bluetooth {
+
+// Implementation of Mojo AdapterFactory located in
+// device/bluetooth/public/interfaces/adapter.mojom.
+// It handles requests for Mojo Adapter instances
+// and strongly binds the Adapter instance to the system's
+// Bluetooth adapter.
+class AdapterFactory : public mojom::AdapterFactory {
+ public:
+ AdapterFactory();
+ ~AdapterFactory() override;
+
+ // Creates an AdapterFactory with a strong Mojo binding to |request|.
+ static void Create(mojom::AdapterFactoryRequest request);
+
+ // mojom::AdapterFactory overrides:
+ void GetAdapter(const GetAdapterCallback& callback) override;
+
+ private:
+ void OnGetAdapter(const GetAdapterCallback& callback,
+ scoped_refptr<device::BluetoothAdapter> adapter);
+
+ base::WeakPtrFactory<AdapterFactory> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(AdapterFactory);
+};
+
+} // namespace bluetooth
+
+#endif // DEVICE_BLUETOOTH_ADAPTER_FACTORY_H_
« no previous file with comments | « device/bluetooth/adapter.cc ('k') | device/bluetooth/adapter_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698