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.
5 #ifndef ASH_SYSTEM_AUDIO_TRAY_AUDIO_H_
6 #define ASH_SYSTEM_AUDIO_TRAY_AUDIO_H_
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 #include "ui/gfx/display_observer.h"
16 class TrayAudioDelegate
;
23 class TrayAudio
: public TrayImageItem
,
25 public gfx::DisplayObserver
{
27 TrayAudio(SystemTray
* system_tray
,
28 scoped_ptr
<system::TrayAudioDelegate
> audio_delegate
);
29 ~TrayAudio() override
;
31 static bool ShowAudioDeviceMenu();
34 // Overridden from gfx::DisplayObserver.
35 void OnDisplayAdded(const gfx::Display
& new_display
) override
;
36 void OnDisplayRemoved(const gfx::Display
& old_display
) override
;
37 void OnDisplayMetricsChanged(const gfx::Display
& display
,
38 uint32_t changed_metrics
) override
;
40 virtual void Update();
42 scoped_ptr
<system::TrayAudioDelegate
> audio_delegate_
;
43 tray::VolumeView
* volume_view_
;
45 // True if VolumeView should be created for accelerator pop up;
46 // Otherwise, it should be created for detailed view in ash tray bubble.
47 bool pop_up_volume_view_
;
50 // Overridden from TrayImageItem.
51 bool GetInitialVisibility() override
;
53 // Overridden from SystemTrayItem.
54 views::View
* CreateDefaultView(user::LoginStatus status
) override
;
55 views::View
* CreateDetailedView(user::LoginStatus status
) override
;
56 void DestroyDefaultView() override
;
57 void DestroyDetailedView() override
;
58 bool ShouldHideArrow() const override
;
59 bool ShouldShowShelf() const override
;
61 // Overridden from AudioObserver.
62 void OnOutputNodeVolumeChanged(uint64_t node_id
, double volume
) override
;
63 void OnOutputMuteChanged(bool mute_on
, bool system_adjust
) override
;
64 void OnAudioNodesChanged() override
;
65 void OnActiveOutputNodeChanged() override
;
66 void OnActiveInputNodeChanged() override
;
68 void ChangeInternalSpeakerChannelMode();
70 DISALLOW_COPY_AND_ASSIGN(TrayAudio
);
75 #endif // ASH_SYSTEM_AUDIO_TRAY_AUDIO_H_