| OLD | NEW |
| 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" |
| 11 #include "ash/audio/sounds.h" | 11 #include "ash/audio/sounds.h" |
| 12 #include "ash/desktop_background/desktop_background_controller.h" | 12 #include "ash/desktop_background/desktop_background_controller.h" |
| 13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "ash/wm/common/window_state.h" | 14 #include "ash/wm/common/window_state.h" |
| 15 #include "ash/wm/common/wm_event.h" | 15 #include "ash/wm/common/wm_event.h" |
| 16 #include "ash/wm/lock_state_controller.h" | 16 #include "ash/wm/lock_state_controller.h" |
| 17 #include "ash/wm/window_state_aura.h" | 17 #include "ash/wm/window_state_aura.h" |
| 18 #include "ash/wm/window_util.h" | 18 #include "ash/wm/window_util.h" |
| 19 #include "base/bind.h" | 19 #include "base/bind.h" |
| 20 #include "base/command_line.h" | 20 #include "base/command_line.h" |
| 21 #include "base/lazy_instance.h" | 21 #include "base/lazy_instance.h" |
| 22 #include "base/location.h" |
| 22 #include "base/macros.h" | 23 #include "base/macros.h" |
| 23 #include "base/memory/weak_ptr.h" | 24 #include "base/memory/weak_ptr.h" |
| 24 #include "base/message_loop/message_loop.h" | 25 #include "base/message_loop/message_loop.h" |
| 25 #include "base/metrics/histogram.h" | 26 #include "base/metrics/histogram.h" |
| 27 #include "base/single_thread_task_runner.h" |
| 26 #include "base/strings/string_number_conversions.h" | 28 #include "base/strings/string_number_conversions.h" |
| 27 #include "base/strings/string_util.h" | 29 #include "base/strings/string_util.h" |
| 30 #include "base/threading/thread_task_runner_handle.h" |
| 28 #include "chrome/browser/chrome_notification_types.h" | 31 #include "chrome/browser/chrome_notification_types.h" |
| 29 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" | 32 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" |
| 30 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 33 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
| 31 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 34 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
| 32 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 35 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 33 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 36 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
| 34 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 37 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
| 35 #include "chrome/browser/lifetime/application_lifetime.h" | 38 #include "chrome/browser/lifetime/application_lifetime.h" |
| 36 #include "chrome/browser/signin/easy_unlock_service.h" | 39 #include "chrome/browser/signin/easy_unlock_service.h" |
| 37 #include "chrome/browser/signin/signin_manager_factory.h" | 40 #include "chrome/browser/signin/signin_manager_factory.h" |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 UserSessionManager::GetInstance()->UpdateEasyUnlockKeys(user_context); | 221 UserSessionManager::GetInstance()->UpdateEasyUnlockKeys(user_context); |
| 219 } else { | 222 } else { |
| 220 NOTREACHED() << "Logged in user not found."; | 223 NOTREACHED() << "Logged in user not found."; |
| 221 } | 224 } |
| 222 | 225 |
| 223 authentication_capture_.reset(new AuthenticationParametersCapture()); | 226 authentication_capture_.reset(new AuthenticationParametersCapture()); |
| 224 authentication_capture_->user_context = user_context; | 227 authentication_capture_->user_context = user_context; |
| 225 | 228 |
| 226 // Add guard for case when something get broken in call chain to unlock | 229 // Add guard for case when something get broken in call chain to unlock |
| 227 // for sure. | 230 // for sure. |
| 228 base::MessageLoop::current()->PostDelayedTask( | 231 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 229 FROM_HERE, | 232 FROM_HERE, base::Bind(&ScreenLocker::UnlockOnLoginSuccess, |
| 230 base::Bind(&ScreenLocker::UnlockOnLoginSuccess, | 233 weak_factory_.GetWeakPtr()), |
| 231 weak_factory_.GetWeakPtr()), | |
| 232 base::TimeDelta::FromMilliseconds(kUnlockGuardTimeoutMs)); | 234 base::TimeDelta::FromMilliseconds(kUnlockGuardTimeoutMs)); |
| 233 delegate_->AnimateAuthenticationSuccess(); | 235 delegate_->AnimateAuthenticationSuccess(); |
| 234 } | 236 } |
| 235 | 237 |
| 236 void ScreenLocker::UnlockOnLoginSuccess() { | 238 void ScreenLocker::UnlockOnLoginSuccess() { |
| 237 DCHECK(base::MessageLoopForUI::IsCurrent()); | 239 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 238 if (!authentication_capture_.get()) { | 240 if (!authentication_capture_.get()) { |
| 239 LOG(WARNING) << "Call to UnlockOnLoginSuccess without previous " << | 241 LOG(WARNING) << "Call to UnlockOnLoginSuccess without previous " << |
| 240 "authentication success."; | 242 "authentication success."; |
| 241 return; | 243 return; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 for (user_manager::UserList::const_iterator it = users_.begin(); | 509 for (user_manager::UserList::const_iterator it = users_.begin(); |
| 508 it != users_.end(); | 510 it != users_.end(); |
| 509 ++it) { | 511 ++it) { |
| 510 if ((*it)->email() == username) | 512 if ((*it)->email() == username) |
| 511 return true; | 513 return true; |
| 512 } | 514 } |
| 513 return false; | 515 return false; |
| 514 } | 516 } |
| 515 | 517 |
| 516 } // namespace chromeos | 518 } // namespace chromeos |
| OLD | NEW |