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

Unified Diff: chrome/browser/chromeos/login/lock/screen_locker.cc

Issue 2809993004: cros: Implement cryptohome backend for pin.
Patch Set: Address comments Created 3 years, 6 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/chromeos/login/lock/screen_locker.cc
diff --git a/chrome/browser/chromeos/login/lock/screen_locker.cc b/chrome/browser/chromeos/login/lock/screen_locker.cc
index 7e1a29aa46ee77b9d397d6552773a70e69d1a8c7..50091b243aba329aed993b1a6bf6b1a5b77a6c06 100644
--- a/chrome/browser/chromeos/login/lock/screen_locker.cc
+++ b/chrome/browser/chromeos/login/lock/screen_locker.cc
@@ -30,6 +30,8 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
#include "chrome/browser/chromeos/login/lock/webui_screen_locker.h"
+#include "chrome/browser/chromeos/login/quick_unlock/fingerprint_storage.h"
+#include "chrome/browser/chromeos/login/quick_unlock/pin_backend.h"
#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h"
#include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h"
#include "chrome/browser/chromeos/login/session/user_session_manager.h"
@@ -326,10 +328,10 @@ void ScreenLocker::OnAuthSuccess(const UserContext& user_context) {
// 2. If the user signed in with cryptohome keys, then the PIN timeout is
// going to be reset as well, so it is safe to reset the unlock attempt
// count.
+ quick_unlock::PinBackend::NotifyAuthentication(user_context.GetAccountId());
quick_unlock::QuickUnlockStorage* quick_unlock_storage =
quick_unlock::QuickUnlockFactory::GetForUser(user);
if (quick_unlock_storage) {
- quick_unlock_storage->pin_storage()->ResetUnlockAttemptCount();
quick_unlock_storage->fingerprint_storage()->ResetUnlockAttemptCount();
}
@@ -397,15 +399,29 @@ void ScreenLocker::Authenticate(const UserContext& user_context) {
int dummy_value;
if (unlock_attempt_type_ == AUTH_PIN &&
base::StringToInt(pin, &dummy_value)) {
- quick_unlock::QuickUnlockStorage* quick_unlock_storage =
- quick_unlock::QuickUnlockFactory::GetForUser(user);
- if (quick_unlock_storage &&
- quick_unlock_storage->TryAuthenticatePin(pin)) {
- OnAuthSuccess(user_context);
- return;
- }
+ quick_unlock::PinBackend::TryAuthenticate(
+ user_context.GetAccountId(), pin,
+ base::Bind(&ScreenLocker::OnPinAttemptDone,
+ weak_factory_.GetWeakPtr(), user_context));
+ return;
}
+ }
+
+ ContinueAuthenticate(user_context);
+}
+
+void ScreenLocker::OnPinAttemptDone(const UserContext& user_context,
+ bool success) {
+ if (success)
+ OnAuthSuccess(user_context);
+ else
+ ContinueAuthenticate(user_context);
+}
+void ScreenLocker::ContinueAuthenticate(
+ const chromeos::UserContext& user_context) {
+ const user_manager::User* user = FindUnlockUser(user_context.GetAccountId());
+ if (user) {
// Special case: supervised users. Use special authenticator.
if (user->GetType() == user_manager::USER_TYPE_SUPERVISED) {
UserContext updated_context = ChromeUserManager::Get()
« no previous file with comments | « chrome/browser/chromeos/login/lock/screen_locker.h ('k') | chrome/browser/chromeos/login/quick_unlock/pin_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698