Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(204)

Side by Side Diff: chrome/browser/signin/easy_unlock_service_regular.cc

Issue 898003002: [Cleanup] Const-correct the profile() method for the EasyUnlockService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/signin/easy_unlock_service.h ('k') | chrome/browser/signin/screenlock_bridge.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/easy_unlock_service.h ('k') | chrome/browser/signin/screenlock_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698