| 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/ash_switches.h" | 10 #include "ash/ash_switches.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // crbug.com/408733 | 152 // crbug.com/408733 |
| 153 ash::Shell::GetInstance()-> | 153 ash::Shell::GetInstance()-> |
| 154 lock_state_controller()->SetLockScreenDisplayedCallback( | 154 lock_state_controller()->SetLockScreenDisplayedCallback( |
| 155 base::Bind(base::IgnoreResult(&ash::PlaySystemSoundIfSpokenFeedback), | 155 base::Bind(base::IgnoreResult(&ash::PlaySystemSoundIfSpokenFeedback), |
| 156 static_cast<media::SoundsManager::SoundKey>( | 156 static_cast<media::SoundsManager::SoundKey>( |
| 157 chromeos::SOUND_LOCK))); | 157 chromeos::SOUND_LOCK))); |
| 158 #endif | 158 #endif |
| 159 } | 159 } |
| 160 | 160 |
| 161 void ScreenLocker::Init() { | 161 void ScreenLocker::Init() { |
| 162 input_method::InputMethodManager* imm = |
| 163 input_method::InputMethodManager::Get(); |
| 164 saved_ime_state_ = imm->GetActiveIMEState(); |
| 165 imm->SetState(saved_ime_state_->Clone()); |
| 166 |
| 162 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 167 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
| 163 extended_authenticator_ = new ExtendedAuthenticator(this); | 168 extended_authenticator_ = new ExtendedAuthenticator(this); |
| 164 delegate_.reset(new WebUIScreenLocker(this)); | 169 delegate_.reset(new WebUIScreenLocker(this)); |
| 165 delegate_->LockScreen(); | 170 delegate_->LockScreen(); |
| 166 | 171 |
| 167 // Ownership of |icon_image_source| is passed. | 172 // Ownership of |icon_image_source| is passed. |
| 168 screenlock_icon_provider_.reset(new ScreenlockIconProvider); | 173 screenlock_icon_provider_.reset(new ScreenlockIconProvider); |
| 169 ScreenlockIconSource* screenlock_icon_source = | 174 ScreenlockIconSource* screenlock_icon_source = |
| 170 new ScreenlockIconSource(screenlock_icon_provider_->AsWeakPtr()); | 175 new ScreenlockIconSource(screenlock_icon_provider_->AsWeakPtr()); |
| 171 content::URLDataSource::Add( | 176 content::URLDataSource::Add( |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 locked_ = true; | 495 locked_ = true; |
| 491 base::TimeDelta delta = base::Time::Now() - start_time_; | 496 base::TimeDelta delta = base::Time::Now() - start_time_; |
| 492 VLOG(1) << "ScreenLocker " << this << " is ready after " | 497 VLOG(1) << "ScreenLocker " << this << " is ready after " |
| 493 << delta.InSecondsF() << " second(s)"; | 498 << delta.InSecondsF() << " second(s)"; |
| 494 UMA_HISTOGRAM_TIMES("ScreenLocker.ScreenLockTime", delta); | 499 UMA_HISTOGRAM_TIMES("ScreenLocker.ScreenLockTime", delta); |
| 495 | 500 |
| 496 VLOG(1) << "Moving desktop background to locked container"; | 501 VLOG(1) << "Moving desktop background to locked container"; |
| 497 ash::Shell::GetInstance()-> | 502 ash::Shell::GetInstance()-> |
| 498 desktop_background_controller()->MoveDesktopToLockedContainer(); | 503 desktop_background_controller()->MoveDesktopToLockedContainer(); |
| 499 | 504 |
| 500 input_method::InputMethodManager* imm = | 505 input_method::InputMethodManager::Get() |
| 501 input_method::InputMethodManager::Get(); | 506 ->GetActiveIMEState() |
| 502 saved_ime_state_ = imm->GetActiveIMEState(); | 507 ->EnableLockScreenLayouts(); |
| 503 imm->SetState(saved_ime_state_->Clone()); | |
| 504 imm->GetActiveIMEState()->EnableLockScreenLayouts(); | |
| 505 | 508 |
| 506 bool state = true; | 509 bool state = true; |
| 507 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; | 510 VLOG(1) << "Emitting SCREEN_LOCK_STATE_CHANGED with state=" << state; |
| 508 content::NotificationService::current()->Notify( | 511 content::NotificationService::current()->Notify( |
| 509 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, | 512 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, |
| 510 content::Source<ScreenLocker>(this), | 513 content::Source<ScreenLocker>(this), |
| 511 content::Details<bool>(&state)); | 514 content::Details<bool>(&state)); |
| 512 VLOG(1) << "Calling session manager's HandleLockScreenShown D-Bus method"; | 515 VLOG(1) << "Calling session manager's HandleLockScreenShown D-Bus method"; |
| 513 DBusThreadManager::Get()->GetSessionManagerClient()->NotifyLockScreenShown(); | 516 DBusThreadManager::Get()->GetSessionManagerClient()->NotifyLockScreenShown(); |
| 514 } | 517 } |
| 515 | 518 |
| 516 content::WebUI* ScreenLocker::GetAssociatedWebUI() { | 519 content::WebUI* ScreenLocker::GetAssociatedWebUI() { |
| 517 return delegate_->GetAssociatedWebUI(); | 520 return delegate_->GetAssociatedWebUI(); |
| 518 } | 521 } |
| 519 | 522 |
| 520 bool ScreenLocker::IsUserLoggedIn(const std::string& username) { | 523 bool ScreenLocker::IsUserLoggedIn(const std::string& username) { |
| 521 for (user_manager::UserList::const_iterator it = users_.begin(); | 524 for (user_manager::UserList::const_iterator it = users_.begin(); |
| 522 it != users_.end(); | 525 it != users_.end(); |
| 523 ++it) { | 526 ++it) { |
| 524 if ((*it)->email() == username) | 527 if ((*it)->email() == username) |
| 525 return true; | 528 return true; |
| 526 } | 529 } |
| 527 return false; | 530 return false; |
| 528 } | 531 } |
| 529 | 532 |
| 530 } // namespace chromeos | 533 } // namespace chromeos |
| OLD | NEW |