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

Side by Side 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 unified diff | Download patch
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 } 517 }
518 518
519 void EasyUnlockServiceRegular::OnScreenDidLock( 519 void EasyUnlockServiceRegular::OnScreenDidLock(
520 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { 520 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) {
521 will_unlock_using_easy_unlock_ = false; 521 will_unlock_using_easy_unlock_ = false;
522 lock_screen_last_shown_timestamp_ = base::TimeTicks::Now(); 522 lock_screen_last_shown_timestamp_ = base::TimeTicks::Now();
523 } 523 }
524 524
525 void EasyUnlockServiceRegular::OnScreenDidUnlock( 525 void EasyUnlockServiceRegular::OnScreenDidUnlock(
526 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { 526 proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) {
527 bool is_lock_screen =
528 screen_type == proximity_auth::ScreenlockBridge::LockHandler::LOCK_SCREEN;
529
530 if (!will_unlock_using_easy_unlock_ && GetProximityAuthPrefManager() &&
531 (is_lock_screen || !base::CommandLine::ForCurrentProcess()->HasSwitch(
532 proximity_auth::switches::kEnableChromeOSLogin))) {
533 // If a password was used, then record the current timestamp. This timestamp
534 // is used to enforce password reauths after a certain time has elapsed.
535 GetProximityAuthPrefManager()->SetLastPasswordEntryTimestampMs(
536 base::Time::Now().ToJavaTime());
537 }
538
527 // Notifications of signin screen unlock events can also reach this code path; 539 // Notifications of signin screen unlock events can also reach this code path;
528 // disregard them. 540 // disregard them.
529 if (screen_type != proximity_auth::ScreenlockBridge::LockHandler::LOCK_SCREEN) 541 if (!is_lock_screen)
530 return; 542 return;
531 543
532 // Only record metrics for users who have enabled the feature. 544 // Only record metrics for users who have enabled the feature.
533 if (IsEnabled()) { 545 if (IsEnabled()) {
534 EasyUnlockAuthEvent event = 546 EasyUnlockAuthEvent event = will_unlock_using_easy_unlock_
535 will_unlock_using_easy_unlock_ 547 ? EASY_UNLOCK_SUCCESS
536 ? EASY_UNLOCK_SUCCESS 548 : GetPasswordAuthEvent();
537 : GetPasswordAuthEvent();
538 RecordEasyUnlockScreenUnlockEvent(event); 549 RecordEasyUnlockScreenUnlockEvent(event);
539 550
540 if (will_unlock_using_easy_unlock_) { 551 if (will_unlock_using_easy_unlock_) {
541 RecordEasyUnlockScreenUnlockDuration( 552 RecordEasyUnlockScreenUnlockDuration(base::TimeTicks::Now() -
542 base::TimeTicks::Now() - lock_screen_last_shown_timestamp_); 553 lock_screen_last_shown_timestamp_);
543 } 554 }
544 } 555 }
545 556
546 will_unlock_using_easy_unlock_ = false; 557 will_unlock_using_easy_unlock_ = false;
547 558
548 // If we synced remote devices while the screen was locked, we can now load 559 // If we synced remote devices while the screen was locked, we can now load
549 // the new remote devices. 560 // the new remote devices.
550 if (deferring_device_load_) { 561 if (deferring_device_load_) {
551 PA_LOG(INFO) << "Loading deferred devices after screen unlock."; 562 PA_LOG(INFO) << "Loading deferred devices after screen unlock.";
552 deferring_device_load_ = false; 563 deferring_device_load_ = false;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 628
618 cryptauth::CryptAuthDeviceManager* 629 cryptauth::CryptAuthDeviceManager*
619 EasyUnlockServiceRegular::GetCryptAuthDeviceManager() { 630 EasyUnlockServiceRegular::GetCryptAuthDeviceManager() {
620 cryptauth::CryptAuthDeviceManager* manager = 631 cryptauth::CryptAuthDeviceManager* manager =
621 ChromeCryptAuthServiceFactory::GetInstance() 632 ChromeCryptAuthServiceFactory::GetInstance()
622 ->GetForBrowserContext(profile()) 633 ->GetForBrowserContext(profile())
623 ->GetCryptAuthDeviceManager(); 634 ->GetCryptAuthDeviceManager();
624 DCHECK(manager); 635 DCHECK(manager);
625 return manager; 636 return manager;
626 } 637 }
OLDNEW
« 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