| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 DCHECK(!screen_locker_); | 139 DCHECK(!screen_locker_); |
| 140 screen_locker_ = this; | 140 screen_locker_ = this; |
| 141 | 141 |
| 142 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 142 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 143 media::SoundsManager* manager = media::SoundsManager::Get(); | 143 media::SoundsManager* manager = media::SoundsManager::Get(); |
| 144 manager->Initialize(SOUND_LOCK, | 144 manager->Initialize(SOUND_LOCK, |
| 145 bundle.GetRawDataResource(IDR_SOUND_LOCK_WAV)); | 145 bundle.GetRawDataResource(IDR_SOUND_LOCK_WAV)); |
| 146 manager->Initialize(SOUND_UNLOCK, | 146 manager->Initialize(SOUND_UNLOCK, |
| 147 bundle.GetRawDataResource(IDR_SOUND_UNLOCK_WAV)); | 147 bundle.GetRawDataResource(IDR_SOUND_UNLOCK_WAV)); |
| 148 | 148 |
| 149 #if !defined(USE_ATHENA) |
| 150 // crbug.com/408733 |
| 149 ash::Shell::GetInstance()-> | 151 ash::Shell::GetInstance()-> |
| 150 lock_state_controller()->SetLockScreenDisplayedCallback( | 152 lock_state_controller()->SetLockScreenDisplayedCallback( |
| 151 base::Bind(base::IgnoreResult(&ash::PlaySystemSoundIfSpokenFeedback), | 153 base::Bind(base::IgnoreResult(&ash::PlaySystemSoundIfSpokenFeedback), |
| 152 static_cast<media::SoundsManager::SoundKey>( | 154 static_cast<media::SoundsManager::SoundKey>( |
| 153 chromeos::SOUND_LOCK))); | 155 chromeos::SOUND_LOCK))); |
| 156 #endif |
| 154 } | 157 } |
| 155 | 158 |
| 156 void ScreenLocker::Init() { | 159 void ScreenLocker::Init() { |
| 157 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 160 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
| 158 extended_authenticator_ = new ExtendedAuthenticator(this); | 161 extended_authenticator_ = new ExtendedAuthenticator(this); |
| 159 delegate_.reset(new WebUIScreenLocker(this)); | 162 delegate_.reset(new WebUIScreenLocker(this)); |
| 160 delegate_->LockScreen(); | 163 delegate_->LockScreen(); |
| 161 | 164 |
| 162 // Ownership of |icon_image_source| is passed. | 165 // Ownership of |icon_image_source| is passed. |
| 163 screenlock_icon_provider_.reset(new ScreenlockIconProvider); | 166 screenlock_icon_provider_.reset(new ScreenlockIconProvider); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 // avoid complications with displaying the lock screen over the login | 364 // avoid complications with displaying the lock screen over the login |
| 362 // screen while remaining secure in the case the user walks away during | 365 // screen while remaining secure in the case the user walks away during |
| 363 // the sign-in steps. See crbug.com/112225 and crbug.com/110933. | 366 // the sign-in steps. See crbug.com/112225 and crbug.com/110933. |
| 364 VLOG(1) << "Calling session manager's StopSession D-Bus method"; | 367 VLOG(1) << "Calling session manager's StopSession D-Bus method"; |
| 365 DBusThreadManager::Get()->GetSessionManagerClient()->StopSession(); | 368 DBusThreadManager::Get()->GetSessionManagerClient()->StopSession(); |
| 366 } | 369 } |
| 367 } | 370 } |
| 368 | 371 |
| 369 // static | 372 // static |
| 370 void ScreenLocker::Show() { | 373 void ScreenLocker::Show() { |
| 374 #if defined(USE_ATHENA) |
| 375 // crbug.com/413926 |
| 376 return; |
| 377 #endif |
| 378 |
| 371 content::RecordAction(UserMetricsAction("ScreenLocker_Show")); | 379 content::RecordAction(UserMetricsAction("ScreenLocker_Show")); |
| 372 DCHECK(base::MessageLoopForUI::IsCurrent()); | 380 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 373 | 381 |
| 374 // Check whether the currently logged in user is a guest account and if so, | 382 // Check whether the currently logged in user is a guest account and if so, |
| 375 // refuse to lock the screen (crosbug.com/23764). | 383 // refuse to lock the screen (crosbug.com/23764). |
| 376 // For a demo user, we should never show the lock screen (crosbug.com/27647). | 384 // For a demo user, we should never show the lock screen (crosbug.com/27647). |
| 377 if (user_manager::UserManager::Get()->IsLoggedInAsGuest() || | 385 if (user_manager::UserManager::Get()->IsLoggedInAsGuest() || |
| 378 user_manager::UserManager::Get()->IsLoggedInAsDemoUser()) { | 386 user_manager::UserManager::Get()->IsLoggedInAsDemoUser()) { |
| 379 VLOG(1) << "Refusing to lock screen for guest/demo account"; | 387 VLOG(1) << "Refusing to lock screen for guest/demo account"; |
| 380 return; | 388 return; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 400 } else { | 408 } else { |
| 401 VLOG(1) << "ScreenLocker " << screen_locker_ << " already exists; " | 409 VLOG(1) << "ScreenLocker " << screen_locker_ << " already exists; " |
| 402 << " calling session manager's HandleLockScreenShown D-Bus method"; | 410 << " calling session manager's HandleLockScreenShown D-Bus method"; |
| 403 DBusThreadManager::Get()->GetSessionManagerClient()-> | 411 DBusThreadManager::Get()->GetSessionManagerClient()-> |
| 404 NotifyLockScreenShown(); | 412 NotifyLockScreenShown(); |
| 405 } | 413 } |
| 406 } | 414 } |
| 407 | 415 |
| 408 // static | 416 // static |
| 409 void ScreenLocker::Hide() { | 417 void ScreenLocker::Hide() { |
| 418 #if defined(USE_ATHENA) |
| 419 // crbug.com/413926 |
| 420 return; |
| 421 #endif |
| 422 |
| 410 DCHECK(base::MessageLoopForUI::IsCurrent()); | 423 DCHECK(base::MessageLoopForUI::IsCurrent()); |
| 411 // For a guest/demo user, screen_locker_ would have never been initialized. | 424 // For a guest/demo user, screen_locker_ would have never been initialized. |
| 412 if (user_manager::UserManager::Get()->IsLoggedInAsGuest() || | 425 if (user_manager::UserManager::Get()->IsLoggedInAsGuest() || |
| 413 user_manager::UserManager::Get()->IsLoggedInAsDemoUser()) { | 426 user_manager::UserManager::Get()->IsLoggedInAsDemoUser()) { |
| 414 VLOG(1) << "Refusing to hide lock screen for guest/demo account"; | 427 VLOG(1) << "Refusing to hide lock screen for guest/demo account"; |
| 415 return; | 428 return; |
| 416 } | 429 } |
| 417 | 430 |
| 418 DCHECK(screen_locker_); | 431 DCHECK(screen_locker_); |
| 419 base::Callback<void(void)> callback = | 432 base::Callback<void(void)> callback = |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 for (user_manager::UserList::const_iterator it = users_.begin(); | 518 for (user_manager::UserList::const_iterator it = users_.begin(); |
| 506 it != users_.end(); | 519 it != users_.end(); |
| 507 ++it) { | 520 ++it) { |
| 508 if ((*it)->email() == username) | 521 if ((*it)->email() == username) |
| 509 return true; | 522 return true; |
| 510 } | 523 } |
| 511 return false; | 524 return false; |
| 512 } | 525 } |
| 513 | 526 |
| 514 } // namespace chromeos | 527 } // namespace chromeos |
| OLD | NEW |