| OLD | NEW |
| (Empty) |
| 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_COMMON_SYSTEM_CHROMEOS_AUDIO_TRAY_AUDIO_H_ | |
| 6 #define ASH_COMMON_SYSTEM_CHROMEOS_AUDIO_TRAY_AUDIO_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 #include <memory> | |
| 11 | |
| 12 #include "ash/ash_export.h" | |
| 13 #include "ash/common/system/tray/tray_image_item.h" | |
| 14 #include "base/macros.h" | |
| 15 #include "chromeos/audio/cras_audio_handler.h" | |
| 16 #include "chromeos/dbus/power_manager_client.h" | |
| 17 #include "ui/display/display_observer.h" | |
| 18 | |
| 19 namespace ash { | |
| 20 | |
| 21 namespace system { | |
| 22 class TrayAudioDelegate; | |
| 23 } | |
| 24 | |
| 25 namespace tray { | |
| 26 class AudioDetailedView; | |
| 27 class VolumeView; | |
| 28 } | |
| 29 | |
| 30 // The system tray item for audio input and output. | |
| 31 class ASH_EXPORT TrayAudio : public TrayImageItem, | |
| 32 public chromeos::CrasAudioHandler::AudioObserver, | |
| 33 public display::DisplayObserver, | |
| 34 public chromeos::PowerManagerClient::Observer { | |
| 35 public: | |
| 36 explicit TrayAudio(SystemTray* system_tray); | |
| 37 ~TrayAudio() override; | |
| 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 | |
| 46 private: | |
| 47 // Overridden from display::DisplayObserver. | |
| 48 void OnDisplayAdded(const display::Display& new_display) override; | |
| 49 void OnDisplayRemoved(const display::Display& old_display) override; | |
| 50 void OnDisplayMetricsChanged(const display::Display& display, | |
| 51 uint32_t changed_metrics) override; | |
| 52 | |
| 53 // Overridden from TrayImageItem. | |
| 54 bool GetInitialVisibility() override; | |
| 55 | |
| 56 // Overridden from SystemTrayItem. | |
| 57 views::View* CreateDefaultView(LoginStatus status) override; | |
| 58 views::View* CreateDetailedView(LoginStatus status) override; | |
| 59 void DestroyDefaultView() override; | |
| 60 void DestroyDetailedView() override; | |
| 61 bool ShouldShowShelf() const override; | |
| 62 | |
| 63 // Overridden from CrasAudioHandler::AudioObserver. | |
| 64 void OnOutputNodeVolumeChanged(uint64_t node_id, int volume) override; | |
| 65 void OnOutputMuteChanged(bool mute_on, bool system_adjust) override; | |
| 66 void OnAudioNodesChanged() override; | |
| 67 void OnActiveOutputNodeChanged() override; | |
| 68 void OnActiveInputNodeChanged() override; | |
| 69 | |
| 70 // Overridden from chromeos::PowerManagerClient::Observer. | |
| 71 void SuspendDone(const base::TimeDelta& sleep_duration) override; | |
| 72 | |
| 73 // Swaps the left and right channels on yoga devices based on orientation. | |
| 74 void ChangeInternalSpeakerChannelMode(); | |
| 75 | |
| 76 // Updates the UI views. | |
| 77 void Update(); | |
| 78 | |
| 79 // TODO(jamescook): Remove this delegate and inline all the code. | |
| 80 std::unique_ptr<system::TrayAudioDelegate> audio_delegate_; | |
| 81 tray::VolumeView* volume_view_; | |
| 82 | |
| 83 // True if VolumeView should be created for accelerator pop up; | |
| 84 // Otherwise, it should be created for detailed view in ash tray bubble. | |
| 85 bool pop_up_volume_view_; | |
| 86 | |
| 87 tray::AudioDetailedView* audio_detail_view_; | |
| 88 | |
| 89 DISALLOW_COPY_AND_ASSIGN(TrayAudio); | |
| 90 }; | |
| 91 | |
| 92 } // namespace ash | |
| 93 | |
| 94 #endif // ASH_COMMON_SYSTEM_CHROMEOS_AUDIO_TRAY_AUDIO_H_ | |
| OLD | NEW |