Index: chrome/browser/signin/easy_unlock_service_regular.cc |
diff --git a/chrome/browser/signin/easy_unlock_service_regular.cc b/chrome/browser/signin/easy_unlock_service_regular.cc |
index 38598e88950e1f0f9e5c21d5efa6065956276891..5446c93304f54cc351a979fef627dbc4fa1313e7 100644 |
--- a/chrome/browser/signin/easy_unlock_service_regular.cc |
+++ b/chrome/browser/signin/easy_unlock_service_regular.cc |
@@ -11,6 +11,7 @@ |
#include "base/base64url.h" |
#include "base/bind.h" |
#include "base/command_line.h" |
+#include "base/json/json_string_value_serializer.h" |
#include "base/logging.h" |
#include "base/memory/ptr_util.h" |
#include "base/sys_info.h" |
@@ -135,6 +136,23 @@ void EasyUnlockServiceRegular::OnRemoteDevicesLoaded( |
dict->SetString("permitRecord.id", b64_public_key); |
dict->SetString("permitRecord.type", "license"); |
dict->SetString("permitRecord.data", b64_public_key); |
+ |
+ // TODO(tengs): Retrieve the actual BeaconSeeds from the RemoteDevice. |
+ std::vector<cryptauth::BeaconSeed> beacon_seeds; |
+ std::unique_ptr<base::ListValue> beacon_seed_list(new base::ListValue()); |
+ for (const auto& beacon_seed : beacon_seeds) { |
+ std::string b64_beacon_seed; |
+ base::Base64UrlEncode(beacon_seed.SerializeAsString(), |
+ base::Base64UrlEncodePolicy::INCLUDE_PADDING, |
+ &b64_beacon_seed); |
+ beacon_seed_list->AppendString(b64_beacon_seed); |
+ } |
+ |
+ std::string serialized_beacon_seeds; |
+ JSONStringValueSerializer serializer(&serialized_beacon_seeds); |
+ serializer.Serialize(*beacon_seed_list); |
+ dict->SetString("serializedBeaconSeeds", serialized_beacon_seeds); |
+ |
device_list->Append(std::move(dict)); |
} |
@@ -255,6 +273,11 @@ const base::ListValue* EasyUnlockServiceRegular::GetRemoteDevices() const { |
void EasyUnlockServiceRegular::SetRemoteDevices( |
const base::ListValue& devices) { |
+ std::string remote_devices_json; |
+ JSONStringValueSerializer serializer(&remote_devices_json); |
+ serializer.Serialize(devices); |
+ PA_LOG(INFO) << "Setting RemoteDevices:\n " << remote_devices_json; |
+ |
DictionaryPrefUpdate pairing_update(profile()->GetPrefs(), |
prefs::kEasyUnlockPairing); |
if (devices.empty()) |