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

Unified Diff: chrome/browser/signin/easy_unlock_service_regular.cc

Issue 2902093002: [EasyUnlock] Force user to enter their password after 20 hours. (Closed)
Patch Set: fix test Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/signin/easy_unlock_service_regular.cc
diff --git a/chrome/browser/signin/easy_unlock_service_regular.cc b/chrome/browser/signin/easy_unlock_service_regular.cc
index 8e9bd9e63257a0cf65c9e9d33789ed53ef20dd4a..6a4dcfec42b9fe375b9fff5c49fb363f083a61af 100644
--- a/chrome/browser/signin/easy_unlock_service_regular.cc
+++ b/chrome/browser/signin/easy_unlock_service_regular.cc
@@ -524,22 +524,33 @@ void EasyUnlockServiceRegular::OnScreenDidLock(
void EasyUnlockServiceRegular::OnScreenDidUnlock(
proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) {
+ bool is_lock_screen =
+ screen_type == proximity_auth::ScreenlockBridge::LockHandler::LOCK_SCREEN;
+
+ if (!will_unlock_using_easy_unlock_ && GetProximityAuthPrefManager() &&
+ (is_lock_screen || !base::CommandLine::ForCurrentProcess()->HasSwitch(
+ proximity_auth::switches::kEnableChromeOSLogin))) {
+ // If a password was used, then record the current timestamp. This timestamp
+ // is used to enforce password reauths after a certain time has elapsed.
+ GetProximityAuthPrefManager()->SetLastPasswordEntryTimestampMs(
+ base::Time::Now().ToJavaTime());
+ }
+
// Notifications of signin screen unlock events can also reach this code path;
// disregard them.
- if (screen_type != proximity_auth::ScreenlockBridge::LockHandler::LOCK_SCREEN)
+ if (!is_lock_screen)
return;
// Only record metrics for users who have enabled the feature.
if (IsEnabled()) {
- EasyUnlockAuthEvent event =
- will_unlock_using_easy_unlock_
- ? EASY_UNLOCK_SUCCESS
- : GetPasswordAuthEvent();
+ EasyUnlockAuthEvent event = will_unlock_using_easy_unlock_
+ ? EASY_UNLOCK_SUCCESS
+ : GetPasswordAuthEvent();
RecordEasyUnlockScreenUnlockEvent(event);
if (will_unlock_using_easy_unlock_) {
- RecordEasyUnlockScreenUnlockDuration(
- base::TimeTicks::Now() - lock_screen_last_shown_timestamp_);
+ RecordEasyUnlockScreenUnlockDuration(base::TimeTicks::Now() -
+ lock_screen_last_shown_timestamp_);
}
}
« no previous file with comments | « chrome/browser/signin/easy_unlock_service.cc ('k') | components/proximity_auth/proximity_auth_pref_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698