Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Side by Side Diff: ash/system/audio/tray_audio.h

Issue 163953007: Refactor the TrayAudio code so that it can be used by other platforms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef ASH_SYSTEM_CHROMEOS_AUDIO_TRAY_AUDIO_H_ 5 #ifndef ASH_SYSTEM_AUDIO_TRAY_AUDIO_H_
6 #define ASH_SYSTEM_CHROMEOS_AUDIO_TRAY_AUDIO_H_ 6 #define ASH_SYSTEM_AUDIO_TRAY_AUDIO_H_
7 7
8 #include "ash/system/audio/audio_observer.h"
8 #include "ash/system/tray/tray_image_item.h" 9 #include "ash/system/tray/tray_image_item.h"
9 #include "chromeos/audio/cras_audio_handler.h"
10 10
11 namespace ash { 11 namespace ash {
12
13 namespace system {
14 class TrayAudioDelegate;
15 }
16
12 namespace internal { 17 namespace internal {
13 18
14 namespace tray { 19 namespace tray {
15 class VolumeView; 20 class VolumeView;
16 class AudioDetailedView;
17 } 21 }
18 22
19 class TrayAudio : public TrayImageItem, 23 class TrayAudio : public TrayImageItem,
20 public chromeos::CrasAudioHandler::AudioObserver { 24 public AudioObserver {
21 public: 25 public:
22 explicit TrayAudio(SystemTray* system_tray); 26 explicit TrayAudio(SystemTray* system_tray,
27 system::TrayAudioDelegate* audio_delegate);
jennyz 2014/02/14 21:36:43 Remove explicit since the constructor now takes 2
zturner 2014/02/15 00:57:45 Done.
23 virtual ~TrayAudio(); 28 virtual ~TrayAudio();
24 29
30 protected:
31 virtual void Update();
32
33 system::TrayAudioDelegate* audio_delegate_;
34 tray::VolumeView* volume_view_;
35
36 // True if VolumeView should be created for accelerator pop up;
37 // Otherwise, it should be created for detailed view in ash tray bubble.
38 bool pop_up_volume_view_;
39
25 private: 40 private:
26 // Overridden from TrayImageItem. 41 // Overridden from TrayImageItem.
27 virtual bool GetInitialVisibility() OVERRIDE; 42 virtual bool GetInitialVisibility() OVERRIDE;
28 43
29 // Overridden from SystemTrayItem. 44 // Overridden from SystemTrayItem.
30 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; 45 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE;
31 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; 46 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE;
32 virtual void DestroyDefaultView() OVERRIDE; 47 virtual void DestroyDefaultView() OVERRIDE;
33 virtual void DestroyDetailedView() OVERRIDE; 48 virtual void DestroyDetailedView() OVERRIDE;
34 virtual bool ShouldHideArrow() const OVERRIDE; 49 virtual bool ShouldHideArrow() const OVERRIDE;
35 virtual bool ShouldShowShelf() const OVERRIDE; 50 virtual bool ShouldShowShelf() const OVERRIDE;
36 51
37 // Overridden from chromeos::CrasAudioHandler::AudioObserver. 52 // Overridden from AudioObserver.
38 virtual void OnOutputVolumeChanged() OVERRIDE; 53 virtual void OnOutputVolumeChanged() OVERRIDE;
39 virtual void OnOutputMuteChanged() OVERRIDE; 54 virtual void OnOutputMuteChanged() OVERRIDE;
40 virtual void OnInputGainChanged() OVERRIDE;
41 virtual void OnInputMuteChanged() OVERRIDE;
42 virtual void OnAudioNodesChanged() OVERRIDE; 55 virtual void OnAudioNodesChanged() OVERRIDE;
43 virtual void OnActiveOutputNodeChanged() OVERRIDE; 56 virtual void OnActiveOutputNodeChanged() OVERRIDE;
44 virtual void OnActiveInputNodeChanged() OVERRIDE; 57 virtual void OnActiveInputNodeChanged() OVERRIDE;
45 58
46 void Update();
47
48 tray::VolumeView* volume_view_;
49 tray::AudioDetailedView* audio_detail_;
50
51 // True if VolumeView should be created for accelerator pop up;
52 // Otherwise, it should be created for detailed view in ash tray bubble.
53 bool pop_up_volume_view_;
54
55 DISALLOW_COPY_AND_ASSIGN(TrayAudio); 59 DISALLOW_COPY_AND_ASSIGN(TrayAudio);
56 }; 60 };
57 61
58 } // namespace internal 62 } // namespace internal
59 } // namespace ash 63 } // namespace ash
60 64
61 #endif // ASH_SYSTEM_CHROMEOS_AUDIO_TRAY_AUDIO_H_ 65 #endif // ASH_SYSTEM_AUDIO_TRAY_AUDIO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698