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

Side by Side Diff: chrome/browser/chromeos/login/lock/screen_locker.cc

Issue 2715823004: Add FingerprintUnlock KeyedService for each profile (Closed)
Patch Set: Created 3 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
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/chromeos/login/lock/screen_locker.h" 5 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/common/wallpaper/wallpaper_controller.h" 10 #include "ash/common/wallpaper/wallpaper_controller.h"
(...skipping 12 matching lines...) Expand all
23 #include "base/memory/weak_ptr.h" 23 #include "base/memory/weak_ptr.h"
24 #include "base/message_loop/message_loop.h" 24 #include "base/message_loop/message_loop.h"
25 #include "base/metrics/histogram_macros.h" 25 #include "base/metrics/histogram_macros.h"
26 #include "base/single_thread_task_runner.h" 26 #include "base/single_thread_task_runner.h"
27 #include "base/strings/string_number_conversions.h" 27 #include "base/strings/string_number_conversions.h"
28 #include "base/strings/string_util.h" 28 #include "base/strings/string_util.h"
29 #include "base/threading/thread_task_runner_handle.h" 29 #include "base/threading/thread_task_runner_handle.h"
30 #include "chrome/browser/chrome_notification_types.h" 30 #include "chrome/browser/chrome_notification_types.h"
31 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 31 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
32 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" 32 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h"
33 #include "chrome/browser/chromeos/login/quick_unlock/fingerprint_unlock.h"
34 #include "chrome/browser/chromeos/login/quick_unlock/fingerprint_unlock_factory. h"
33 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" 35 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h"
34 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h" 36 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h"
35 #include "chrome/browser/chromeos/login/session/user_session_manager.h" 37 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
36 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio n.h" 38 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio n.h"
37 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" 39 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
38 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" 40 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h"
39 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" 41 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h"
40 #include "chrome/browser/lifetime/application_lifetime.h" 42 #include "chrome/browser/lifetime/application_lifetime.h"
41 #include "chrome/browser/signin/easy_unlock_service.h" 43 #include "chrome/browser/signin/easy_unlock_service.h"
42 #include "chrome/browser/signin/signin_manager_factory.h" 44 #include "chrome/browser/signin/signin_manager_factory.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 session_started_ = true; 112 session_started_ = true;
111 113
112 // The user session has just started, so the user has logged in. Mark a 114 // The user session has just started, so the user has logged in. Mark a
113 // strong authentication to allow them to use PIN to unlock the device. 115 // strong authentication to allow them to use PIN to unlock the device.
114 user_manager::User* user = 116 user_manager::User* user =
115 content::Details<user_manager::User>(details).ptr(); 117 content::Details<user_manager::User>(details).ptr();
116 quick_unlock::PinStorage* pin_storage = 118 quick_unlock::PinStorage* pin_storage =
117 quick_unlock::PinStorageFactory::GetForUser(user); 119 quick_unlock::PinStorageFactory::GetForUser(user);
118 if (pin_storage) 120 if (pin_storage)
119 pin_storage->MarkStrongAuth(); 121 pin_storage->MarkStrongAuth();
122
123 quick_unlock::FingerprintUnlock* fingerprint_unlock =
124 quick_unlock::FingerprintUnlockFactory::GetForUser(user);
125 if (fingerprint_unlock)
126 fingerprint_unlock->MarkStrongAuth();
120 } else { 127 } else {
121 NOTREACHED() << "Unexpected notification " << type; 128 NOTREACHED() << "Unexpected notification " << type;
122 } 129 }
123 } 130 }
124 131
125 // UserAddingScreen::Observer overrides: 132 // UserAddingScreen::Observer overrides:
126 void OnUserAddingFinished() override { 133 void OnUserAddingFinished() override {
127 UserAddingScreen::Get()->RemoveObserver(this); 134 UserAddingScreen::Get()->RemoveObserver(this);
128 ScreenLocker::HandleLockScreenRequest(); 135 ScreenLocker::HandleLockScreenRequest();
129 } 136 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 // 1. If the user signed in with a PIN, that means they should be able to 250 // 1. If the user signed in with a PIN, that means they should be able to
244 // continue signing in with a PIN. 251 // continue signing in with a PIN.
245 // 2. If the user signed in with cryptohome keys, then the PIN timeout is 252 // 2. If the user signed in with cryptohome keys, then the PIN timeout is
246 // going to be reset as well, so it is safe to reset the unlock attempt 253 // going to be reset as well, so it is safe to reset the unlock attempt
247 // count. 254 // count.
248 quick_unlock::PinStorage* pin_storage = 255 quick_unlock::PinStorage* pin_storage =
249 quick_unlock::PinStorageFactory::GetForUser(user); 256 quick_unlock::PinStorageFactory::GetForUser(user);
250 if (pin_storage) 257 if (pin_storage)
251 pin_storage->ResetUnlockAttemptCount(); 258 pin_storage->ResetUnlockAttemptCount();
252 259
260 quick_unlock::FingerprintUnlock* fingerprint_unlock =
261 quick_unlock::FingerprintUnlockFactory::GetForAccountId(
jdufault 2017/02/24 23:37:10 GetForUser?
xiaoyinh(OOO Sep 11-29) 2017/02/27 21:36:42 Changed.
262 user_context.GetAccountId());
263 if (fingerprint_unlock)
264 fingerprint_unlock->ResetUnlockAttemptCount();
265
253 UserSessionManager::GetInstance()->UpdateEasyUnlockKeys(user_context); 266 UserSessionManager::GetInstance()->UpdateEasyUnlockKeys(user_context);
254 } else { 267 } else {
255 NOTREACHED() << "Logged in user not found."; 268 NOTREACHED() << "Logged in user not found.";
256 } 269 }
257 270
258 authentication_capture_.reset(new AuthenticationParametersCapture()); 271 authentication_capture_.reset(new AuthenticationParametersCapture());
259 authentication_capture_->user_context = user_context; 272 authentication_capture_->user_context = user_context;
260 273
261 // Add guard for case when something get broken in call chain to unlock 274 // Add guard for case when something get broken in call chain to unlock
262 // for sure. 275 // for sure.
263 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 276 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
264 FROM_HERE, base::Bind(&ScreenLocker::UnlockOnLoginSuccess, 277 FROM_HERE, base::Bind(&ScreenLocker::UnlockOnLoginSuccess,
265 weak_factory_.GetWeakPtr()), 278 weak_factory_.GetWeakPtr()),
266 base::TimeDelta::FromMilliseconds(kUnlockGuardTimeoutMs)); 279 base::TimeDelta::FromMilliseconds(kUnlockGuardTimeoutMs));
267 web_ui()->AnimateAuthenticationSuccess(); 280 web_ui()->AnimateAuthenticationSuccess();
268 } 281 }
269 282
270 void ScreenLocker::OnPasswordAuthSuccess(const UserContext& user_context) { 283 void ScreenLocker::OnPasswordAuthSuccess(const UserContext& user_context) {
271 // The user has signed in using their password, so reset the PIN timeout. 284 // The user has signed in using their password, so reset the PIN timeout.
272 quick_unlock::PinStorage* pin_storage = 285 quick_unlock::PinStorage* pin_storage =
273 quick_unlock::PinStorageFactory::GetForAccountId( 286 quick_unlock::PinStorageFactory::GetForAccountId(
274 user_context.GetAccountId()); 287 user_context.GetAccountId());
275 if (pin_storage) 288 if (pin_storage)
276 pin_storage->MarkStrongAuth(); 289 pin_storage->MarkStrongAuth();
290
291 quick_unlock::FingerprintUnlock* fingerprint_unlock =
292 quick_unlock::FingerprintUnlockFactory::GetForAccountId(
293 user_context.GetAccountId());
294 if (fingerprint_unlock)
295 fingerprint_unlock->MarkStrongAuth();
277 } 296 }
278 297
279 void ScreenLocker::UnlockOnLoginSuccess() { 298 void ScreenLocker::UnlockOnLoginSuccess() {
280 DCHECK(base::MessageLoopForUI::IsCurrent()); 299 DCHECK(base::MessageLoopForUI::IsCurrent());
281 if (!authentication_capture_.get()) { 300 if (!authentication_capture_.get()) {
282 LOG(WARNING) << "Call to UnlockOnLoginSuccess without previous " << 301 LOG(WARNING) << "Call to UnlockOnLoginSuccess without previous " <<
283 "authentication success."; 302 "authentication success.";
284 return; 303 return;
285 } 304 }
286 305
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 575
557 bool ScreenLocker::IsUserLoggedIn(const AccountId& account_id) const { 576 bool ScreenLocker::IsUserLoggedIn(const AccountId& account_id) const {
558 for (user_manager::User* user : users_) { 577 for (user_manager::User* user : users_) {
559 if (user->GetAccountId() == account_id) 578 if (user->GetAccountId() == account_id)
560 return true; 579 return true;
561 } 580 }
562 return false; 581 return false;
563 } 582 }
564 583
565 } // namespace chromeos 584 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698