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

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

Issue 1412813003: This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Fix Win GN build. Created 5 years, 1 month 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/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 IDS_LOGIN_ERROR_AUTHENTICATING, 190 IDS_LOGIN_ERROR_AUTHENTICATING,
191 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT); 191 HelpAppLauncher::HELP_CANT_ACCESS_ACCOUNT);
192 192
193 if (auth_status_consumer_) 193 if (auth_status_consumer_)
194 auth_status_consumer_->OnAuthFailure(error); 194 auth_status_consumer_->OnAuthFailure(error);
195 } 195 }
196 196
197 void ScreenLocker::OnAuthSuccess(const UserContext& user_context) { 197 void ScreenLocker::OnAuthSuccess(const UserContext& user_context) {
198 incorrect_passwords_count_ = 0; 198 incorrect_passwords_count_ = 0;
199 if (authentication_start_time_.is_null()) { 199 if (authentication_start_time_.is_null()) {
200 if (!user_context.GetUserID().empty()) 200 if (user_context.GetAccountId().is_valid())
201 LOG(ERROR) << "Start time is not set at authentication success"; 201 LOG(ERROR) << "Start time is not set at authentication success";
202 } else { 202 } else {
203 base::TimeDelta delta = base::Time::Now() - authentication_start_time_; 203 base::TimeDelta delta = base::Time::Now() - authentication_start_time_;
204 VLOG(1) << "Authentication success: " << delta.InSecondsF() << " second(s)"; 204 VLOG(1) << "Authentication success: " << delta.InSecondsF() << " second(s)";
205 UMA_HISTOGRAM_TIMES("ScreenLocker.AuthenticationSuccessTime", delta); 205 UMA_HISTOGRAM_TIMES("ScreenLocker.AuthenticationSuccessTime", delta);
206 } 206 }
207 207
208 const user_manager::User* user = 208 const user_manager::User* user =
209 user_manager::UserManager::Get()->FindUser(user_context.GetUserID()); 209 user_manager::UserManager::Get()->FindUser(user_context.GetAccountId());
210 if (user) { 210 if (user) {
211 if (!user->is_active()) { 211 if (!user->is_active()) {
212 saved_ime_state_ = NULL; 212 saved_ime_state_ = NULL;
213 user_manager::UserManager::Get()->SwitchActiveUser( 213 user_manager::UserManager::Get()->SwitchActiveUser(
214 user_context.GetUserID()); 214 user_context.GetAccountId());
215 } 215 }
216 UserSessionManager::GetInstance()->UpdateEasyUnlockKeys(user_context); 216 UserSessionManager::GetInstance()->UpdateEasyUnlockKeys(user_context);
217 } else { 217 } else {
218 NOTREACHED() << "Logged in user not found."; 218 NOTREACHED() << "Logged in user not found.";
219 } 219 }
220 220
221 authentication_capture_.reset(new AuthenticationParametersCapture()); 221 authentication_capture_.reset(new AuthenticationParametersCapture());
222 authentication_capture_->user_context = user_context; 222 authentication_capture_->user_context = user_context;
223 223
224 // Add guard for case when something get broken in call chain to unlock 224 // Add guard for case when something get broken in call chain to unlock
(...skipping 18 matching lines...) Expand all
243 auth_status_consumer_->OnAuthSuccess(authentication_capture_->user_context); 243 auth_status_consumer_->OnAuthSuccess(authentication_capture_->user_context);
244 } 244 }
245 authentication_capture_.reset(); 245 authentication_capture_.reset();
246 weak_factory_.InvalidateWeakPtrs(); 246 weak_factory_.InvalidateWeakPtrs();
247 247
248 VLOG(1) << "Hiding the lock screen."; 248 VLOG(1) << "Hiding the lock screen.";
249 chromeos::ScreenLocker::Hide(); 249 chromeos::ScreenLocker::Hide();
250 } 250 }
251 251
252 void ScreenLocker::Authenticate(const UserContext& user_context) { 252 void ScreenLocker::Authenticate(const UserContext& user_context) {
253 LOG_ASSERT(IsUserLoggedIn(user_context.GetUserID())) 253 LOG_ASSERT(IsUserLoggedIn(user_context.GetAccountId().GetUserEmail()))
254 << "Invalid user trying to unlock."; 254 << "Invalid user trying to unlock.";
255 255
256 authentication_start_time_ = base::Time::Now(); 256 authentication_start_time_ = base::Time::Now();
257 delegate_->SetInputEnabled(false); 257 delegate_->SetInputEnabled(false);
258 delegate_->OnAuthenticate(); 258 delegate_->OnAuthenticate();
259 259
260 // Special case: supervised users. Use special authenticator. 260 // Special case: supervised users. Use special authenticator.
261 if (const user_manager::User* user = 261 if (const user_manager::User* user =
262 FindUnlockUser(user_context.GetUserID())) { 262 FindUnlockUser(user_context.GetAccountId().GetUserEmail())) {
263 if (user->GetType() == user_manager::USER_TYPE_SUPERVISED) { 263 if (user->GetType() == user_manager::USER_TYPE_SUPERVISED) {
264 UserContext updated_context = ChromeUserManager::Get() 264 UserContext updated_context = ChromeUserManager::Get()
265 ->GetSupervisedUserManager() 265 ->GetSupervisedUserManager()
266 ->GetAuthentication() 266 ->GetAuthentication()
267 ->TransformKey(user_context); 267 ->TransformKey(user_context);
268 // TODO(antrim) : replace empty closure with explicit method. 268 // TODO(antrim) : replace empty closure with explicit method.
269 // http://crbug.com/351268 269 // http://crbug.com/351268
270 BrowserThread::PostTask( 270 BrowserThread::PostTask(
271 BrowserThread::UI, 271 BrowserThread::UI,
272 FROM_HERE, 272 FROM_HERE,
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 for (user_manager::UserList::const_iterator it = users_.begin(); 505 for (user_manager::UserList::const_iterator it = users_.begin();
506 it != users_.end(); 506 it != users_.end();
507 ++it) { 507 ++it) {
508 if ((*it)->email() == username) 508 if ((*it)->email() == username)
509 return true; 509 return true;
510 } 510 }
511 return false; 511 return false;
512 } 512 }
513 513
514 } // namespace chromeos 514 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/kiosk_browsertest.cc ('k') | chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698