diff options
author | ygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-02 22:11:20 +0000 |
---|---|---|
committer | ygorshenin@chromium.org <ygorshenin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-02 22:11:20 +0000 |
commit | fe703f017f1d143566dc62df15d8dcc0d55aaf0d (patch) | |
tree | 1f34ff639af00bb7f02564ff85024ba335420704 /ash/wm | |
parent | 7601d1a2bb004b7bf5a0b231077f046843179d67 (diff) | |
download | chromium_src-fe703f017f1d143566dc62df15d8dcc0d55aaf0d.zip chromium_src-fe703f017f1d143566dc62df15d8dcc0d55aaf0d.tar.gz chromium_src-fe703f017f1d143566dc62df15d8dcc0d55aaf0d.tar.bz2 |
Implemented lock/unlock/shutdown system sounds.
Implemented lock/unlock/shutdown system sounds. Partially based on
https://codereview.chromium.org/12287003/diff/141001/chrome/browser/notifications/notification_audio_controller.cc.
BUG=271057
TEST=manual tests on Lumpy.
Review URL: https://codereview.chromium.org/23694045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@232640 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm')
-rw-r--r-- | ash/wm/lock_state_controller.cc | 25 | ||||
-rw-r--r-- | ash/wm/lock_state_controller.h | 2 |
2 files changed, 25 insertions, 2 deletions
diff --git a/ash/wm/lock_state_controller.cc b/ash/wm/lock_state_controller.cc index 11b840b..28a9b9b 100644 --- a/ash/wm/lock_state_controller.cc +++ b/ash/wm/lock_state_controller.cc @@ -4,6 +4,9 @@ #include "ash/wm/lock_state_controller.h" +#include <algorithm> + +#include "ash/accessibility_delegate.h" #include "ash/ash_switches.h" #include "ash/cancel_mode.h" #include "ash/shell.h" @@ -20,12 +23,19 @@ #if defined(OS_CHROMEOS) #include "base/sys_info.h" +#include "media/audio/sounds/sounds_manager.h" +#endif + +#if defined(OS_CHROMEOS) +using media::SoundsManager; #endif namespace ash { namespace { +const int kMaxShutdownSoundDurationMs = 1500; + aura::Window* GetBackground() { aura::Window* root_window = Shell::GetPrimaryRootWindow(); return Shell::GetContainer(root_window, @@ -274,7 +284,7 @@ void LockStateController::OnLockScreenHide( } void LockStateController::SetLockScreenDisplayedCallback( - base::Closure& callback) { + const base::Closure& callback) { lock_screen_displayed_callback_ = callback; } @@ -368,6 +378,19 @@ void LockStateController::StartRealShutdownTimer( duration += animator_->GetDuration( internal::SessionStateAnimator::ANIMATION_SPEED_SHUTDOWN); } + +#if defined(OS_CHROMEOS) + const AccessibilityDelegate* const delegate = + Shell::GetInstance()->accessibility_delegate(); + if (delegate->IsSpokenFeedbackEnabled()) { + const base::TimeDelta shutdown_sound_duration = std::min( + SoundsManager::Get()->GetDuration(SoundsManager::SOUND_SHUTDOWN), + base::TimeDelta::FromMilliseconds(kMaxShutdownSoundDurationMs)); + duration = std::max(duration, shutdown_sound_duration); + SoundsManager::Get()->Play(SoundsManager::SOUND_SHUTDOWN); + } +#endif + real_shutdown_timer_.Start( FROM_HERE, duration, diff --git a/ash/wm/lock_state_controller.h b/ash/wm/lock_state_controller.h index 66c8ceb..c2e7a6a 100644 --- a/ash/wm/lock_state_controller.h +++ b/ash/wm/lock_state_controller.h @@ -195,7 +195,7 @@ class ASH_EXPORT LockStateController : public aura::RootWindowObserver, // Sets up the callback that should be called once lock animation is finished. // Callback is guaranteed to be called once and then discarded. - void SetLockScreenDisplayedCallback(base::Closure& callback); + void SetLockScreenDisplayedCallback(const base::Closure& callback); // RootWindowObserver override: virtual void OnRootWindowHostCloseRequested( |