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

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

Issue 10539054: Improve errors for the bluetooth.connect API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 | no next file » | 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 7e182c2caf9e70471094294efe271e0b5c274604..7b80b96d7a4aa25bd28e63df964dc610e60d156d 100644
--- a/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
+++ b/chrome/browser/extensions/api/bluetooth/bluetooth_api.cc
@@ -43,6 +43,8 @@ chromeos::BluetoothAdapter* GetMutableAdapter(Profile* profile) {
namespace {
+const char kFailedToConnect[] = "Connection failed";
+const char kInvalidDevice[] = "Invalid device";
const char kSocketNotFoundError[] = "Socket not found: invalid socket id";
} // namespace
@@ -165,6 +167,7 @@ void BluetoothConnectFunction::ConnectToServiceCallback(
result_.reset(result_socket.ToValue().release());
SendResponse(true);
} else {
+ SetError(kFailedToConnect);
SendResponse(false);
}
@@ -179,6 +182,7 @@ bool BluetoothConnectFunction::RunImpl() {
GetMutableAdapter(profile())->GetDevice(params->device.address);
if (!device) {
SendResponse(false);
+ SetError(kInvalidDevice);
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698