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/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/prefs/scoped_user_pref_update.h" | 10 #include "base/prefs/scoped_user_pref_update.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 prefs::kEasyUnlockPairing); | 159 prefs::kEasyUnlockPairing); |
160 pairing_update->SetWithoutPathExpansion(kKeyDevices, devices.DeepCopy()); | 160 pairing_update->SetWithoutPathExpansion(kKeyDevices, devices.DeepCopy()); |
161 | 161 |
162 #if defined(OS_CHROMEOS) | 162 #if defined(OS_CHROMEOS) |
163 // TODO(tengs): Investigate if we can determine if the remote devices were set | 163 // TODO(tengs): Investigate if we can determine if the remote devices were set |
164 // from sync or from the setup app. | 164 // from sync or from the setup app. |
165 if (short_lived_user_context_ && short_lived_user_context_->user_context() && | 165 if (short_lived_user_context_ && short_lived_user_context_->user_context() && |
166 !devices.empty()) { | 166 !devices.empty()) { |
167 // We may already have the password cached, so proceed to create the | 167 // We may already have the password cached, so proceed to create the |
168 // cryptohome keys for sign-in or the system will be hardlocked. | 168 // cryptohome keys for sign-in or the system will be hardlocked. |
169 chromeos::UserContext* user_context = | 169 chromeos::UserSessionManager::GetInstance()->GetEasyUnlockKeyManager() |
170 short_lived_user_context_->user_context(); | 170 ->RefreshKeys( |
171 chromeos::EasyUnlockKeyManager* key_manager = | 171 *short_lived_user_context_->user_context(), |
172 chromeos::UserSessionManager::GetInstance()->GetEasyUnlockKeyManager(); | 172 devices, |
173 | 173 base::Bind(&EasyUnlockServiceRegular::OnKeysRefreshedForSetDevices, |
174 key_manager->RefreshKeys( | 174 weak_ptr_factory_.GetWeakPtr())); |
175 *user_context, devices, | |
176 base::Bind(&EasyUnlockServiceRegular::OnKeysRefreshedForSetDevices, | |
177 weak_ptr_factory_.GetWeakPtr())); | |
178 } else { | 175 } else { |
179 CheckCryptohomeKeysAndMaybeHardlock(); | 176 CheckCryptohomeKeysAndMaybeHardlock(); |
180 } | 177 } |
181 #else | 178 #else |
182 CheckCryptohomeKeysAndMaybeHardlock(); | 179 CheckCryptohomeKeysAndMaybeHardlock(); |
183 #endif | 180 #endif |
184 } | 181 } |
185 | 182 |
186 void EasyUnlockServiceRegular::ClearRemoteDevices() { | 183 void EasyUnlockServiceRegular::ClearRemoteDevices() { |
187 DictionaryPrefUpdate pairing_update(profile()->GetPrefs(), | 184 DictionaryPrefUpdate pairing_update(profile()->GetPrefs(), |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 299 |
303 if (!success) { | 300 if (!success) { |
304 SetTurnOffFlowStatus(FAIL); | 301 SetTurnOffFlowStatus(FAIL); |
305 return; | 302 return; |
306 } | 303 } |
307 | 304 |
308 ClearRemoteDevices(); | 305 ClearRemoteDevices(); |
309 SetTurnOffFlowStatus(IDLE); | 306 SetTurnOffFlowStatus(IDLE); |
310 ReloadApp(); | 307 ReloadApp(); |
311 } | 308 } |
OLD | NEW |