OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/screen_locker.h" | 5 #include "chrome/browser/chromeos/login/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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 UserManager::Get()->SwitchActiveUser(user_context.username); | 224 UserManager::Get()->SwitchActiveUser(user_context.username); |
225 } else { | 225 } else { |
226 NOTREACHED() << "Logged in user not found."; | 226 NOTREACHED() << "Logged in user not found."; |
227 } | 227 } |
228 | 228 |
229 authentication_capture_.reset(new AuthenticationParametersCapture()); | 229 authentication_capture_.reset(new AuthenticationParametersCapture()); |
230 authentication_capture_->username = user_context.username; | 230 authentication_capture_->username = user_context.username; |
231 authentication_capture_->pending_requests = pending_requests; | 231 authentication_capture_->pending_requests = pending_requests; |
232 authentication_capture_->using_oauth = using_oauth; | 232 authentication_capture_->using_oauth = using_oauth; |
233 | 233 |
234 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 234 // Add guard for case when something get broken in call chain to unlock |
235 if (command_line->HasSwitch(ash::switches::kAshDisableNewLockAnimations)) { | 235 // for sure. |
236 UnlockOnLoginSuccess(); | 236 base::MessageLoop::current()->PostDelayedTask( |
237 } else { | 237 FROM_HERE, |
238 // Add guard for case when something get broken in call chain to unlock | 238 base::Bind(&ScreenLocker::UnlockOnLoginSuccess, |
239 // for sure. | 239 weak_factory_.GetWeakPtr()), |
240 base::MessageLoop::current()->PostDelayedTask( | 240 base::TimeDelta::FromMilliseconds(kUnlockGuardTimeoutMs)); |
241 FROM_HERE, | 241 delegate_->AnimateAuthenticationSuccess(); |
242 base::Bind(&ScreenLocker::UnlockOnLoginSuccess, | |
243 weak_factory_.GetWeakPtr()), | |
244 base::TimeDelta::FromMilliseconds(kUnlockGuardTimeoutMs)); | |
245 delegate_->AnimateAuthenticationSuccess(); | |
246 } | |
247 } | 242 } |
248 | 243 |
249 void ScreenLocker::UnlockOnLoginSuccess() { | 244 void ScreenLocker::UnlockOnLoginSuccess() { |
250 DCHECK(base::MessageLoop::current()->type() == base::MessageLoop::TYPE_UI); | 245 DCHECK(base::MessageLoop::current()->type() == base::MessageLoop::TYPE_UI); |
251 if (!authentication_capture_.get()) { | 246 if (!authentication_capture_.get()) { |
252 LOG(WARNING) << "Call to UnlockOnLoginSuccess without previous " << | 247 LOG(WARNING) << "Call to UnlockOnLoginSuccess without previous " << |
253 "authentication success."; | 248 "authentication success."; |
254 return; | 249 return; |
255 } | 250 } |
256 | 251 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 | 439 |
445 bool ScreenLocker::IsUserLoggedIn(const std::string& username) { | 440 bool ScreenLocker::IsUserLoggedIn(const std::string& username) { |
446 for (UserList::const_iterator it = users_.begin(); it != users_.end(); ++it) { | 441 for (UserList::const_iterator it = users_.begin(); it != users_.end(); ++it) { |
447 if ((*it)->email() == username) | 442 if ((*it)->email() == username) |
448 return true; | 443 return true; |
449 } | 444 } |
450 return false; | 445 return false; |
451 } | 446 } |
452 | 447 |
453 } // namespace chromeos | 448 } // namespace chromeos |
OLD | NEW |