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

Unified Diff: chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc

Issue 1941923002: bluetooth: Return int8_t and use -128 for unknown tx power. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Fix extensions tests Created 4 years, 7 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/easy_unlock_private/easy_unlock_private_api.cc
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc
index 1350f0529278651eb192e3cd9fafd7ef115c1591..9769ab7246fef82bca6c8ab21de9782585e63536 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc
@@ -68,6 +68,8 @@ namespace easy_unlock_private = api::easy_unlock_private;
namespace {
+enum { kUnknownPower = 127 };
+
static base::LazyInstance<BrowserContextKeyedAPIFactory<EasyUnlockPrivateAPI> >
g_factory = LAZY_INSTANCE_INITIALIZER;
@@ -955,9 +957,14 @@ bool EasyUnlockPrivateGetConnectionInfoFunction::DoWork(
void EasyUnlockPrivateGetConnectionInfoFunction::OnConnectionInfo(
const device::BluetoothDevice::ConnectionInfo& connection_info) {
std::unique_ptr<base::ListValue> results(new base::ListValue());
- results->AppendInteger(connection_info.rssi);
- results->AppendInteger(connection_info.transmit_power);
- results->AppendInteger(connection_info.max_transmit_power);
+ results->AppendInteger(connection_info.rssi ? connection_info.rssi.value()
+ : kUnknownPower);
+ results->AppendInteger(connection_info.transmit_power
+ ? connection_info.transmit_power.value()
+ : kUnknownPower);
+ results->AppendInteger(connection_info.max_transmit_power
+ ? connection_info.max_transmit_power.value()
+ : kUnknownPower);
SetResultList(std::move(results));
SendResponse(true);
}
« no previous file with comments | « no previous file | components/arc/bluetooth/arc_bluetooth_bridge.cc » ('j') | device/bluetooth/bluetooth_classic_device_mac.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698