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

Unified Diff: extensions/browser/api/bluetooth/bluetooth_api.cc

Issue 2801403002: MD Settings: Bluetooth: Fix adapter state and discovery (Closed)
Patch Set: Use CHECK instead of early exit Created 3 years, 8 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
« no previous file with comments | « extensions/browser/api/DEPS ('k') | extensions/browser/api/bluetooth/bluetooth_event_router.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/bluetooth/bluetooth_api.cc
diff --git a/extensions/browser/api/bluetooth/bluetooth_api.cc b/extensions/browser/api/bluetooth/bluetooth_api.cc
index 453ff77d62e6158dc56fd9de9feef7b3ee4220d0..2e9e40a0e4f19ba28d3fed1eda676463cd31db60 100644
--- a/extensions/browser/api/bluetooth/bluetooth_api.cc
+++ b/extensions/browser/api/bluetooth/bluetooth_api.cc
@@ -11,6 +11,7 @@
#include "base/bind_helpers.h"
#include "base/lazy_instance.h"
#include "base/memory/ref_counted.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"
@@ -64,6 +65,7 @@ BluetoothAPI* BluetoothAPI::Get(BrowserContext* context) {
BluetoothAPI::BluetoothAPI(content::BrowserContext* context)
: browser_context_(context) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ BLUETOOTH_LOG(EVENT) << "BluetoothAPI: " << browser_context_;
EventRouter* event_router = EventRouter::Get(browser_context_);
event_router->RegisterObserver(this,
bluetooth::OnAdapterStateChanged::kEventName);
@@ -72,11 +74,14 @@ BluetoothAPI::BluetoothAPI(content::BrowserContext* context)
event_router->RegisterObserver(this, bluetooth::OnDeviceRemoved::kEventName);
}
-BluetoothAPI::~BluetoothAPI() {}
+BluetoothAPI::~BluetoothAPI() {
+ BLUETOOTH_LOG(EVENT) << "~BluetoothAPI: " << browser_context_;
+}
BluetoothEventRouter* BluetoothAPI::event_router() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (!event_router_) {
+ BLUETOOTH_LOG(EVENT) << "BluetoothAPI: Creating BluetoothEventRouter";
event_router_.reset(new BluetoothEventRouter(browser_context_));
}
return event_router_.get();
@@ -84,19 +89,20 @@ BluetoothEventRouter* BluetoothAPI::event_router() {
void BluetoothAPI::Shutdown() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
+ BLUETOOTH_LOG(EVENT) << "BluetoothAPI: Shutdown";
EventRouter::Get(browser_context_)->UnregisterObserver(this);
}
void BluetoothAPI::OnListenerAdded(const EventListenerInfo& details) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (event_router()->IsBluetoothSupported())
- event_router()->OnListenerAdded();
+ event_router()->OnListenerAdded(details);
}
void BluetoothAPI::OnListenerRemoved(const EventListenerInfo& details) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (event_router()->IsBluetoothSupported())
- event_router()->OnListenerRemoved();
+ event_router()->OnListenerRemoved(details);
}
namespace api {
« no previous file with comments | « extensions/browser/api/DEPS ('k') | extensions/browser/api/bluetooth/bluetooth_event_router.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698