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