mic_gain_slider_view.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2020 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. #ifndef ASH_SYSTEM_AUDIO_MIC_GAIN_SLIDER_VIEW_H_
  5. #define ASH_SYSTEM_AUDIO_MIC_GAIN_SLIDER_VIEW_H_
  6. #include "ash/system/unified/unified_slider_view.h"
  7. #include "chromeos/ash/components/audio/cras_audio_handler.h"
  8. namespace ash {
  9. class MicGainSliderController;
  10. class MicGainSliderView : public UnifiedSliderView,
  11. public CrasAudioHandler::AudioObserver {
  12. public:
  13. explicit MicGainSliderView(MicGainSliderController* controller);
  14. MicGainSliderView(MicGainSliderController* controller,
  15. uint64_t device_id,
  16. bool internal);
  17. ~MicGainSliderView() override;
  18. uint64_t device_id() const { return device_id_; }
  19. // CrasAudioHandler::AudioObserver:
  20. void OnInputNodeGainChanged(uint64_t node_id, int gain) override;
  21. void OnInputMuteChanged(bool mute_on) override;
  22. void OnInputMutedByMicrophoneMuteSwitchChanged(bool muted) override;
  23. void OnActiveInputNodeChanged() override;
  24. // views::View:
  25. const char* GetClassName() const override;
  26. private:
  27. void Update(bool by_user);
  28. // device id for the input device tied to this slider.
  29. const uint64_t device_id_;
  30. // True if the audio device this slider represents is internal.
  31. const bool internal_;
  32. // View used for a11y alert when mute state changes.
  33. views::View* announcement_view_ = nullptr;
  34. };
  35. } // namespace ash
  36. #endif // ASH_SYSTEM_AUDIO_MIC_GAIN_SLIDER_VIEW_H_