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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ api.h" 5 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ api.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64url.h" 10 #include "base/base64url.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #endif 61 #endif
62 62
63 using proximity_auth::ScreenlockState; 63 using proximity_auth::ScreenlockState;
64 64
65 namespace extensions { 65 namespace extensions {
66 66
67 namespace easy_unlock_private = api::easy_unlock_private; 67 namespace easy_unlock_private = api::easy_unlock_private;
68 68
69 namespace { 69 namespace {
70 70
71 enum { kUnknownPower = 127 };
72
71 static base::LazyInstance<BrowserContextKeyedAPIFactory<EasyUnlockPrivateAPI> > 73 static base::LazyInstance<BrowserContextKeyedAPIFactory<EasyUnlockPrivateAPI> >
72 g_factory = LAZY_INSTANCE_INITIALIZER; 74 g_factory = LAZY_INSTANCE_INITIALIZER;
73 75
74 // Utility method for getting the API's crypto delegate. 76 // Utility method for getting the API's crypto delegate.
75 EasyUnlockPrivateCryptoDelegate* GetCryptoDelegate( 77 EasyUnlockPrivateCryptoDelegate* GetCryptoDelegate(
76 content::BrowserContext* context) { 78 content::BrowserContext* context) {
77 return BrowserContextKeyedAPIFactory<EasyUnlockPrivateAPI>::Get(context) 79 return BrowserContextKeyedAPIFactory<EasyUnlockPrivateAPI>::Get(context)
78 ->GetCryptoDelegate(); 80 ->GetCryptoDelegate();
79 } 81 }
80 82
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 } 950 }
949 951
950 device->GetConnectionInfo(base::Bind( 952 device->GetConnectionInfo(base::Bind(
951 &EasyUnlockPrivateGetConnectionInfoFunction::OnConnectionInfo, this)); 953 &EasyUnlockPrivateGetConnectionInfoFunction::OnConnectionInfo, this));
952 return false; 954 return false;
953 } 955 }
954 956
955 void EasyUnlockPrivateGetConnectionInfoFunction::OnConnectionInfo( 957 void EasyUnlockPrivateGetConnectionInfoFunction::OnConnectionInfo(
956 const device::BluetoothDevice::ConnectionInfo& connection_info) { 958 const device::BluetoothDevice::ConnectionInfo& connection_info) {
957 std::unique_ptr<base::ListValue> results(new base::ListValue()); 959 std::unique_ptr<base::ListValue> results(new base::ListValue());
958 results->AppendInteger(connection_info.rssi); 960 results->AppendInteger(connection_info.rssi ? connection_info.rssi.value()
959 results->AppendInteger(connection_info.transmit_power); 961 : kUnknownPower);
960 results->AppendInteger(connection_info.max_transmit_power); 962 results->AppendInteger(connection_info.transmit_power
963 ? connection_info.transmit_power.value()
964 : kUnknownPower);
965 results->AppendInteger(connection_info.max_transmit_power
966 ? connection_info.max_transmit_power.value()
967 : kUnknownPower);
961 SetResultList(std::move(results)); 968 SetResultList(std::move(results));
962 SendResponse(true); 969 SendResponse(true);
963 } 970 }
964 971
965 EasyUnlockPrivateShowErrorBubbleFunction:: 972 EasyUnlockPrivateShowErrorBubbleFunction::
966 EasyUnlockPrivateShowErrorBubbleFunction() { 973 EasyUnlockPrivateShowErrorBubbleFunction() {
967 } 974 }
968 975
969 EasyUnlockPrivateShowErrorBubbleFunction:: 976 EasyUnlockPrivateShowErrorBubbleFunction::
970 ~EasyUnlockPrivateShowErrorBubbleFunction() { 977 ~EasyUnlockPrivateShowErrorBubbleFunction() {
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 ->GetDeviceAddress(extension(), params->connection_id); 1184 ->GetDeviceAddress(extension(), params->connection_id);
1178 results_ = 1185 results_ =
1179 easy_unlock_private::SetupConnectionGetDeviceAddress::Results::Create( 1186 easy_unlock_private::SetupConnectionGetDeviceAddress::Results::Create(
1180 device_address); 1187 device_address);
1181 if (device_address.empty()) 1188 if (device_address.empty())
1182 SetError("Invalid connectionId."); 1189 SetError("Invalid connectionId.");
1183 return true; 1190 return true;
1184 } 1191 }
1185 1192
1186 } // namespace extensions 1193 } // namespace extensions
OLDNEW
« 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