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/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
11 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
12 #include "ash/common/wm/wm_event.h" | 12 #include "ash/common/wm/wm_event.h" |
13 #include "ash/desktop_background/desktop_background_controller.h" | |
14 #include "ash/shell.h" | 13 #include "ash/shell.h" |
| 14 #include "ash/wallpaper/wallpaper_controller.h" |
15 #include "ash/wm/lock_state_controller.h" | 15 #include "ash/wm/lock_state_controller.h" |
16 #include "ash/wm/window_state_aura.h" | 16 #include "ash/wm/window_state_aura.h" |
17 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
18 #include "base/bind.h" | 18 #include "base/bind.h" |
19 #include "base/command_line.h" | 19 #include "base/command_line.h" |
20 #include "base/lazy_instance.h" | 20 #include "base/lazy_instance.h" |
21 #include "base/location.h" | 21 #include "base/location.h" |
22 #include "base/macros.h" | 22 #include "base/macros.h" |
23 #include "base/memory/weak_ptr.h" | 23 #include "base/memory/weak_ptr.h" |
24 #include "base/message_loop/message_loop.h" | 24 #include "base/message_loop/message_loop.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 // ScreenLocker, private: | 484 // ScreenLocker, private: |
485 | 485 |
486 ScreenLocker::~ScreenLocker() { | 486 ScreenLocker::~ScreenLocker() { |
487 VLOG(1) << "Destroying ScreenLocker " << this; | 487 VLOG(1) << "Destroying ScreenLocker " << this; |
488 DCHECK(base::MessageLoopForUI::IsCurrent()); | 488 DCHECK(base::MessageLoopForUI::IsCurrent()); |
489 | 489 |
490 if (authenticator_.get()) | 490 if (authenticator_.get()) |
491 authenticator_->SetConsumer(NULL); | 491 authenticator_->SetConsumer(NULL); |
492 ClearErrors(); | 492 ClearErrors(); |
493 | 493 |
494 VLOG(1) << "Moving desktop background to unlocked container"; | 494 VLOG(1) << "Moving wallpaper to unlocked container"; |
495 ash::Shell::GetInstance()-> | 495 ash::Shell::GetInstance()->wallpaper_controller()->MoveToUnlockedContainer(); |
496 desktop_background_controller()->MoveDesktopToUnlockedContainer(); | |
497 | 496 |
498 screen_locker_ = NULL; | 497 screen_locker_ = NULL; |
499 bool state = false; | 498 bool state = false; |
500 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; | 499 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; |
501 content::NotificationService::current()->Notify( | 500 content::NotificationService::current()->Notify( |
502 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 501 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
503 content::Source<ScreenLocker>(this), | 502 content::Source<ScreenLocker>(this), |
504 content::Details<bool>(&state)); | 503 content::Details<bool>(&state)); |
505 | 504 |
506 VLOG(1) << "Calling session manager's HandleLockScreenDismissed D-Bus method"; | 505 VLOG(1) << "Calling session manager's HandleLockScreenDismissed D-Bus method"; |
507 DBusThreadManager::Get()->GetSessionManagerClient()-> | 506 DBusThreadManager::Get()->GetSessionManagerClient()-> |
508 NotifyLockScreenDismissed(); | 507 NotifyLockScreenDismissed(); |
509 | 508 |
510 if (saved_ime_state_.get()) { | 509 if (saved_ime_state_.get()) { |
511 input_method::InputMethodManager::Get()->SetState(saved_ime_state_); | 510 input_method::InputMethodManager::Get()->SetState(saved_ime_state_); |
512 } | 511 } |
513 } | 512 } |
514 | 513 |
515 void ScreenLocker::SetAuthenticator(Authenticator* authenticator) { | 514 void ScreenLocker::SetAuthenticator(Authenticator* authenticator) { |
516 authenticator_ = authenticator; | 515 authenticator_ = authenticator; |
517 } | 516 } |
518 | 517 |
519 void ScreenLocker::ScreenLockReady() { | 518 void ScreenLocker::ScreenLockReady() { |
520 locked_ = true; | 519 locked_ = true; |
521 base::TimeDelta delta = base::Time::Now() - start_time_; | 520 base::TimeDelta delta = base::Time::Now() - start_time_; |
522 VLOG(1) << "ScreenLocker " << this << " is ready after " | 521 VLOG(1) << "ScreenLocker " << this << " is ready after " |
523 << delta.InSecondsF() << " second(s)"; | 522 << delta.InSecondsF() << " second(s)"; |
524 UMA_HISTOGRAM_TIMES("ScreenLocker.ScreenLockTime", delta); | 523 UMA_HISTOGRAM_TIMES("ScreenLocker.ScreenLockTime", delta); |
525 | 524 |
526 VLOG(1) << "Moving desktop background to locked container"; | 525 VLOG(1) << "Moving wallpaper to locked container"; |
527 ash::Shell::GetInstance()-> | 526 ash::Shell::GetInstance()->wallpaper_controller()->MoveToLockedContainer(); |
528 desktop_background_controller()->MoveDesktopToLockedContainer(); | |
529 | 527 |
530 bool state = true; | 528 bool state = true; |
531 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; | 529 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; |
532 content::NotificationService::current()->Notify( | 530 content::NotificationService::current()->Notify( |
533 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 531 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
534 content::Source<ScreenLocker>(this), | 532 content::Source<ScreenLocker>(this), |
535 content::Details<bool>(&state)); | 533 content::Details<bool>(&state)); |
536 VLOG(1) << "Calling session manager's HandleLockScreenShown D-Bus method"; | 534 VLOG(1) << "Calling session manager's HandleLockScreenShown D-Bus method"; |
537 DBusThreadManager::Get()->GetSessionManagerClient()->NotifyLockScreenShown(); | 535 DBusThreadManager::Get()->GetSessionManagerClient()->NotifyLockScreenShown(); |
538 | 536 |
539 input_method::InputMethodManager::Get() | 537 input_method::InputMethodManager::Get() |
540 ->GetActiveIMEState() | 538 ->GetActiveIMEState() |
541 ->EnableLockScreenLayouts(); | 539 ->EnableLockScreenLayouts(); |
542 } | 540 } |
543 | 541 |
544 content::WebUI* ScreenLocker::GetAssociatedWebUI() { | 542 content::WebUI* ScreenLocker::GetAssociatedWebUI() { |
545 return delegate_->GetAssociatedWebUI(); | 543 return delegate_->GetAssociatedWebUI(); |
546 } | 544 } |
547 | 545 |
548 bool ScreenLocker::IsUserLoggedIn(const AccountId& account_id) const { | 546 bool ScreenLocker::IsUserLoggedIn(const AccountId& account_id) const { |
549 for (user_manager::User* user : users_) { | 547 for (user_manager::User* user : users_) { |
550 if (user->GetAccountId() == account_id) | 548 if (user->GetAccountId() == account_id) |
551 return true; | 549 return true; |
552 } | 550 } |
553 return false; | 551 return false; |
554 } | 552 } |
555 | 553 |
556 } // namespace chromeos | 554 } // namespace chromeos |
OLD | NEW |