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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 bool EasyUnlockServiceRegular::IsAllowedInternal() const { | 295 bool EasyUnlockServiceRegular::IsAllowedInternal() const { |
296 #if defined(OS_CHROMEOS) | 296 #if defined(OS_CHROMEOS) |
297 if (!user_manager::UserManager::Get()->IsLoggedInAsUserWithGaiaAccount()) | 297 if (!user_manager::UserManager::Get()->IsLoggedInAsUserWithGaiaAccount()) |
298 return false; | 298 return false; |
299 | 299 |
300 // TODO(tengs): Ephemeral accounts generate a new enrollment every time they | 300 // TODO(tengs): Ephemeral accounts generate a new enrollment every time they |
301 // are added, so disable Smart Lock to reduce enrollments on server. However, | 301 // are added, so disable Smart Lock to reduce enrollments on server. However, |
302 // ephemeral accounts can be locked, so we should revisit this use case. | 302 // ephemeral accounts can be locked, so we should revisit this use case. |
303 // TODO(tengs): Remove this special case and test this code path after test | 303 // TODO(tengs): Remove this special case and test this code path after test |
304 // refactoring is landed (crbug.com/414829). | 304 // refactoring is landed (crbug.com/414829). |
305 user_manager::User* user = | 305 const user_manager::User* user = |
306 chromeos::ProfileHelper::Get()->GetUserByProfile(profile()); | 306 chromeos::ProfileHelper::Get()->GetUserByProfile(profile()); |
307 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); | 307 user_manager::UserManager* user_manager = user_manager::UserManager::Get(); |
308 if (user->email() != chromeos::login::kStubUser && | 308 if (user->email() != chromeos::login::kStubUser && |
309 user_manager->IsCurrentUserNonCryptohomeDataEphemeral()) | 309 user_manager->IsCurrentUserNonCryptohomeDataEphemeral()) |
310 return false; | 310 return false; |
311 | 311 |
312 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile())) | 312 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile())) |
313 return false; | 313 return false; |
314 | 314 |
315 if (!profile()->GetPrefs()->GetBoolean(prefs::kEasyUnlockAllowed)) | 315 if (!profile()->GetPrefs()->GetBoolean(prefs::kEasyUnlockAllowed)) |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 new base::DictionaryValue()); | 393 new base::DictionaryValue()); |
394 user_prefs_dict->SetBooleanWithoutPathExpansion( | 394 user_prefs_dict->SetBooleanWithoutPathExpansion( |
395 prefs::kEasyUnlockProximityRequired, | 395 prefs::kEasyUnlockProximityRequired, |
396 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); | 396 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); |
397 | 397 |
398 DictionaryPrefUpdate update(local_state, | 398 DictionaryPrefUpdate update(local_state, |
399 prefs::kEasyUnlockLocalStateUserPrefs); | 399 prefs::kEasyUnlockLocalStateUserPrefs); |
400 std::string user_email = GetUserEmail(); | 400 std::string user_email = GetUserEmail(); |
401 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass()); | 401 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass()); |
402 } | 402 } |
OLD | NEW |