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

Side by Side Diff: chrome/browser/signin/easy_unlock_service_signin_chromeos.cc

Issue 2560713002: Move RemoteDevice from //components/proximity_auth to //components/cryptauth so that it can be easi… (Closed)
Patch Set: Add cryptauth dependency. Created 4 years 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
« no previous file with comments | « chrome/browser/signin/easy_unlock_service_regular.cc ('k') | components/cryptauth/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/signin/easy_unlock_service_signin_chromeos.h" 5 #include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/base64url.h" 9 #include "base/base64url.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 } 421 }
422 422
423 // If the fetched data belongs to the currently focused user, notify the app 423 // If the fetched data belongs to the currently focused user, notify the app
424 // that it has to refresh it's user data. 424 // that it has to refresh it's user data.
425 if (account_id == account_id_) 425 if (account_id == account_id_)
426 NotifyUserUpdated(); 426 NotifyUserUpdated();
427 427
428 if (devices.empty()) 428 if (devices.empty())
429 return; 429 return;
430 430
431 proximity_auth::RemoteDeviceList remote_devices; 431 cryptauth::RemoteDeviceList remote_devices;
432 for (const auto& device : devices) { 432 for (const auto& device : devices) {
433 std::string decoded_public_key, decoded_psk, decoded_challenge; 433 std::string decoded_public_key, decoded_psk, decoded_challenge;
434 if (!base::Base64UrlDecode(device.public_key, 434 if (!base::Base64UrlDecode(device.public_key,
435 base::Base64UrlDecodePolicy::REQUIRE_PADDING, 435 base::Base64UrlDecodePolicy::REQUIRE_PADDING,
436 &decoded_public_key) || 436 &decoded_public_key) ||
437 !base::Base64UrlDecode(device.psk, 437 !base::Base64UrlDecode(device.psk,
438 base::Base64UrlDecodePolicy::REQUIRE_PADDING, 438 base::Base64UrlDecodePolicy::REQUIRE_PADDING,
439 &decoded_psk) || 439 &decoded_psk) ||
440 !base::Base64UrlDecode(device.challenge, 440 !base::Base64UrlDecode(device.challenge,
441 base::Base64UrlDecodePolicy::REQUIRE_PADDING, 441 base::Base64UrlDecodePolicy::REQUIRE_PADDING,
442 &decoded_challenge)) { 442 &decoded_challenge)) {
443 PA_LOG(ERROR) << "Unable base64url decode stored remote device: " 443 PA_LOG(ERROR) << "Unable base64url decode stored remote device: "
444 << device.public_key; 444 << device.public_key;
445 continue; 445 continue;
446 } 446 }
447 proximity_auth::RemoteDevice::BluetoothType bluetooth_type = 447 cryptauth::RemoteDevice::BluetoothType bluetooth_type =
448 device.bluetooth_type == chromeos::EasyUnlockDeviceKeyData::BLUETOOTH_LE 448 device.bluetooth_type == chromeos::EasyUnlockDeviceKeyData::BLUETOOTH_LE
449 ? proximity_auth::RemoteDevice::BLUETOOTH_LE 449 ? cryptauth::RemoteDevice::BLUETOOTH_LE
450 : proximity_auth::RemoteDevice::BLUETOOTH_CLASSIC; 450 : cryptauth::RemoteDevice::BLUETOOTH_CLASSIC;
451 proximity_auth::RemoteDevice remote_device( 451 cryptauth::RemoteDevice remote_device(
452 account_id.GetUserEmail(), std::string(), decoded_public_key, 452 account_id.GetUserEmail(), std::string(), decoded_public_key,
453 bluetooth_type, device.bluetooth_address, decoded_psk, 453 bluetooth_type, device.bluetooth_address, decoded_psk,
454 decoded_challenge); 454 decoded_challenge);
455 remote_devices.push_back(remote_device); 455 remote_devices.push_back(remote_device);
456 PA_LOG(INFO) << "Loaded Remote Device:\n" 456 PA_LOG(INFO) << "Loaded Remote Device:\n"
457 << " user id: " << remote_device.user_id << "\n" 457 << " user id: " << remote_device.user_id << "\n"
458 << " name: " << remote_device.name << "\n" 458 << " name: " << remote_device.name << "\n"
459 << " public key" << device.public_key << "\n" 459 << " public key" << device.public_key << "\n"
460 << " bt_addr:" << remote_device.bluetooth_address 460 << " bt_addr:" << remote_device.bluetooth_address
461 << " type:" << static_cast<int>(remote_device.bluetooth_type); 461 << " type:" << static_cast<int>(remote_device.bluetooth_type);
462 } 462 }
463 463
464 SetProximityAuthDevices(account_id, remote_devices); 464 SetProximityAuthDevices(account_id, remote_devices);
465 } 465 }
466 466
467 const EasyUnlockServiceSignin::UserData* 467 const EasyUnlockServiceSignin::UserData*
468 EasyUnlockServiceSignin::FindLoadedDataForCurrentUser() const { 468 EasyUnlockServiceSignin::FindLoadedDataForCurrentUser() const {
469 if (!account_id_.is_valid()) 469 if (!account_id_.is_valid())
470 return nullptr; 470 return nullptr;
471 471
472 const auto it = user_data_.find(account_id_); 472 const auto it = user_data_.find(account_id_);
473 if (it == user_data_.end()) 473 if (it == user_data_.end())
474 return nullptr; 474 return nullptr;
475 if (it->second->state != USER_DATA_STATE_LOADED) 475 if (it->second->state != USER_DATA_STATE_LOADED)
476 return nullptr; 476 return nullptr;
477 return it->second.get(); 477 return it->second.get();
478 } 478 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_service_regular.cc ('k') | components/cryptauth/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698