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

Unified Diff: chrome/browser/ui/webui/bluetooth_internals/services/bluetooth_adapter_service.h

Issue 2357383002: bluetooth: Add device list retrieval for chrome://bluetooth-internals (Closed)
Patch Set: Created 4 years, 3 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: chrome/browser/ui/webui/bluetooth_internals/services/bluetooth_adapter_service.h
diff --git a/chrome/browser/ui/webui/bluetooth_internals/services/bluetooth_adapter_service.h b/chrome/browser/ui/webui/bluetooth_internals/services/bluetooth_adapter_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..5133586a139d4bd5f3d662c51a7e499576b2a2f8
--- /dev/null
+++ b/chrome/browser/ui/webui/bluetooth_internals/services/bluetooth_adapter_service.h
@@ -0,0 +1,49 @@
+// 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 CHROME_BROWSER_UI_WEBUI_BLUETOOTH_INTERNALS_SERVICES_BLUETOOTH_ADAPTER_SERVICE_H_
+#define CHROME_BROWSER_UI_WEBUI_BLUETOOTH_INTERNALS_SERVICES_BLUETOOTH_ADAPTER_SERVICE_H_
+
+#include <set>
+#include <string>
+
+#include "base/macros.h"
+#include "base/strings/utf_string_conversions.h"
+#include "chrome/browser/ui/webui/bluetooth_internals/bluetooth_internals.mojom.h"
+#include "chrome/browser/ui/webui/mojo_web_ui_handler.h"
+#include "device/bluetooth/bluetooth_adapter.h"
+#include "device/bluetooth/bluetooth_adapter_factory_wrapper.h"
+#include "mojo/public/cpp/bindings/binding.h"
+
+class BluetoothAdapterService : public bluetooth::Adapter,
ortuno 2016/09/22 08:32:54 Is BluetoothAdapter the right name here? I thought
mbrunson 2016/09/24 01:05:47 Since everything is a WIP, this file will change m
ortuno 2016/09/26 01:57:55 This is not really a big issue but I was just wond
+ public device::BluetoothAdapter::Observer {
+ public:
+ explicit BluetoothAdapterService(bluetooth::AdapterClientPtr client);
+ ~BluetoothAdapterService() override;
+
+ // bluetooth::AdapterService overrides:
+ void GetDevices(int8_t index,
+ int8_t count,
+ const GetDevicesCallback& callback) override;
+
+ // device::BluetoothAdapter::Observer overrides:
+ void DeviceAdded(device::BluetoothAdapter* adapter,
+ device::BluetoothDevice* device) override;
+
+ void DeviceRemoved(device::BluetoothAdapter* adapter,
+ device::BluetoothDevice* device) override;
+
+ private:
+ device::BluetoothAdapter* GetAdapter();
+ bluetooth::DeviceInfoPtr GetDeviceInfo(device::BluetoothDevice* device);
+ void OnAdapterAcquired(device::BluetoothAdapter* adapter);
+
+ std::set<std::string> addresses_;
+ bluetooth::AdapterClientPtr client_;
+ base::WeakPtrFactory<BluetoothAdapterService> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterService);
+};
+
+#endif // CHROME_BROWSER_UI_WEBUI_BLUETOOTH_INTERNALS_SERVICES_BLUETOOTH_ADAPTER_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698