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/shell.h" | 10 #include "ash/shell.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h" | 34 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_factory.h" |
35 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" | 35 #include "chrome/browser/chromeos/login/quick_unlock/quick_unlock_storage.h" |
36 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 36 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
37 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 37 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
38 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 38 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
39 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 39 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
40 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 40 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
41 #include "chrome/browser/lifetime/application_lifetime.h" | 41 #include "chrome/browser/lifetime/application_lifetime.h" |
42 #include "chrome/browser/signin/easy_unlock_service.h" | 42 #include "chrome/browser/signin/easy_unlock_service.h" |
43 #include "chrome/browser/signin/signin_manager_factory.h" | 43 #include "chrome/browser/signin/signin_manager_factory.h" |
| 44 #include "chrome/browser/ui/ash/session_controller_client.h" |
44 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_provider.h" | 45 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_provider.h" |
45 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h" | 46 #include "chrome/browser/ui/webui/chromeos/login/screenlock_icon_source.h" |
46 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
47 #include "chrome/grit/browser_resources.h" | 48 #include "chrome/grit/browser_resources.h" |
48 #include "chrome/grit/generated_resources.h" | 49 #include "chrome/grit/generated_resources.h" |
49 #include "chromeos/audio/chromeos_sounds.h" | 50 #include "chromeos/audio/chromeos_sounds.h" |
50 #include "chromeos/dbus/dbus_thread_manager.h" | 51 #include "chromeos/dbus/dbus_thread_manager.h" |
51 #include "chromeos/dbus/session_manager_client.h" | 52 #include "chromeos/dbus/session_manager_client.h" |
52 #include "chromeos/login/auth/authenticator.h" | 53 #include "chromeos/login/auth/authenticator.h" |
53 #include "chromeos/login/auth/extended_authenticator.h" | 54 #include "chromeos/login/auth/extended_authenticator.h" |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 // static | 466 // static |
466 void ScreenLocker::Hide() { | 467 void ScreenLocker::Hide() { |
467 DCHECK(base::MessageLoopForUI::IsCurrent()); | 468 DCHECK(base::MessageLoopForUI::IsCurrent()); |
468 // For a guest user, screen_locker_ would have never been initialized. | 469 // For a guest user, screen_locker_ would have never been initialized. |
469 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) { | 470 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) { |
470 VLOG(1) << "Refusing to hide lock screen for guest account"; | 471 VLOG(1) << "Refusing to hide lock screen for guest account"; |
471 return; | 472 return; |
472 } | 473 } |
473 | 474 |
474 DCHECK(screen_locker_); | 475 DCHECK(screen_locker_); |
475 | 476 SessionControllerClient::Get()->RunUnlockAnimation( |
476 // Sets session state to ACTIVE before destroying screen locker. Otherwise, | 477 base::Bind(&ScreenLocker::ScheduleDeletion)); |
477 // ash thinks the session is blocked and does not correct set focus on | |
478 // screen lock dismissal. | |
479 // TODO(xiyuan): Figure out a better way to ensure state change go through. | |
480 session_manager::SessionManager::Get()->SetSessionState( | |
481 session_manager::SessionState::ACTIVE); | |
482 BrowserThread::PostTask( | |
483 BrowserThread::UI, FROM_HERE, base::Bind([] { | |
484 base::Callback<void(void)> callback = | |
485 base::Bind(&ScreenLocker::ScheduleDeletion); | |
486 ash::Shell::Get()->lock_state_controller()->OnLockScreenHide(callback); | |
487 })); | |
488 } | 478 } |
489 | 479 |
490 // static | 480 // static |
491 void ScreenLocker::ScheduleDeletion() { | 481 void ScreenLocker::ScheduleDeletion() { |
492 // Avoid possible multiple calls. | 482 // Avoid possible multiple calls. |
493 if (screen_locker_ == NULL) | 483 if (screen_locker_ == NULL) |
494 return; | 484 return; |
495 VLOG(1) << "Deleting ScreenLocker " << screen_locker_; | 485 VLOG(1) << "Deleting ScreenLocker " << screen_locker_; |
496 | 486 |
497 AccessibilityManager::Get()->PlayEarcon( | 487 AccessibilityManager::Get()->PlayEarcon( |
(...skipping 22 matching lines...) Expand all Loading... |
520 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; | 510 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; |
521 content::NotificationService::current()->Notify( | 511 content::NotificationService::current()->Notify( |
522 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 512 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
523 content::Source<ScreenLocker>(this), | 513 content::Source<ScreenLocker>(this), |
524 content::Details<bool>(&state)); | 514 content::Details<bool>(&state)); |
525 | 515 |
526 VLOG(1) << "Calling session manager's HandleLockScreenDismissed D-Bus method"; | 516 VLOG(1) << "Calling session manager's HandleLockScreenDismissed D-Bus method"; |
527 DBusThreadManager::Get()->GetSessionManagerClient()-> | 517 DBusThreadManager::Get()->GetSessionManagerClient()-> |
528 NotifyLockScreenDismissed(); | 518 NotifyLockScreenDismissed(); |
529 | 519 |
| 520 session_manager::SessionManager::Get()->SetSessionState( |
| 521 session_manager::SessionState::ACTIVE); |
| 522 |
530 if (saved_ime_state_.get()) { | 523 if (saved_ime_state_.get()) { |
531 input_method::InputMethodManager::Get()->SetState(saved_ime_state_); | 524 input_method::InputMethodManager::Get()->SetState(saved_ime_state_); |
532 } | 525 } |
533 } | 526 } |
534 | 527 |
535 void ScreenLocker::SetAuthenticator(Authenticator* authenticator) { | 528 void ScreenLocker::SetAuthenticator(Authenticator* authenticator) { |
536 authenticator_ = authenticator; | 529 authenticator_ = authenticator; |
537 } | 530 } |
538 | 531 |
539 void ScreenLocker::ScreenLockReady() { | 532 void ScreenLocker::ScreenLockReady() { |
(...skipping 25 matching lines...) Expand all Loading... |
565 | 558 |
566 bool ScreenLocker::IsUserLoggedIn(const AccountId& account_id) const { | 559 bool ScreenLocker::IsUserLoggedIn(const AccountId& account_id) const { |
567 for (user_manager::User* user : users_) { | 560 for (user_manager::User* user : users_) { |
568 if (user->GetAccountId() == account_id) | 561 if (user->GetAccountId() == account_id) |
569 return true; | 562 return true; |
570 } | 563 } |
571 return false; | 564 return false; |
572 } | 565 } |
573 | 566 |
574 } // namespace chromeos | 567 } // namespace chromeos |
OLD | NEW |