#include "extensions/browser/api/bluetooth/bluetooth_api.h"
#include <memory>
#include <string>
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/lazy_instance.h"
#include "base/memory/ref_counted.h"
#include "build/chromeos_buildflags.h"
#include "components/device_event_log/device_event_log.h"
#include "content/public/browser/browser_thread.h"
#include "device/bluetooth/bluetooth_adapter.h"
#include "device/bluetooth/bluetooth_device.h"
#include "extensions/browser/api/bluetooth/bluetooth_api_utils.h"
#include "extensions/browser/api/bluetooth/bluetooth_event_router.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_host_registry.h"
#include "extensions/common/api/bluetooth.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "device/bluetooth/chromeos/bluetooth_utils.h"
#endif
BrowserContext;
BrowserThread;
BluetoothAdapter;
BluetoothDevice;
bluetooth_api;
GetDevice;
GetDevices;
namespace {
const char kInvalidDevice[] = …;
const char kStartDiscoveryFailed[] = …;
const char kStopDiscoveryFailed[] = …;
extensions::BluetoothEventRouter* GetEventRouter(BrowserContext* context) { … }
}
namespace extensions {
static base::LazyInstance<
BrowserContextKeyedAPIFactory<BluetoothAPI>>::DestructorAtExit g_factory = …;
BrowserContextKeyedAPIFactory<BluetoothAPI>*
BluetoothAPI::GetFactoryInstance() { … }
template <>
void BrowserContextKeyedAPIFactory<BluetoothAPI>::DeclareFactoryDependencies() { … }
BluetoothAPI* BluetoothAPI::Get(BrowserContext* context) { … }
BluetoothAPI::BluetoothAPI(content::BrowserContext* context)
: … { … }
BluetoothAPI::~BluetoothAPI() { … }
BluetoothEventRouter* BluetoothAPI::event_router() { … }
void BluetoothAPI::Shutdown() { … }
void BluetoothAPI::OnListenerAdded(const EventListenerInfo& details) { … }
void BluetoothAPI::OnListenerRemoved(const EventListenerInfo& details) { … }
namespace api {
BluetoothGetAdapterStateFunction::~BluetoothGetAdapterStateFunction() = default;
void BluetoothGetAdapterStateFunction::DoWork(
scoped_refptr<BluetoothAdapter> adapter) { … }
BluetoothGetDevicesFunction::BluetoothGetDevicesFunction() = default;
BluetoothGetDevicesFunction::~BluetoothGetDevicesFunction() = default;
bool BluetoothGetDevicesFunction::CreateParams() { … }
void BluetoothGetDevicesFunction::DoWork(
scoped_refptr<BluetoothAdapter> adapter) { … }
BluetoothGetDeviceFunction::BluetoothGetDeviceFunction() = default;
BluetoothGetDeviceFunction::~BluetoothGetDeviceFunction() = default;
bool BluetoothGetDeviceFunction::CreateParams() { … }
void BluetoothGetDeviceFunction::DoWork(
scoped_refptr<BluetoothAdapter> adapter) { … }
void BluetoothStartDiscoveryFunction::OnSuccessCallback() { … }
void BluetoothStartDiscoveryFunction::OnErrorCallback() { … }
void BluetoothStartDiscoveryFunction::DoWork(
scoped_refptr<BluetoothAdapter> adapter) { … }
void BluetoothStopDiscoveryFunction::OnSuccessCallback() { … }
void BluetoothStopDiscoveryFunction::OnErrorCallback() { … }
void BluetoothStopDiscoveryFunction::DoWork(
scoped_refptr<BluetoothAdapter> adapter) { … }
}
}