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/audio/sounds.h" | |
11 #include "ash/common/ash_switches.h" | 10 #include "ash/common/ash_switches.h" |
12 #include "ash/common/wm/window_state.h" | 11 #include "ash/common/wm/window_state.h" |
13 #include "ash/common/wm/wm_event.h" | 12 #include "ash/common/wm/wm_event.h" |
14 #include "ash/desktop_background/desktop_background_controller.h" | 13 #include "ash/desktop_background/desktop_background_controller.h" |
15 #include "ash/shell.h" | 14 #include "ash/shell.h" |
16 #include "ash/wm/lock_state_controller.h" | 15 #include "ash/wm/lock_state_controller.h" |
17 #include "ash/wm/window_state_aura.h" | 16 #include "ash/wm/window_state_aura.h" |
18 #include "ash/wm/window_util.h" | 17 #include "ash/wm/window_util.h" |
19 #include "base/bind.h" | 18 #include "base/bind.h" |
20 #include "base/command_line.h" | 19 #include "base/command_line.h" |
21 #include "base/lazy_instance.h" | 20 #include "base/lazy_instance.h" |
22 #include "base/location.h" | 21 #include "base/location.h" |
23 #include "base/macros.h" | 22 #include "base/macros.h" |
24 #include "base/memory/weak_ptr.h" | 23 #include "base/memory/weak_ptr.h" |
25 #include "base/message_loop/message_loop.h" | 24 #include "base/message_loop/message_loop.h" |
26 #include "base/metrics/histogram.h" | 25 #include "base/metrics/histogram.h" |
27 #include "base/single_thread_task_runner.h" | 26 #include "base/single_thread_task_runner.h" |
28 #include "base/strings/string_number_conversions.h" | 27 #include "base/strings/string_number_conversions.h" |
29 #include "base/strings/string_util.h" | 28 #include "base/strings/string_util.h" |
30 #include "base/threading/thread_task_runner_handle.h" | 29 #include "base/threading/thread_task_runner_handle.h" |
31 #include "chrome/browser/chrome_notification_types.h" | 30 #include "chrome/browser/chrome_notification_types.h" |
| 31 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" |
32 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" | 32 #include "chrome/browser/chromeos/login/lock/webui_screen_locker.h" |
33 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" | 33 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage.h" |
34 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h" | 34 #include "chrome/browser/chromeos/login/quick_unlock/pin_storage_factory.h" |
35 #include "chrome/browser/chromeos/login/session/user_session_manager.h" | 35 #include "chrome/browser/chromeos/login/session/user_session_manager.h" |
36 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" | 36 #include "chrome/browser/chromeos/login/supervised/supervised_user_authenticatio
n.h" |
37 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 37 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
38 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" | 38 #include "chrome/browser/chromeos/login/users/chrome_user_manager.h" |
39 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" | 39 #include "chrome/browser/chromeos/login/users/supervised_user_manager.h" |
40 #include "chrome/browser/lifetime/application_lifetime.h" | 40 #include "chrome/browser/lifetime/application_lifetime.h" |
41 #include "chrome/browser/signin/easy_unlock_service.h" | 41 #include "chrome/browser/signin/easy_unlock_service.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 DCHECK(!screen_locker_); | 144 DCHECK(!screen_locker_); |
145 screen_locker_ = this; | 145 screen_locker_ = this; |
146 | 146 |
147 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 147 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
148 media::SoundsManager* manager = media::SoundsManager::Get(); | 148 media::SoundsManager* manager = media::SoundsManager::Get(); |
149 manager->Initialize(SOUND_LOCK, | 149 manager->Initialize(SOUND_LOCK, |
150 bundle.GetRawDataResource(IDR_SOUND_LOCK_WAV)); | 150 bundle.GetRawDataResource(IDR_SOUND_LOCK_WAV)); |
151 manager->Initialize(SOUND_UNLOCK, | 151 manager->Initialize(SOUND_UNLOCK, |
152 bundle.GetRawDataResource(IDR_SOUND_UNLOCK_WAV)); | 152 bundle.GetRawDataResource(IDR_SOUND_UNLOCK_WAV)); |
153 | 153 |
154 ash::Shell::GetInstance()-> | 154 ash::Shell::GetInstance() |
155 lock_state_controller()->SetLockScreenDisplayedCallback( | 155 ->lock_state_controller() |
156 base::Bind(base::IgnoreResult(&ash::PlaySystemSoundIfSpokenFeedback), | 156 ->SetLockScreenDisplayedCallback(base::Bind( |
157 static_cast<media::SoundsManager::SoundKey>( | 157 base::IgnoreResult(&AccessibilityManager::PlayEarcon), |
158 chromeos::SOUND_LOCK))); | 158 base::Unretained(AccessibilityManager::Get()), chromeos::SOUND_LOCK, |
| 159 PlaySoundOption::SPOKEN_FEEDBACK_ENABLED)); |
159 } | 160 } |
160 | 161 |
161 void ScreenLocker::Init() { | 162 void ScreenLocker::Init() { |
162 input_method::InputMethodManager* imm = | 163 input_method::InputMethodManager* imm = |
163 input_method::InputMethodManager::Get(); | 164 input_method::InputMethodManager::Get(); |
164 saved_ime_state_ = imm->GetActiveIMEState(); | 165 saved_ime_state_ = imm->GetActiveIMEState(); |
165 imm->SetState(saved_ime_state_->Clone()); | 166 imm->SetState(saved_ime_state_->Clone()); |
166 | 167 |
167 authenticator_ = UserSessionManager::GetInstance()->CreateAuthenticator(this); | 168 authenticator_ = UserSessionManager::GetInstance()->CreateAuthenticator(this); |
168 extended_authenticator_ = ExtendedAuthenticator::Create(this); | 169 extended_authenticator_ = ExtendedAuthenticator::Create(this); |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 ash::Shell::GetInstance()->lock_state_controller()-> | 458 ash::Shell::GetInstance()->lock_state_controller()-> |
458 OnLockScreenHide(callback); | 459 OnLockScreenHide(callback); |
459 } | 460 } |
460 | 461 |
461 void ScreenLocker::ScheduleDeletion() { | 462 void ScreenLocker::ScheduleDeletion() { |
462 // Avoid possible multiple calls. | 463 // Avoid possible multiple calls. |
463 if (screen_locker_ == NULL) | 464 if (screen_locker_ == NULL) |
464 return; | 465 return; |
465 VLOG(1) << "Deleting ScreenLocker " << screen_locker_; | 466 VLOG(1) << "Deleting ScreenLocker " << screen_locker_; |
466 | 467 |
467 ash::PlaySystemSoundIfSpokenFeedback(SOUND_UNLOCK); | 468 AccessibilityManager::Get()->PlayEarcon( |
| 469 SOUND_UNLOCK, PlaySoundOption::SPOKEN_FEEDBACK_ENABLED); |
468 | 470 |
469 delete screen_locker_; | 471 delete screen_locker_; |
470 screen_locker_ = NULL; | 472 screen_locker_ = NULL; |
471 } | 473 } |
472 | 474 |
473 //////////////////////////////////////////////////////////////////////////////// | 475 //////////////////////////////////////////////////////////////////////////////// |
474 // ScreenLocker, private: | 476 // ScreenLocker, private: |
475 | 477 |
476 ScreenLocker::~ScreenLocker() { | 478 ScreenLocker::~ScreenLocker() { |
477 VLOG(1) << "Destroying ScreenLocker " << this; | 479 VLOG(1) << "Destroying ScreenLocker " << this; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 | 539 |
538 bool ScreenLocker::IsUserLoggedIn(const AccountId& account_id) const { | 540 bool ScreenLocker::IsUserLoggedIn(const AccountId& account_id) const { |
539 for (user_manager::User* user : users_) { | 541 for (user_manager::User* user : users_) { |
540 if (user->GetAccountId() == account_id) | 542 if (user->GetAccountId() == account_id) |
541 return true; | 543 return true; |
542 } | 544 } |
543 return false; | 545 return false; |
544 } | 546 } |
545 | 547 |
546 } // namespace chromeos | 548 } // namespace chromeos |
OLD | NEW |