Chromium Code Reviews| Index: device/bluetooth/adapter.h |
| diff --git a/device/bluetooth/adapter.h b/device/bluetooth/adapter.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..82c0057602562f2448a4af448115918dc319f0f1 |
| --- /dev/null |
| +++ b/device/bluetooth/adapter.h |
| @@ -0,0 +1,68 @@ |
| +// 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_H_ |
| +#define DEVICE_BLUETOOTH_ADAPTER_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/macros.h" |
| +#include "base/strings/utf_string_conversions.h" |
|
ortuno
2016/09/28 09:44:55
I don't think you need this include in this header
mbrunson
2016/09/28 21:20:35
Yes. This should be in the cc.
|
| +#include "device/bluetooth/bluetooth_adapter.h" |
| +#include "device/bluetooth/bluetooth_adapter_factory.h" |
|
ortuno
2016/09/28 09:44:55
I don't think you need this include in this header
mbrunson
2016/09/28 21:20:35
In the cc, also.
|
| +#include "device/bluetooth/public/interfaces/adapter.mojom.h" |
| +#include "mojo/public/cpp/bindings/binding.h" |
|
ortuno
2016/09/28 09:44:55
I might be missing something but I don't think you
mbrunson
2016/09/28 21:20:35
Done.
|
| + |
| +namespace bluetooth { |
| + |
| +// Implementation of Mojo BluetoothAdapter located in |
| +// device/bluetooth/public/interfaces/bluetooth.mojom. |
| +// It handles requests for Bluetooth adapter capabilities |
| +// and devices coming from the chrome://bluetooth-internals |
|
scheib
2016/09/28 03:12:21
Remove the reference to internals page.
mbrunson
2016/09/28 21:20:35
Done.
|
| +// page and uses the platform abstraction of device/bluetooth. |
| +class Adapter : public mojom::Adapter, |
|
ortuno
2016/09/28 09:44:55
I like that the name is so short but I'm a bit ner
|
| + public device::BluetoothAdapter::Observer { |
| + public: |
| + Adapter(); |
| + ~Adapter() override; |
| + |
| + static void Create(mojom::AdapterRequest request); |
|
ortuno
2016/09/28 09:44:55
Please add comment mentioning what type of binding
mbrunson
2016/09/28 21:20:35
Done.
|
| + |
| + // mojom::Adapter overrides: |
| + void GetDevices(const GetDevicesCallback& callback) override; |
| + |
|
ortuno
2016/09/28 09:44:55
nit: I would remove the line to make it obvious al
mbrunson
2016/09/28 21:20:35
Done.
|
| + void SetClient(mojom::AdapterClientPtr client) override; |
| + |
| + // device::BluetoothAdapter::Observer overrides: |
| + void DeviceAdded(device::BluetoothAdapter* adapter, |
| + device::BluetoothDevice* device) override; |
| + |
| + void DeviceRemoved(device::BluetoothAdapter* adapter, |
| + device::BluetoothDevice* device) override; |
| + |
| + private: |
| + mojom::DeviceInfoPtr ConstructDeviceInfoStruct( |
| + const device::BluetoothDevice* device) const; |
| + |
| + scoped_refptr<device::BluetoothAdapter> GetAdapter(); |
| + |
| + void GetDevicesImpl(const GetDevicesCallback& callback, |
| + scoped_refptr<device::BluetoothAdapter> adapter); |
| + |
| + void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); |
| + |
| + // The current Bluetooth adapter |
|
ortuno
2016/09/28 09:44:55
nit: Period at the end of service. When I first jo
mbrunson
2016/09/28 21:20:35
I always used to do it in Python but I haven't got
|
| + scoped_refptr<device::BluetoothAdapter> adapter_; |
| + |
| + // The adapter client that listens to this service |
|
ortuno
2016/09/28 09:44:55
Same here. :)
mbrunson
2016/09/28 21:20:35
Done.
|
| + mojom::AdapterClientPtr client_; |
| + |
| + base::WeakPtrFactory<Adapter> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(Adapter); |
| +}; |
| + |
| +} // namespace bluetooth |
| + |
| +#endif // DEVICE_BLUETOOTH_ADAPTER_H_ |