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