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

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

Issue 10815072: Bluetooth API: improve discovery (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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/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 90528caa1701bac0f631a6ede8a33793493c129b..64dbfccf616462ef6a3a03c178e346cbfec4c4ca 100644
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
@@ -48,12 +48,12 @@ const char kCouldNotGetLocalOutOfBandPairingData[] =
"Could not get local Out Of Band Pairing Data";
const char kCouldNotSetOutOfBandPairingData[] =
"Could not set Out Of Band Pairing Data";
+const char kDiscoveryInProgress[] = "Discovery already in progress";
const char kFailedToConnect[] = "Connection failed";
const char kInvalidDevice[] = "Invalid device";
const char kServiceDiscoveryFailed[] = "Service discovery failed";
const char kSocketNotFoundError[] = "Socket not found: invalid socket id";
-const char kStartDiscoveryFailed[] =
- "Starting discovery failed, or already discovering";
+const char kStartDiscoveryFailed[] = "Starting discovery failed";
const char kStopDiscoveryFailed[] = "Failed to stop discovery";
} // namespace
@@ -456,11 +456,12 @@ void BluetoothStartDiscoveryFunction::OnErrorCallback() {
bool BluetoothStartDiscoveryFunction::RunImpl() {
GetEventRouter(profile())->SetSendDiscoveryEvents(true);
- // BluetoothAdapter will throw an error if we SetDiscovering(true) when
- // discovery is already in progress
+ // Fail if discovery is already in progress: this extension has missed all
+ // discovered devices so far. It should re-try discovery after discovery has
+ // finished.
asargent_no_longer_on_chrome 2012/07/24 20:29:45 Random thought- this can happen because *another*
bryeung 2012/08/03 20:08:37 I had originally decided against this, but your co
if (GetMutableAdapter(profile())->IsDiscovering()) {
- SendResponse(true);
- return true;
+ SetError(kDiscoveryInProgress);
+ return false;
}
GetMutableAdapter(profile())->SetDiscovering(true,

Powered by Google App Engine
This is Rietveld 408576698