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

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

Issue 981723007: Remove workaround for to disable EasyUnlock in ephemeral mode for tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | chrome/browser/signin/easy_unlock_service_unittest_chromeos.cc » ('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 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 short_lived_user_context_.reset(); 287 short_lived_user_context_.reset();
288 #endif 288 #endif
289 289
290 turn_off_flow_status_ = EasyUnlockService::IDLE; 290 turn_off_flow_status_ = EasyUnlockService::IDLE;
291 registrar_.RemoveAll(); 291 registrar_.RemoveAll();
292 ScreenlockBridge::Get()->RemoveObserver(this); 292 ScreenlockBridge::Get()->RemoveObserver(this);
293 } 293 }
294 294
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 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
298 if (!user_manager->IsLoggedInAsUserWithGaiaAccount())
298 return false; 299 return false;
299 300
300 // TODO(tengs): Ephemeral accounts generate a new enrollment every time they 301 // TODO(tengs): Ephemeral accounts generate a new enrollment every time they
301 // are added, so disable Smart Lock to reduce enrollments on server. However, 302 // 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. 303 // 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 304 if (user_manager->IsCurrentUserNonCryptohomeDataEphemeral())
304 // refactoring is landed (crbug.com/414829).
305 const user_manager::User* user =
306 chromeos::ProfileHelper::Get()->GetUserByProfile(profile());
307 user_manager::UserManager* user_manager = user_manager::UserManager::Get();
308 if (user->email() != chromeos::login::kStubUser &&
309 user_manager->IsCurrentUserNonCryptohomeDataEphemeral())
310 return false; 305 return false;
311 306
312 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile())) 307 if (!chromeos::ProfileHelper::IsPrimaryProfile(profile()))
313 return false; 308 return false;
314 309
315 if (!profile()->GetPrefs()->GetBoolean(prefs::kEasyUnlockAllowed)) 310 if (!profile()->GetPrefs()->GetBoolean(prefs::kEasyUnlockAllowed))
316 return false; 311 return false;
317 312
318 return true; 313 return true;
319 #else 314 #else
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 new base::DictionaryValue()); 388 new base::DictionaryValue());
394 user_prefs_dict->SetBooleanWithoutPathExpansion( 389 user_prefs_dict->SetBooleanWithoutPathExpansion(
395 prefs::kEasyUnlockProximityRequired, 390 prefs::kEasyUnlockProximityRequired,
396 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired)); 391 profile_prefs->GetBoolean(prefs::kEasyUnlockProximityRequired));
397 392
398 DictionaryPrefUpdate update(local_state, 393 DictionaryPrefUpdate update(local_state,
399 prefs::kEasyUnlockLocalStateUserPrefs); 394 prefs::kEasyUnlockLocalStateUserPrefs);
400 std::string user_email = GetUserEmail(); 395 std::string user_email = GetUserEmail();
401 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass()); 396 update->SetWithoutPathExpansion(user_email, user_prefs_dict.Pass());
402 } 397 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/signin/easy_unlock_service_unittest_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698