Chromium Code Reviews| 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" |
| 11 #include "ash/wallpaper/wallpaper_controller.h" | |
| 12 #include "ash/wm/window_state.h" | 11 #include "ash/wm/window_state.h" |
| 13 #include "ash/wm/window_state_aura.h" | 12 #include "ash/wm/window_state_aura.h" |
| 14 #include "ash/wm/window_util.h" | 13 #include "ash/wm/window_util.h" |
| 15 #include "ash/wm/wm_event.h" | 14 #include "ash/wm/wm_event.h" |
| 16 #include "base/bind.h" | 15 #include "base/bind.h" |
| 17 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 18 #include "base/lazy_instance.h" | 17 #include "base/lazy_instance.h" |
| 19 #include "base/location.h" | 18 #include "base/location.h" |
| 20 #include "base/macros.h" | 19 #include "base/macros.h" |
| 21 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 503 // ScreenLocker, private: | 502 // ScreenLocker, private: |
| 504 | 503 |
| 505 ScreenLocker::~ScreenLocker() { | 504 ScreenLocker::~ScreenLocker() { |
| 506 VLOG(1) << "Destroying ScreenLocker " << this; | 505 VLOG(1) << "Destroying ScreenLocker " << this; |
| 507 DCHECK(base::MessageLoopForUI::IsCurrent()); | 506 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 508 | 507 |
| 509 if (authenticator_.get()) | 508 if (authenticator_.get()) |
| 510 authenticator_->SetConsumer(NULL); | 509 authenticator_->SetConsumer(NULL); |
| 511 ClearErrors(); | 510 ClearErrors(); |
| 512 | 511 |
| 513 VLOG(1) << "Moving wallpaper to unlocked container"; | |
| 514 ash::Shell::Get()->wallpaper_controller()->MoveToUnlockedContainer(); | |
|
xiyuan
2017/04/21 15:30:58
Covered by session state change to ACTIVE in line
| |
| 515 | |
| 516 screen_locker_ = NULL; | 512 screen_locker_ = NULL; |
| 517 bool state = false; | 513 bool state = false; |
| 518 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; | 514 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; |
| 519 content::NotificationService::current()->Notify( | 515 content::NotificationService::current()->Notify( |
| 520 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 516 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
| 521 content::Source<ScreenLocker>(this), | 517 content::Source<ScreenLocker>(this), |
| 522 content::Details<bool>(&state)); | 518 content::Details<bool>(&state)); |
| 523 | 519 |
| 524 VLOG(1) << "Calling session manager's HandleLockScreenDismissed D-Bus method"; | 520 VLOG(1) << "Calling session manager's HandleLockScreenDismissed D-Bus method"; |
| 525 DBusThreadManager::Get()->GetSessionManagerClient()-> | 521 DBusThreadManager::Get()->GetSessionManagerClient()-> |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 537 authenticator_ = authenticator; | 533 authenticator_ = authenticator; |
| 538 } | 534 } |
| 539 | 535 |
| 540 void ScreenLocker::ScreenLockReady() { | 536 void ScreenLocker::ScreenLockReady() { |
| 541 locked_ = true; | 537 locked_ = true; |
| 542 base::TimeDelta delta = base::Time::Now() - start_time_; | 538 base::TimeDelta delta = base::Time::Now() - start_time_; |
| 543 VLOG(1) << "ScreenLocker " << this << " is ready after " | 539 VLOG(1) << "ScreenLocker " << this << " is ready after " |
| 544 << delta.InSecondsF() << " second(s)"; | 540 << delta.InSecondsF() << " second(s)"; |
| 545 UMA_HISTOGRAM_TIMES("ScreenLocker.ScreenLockTime", delta); | 541 UMA_HISTOGRAM_TIMES("ScreenLocker.ScreenLockTime", delta); |
| 546 | 542 |
| 547 VLOG(1) << "Moving wallpaper to locked container"; | |
| 548 ash::Shell::Get()->wallpaper_controller()->MoveToLockedContainer(); | |
|
xiyuan
2017/04/21 15:30:58
Covered by session state change to LOCKED in line
| |
| 549 | |
| 550 bool state = true; | 543 bool state = true; |
| 551 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; | 544 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; |
| 552 content::NotificationService::current()->Notify( | 545 content::NotificationService::current()->Notify( |
| 553 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 546 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
| 554 content::Source<ScreenLocker>(this), | 547 content::Source<ScreenLocker>(this), |
| 555 content::Details<bool>(&state)); | 548 content::Details<bool>(&state)); |
| 556 VLOG(1) << "Calling session manager's HandleLockScreenShown D-Bus method"; | 549 VLOG(1) << "Calling session manager's HandleLockScreenShown D-Bus method"; |
| 557 DBusThreadManager::Get()->GetSessionManagerClient()->NotifyLockScreenShown(); | 550 DBusThreadManager::Get()->GetSessionManagerClient()->NotifyLockScreenShown(); |
| 558 | 551 |
| 559 session_manager::SessionManager::Get()->SetSessionState( | 552 session_manager::SessionManager::Get()->SetSessionState( |
| 560 session_manager::SessionState::LOCKED); | 553 session_manager::SessionState::LOCKED); |
| 561 | 554 |
| 562 input_method::InputMethodManager::Get() | 555 input_method::InputMethodManager::Get() |
| 563 ->GetActiveIMEState() | 556 ->GetActiveIMEState() |
| 564 ->EnableLockScreenLayouts(); | 557 ->EnableLockScreenLayouts(); |
| 565 } | 558 } |
| 566 | 559 |
| 567 bool ScreenLocker::IsUserLoggedIn(const AccountId& account_id) const { | 560 bool ScreenLocker::IsUserLoggedIn(const AccountId& account_id) const { |
| 568 for (user_manager::User* user : users_) { | 561 for (user_manager::User* user : users_) { |
| 569 if (user->GetAccountId() == account_id) | 562 if (user->GetAccountId() == account_id) |
| 570 return true; | 563 return true; |
| 571 } | 564 } |
| 572 return false; | 565 return false; |
| 573 } | 566 } |
| 574 | 567 |
| 575 } // namespace chromeos | 568 } // namespace chromeos |
| OLD | NEW |