Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: chrome/browser/chromeos/login/lock/screen_locker.cc

Issue 521463005: Make SetState be called later when screen is unlocking. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 {
212 user_manager::UserManager::Get()->SwitchActiveUser( 209 user_manager::UserManager::Get()->SwitchActiveUser(
213 user_context.GetUserID()); 210 user_context.GetUserID());
214 } 211 }
215 } else { 212 } else {
216 NOTREACHED() << "Logged in user not found."; 213 NOTREACHED() << "Logged in user not found.";
217 } 214 }
218 saved_ime_state_ = NULL;
219 215
220 authentication_capture_.reset(new AuthenticationParametersCapture()); 216 authentication_capture_.reset(new AuthenticationParametersCapture());
221 authentication_capture_->user_context = user_context; 217 authentication_capture_->user_context = user_context;
222 218
223 // Add guard for case when something get broken in call chain to unlock 219 // Add guard for case when something get broken in call chain to unlock
224 // for sure. 220 // for sure.
225 base::MessageLoop::current()->PostDelayedTask( 221 base::MessageLoop::current()->PostDelayedTask(
226 FROM_HERE, 222 FROM_HERE,
227 base::Bind(&ScreenLocker::UnlockOnLoginSuccess, 223 base::Bind(&ScreenLocker::UnlockOnLoginSuccess,
228 weak_factory_.GetWeakPtr()), 224 weak_factory_.GetWeakPtr()),
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 bool state = false; 452 bool state = false;
457 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; 453 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state;
458 content::NotificationService::current()->Notify( 454 content::NotificationService::current()->Notify(
459 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, 455 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
460 content::Source<ScreenLocker>(this), 456 content::Source<ScreenLocker>(this),
461 content::Details<bool>(&state)); 457 content::Details<bool>(&state));
462 458
463 VLOG(1) << "Calling session manager's HandleLockScreenDismissed D-Bus method"; 459 VLOG(1) << "Calling session manager's HandleLockScreenDismissed D-Bus method";
464 DBusThreadManager::Get()->GetSessionManagerClient()-> 460 DBusThreadManager::Get()->GetSessionManagerClient()->
465 NotifyLockScreenDismissed(); 461 NotifyLockScreenDismissed();
462
463 if (saved_ime_state_) {
464 input_method::InputMethodManager::Get()->SetState(saved_ime_state_);
465 }
466 } 466 }
467 467
468 void ScreenLocker::SetAuthenticator(Authenticator* authenticator) { 468 void ScreenLocker::SetAuthenticator(Authenticator* authenticator) {
469 authenticator_ = authenticator; 469 authenticator_ = authenticator;
470 } 470 }
471 471
472 void ScreenLocker::ScreenLockReady() { 472 void ScreenLocker::ScreenLockReady() {
473 locked_ = true; 473 locked_ = true;
474 base::TimeDelta delta = base::Time::Now() - start_time_; 474 base::TimeDelta delta = base::Time::Now() - start_time_;
475 VLOG(1) << "ScreenLocker " << this << " is ready after " 475 VLOG(1) << "ScreenLocker " << this << " is ready after "
476 << delta.InSecondsF() << " second(s)"; 476 << delta.InSecondsF() << " second(s)";
477 UMA_HISTOGRAM_TIMES("ScreenLocker.ScreenLockTime", delta); 477 UMA_HISTOGRAM_TIMES("ScreenLocker.ScreenLockTime", delta);
478 478
479 VLOG(1) << "Moving desktop background to locked container"; 479 VLOG(1) << "Moving desktop background to locked container";
480 ash::Shell::GetInstance()-> 480 ash::Shell::GetInstance()->
481 desktop_background_controller()->MoveDesktopToLockedContainer(); 481 desktop_background_controller()->MoveDesktopToLockedContainer();
482 482
483 input_method::InputMethodManager* imm = 483 input_method::InputMethodManager* imm =
484 input_method::InputMethodManager::Get(); 484 input_method::InputMethodManager::Get();
485 saved_ime_state_ = imm->GetActiveIMEState(); 485 saved_ime_state_ = imm->GetActiveIMEState()->Clone();
486 imm->SetState(saved_ime_state_->Clone());
487 imm->GetActiveIMEState()->EnableLockScreenLayouts(); 486 imm->GetActiveIMEState()->EnableLockScreenLayouts();
Alexander Alekseev 2014/09/01 12:24:43 Why do you need this change? This breaks "User def
Shu Chen 2014/09/01 13:37:53 I've reverted the change here. My original intenti
Alexander Alekseev 2014/09/01 13:50:05 SetState will not call ChangeInputMethodInternal()
488 487
489 bool state = true; 488 bool state = true;
490 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; 489 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state;
491 content::NotificationService::current()->Notify( 490 content::NotificationService::current()->Notify(
492 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, 491 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
493 content::Source<ScreenLocker>(this), 492 content::Source<ScreenLocker>(this),
494 content::Details<bool>(&state)); 493 content::Details<bool>(&state));
495 VLOG(1) << "Calling session manager's HandleLockScreenShown D-Bus method"; 494 VLOG(1) << "Calling session manager's HandleLockScreenShown D-Bus method";
496 DBusThreadManager::Get()->GetSessionManagerClient()->NotifyLockScreenShown(); 495 DBusThreadManager::Get()->GetSessionManagerClient()->NotifyLockScreenShown();
497 } 496 }
498 497
499 content::WebUI* ScreenLocker::GetAssociatedWebUI() { 498 content::WebUI* ScreenLocker::GetAssociatedWebUI() {
500 return delegate_->GetAssociatedWebUI(); 499 return delegate_->GetAssociatedWebUI();
501 } 500 }
502 501
503 bool ScreenLocker::IsUserLoggedIn(const std::string& username) { 502 bool ScreenLocker::IsUserLoggedIn(const std::string& username) {
504 for (user_manager::UserList::const_iterator it = users_.begin(); 503 for (user_manager::UserList::const_iterator it = users_.begin();
505 it != users_.end(); 504 it != users_.end();
506 ++it) { 505 ++it) {
507 if ((*it)->email() == username) 506 if ((*it)->email() == username)
508 return true; 507 return true;
509 } 508 }
510 return false; 509 return false;
511 } 510 }
512 511
513 } // namespace chromeos 512 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698