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 3 // found in the LICENSE file. 4 5 #ifndef ASH_SYSTEM_AUDIO_TRAY_AUDIO_H_ 6 #define ASH_SYSTEM_AUDIO_TRAY_AUDIO_H_ 7 8 #include "ash/system/audio/audio_observer.h" 9 #include "ash/system/tray/tray_image_item.h" 10 #include "base/memory/scoped_ptr.h" 11 12 namespace ash { 13 14 namespace system { 15 class TrayAudioDelegate; 16 } 17 18 namespace tray { 19 class VolumeView; 20 } 21 22 class TrayAudio : public TrayImageItem, 23 public AudioObserver { 24 public: 25 TrayAudio(SystemTray* system_tray, 26 scoped_ptr<system::TrayAudioDelegate> audio_delegate); 27 virtual ~TrayAudio(); 28 29 static bool ShowAudioDeviceMenu(); 30 31 protected: 32 virtual void Update(); 33 34 scoped_ptr<system::TrayAudioDelegate> audio_delegate_; 35 tray::VolumeView* volume_view_; 36 37 // True if VolumeView should be created for accelerator pop up; 38 // Otherwise, it should be created for detailed view in ash tray bubble. 39 bool pop_up_volume_view_; 40 41 private: 42 // Overridden from TrayImageItem. 43 virtual bool GetInitialVisibility() OVERRIDE; 44 45 // Overridden from SystemTrayItem. 46 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; 47 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; 48 virtual void DestroyDefaultView() OVERRIDE; 49 virtual void DestroyDetailedView() OVERRIDE; 50 virtual bool ShouldHideArrow() const OVERRIDE; 51 virtual bool ShouldShowShelf() const OVERRIDE; 52 53 // Overridden from AudioObserver. 54 virtual void OnOutputVolumeChanged() OVERRIDE; 55 virtual void OnOutputMuteChanged() OVERRIDE; 56 virtual void OnAudioNodesChanged() OVERRIDE; 57 virtual void OnActiveOutputNodeChanged() OVERRIDE; 58 virtual void OnActiveInputNodeChanged() OVERRIDE; 59 60 DISALLOW_COPY_AND_ASSIGN(TrayAudio); 61 }; 62 63 } // namespace ash 64 65 #endif // ASH_SYSTEM_AUDIO_TRAY_AUDIO_H_ 66