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