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

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

Issue 1749893002: Fix Smart Lock bugs introduced by change from raw email to AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2623
Patch Set: Created 4 years, 9 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/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 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 331
332 void EasyUnlockServiceSignin::OnFocusedUserChanged( 332 void EasyUnlockServiceSignin::OnFocusedUserChanged(
333 const AccountId& account_id) { 333 const AccountId& account_id) {
334 if (account_id_ == account_id) 334 if (account_id_ == account_id)
335 return; 335 return;
336 336
337 // Setting or clearing the account_id may changed |IsAllowed| value, so in 337 // Setting or clearing the account_id may changed |IsAllowed| value, so in
338 // these 338 // these
339 // cases update the app state. Otherwise, it's enough to notify the app the 339 // cases update the app state. Otherwise, it's enough to notify the app the
340 // user data has been updated. 340 // user data has been updated.
341 const bool should_update_app_state = 341 const bool should_update_app_state = (account_id_ != account_id);
342 account_id_.is_valid() != account_id.is_valid();
343 account_id_ = account_id; 342 account_id_ = account_id;
344 user_pod_last_focused_timestamp_ = base::TimeTicks::Now(); 343 user_pod_last_focused_timestamp_ = base::TimeTicks::Now();
345 344
346 ResetScreenlockState(); 345 ResetScreenlockState();
347 ShowInitialUserState(); 346 ShowInitialUserState();
348 347
349 if (should_update_app_state) { 348 if (should_update_app_state) {
350 UpdateAppState(); 349 UpdateAppState();
351 } else { 350 } else {
352 NotifyUserUpdated(); 351 NotifyUserUpdated();
(...skipping 15 matching lines...) Expand all
368 if (!chromeos::LoginState::Get()->IsUserLoggedIn()) 367 if (!chromeos::LoginState::Get()->IsUserLoggedIn())
369 return; 368 return;
370 DisableAppWithoutResettingScreenlockState(); 369 DisableAppWithoutResettingScreenlockState();
371 } 370 }
372 371
373 void EasyUnlockServiceSignin::LoadCurrentUserDataIfNeeded() { 372 void EasyUnlockServiceSignin::LoadCurrentUserDataIfNeeded() {
374 // TODO(xiyuan): Revisit this when adding tests. 373 // TODO(xiyuan): Revisit this when adding tests.
375 if (!base::SysInfo::IsRunningOnChromeOS()) 374 if (!base::SysInfo::IsRunningOnChromeOS())
376 return; 375 return;
377 376
378 if (account_id_.is_valid() || !service_active_) 377 if (!account_id_.is_valid() || !service_active_)
379 return; 378 return;
380 379
381 const auto it = user_data_.find(account_id_); 380 const auto it = user_data_.find(account_id_);
382 if (it == user_data_.end()) 381 if (it == user_data_.end())
383 user_data_.insert(std::make_pair(account_id_, new UserData())); 382 user_data_.insert(std::make_pair(account_id_, new UserData()));
384 383
385 UserData* data = user_data_[account_id_]; 384 UserData* data = user_data_[account_id_];
386 385
387 if (data->state != USER_DATA_STATE_INITIAL) 386 if (data->state != USER_DATA_STATE_INITIAL)
388 return; 387 return;
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 << " public key" << device.public_key << "\n" 459 << " public key" << device.public_key << "\n"
461 << " bt_addr:" << remote_device.bluetooth_address 460 << " bt_addr:" << remote_device.bluetooth_address
462 << " type:" << static_cast<int>(remote_device.bluetooth_type); 461 << " type:" << static_cast<int>(remote_device.bluetooth_type);
463 } 462 }
464 463
465 SetProximityAuthDevices(account_id, remote_devices); 464 SetProximityAuthDevices(account_id, remote_devices);
466 } 465 }
467 466
468 const EasyUnlockServiceSignin::UserData* 467 const EasyUnlockServiceSignin::UserData*
469 EasyUnlockServiceSignin::FindLoadedDataForCurrentUser() const { 468 EasyUnlockServiceSignin::FindLoadedDataForCurrentUser() const {
470 if (account_id_.is_valid()) 469 if (!account_id_.is_valid())
471 return nullptr; 470 return nullptr;
472 471
473 const auto it = user_data_.find(account_id_); 472 const auto it = user_data_.find(account_id_);
474 if (it == user_data_.end()) 473 if (it == user_data_.end())
475 return nullptr; 474 return nullptr;
476 if (it->second->state != USER_DATA_STATE_LOADED) 475 if (it->second->state != USER_DATA_STATE_LOADED)
477 return nullptr; 476 return nullptr;
478 return it->second; 477 return it->second;
479 } 478 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_service_regular.cc ('k') | chrome/browser/signin/easy_unlock_service_unittest_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698