OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef DEVICE_BLUETOOTH_ADAPTER_H_ | |
6 #define DEVICE_BLUETOOTH_ADAPTER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/macros.h" | |
11 #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.
| |
12 #include "device/bluetooth/bluetooth_adapter.h" | |
13 #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.
| |
14 #include "device/bluetooth/public/interfaces/adapter.mojom.h" | |
15 #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.
| |
16 | |
17 namespace bluetooth { | |
18 | |
19 // Implementation of Mojo BluetoothAdapter located in | |
20 // device/bluetooth/public/interfaces/bluetooth.mojom. | |
21 // It handles requests for Bluetooth adapter capabilities | |
22 // 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.
| |
23 // page and uses the platform abstraction of device/bluetooth. | |
24 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
| |
25 public device::BluetoothAdapter::Observer { | |
26 public: | |
27 Adapter(); | |
28 ~Adapter() override; | |
29 | |
30 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.
| |
31 | |
32 // mojom::Adapter overrides: | |
33 void GetDevices(const GetDevicesCallback& callback) override; | |
34 | |
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.
| |
35 void SetClient(mojom::AdapterClientPtr client) override; | |
36 | |
37 // device::BluetoothAdapter::Observer overrides: | |
38 void DeviceAdded(device::BluetoothAdapter* adapter, | |
39 device::BluetoothDevice* device) override; | |
40 | |
41 void DeviceRemoved(device::BluetoothAdapter* adapter, | |
42 device::BluetoothDevice* device) override; | |
43 | |
44 private: | |
45 mojom::DeviceInfoPtr ConstructDeviceInfoStruct( | |
46 const device::BluetoothDevice* device) const; | |
47 | |
48 scoped_refptr<device::BluetoothAdapter> GetAdapter(); | |
49 | |
50 void GetDevicesImpl(const GetDevicesCallback& callback, | |
51 scoped_refptr<device::BluetoothAdapter> adapter); | |
52 | |
53 void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); | |
54 | |
55 // 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
| |
56 scoped_refptr<device::BluetoothAdapter> adapter_; | |
57 | |
58 // 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.
| |
59 mojom::AdapterClientPtr client_; | |
60 | |
61 base::WeakPtrFactory<Adapter> weak_ptr_factory_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(Adapter); | |
64 }; | |
65 | |
66 } // namespace bluetooth | |
67 | |
68 #endif // DEVICE_BLUETOOTH_ADAPTER_H_ | |
OLD | NEW |