Chromium Code Reviews| 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..2c12dc00316eacd6208a0754b8a10ed607f30c91 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,25 @@ 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); |
| + PA_LOG(INFO) << " beacon_seed: " << b64_beacon_seed; |
|
Ryan Hansberry
2017/05/09 02:44:08
nit: Make the output of this prettier. At least ma
Tim Song
2017/05/10 18:23:26
Done. I just deleted this log; it's a bit unnecess
|
| + beacon_seed_list->AppendString(b64_beacon_seed); |
| + } |
| + |
| + PA_LOG(INFO) << "Serializing " << beacon_seed_list->GetSize() << " seeds."; |
| + 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 +275,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; |
|
Ryan Hansberry
2017/05/09 02:44:08
nit: remove the line break.
Tim Song
2017/05/10 18:23:26
The line break makes the JSON more readable, as it
|
| + |
| DictionaryPrefUpdate pairing_update(profile()->GetPrefs(), |
| prefs::kEasyUnlockPairing); |
| if (devices.empty()) |