| OLD | NEW |
| 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 weak_ptr_factory_.GetWeakPtr(), | 328 weak_ptr_factory_.GetWeakPtr(), |
| 329 user_id_)); | 329 user_id_)); |
| 330 } | 330 } |
| 331 | 331 |
| 332 void EasyUnlockServiceSignin::OnUserDataLoaded( | 332 void EasyUnlockServiceSignin::OnUserDataLoaded( |
| 333 const std::string& user_id, | 333 const std::string& user_id, |
| 334 bool success, | 334 bool success, |
| 335 const chromeos::EasyUnlockDeviceKeyDataList& devices) { | 335 const chromeos::EasyUnlockDeviceKeyDataList& devices) { |
| 336 allow_cryptohome_backoff_ = false; | 336 allow_cryptohome_backoff_ = false; |
| 337 | 337 |
| 338 UserData* data = user_data_[user_id_]; | 338 UserData* data = user_data_[user_id]; |
| 339 data->state = USER_DATA_STATE_LOADED; | 339 data->state = USER_DATA_STATE_LOADED; |
| 340 if (success) { | 340 if (success) { |
| 341 data->devices = devices; | 341 data->devices = devices; |
| 342 chromeos::EasyUnlockKeyManager::DeviceDataListToRemoteDeviceList( | 342 chromeos::EasyUnlockKeyManager::DeviceDataListToRemoteDeviceList( |
| 343 user_id, devices, &data->remote_devices_value); | 343 user_id, devices, &data->remote_devices_value); |
| 344 } | 344 } |
| 345 | 345 |
| 346 // If the fetched data belongs to the currently focused user, notify the app | 346 // If the fetched data belongs to the currently focused user, notify the app |
| 347 // that it has to refresh it's user data. | 347 // that it has to refresh it's user data. |
| 348 if (user_id == user_id_) | 348 if (user_id == user_id_) |
| 349 NotifyUserUpdated(); | 349 NotifyUserUpdated(); |
| 350 } | 350 } |
| 351 | 351 |
| 352 const EasyUnlockServiceSignin::UserData* | 352 const EasyUnlockServiceSignin::UserData* |
| 353 EasyUnlockServiceSignin::FindLoadedDataForCurrentUser() const { | 353 EasyUnlockServiceSignin::FindLoadedDataForCurrentUser() const { |
| 354 if (user_id_.empty()) | 354 if (user_id_.empty()) |
| 355 return NULL; | 355 return NULL; |
| 356 | 356 |
| 357 std::map<std::string, UserData*>::const_iterator it = | 357 std::map<std::string, UserData*>::const_iterator it = |
| 358 user_data_.find(user_id_); | 358 user_data_.find(user_id_); |
| 359 if (it == user_data_.end()) | 359 if (it == user_data_.end()) |
| 360 return NULL; | 360 return NULL; |
| 361 if (it->second->state != USER_DATA_STATE_LOADED) | 361 if (it->second->state != USER_DATA_STATE_LOADED) |
| 362 return NULL; | 362 return NULL; |
| 363 return it->second; | 363 return it->second; |
| 364 } | 364 } |
| OLD | NEW |