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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 266 |
267 void EasyUnlockServiceRegular::ShutdownInternal() { | 267 void EasyUnlockServiceRegular::ShutdownInternal() { |
268 #if defined(OS_CHROMEOS) | 268 #if defined(OS_CHROMEOS) |
269 short_lived_user_context_.reset(); | 269 short_lived_user_context_.reset(); |
270 #endif | 270 #endif |
271 | 271 |
272 turn_off_flow_status_ = EasyUnlockService::IDLE; | 272 turn_off_flow_status_ = EasyUnlockService::IDLE; |
273 registrar_.RemoveAll(); | 273 registrar_.RemoveAll(); |
274 } | 274 } |
275 | 275 |
276 bool EasyUnlockServiceRegular::IsAllowedInternal() { | 276 bool EasyUnlockServiceRegular::IsAllowedInternal() const { |
277 #if defined(OS_CHROMEOS) | 277 #if defined(OS_CHROMEOS) |
278 if (!user_manager::UserManager::Get()->IsLoggedInAsUserWithGaiaAccount()) | 278 if (!user_manager::UserManager::Get()->IsLoggedInAsUserWithGaiaAccount()) |
279 return false; | 279 return false; |
280 | 280 |
281 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile())) | 281 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile())) |
282 return false; | 282 return false; |
283 | 283 |
284 if (!profile()->GetPrefs()->GetBoolean(prefs::kEasyUnlockAllowed)) | 284 if (!profile()->GetPrefs()->GetBoolean(prefs::kEasyUnlockAllowed)) |
285 return false; | 285 return false; |
286 | 286 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 new base::DictionaryValue()); | 329 new base::DictionaryValue()); |
330 user_prefs_dict->SetBooleanWithoutPathExpansion( | 330 user_prefs_dict->SetBooleanWithoutPathExpansion( |
331 prefs::kEasyUnlockProximityRequired, | 331 prefs::kEasyUnlockProximityRequired, |
332 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); | 332 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); |
333 | 333 |
334 DictionaryPrefUpdate update(local_state, | 334 DictionaryPrefUpdate update(local_state, |
335 prefs::kEasyUnlockLocalStateUserPrefs); | 335 prefs::kEasyUnlockLocalStateUserPrefs); |
336 std::string user_email = GetUserEmail(); | 336 std::string user_email = GetUserEmail(); |
337 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass()); | 337 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass()); |
338 } | 338 } |
OLD | NEW |