| Index: chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc
|
| diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc
|
| index caad6209cc82a18f14a43c1b8e5ffbc562dcbb6e..c884a82042f25faef68484ba4d9d0d9baa26e501 100644
|
| --- a/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc
|
| +++ b/chrome/browser/extensions/api/bluetooth/bluetooth_extension_function.cc
|
| @@ -7,9 +7,12 @@
|
| #include "base/memory/ref_counted.h"
|
| #include "chrome/browser/extensions/api/bluetooth/bluetooth_api.h"
|
| #include "chrome/browser/extensions/api/bluetooth/bluetooth_event_router.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| #include "device/bluetooth/bluetooth_adapter.h"
|
| #include "device/bluetooth/bluetooth_adapter_factory.h"
|
|
|
| +using content::BrowserThread;
|
| +
|
| namespace {
|
|
|
| const char kPlatformNotSupported[] =
|
| @@ -17,22 +20,24 @@ const char kPlatformNotSupported[] =
|
|
|
| extensions::ExtensionBluetoothEventRouter* GetEventRouter(
|
| content::BrowserContext* context) {
|
| - return extensions::BluetoothAPI::Get(context)->bluetooth_event_router();
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| + return extensions::BluetoothAPI::Get(context)->event_router();
|
| }
|
|
|
| bool IsBluetoothSupported(content::BrowserContext* context) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| return GetEventRouter(context)->IsBluetoothSupported();
|
| }
|
|
|
| void GetAdapter(const device::BluetoothAdapterFactory::AdapterCallback callback,
|
| content::BrowserContext* context) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| GetEventRouter(context)->GetAdapter(callback);
|
| }
|
|
|
| } // namespace
|
|
|
| namespace extensions {
|
| -
|
| namespace api {
|
|
|
| BluetoothExtensionFunction::BluetoothExtensionFunction() {
|
| @@ -42,6 +47,8 @@ BluetoothExtensionFunction::~BluetoothExtensionFunction() {
|
| }
|
|
|
| bool BluetoothExtensionFunction::RunImpl() {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| +
|
| if (!IsBluetoothSupported(browser_context())) {
|
| SetError(kPlatformNotSupported);
|
| return false;
|
| @@ -54,9 +61,9 @@ bool BluetoothExtensionFunction::RunImpl() {
|
|
|
| void BluetoothExtensionFunction::RunOnAdapterReady(
|
| scoped_refptr<device::BluetoothAdapter> adapter) {
|
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| DoWork(adapter);
|
| }
|
|
|
| } // namespace api
|
| -
|
| } // namespace extensions
|
|
|