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

Unified Diff: chrome/browser/signin/easy_unlock_service_signin_chromeos.cc

Issue 1372283002: Hook up ProximityAuthSystem in EasyUnlockService. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth_connection
Patch Set: remove log Created 5 years, 2 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/signin/easy_unlock_service_signin_chromeos.cc
diff --git a/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc b/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc
index 61a3fd884a696b44f7eae410440051272ebd4474..51034090af1e51f9dba16157956b436bccf1d1f3 100644
--- a/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc
+++ b/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc
@@ -6,6 +6,7 @@
#include "base/basictypes.h"
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/stl_util.h"
@@ -18,6 +19,10 @@
#include "chrome/browser/signin/easy_unlock_metrics.h"
#include "chromeos/login/auth/user_context.h"
#include "chromeos/tpm/tpm_token_loader.h"
+#include "components/proximity_auth/cryptauth/base64url.h"
+#include "components/proximity_auth/logging/logging.h"
+#include "components/proximity_auth/remote_device.h"
+#include "components/proximity_auth/switches.h"
namespace {
@@ -258,7 +263,7 @@ void EasyUnlockServiceSignin::OnWillFinalizeUnlock(bool success) {
NOTREACHED();
}
-void EasyUnlockServiceSignin::OnSuspendDone() {
+void EasyUnlockServiceSignin::OnSuspendDoneInternal() {
// Ignored.
}
@@ -382,6 +387,33 @@ void EasyUnlockServiceSignin::OnUserDataLoaded(
// that it has to refresh it's user data.
if (user_id == user_id_)
NotifyUserUpdated();
+
+ if (user_id != user_id || devices.empty())
+ return;
+
+ // TODO(tengs): Currently, ProximityAuthSystem only supports one device. Once
+ // multiple devices are supported, we need to load all devices.
+ std::string decoded_public_key, decoded_psk, decoded_challenge;
+ proximity_auth::Base64UrlDecode(devices[0].public_key, &decoded_public_key);
+ proximity_auth::Base64UrlDecode(devices[0].psk, &decoded_psk);
+ proximity_auth::Base64UrlDecode(devices[0].challenge, &decoded_challenge);
+
+ // TODO(tengs): We need to store the Bluetooth type with the TPM data.
+ proximity_auth::RemoteDevice::BluetoothType bluetooth_type =
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery)
+ ? proximity_auth::RemoteDevice::BLUETOOTH_LE
+ : proximity_auth::RemoteDevice::BLUETOOTH_CLASSIC;
+
+ proximity_auth::RemoteDevice remote_device(
+ user_id, std::string(), decoded_public_key, bluetooth_type,
+ devices[0].bluetooth_address, decoded_psk, decoded_challenge);
+ PA_LOG(INFO) << "Loaded Remote Device:\n"
+ << " user id: " << remote_device.user_id << "\n"
+ << " name: " << remote_device.name << "\n"
+ << " public key" << devices[0].public_key << "\n"
+ << " bt_addr:" << remote_device.bluetooth_address;
+ OnRemoteDeviceChanged(&remote_device);
}
const EasyUnlockServiceSignin::UserData*

Powered by Google App Engine
This is Rietveld 408576698