diff options
author | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-06 16:15:48 +0000 |
---|---|---|
committer | pkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-06 16:15:48 +0000 |
commit | 19a973bb9688745a5779a3a09118a2e0d1f7aa85 (patch) | |
tree | 7cc59808e4d569bea6e8c015e4d228c2567e3435 | |
parent | aad4d0d3e185c386a5898abd56bae37c2219b11f (diff) | |
download | chromium_src-19a973bb9688745a5779a3a09118a2e0d1f7aa85.zip chromium_src-19a973bb9688745a5779a3a09118a2e0d1f7aa85.tar.gz chromium_src-19a973bb9688745a5779a3a09118a2e0d1f7aa85.tar.bz2 |
Revert of Enable the volume slider in Ash for windows. (https://codereview.chromium.org/178883004/)
Reason for revert:
Experimentally reverting this CL because it may have broken AshTestHelperTest.AshTestHelper on Windows Vista . Will revert the revert if this CL is innocent
See http://build.chromium.org/p/chromium.win/builders/Vista%20Tests%20%282%29/builds/41640/steps/ash_unittests/logs/AshTestHelper
Original issue's description:
> Enable the volume slider in Ash for windows.
>
> BUG=227247
>
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=255215
TBR=henrika@chromium.org,tommi@chromium.org,jennyz@chromium.org,dewittj@chromium.org,zturner@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=227247
Review URL: https://codereview.chromium.org/188693004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@255363 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/ash.gyp | 4 | ||||
-rw-r--r-- | ash/system/audio/tray_audio_delegate.h | 2 | ||||
-rw-r--r-- | ash/system/tray/system_tray.cc | 5 | ||||
-rw-r--r-- | ash/system/win/OWNERS | 1 | ||||
-rw-r--r-- | ash/system/win/audio/tray_audio_delegate_win.cc | 117 | ||||
-rw-r--r-- | ash/system/win/audio/tray_audio_delegate_win.h | 40 | ||||
-rw-r--r-- | ash/system/win/audio/tray_audio_win.cc | 25 | ||||
-rw-r--r-- | ash/system/win/audio/tray_audio_win.h | 28 | ||||
-rw-r--r-- | chrome/browser/notifications/desktop_notifications_unittest.cc | 8 | ||||
-rw-r--r-- | chrome/browser/notifications/desktop_notifications_unittest.h | 7 | ||||
-rw-r--r-- | media/audio/win/core_audio_util_win.h | 2 |
11 files changed, 2 insertions, 237 deletions
diff --git a/ash/ash.gyp b/ash/ash.gyp index 93f8392..b1f0e25 100644 --- a/ash/ash.gyp +++ b/ash/ash.gyp @@ -458,10 +458,6 @@ 'system/user/user_observer.h', 'system/web_notification/web_notification_tray.cc', 'system/web_notification/web_notification_tray.h', - 'system/win/audio/tray_audio_delegate_win.cc', - 'system/win/audio/tray_audio_delegate_win.h', - 'system/win/audio/tray_audio_win.cc', - 'system/win/audio/tray_audio_win.h', 'touch/touch_hud_debug.cc', 'touch/touch_hud_debug.h', 'touch/touch_hud_projection.cc', diff --git a/ash/system/audio/tray_audio_delegate.h b/ash/system/audio/tray_audio_delegate.h index 8a6260f..823bfff 100644 --- a/ash/system/audio/tray_audio_delegate.h +++ b/ash/system/audio/tray_audio_delegate.h @@ -8,7 +8,7 @@ namespace ash { namespace system { -class ASH_EXPORT TrayAudioDelegate { +class TrayAudioDelegate { public: enum { kNoAudioDeviceIcon = -1 }; diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index 4acab02..e58391d 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc @@ -61,9 +61,6 @@ #include "ash/system/chromeos/tray_display.h" #include "ash/system/chromeos/tray_tracing.h" #include "ui/message_center/message_center.h" -#elif defined(OS_WIN) -#include "ash/system/win/audio/tray_audio_win.h" -#include "media/audio/win/core_audio_util_win.h" #endif using views::TrayBubbleView; @@ -204,8 +201,6 @@ void SystemTray::CreateItems(SystemTrayDelegate* delegate) { AddTrayItem(tray_date_); #elif defined(OS_WIN) AddTrayItem(tray_accessibility_); - if (media::CoreAudioUtil::IsSupported()) - AddTrayItem(new internal::TrayAudioWin(this)); AddTrayItem(new internal::TrayUpdate(this)); AddTrayItem(tray_date_); #elif defined(OS_LINUX) diff --git a/ash/system/win/OWNERS b/ash/system/win/OWNERS deleted file mode 100644 index 45cb82b..0000000 --- a/ash/system/win/OWNERS +++ /dev/null @@ -1 +0,0 @@ -zturner@chromium.org
\ No newline at end of file diff --git a/ash/system/win/audio/tray_audio_delegate_win.cc b/ash/system/win/audio/tray_audio_delegate_win.cc deleted file mode 100644 index 57c7b56..0000000 --- a/ash/system/win/audio/tray_audio_delegate_win.cc +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/system/win/audio/tray_audio_delegate_win.h" - -#include <audiopolicy.h> -#include <cmath> - -#include "grit/ash_resources.h" -#include "grit/ash_strings.h" -#include "media/audio/win/core_audio_util_win.h" - -using base::win::ScopedComPtr; - -namespace { - -// Volume value which should be considered as muted in range [0, 100]. -const int kMuteThresholdPercent = 1; - -// Lowest volume which is considered to be audible in the range [0, 100]. -const int kDefaultUnmuteVolumePercent = 4; - -} // namespace - -namespace ash { -namespace system { - -void TrayAudioDelegateWin::AdjustOutputVolumeToAudibleLevel() { - if (GetOutputVolumeLevel() <= kMuteThresholdPercent) - SetOutputVolumeLevel(kDefaultUnmuteVolumePercent); -} - -int TrayAudioDelegateWin::GetOutputDefaultVolumeMuteLevel() { - return kMuteThresholdPercent; -} - -int TrayAudioDelegateWin::GetOutputVolumeLevel() { - ScopedComPtr<ISimpleAudioVolume> volume_control = - CreateDefaultVolumeControl(); - if (!volume_control) - return 0; - - float level = 0.0f; - if (FAILED(volume_control->GetMasterVolume(&level))) - return 0; - - // MSVC prior to 2013 doesn't have a round function. The below code is not - // conformant to C99 round(), but since we know that 0 <= level <= 100, it - // should be ok. - return static_cast<int>(level + 0.5); -} - -int TrayAudioDelegateWin::GetActiveOutputDeviceIconId() { - return kNoAudioDeviceIcon; -} - -bool TrayAudioDelegateWin::HasAlternativeSources() { - return false; -} - -bool TrayAudioDelegateWin::IsOutputAudioMuted() { - ScopedComPtr<ISimpleAudioVolume> volume_control = - CreateDefaultVolumeControl(); - - if (!volume_control) - return false; - - BOOL mute = FALSE; - if (FAILED(volume_control->GetMute(&mute))) - return false; - - return !!mute; -} - -void TrayAudioDelegateWin::SetOutputAudioIsMuted(bool is_muted) { - ScopedComPtr<ISimpleAudioVolume> volume_control = - CreateDefaultVolumeControl(); - - if (!volume_control) - return; - - volume_control->SetMute(is_muted, NULL); -} - -void TrayAudioDelegateWin::SetOutputVolumeLevel(int level) { - ScopedComPtr<ISimpleAudioVolume> volume_control = - CreateDefaultVolumeControl(); - - if (!volume_control) - return; - - float volume_level = static_cast<float>(level) / 100.0f; - volume_control->SetMasterVolume(volume_level, NULL); -} - -ScopedComPtr<ISimpleAudioVolume> -TrayAudioDelegateWin::CreateDefaultVolumeControl() { - ScopedComPtr<ISimpleAudioVolume> volume_control; - ScopedComPtr<IAudioSessionManager> session_manager; - - ScopedComPtr<IMMDevice> device = - media::CoreAudioUtil::CreateDefaultDevice(eRender, eConsole); - if (!device || - FAILED(device->Activate(__uuidof(IAudioSessionManager), CLSCTX_ALL, NULL, - session_manager.ReceiveVoid()))) { - return volume_control; - } - - session_manager->GetSimpleAudioVolume(NULL, FALSE, - volume_control.Receive()); - - return volume_control; -} - -} // namespace system -} // namespace ash diff --git a/ash/system/win/audio/tray_audio_delegate_win.h b/ash/system/win/audio/tray_audio_delegate_win.h deleted file mode 100644 index 4014f95..0000000 --- a/ash/system/win/audio/tray_audio_delegate_win.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ASH_SYSTEM_WIN_AUDIO_TRAY_AUDIO_DELEGATE_WIN_H_ -#define ASH_SYSTEM_WIN_AUDIO_TRAY_AUDIO_DELEGATE_WIN_H_ - -#include <audioclient.h> -#include <mmdeviceapi.h> - -#include "ash/ash_export.h" -#include "ash/system/audio/tray_audio_delegate.h" -#include "base/compiler_specific.h" -#include "base/win/scoped_comptr.h" - -namespace ash { -namespace system { - -class ASH_EXPORT TrayAudioDelegateWin : public TrayAudioDelegate { - public: - virtual ~TrayAudioDelegateWin() {} - - // Overridden from TrayAudioDelegate. - virtual void AdjustOutputVolumeToAudibleLevel() OVERRIDE; - virtual int GetOutputDefaultVolumeMuteLevel() OVERRIDE; - virtual int GetOutputVolumeLevel() OVERRIDE; - virtual int GetActiveOutputDeviceIconId() OVERRIDE; - virtual bool HasAlternativeSources() OVERRIDE; - virtual bool IsOutputAudioMuted() OVERRIDE; - virtual void SetOutputAudioIsMuted(bool is_muted) OVERRIDE; - virtual void SetOutputVolumeLevel(int level) OVERRIDE; - - private: - base::win::ScopedComPtr<ISimpleAudioVolume> CreateDefaultVolumeControl(); -}; - -} // namespace system -} // namespace ash - -#endif // ASH_SYSTEM_WIN_AUDIO_TRAY_AUDIO_DELEGATE_WIN_H_
\ No newline at end of file diff --git a/ash/system/win/audio/tray_audio_win.cc b/ash/system/win/audio/tray_audio_win.cc deleted file mode 100644 index 0d2226c..0000000 --- a/ash/system/win/audio/tray_audio_win.cc +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "ash/system/win/audio/tray_audio_win.h" - -#include "ash/system/win/audio/tray_audio_delegate_win.h" - -namespace ash { - -using system::TrayAudioDelegate; -using system::TrayAudioDelegateWin; - -namespace internal { - -TrayAudioWin::TrayAudioWin(SystemTray* system_tray) - : TrayAudio(system_tray, - scoped_ptr<TrayAudioDelegate>(new TrayAudioDelegateWin())) { -} - -TrayAudioWin::~TrayAudioWin() { -} - -} // namespace internal -} // namespace ash diff --git a/ash/system/win/audio/tray_audio_win.h b/ash/system/win/audio/tray_audio_win.h deleted file mode 100644 index 33ca7cb..0000000 --- a/ash/system/win/audio/tray_audio_win.h +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef ASH_SYSTEM_WIN_AUDIO_TRAY_AUDIO_WIN_H_ -#define ASH_SYSTEM_WIN_AUDIO_TRAY_AUDIO_WIN_H_ - -#include "ash/ash_export.h" -#include "ash/system/audio/tray_audio.h" -#include "base/memory/scoped_ptr.h" - -namespace ash { - -namespace internal { - -class TrayAudioWin : public TrayAudio { - public: - explicit TrayAudioWin(SystemTray* system_tray); - virtual ~TrayAudioWin(); - - private: - DISALLOW_COPY_AND_ASSIGN(TrayAudioWin); -}; - -} // namespace internal -} // namespace ash - -#endif // ASH_SYSTEM_WIN_AUDIO_TRAY_AUDIO_WIN_H_
\ No newline at end of file diff --git a/chrome/browser/notifications/desktop_notifications_unittest.cc b/chrome/browser/notifications/desktop_notifications_unittest.cc index 5765fcf..742cdcc 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.cc +++ b/chrome/browser/notifications/desktop_notifications_unittest.cc @@ -107,11 +107,6 @@ DesktopNotificationsTest::~DesktopNotificationsTest() { void DesktopNotificationsTest::SetUp() { ui::InitializeInputMethodForTesting(); -#if defined(OS_WIN) && defined(USE_ASH) - // The system tray under Windows ash contains a volume slider which needs - // to talk to the audio hardware using COM. - com_initializer_.reset(new base::win::ScopedCOMInitializer()); -#endif #if defined(USE_AURA) wm_state_.reset(new views::corewm::WMState); #endif @@ -152,9 +147,6 @@ void DesktopNotificationsTest::TearDown() { #if defined(USE_AURA) wm_state_.reset(); #endif -#if defined(OS_WIN) && defined(USE_ASH) - com_initializer_.reset(); -#endif ui::ShutdownInputMethodForTesting(); } diff --git a/chrome/browser/notifications/desktop_notifications_unittest.h b/chrome/browser/notifications/desktop_notifications_unittest.h index ad7e289..6ecd01e 100644 --- a/chrome/browser/notifications/desktop_notifications_unittest.h +++ b/chrome/browser/notifications/desktop_notifications_unittest.h @@ -21,10 +21,6 @@ #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -#if defined(OS_WIN) && defined(USE_ASH) -#include "base/win/scoped_com_initializer.h" -#endif - #if defined(USE_AURA) namespace views { namespace corewm { @@ -138,9 +134,6 @@ class DesktopNotificationsTest : public testing::Test { #if defined(USE_AURA) scoped_ptr<views::corewm::WMState> wm_state_; #endif -#if defined(OS_WIN) && defined(USE_ASH) - scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; -#endif DISALLOW_COPY_AND_ASSIGN(DesktopNotificationsTest); }; diff --git a/media/audio/win/core_audio_util_win.h b/media/audio/win/core_audio_util_win.h index 8727f97..e78467e 100644 --- a/media/audio/win/core_audio_util_win.h +++ b/media/audio/win/core_audio_util_win.h @@ -4,7 +4,7 @@ // Utility methods for the Core Audio API on Windows. // Always ensure that Core Audio is supported before using these methods. -// Use media::CoreAudioUtil::IsSupported() for this purpose. +// Use media::CoreAudioIsSupported() for this purpose. // Also, all methods must be called on a valid COM thread. This can be done // by using the base::win::ScopedCOMInitializer helper class. |