| 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" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 LOG(ERROR) << "Start time is not set at authentication success"; | 198 LOG(ERROR) << "Start time is not set at authentication success"; |
| 199 } else { | 199 } else { |
| 200 base::TimeDelta delta = base::Time::Now() - authentication_start_time_; | 200 base::TimeDelta delta = base::Time::Now() - authentication_start_time_; |
| 201 VLOG(1) << "Authentication success: " << delta.InSecondsF() << " second(s)"; | 201 VLOG(1) << "Authentication success: " << delta.InSecondsF() << " second(s)"; |
| 202 UMA_HISTOGRAM_TIMES("ScreenLocker.AuthenticationSuccessTime", delta); | 202 UMA_HISTOGRAM_TIMES("ScreenLocker.AuthenticationSuccessTime", delta); |
| 203 } | 203 } |
| 204 | 204 |
| 205 const user_manager::User* user = | 205 const user_manager::User* user = |
| 206 user_manager::UserManager::Get()->FindUser(user_context.GetUserID()); | 206 user_manager::UserManager::Get()->FindUser(user_context.GetUserID()); |
| 207 if (user) { | 207 if (user) { |
| 208 if (!user->is_active()) | 208 if (user->is_active()) { |
| 209 DCHECK(saved_ime_state_); |
| 210 input_method::InputMethodManager::Get()->SetState(saved_ime_state_); |
| 211 } else { |
| 209 user_manager::UserManager::Get()->SwitchActiveUser( | 212 user_manager::UserManager::Get()->SwitchActiveUser( |
| 210 user_context.GetUserID()); | 213 user_context.GetUserID()); |
| 214 } |
| 211 } else { | 215 } else { |
| 212 NOTREACHED() << "Logged in user not found."; | 216 NOTREACHED() << "Logged in user not found."; |
| 213 } | 217 } |
| 218 saved_ime_state_ = NULL; |
| 214 | 219 |
| 215 authentication_capture_.reset(new AuthenticationParametersCapture()); | 220 authentication_capture_.reset(new AuthenticationParametersCapture()); |
| 216 authentication_capture_->user_context = user_context; | 221 authentication_capture_->user_context = user_context; |
| 217 | 222 |
| 218 // Add guard for case when something get broken in call chain to unlock | 223 // Add guard for case when something get broken in call chain to unlock |
| 219 // for sure. | 224 // for sure. |
| 220 base::MessageLoop::current()->PostDelayedTask( | 225 base::MessageLoop::current()->PostDelayedTask( |
| 221 FROM_HERE, | 226 FROM_HERE, |
| 222 base::Bind(&ScreenLocker::UnlockOnLoginSuccess, | 227 base::Bind(&ScreenLocker::UnlockOnLoginSuccess, |
| 223 weak_factory_.GetWeakPtr()), | 228 weak_factory_.GetWeakPtr()), |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 locked_ = true; | 473 locked_ = true; |
| 469 base::TimeDelta delta = base::Time::Now() - start_time_; | 474 base::TimeDelta delta = base::Time::Now() - start_time_; |
| 470 VLOG(1) << "ScreenLocker " << this << " is ready after " | 475 VLOG(1) << "ScreenLocker " << this << " is ready after " |
| 471 << delta.InSecondsF() << " second(s)"; | 476 << delta.InSecondsF() << " second(s)"; |
| 472 UMA_HISTOGRAM_TIMES("ScreenLocker.ScreenLockTime", delta); | 477 UMA_HISTOGRAM_TIMES("ScreenLocker.ScreenLockTime", delta); |
| 473 | 478 |
| 474 VLOG(1) << "Moving desktop background to locked container"; | 479 VLOG(1) << "Moving desktop background to locked container"; |
| 475 ash::Shell::GetInstance()-> | 480 ash::Shell::GetInstance()-> |
| 476 desktop_background_controller()->MoveDesktopToLockedContainer(); | 481 desktop_background_controller()->MoveDesktopToLockedContainer(); |
| 477 | 482 |
| 483 input_method::InputMethodManager* imm = |
| 484 input_method::InputMethodManager::Get(); |
| 485 saved_ime_state_ = imm->GetActiveIMEState(); |
| 486 imm->SetState(saved_ime_state_->Clone()); |
| 487 imm->GetActiveIMEState()->EnableLockScreenLayouts(); |
| 488 |
| 478 bool state = true; | 489 bool state = true; |
| 479 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; | 490 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; |
| 480 content::NotificationService::current()->Notify( | 491 content::NotificationService::current()->Notify( |
| 481 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 492 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
| 482 content::Source<ScreenLocker>(this), | 493 content::Source<ScreenLocker>(this), |
| 483 content::Details<bool>(&state)); | 494 content::Details<bool>(&state)); |
| 484 VLOG(1) << "Calling session manager's HandleLockScreenShown D-Bus method"; | 495 VLOG(1) << "Calling session manager's HandleLockScreenShown D-Bus method"; |
| 485 DBusThreadManager::Get()->GetSessionManagerClient()->NotifyLockScreenShown(); | 496 DBusThreadManager::Get()->GetSessionManagerClient()->NotifyLockScreenShown(); |
| 486 } | 497 } |
| 487 | 498 |
| 488 content::WebUI* ScreenLocker::GetAssociatedWebUI() { | 499 content::WebUI* ScreenLocker::GetAssociatedWebUI() { |
| 489 return delegate_->GetAssociatedWebUI(); | 500 return delegate_->GetAssociatedWebUI(); |
| 490 } | 501 } |
| 491 | 502 |
| 492 bool ScreenLocker::IsUserLoggedIn(const std::string& username) { | 503 bool ScreenLocker::IsUserLoggedIn(const std::string& username) { |
| 493 for (user_manager::UserList::const_iterator it = users_.begin(); | 504 for (user_manager::UserList::const_iterator it = users_.begin(); |
| 494 it != users_.end(); | 505 it != users_.end(); |
| 495 ++it) { | 506 ++it) { |
| 496 if ((*it)->email() == username) | 507 if ((*it)->email() == username) |
| 497 return true; | 508 return true; |
| 498 } | 509 } |
| 499 return false; | 510 return false; |
| 500 } | 511 } |
| 501 | 512 |
| 502 } // namespace chromeos | 513 } // namespace chromeos |
| OLD | NEW |