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

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

Issue 189463002: Migrate chrome.bluetooth API backend to use device::BluetoothDiscoverySession. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | « no previous file | chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
diff --git a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
index 6b2b8db27b6bf6c494717f106d05a583666b5693..c5004262d2a79071334ada76d09f17222dc3b09d 100644
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
@@ -636,24 +636,18 @@ void BluetoothStartDiscoveryFunction::OnSuccessCallback() {
void BluetoothStartDiscoveryFunction::OnErrorCallback() {
SetError(kStartDiscoveryFailed);
- GetEventRouter(browser_context())->SetResponsibleForDiscovery(false);
SendResponse(false);
GetEventRouter(browser_context())->OnListenerRemoved();
}
bool BluetoothStartDiscoveryFunction::DoWork(
scoped_refptr<BluetoothAdapter> adapter) {
- GetEventRouter(browser_context())->SetSendDiscoveryEvents(true);
-
- // If this profile is already discovering devices, there should be nothing
- // else to do.
- if (!GetEventRouter(browser_context())->IsResponsibleForDiscovery()) {
- GetEventRouter(browser_context())->SetResponsibleForDiscovery(true);
- GetEventRouter(browser_context())->OnListenerAdded();
- adapter->StartDiscovering(
- base::Bind(&BluetoothStartDiscoveryFunction::OnSuccessCallback, this),
- base::Bind(&BluetoothStartDiscoveryFunction::OnErrorCallback, this));
- }
+ GetEventRouter(browser_context())->OnListenerAdded();
+ GetEventRouter(browser_context())->StartDiscoverySession(
+ adapter,
+ extension_id(),
+ base::Bind(&BluetoothStartDiscoveryFunction::OnSuccessCallback, this),
+ base::Bind(&BluetoothStartDiscoveryFunction::OnErrorCallback, this));
return true;
}
@@ -665,19 +659,17 @@ void BluetoothStopDiscoveryFunction::OnSuccessCallback() {
void BluetoothStopDiscoveryFunction::OnErrorCallback() {
SetError(kStopDiscoveryFailed);
- GetEventRouter(browser_context())->SetResponsibleForDiscovery(true);
SendResponse(false);
GetEventRouter(browser_context())->OnListenerRemoved();
}
bool BluetoothStopDiscoveryFunction::DoWork(
scoped_refptr<BluetoothAdapter> adapter) {
- GetEventRouter(browser_context())->SetSendDiscoveryEvents(false);
- if (GetEventRouter(browser_context())->IsResponsibleForDiscovery()) {
- adapter->StopDiscovering(
- base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this),
- base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this));
- }
+ GetEventRouter(browser_context())->StopDiscoverySession(
+ adapter,
+ extension_id(),
+ base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this),
+ base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this));
return true;
}
« no previous file with comments | « no previous file | chrome/browser/extensions/api/bluetooth/bluetooth_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698