| 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_regular.h" | 5 #include "chrome/browser/signin/easy_unlock_service_regular.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 prefs::kEasyUnlockPairing); | 182 prefs::kEasyUnlockPairing); |
| 183 pairing_update->SetWithoutPathExpansion(kKeyDevices, devices.DeepCopy()); | 183 pairing_update->SetWithoutPathExpansion(kKeyDevices, devices.DeepCopy()); |
| 184 | 184 |
| 185 #if defined(OS_CHROMEOS) | 185 #if defined(OS_CHROMEOS) |
| 186 // TODO(tengs): Investigate if we can determine if the remote devices were set | 186 // TODO(tengs): Investigate if we can determine if the remote devices were set |
| 187 // from sync or from the setup app. | 187 // from sync or from the setup app. |
| 188 if (short_lived_user_context_ && short_lived_user_context_->user_context() && | 188 if (short_lived_user_context_ && short_lived_user_context_->user_context() && |
| 189 !devices.empty()) { | 189 !devices.empty()) { |
| 190 // We may already have the password cached, so proceed to create the | 190 // We may already have the password cached, so proceed to create the |
| 191 // cryptohome keys for sign-in or the system will be hardlocked. | 191 // cryptohome keys for sign-in or the system will be hardlocked. |
| 192 chromeos::UserContext* user_context = | 192 chromeos::UserSessionManager::GetInstance()->GetEasyUnlockKeyManager() |
| 193 short_lived_user_context_->user_context(); | 193 ->RefreshKeys( |
| 194 chromeos::EasyUnlockKeyManager* key_manager = | 194 *short_lived_user_context_->user_context(), |
| 195 chromeos::UserSessionManager::GetInstance()->GetEasyUnlockKeyManager(); | 195 devices, |
| 196 | 196 base::Bind(&EasyUnlockServiceRegular::OnKeysRefreshedForSetDevices, |
| 197 key_manager->RefreshKeys( | 197 weak_ptr_factory_.GetWeakPtr())); |
| 198 *user_context, devices, | |
| 199 base::Bind(&EasyUnlockServiceRegular::OnKeysRefreshedForSetDevices, | |
| 200 weak_ptr_factory_.GetWeakPtr())); | |
| 201 } else { | 198 } else { |
| 202 CheckCryptohomeKeysAndMaybeHardlock(); | 199 CheckCryptohomeKeysAndMaybeHardlock(); |
| 203 } | 200 } |
| 204 #else | 201 #else |
| 205 CheckCryptohomeKeysAndMaybeHardlock(); | 202 CheckCryptohomeKeysAndMaybeHardlock(); |
| 206 #endif | 203 #endif |
| 207 } | 204 } |
| 208 | 205 |
| 209 void EasyUnlockServiceRegular::ClearRemoteDevices() { | 206 void EasyUnlockServiceRegular::ClearRemoteDevices() { |
| 210 DictionaryPrefUpdate pairing_update(profile()->GetPrefs(), | 207 DictionaryPrefUpdate pairing_update(profile()->GetPrefs(), |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 326 |
| 330 if (!success) { | 327 if (!success) { |
| 331 SetTurnOffFlowStatus(FAIL); | 328 SetTurnOffFlowStatus(FAIL); |
| 332 return; | 329 return; |
| 333 } | 330 } |
| 334 | 331 |
| 335 ClearRemoteDevices(); | 332 ClearRemoteDevices(); |
| 336 SetTurnOffFlowStatus(IDLE); | 333 SetTurnOffFlowStatus(IDLE); |
| 337 ReloadApp(); | 334 ReloadApp(); |
| 338 } | 335 } |
| OLD | NEW |