| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_COMMON_SYSTEM_CHROMEOS_AUDIO_TRAY_AUDIO_H_ | 5 #ifndef ASH_COMMON_SYSTEM_CHROMEOS_AUDIO_TRAY_AUDIO_H_ |
| 6 #define ASH_COMMON_SYSTEM_CHROMEOS_AUDIO_TRAY_AUDIO_H_ | 6 #define ASH_COMMON_SYSTEM_CHROMEOS_AUDIO_TRAY_AUDIO_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "ash/ash_export.h" | 12 #include "ash/ash_export.h" |
| 13 #include "ash/common/system/chromeos/audio/audio_observer.h" | |
| 14 #include "ash/common/system/tray/tray_image_item.h" | 13 #include "ash/common/system/tray/tray_image_item.h" |
| 15 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "chromeos/audio/cras_audio_handler.h" |
| 16 #include "chromeos/dbus/power_manager_client.h" | 16 #include "chromeos/dbus/power_manager_client.h" |
| 17 #include "ui/display/display_observer.h" | 17 #include "ui/display/display_observer.h" |
| 18 | 18 |
| 19 namespace ash { | 19 namespace ash { |
| 20 | 20 |
| 21 namespace system { | 21 namespace system { |
| 22 class TrayAudioDelegate; | 22 class TrayAudioDelegate; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace tray { | 25 namespace tray { |
| 26 class AudioDetailedView; | 26 class AudioDetailedView; |
| 27 class VolumeView; | 27 class VolumeView; |
| 28 } | 28 } |
| 29 | 29 |
| 30 // The system tray item for audio input and output. | 30 // The system tray item for audio input and output. |
| 31 class ASH_EXPORT TrayAudio : public TrayImageItem, | 31 class ASH_EXPORT TrayAudio : public TrayImageItem, |
| 32 public AudioObserver, | 32 public chromeos::CrasAudioHandler::AudioObserver, |
| 33 public display::DisplayObserver, | 33 public display::DisplayObserver, |
| 34 public chromeos::PowerManagerClient::Observer { | 34 public chromeos::PowerManagerClient::Observer { |
| 35 public: | 35 public: |
| 36 explicit TrayAudio(SystemTray* system_tray); | 36 explicit TrayAudio(SystemTray* system_tray); |
| 37 ~TrayAudio() override; | 37 ~TrayAudio() override; |
| 38 | 38 |
| 39 // Temporarily shows the pop-up volume slider on all displays. Used by ARC++ |
| 40 // when an Android app changes the system volume. |
| 41 static void ShowPopUpVolumeView(); |
| 42 |
| 43 tray::VolumeView* volume_view_for_testing() { return volume_view_; } |
| 44 bool pop_up_volume_view_for_testing() { return pop_up_volume_view_; } |
| 45 |
| 39 private: | 46 private: |
| 40 // Overridden from display::DisplayObserver. | 47 // Overridden from display::DisplayObserver. |
| 41 void OnDisplayAdded(const display::Display& new_display) override; | 48 void OnDisplayAdded(const display::Display& new_display) override; |
| 42 void OnDisplayRemoved(const display::Display& old_display) override; | 49 void OnDisplayRemoved(const display::Display& old_display) override; |
| 43 void OnDisplayMetricsChanged(const display::Display& display, | 50 void OnDisplayMetricsChanged(const display::Display& display, |
| 44 uint32_t changed_metrics) override; | 51 uint32_t changed_metrics) override; |
| 45 | 52 |
| 46 // Overridden from TrayImageItem. | 53 // Overridden from TrayImageItem. |
| 47 bool GetInitialVisibility() override; | 54 bool GetInitialVisibility() override; |
| 48 | 55 |
| 49 // Overridden from SystemTrayItem. | 56 // Overridden from SystemTrayItem. |
| 50 views::View* CreateDefaultView(LoginStatus status) override; | 57 views::View* CreateDefaultView(LoginStatus status) override; |
| 51 views::View* CreateDetailedView(LoginStatus status) override; | 58 views::View* CreateDetailedView(LoginStatus status) override; |
| 52 void DestroyDefaultView() override; | 59 void DestroyDefaultView() override; |
| 53 void DestroyDetailedView() override; | 60 void DestroyDetailedView() override; |
| 54 bool ShouldHideArrow() const override; | 61 bool ShouldHideArrow() const override; |
| 55 bool ShouldShowShelf() const override; | 62 bool ShouldShowShelf() const override; |
| 56 | 63 |
| 57 // Overridden from AudioObserver. | 64 // Overridden from CrasAudioHandler::AudioObserver. |
| 58 void OnOutputNodeVolumeChanged(uint64_t node_id, double volume) override; | 65 void OnOutputNodeVolumeChanged(uint64_t node_id, int volume) override; |
| 59 void OnOutputMuteChanged(bool mute_on, bool system_adjust) override; | 66 void OnOutputMuteChanged(bool mute_on, bool system_adjust) override; |
| 60 void OnAudioNodesChanged() override; | 67 void OnAudioNodesChanged() override; |
| 61 void OnActiveOutputNodeChanged() override; | 68 void OnActiveOutputNodeChanged() override; |
| 62 void OnActiveInputNodeChanged() override; | 69 void OnActiveInputNodeChanged() override; |
| 63 | 70 |
| 64 // Overridden from chromeos::PowerManagerClient::Observer. | 71 // Overridden from chromeos::PowerManagerClient::Observer. |
| 65 void SuspendDone(const base::TimeDelta& sleep_duration) override; | 72 void SuspendDone(const base::TimeDelta& sleep_duration) override; |
| 66 | 73 |
| 67 // Swaps the left and right channels on yoga devices based on orientation. | 74 // Swaps the left and right channels on yoga devices based on orientation. |
| 68 void ChangeInternalSpeakerChannelMode(); | 75 void ChangeInternalSpeakerChannelMode(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 79 bool pop_up_volume_view_; | 86 bool pop_up_volume_view_; |
| 80 | 87 |
| 81 tray::AudioDetailedView* audio_detail_view_; | 88 tray::AudioDetailedView* audio_detail_view_; |
| 82 | 89 |
| 83 DISALLOW_COPY_AND_ASSIGN(TrayAudio); | 90 DISALLOW_COPY_AND_ASSIGN(TrayAudio); |
| 84 }; | 91 }; |
| 85 | 92 |
| 86 } // namespace ash | 93 } // namespace ash |
| 87 | 94 |
| 88 #endif // ASH_COMMON_SYSTEM_CHROMEOS_AUDIO_TRAY_AUDIO_H_ | 95 #endif // ASH_COMMON_SYSTEM_CHROMEOS_AUDIO_TRAY_AUDIO_H_ |
| OLD | NEW |