Chromium Code Reviews| 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 EXTENSIONS_SHELL_BROWSER_SHELL_AUDIO_CONTROLLER_CHROMEOS_H_ | |
| 6 #define EXTENSIONS_SHELL_BROWSER_SHELL_AUDIO_CONTROLLER_CHROMEOS_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/ref_counted.h" | |
|
James Cook
2014/08/27 23:18:33
Do you need this include?
Daniel Erat
2014/08/28 00:12:20
whoops, not anymore. thanks, deleted.
| |
| 10 #include "chromeos/audio/audio_devices_pref_handler.h" | |
| 11 #include "chromeos/audio/cras_audio_handler.h" | |
| 12 | |
| 13 namespace chromeos { | |
| 14 class AudioDevicesPrefHandler; | |
| 15 } | |
| 16 | |
| 17 namespace extensions { | |
| 18 | |
| 19 // Ensures that the "best" input and output audio devices are always active. | |
| 20 class ShellAudioController : public chromeos::CrasAudioHandler::AudioObserver { | |
| 21 public: | |
| 22 // Requests max volume for all devices and doesn't bother saving prefs. | |
| 23 class PrefHandler : public chromeos::AudioDevicesPrefHandler { | |
| 24 public: | |
| 25 PrefHandler(); | |
| 26 | |
| 27 // chromeos::AudioDevicesPrefHandler implementation: | |
| 28 virtual double GetOutputVolumeValue( | |
| 29 const chromeos::AudioDevice* device) OVERRIDE; | |
| 30 virtual double GetInputGainValue( | |
| 31 const chromeos::AudioDevice* device) OVERRIDE; | |
| 32 virtual void SetVolumeGainValue(const chromeos::AudioDevice& device, | |
| 33 double value) OVERRIDE; | |
| 34 virtual bool GetMuteValue(const chromeos::AudioDevice& device) OVERRIDE; | |
| 35 virtual void SetMuteValue(const chromeos::AudioDevice& device, | |
| 36 bool mute_on) OVERRIDE; | |
| 37 virtual bool GetAudioCaptureAllowedValue() OVERRIDE; | |
| 38 virtual bool GetAudioOutputAllowedValue() OVERRIDE; | |
| 39 virtual void AddAudioPrefObserver( | |
| 40 chromeos::AudioPrefObserver* observer) OVERRIDE; | |
| 41 virtual void RemoveAudioPrefObserver( | |
| 42 chromeos::AudioPrefObserver* observer) OVERRIDE; | |
| 43 | |
| 44 protected: | |
| 45 virtual ~PrefHandler(); | |
| 46 | |
| 47 private: | |
| 48 DISALLOW_COPY_AND_ASSIGN(PrefHandler); | |
| 49 }; | |
| 50 | |
| 51 ShellAudioController(); | |
| 52 virtual ~ShellAudioController(); | |
| 53 | |
| 54 // chromeos::CrasAudioHandler::Observer implementation: | |
| 55 virtual void OnOutputVolumeChanged() OVERRIDE; | |
| 56 virtual void OnOutputMuteChanged() OVERRIDE; | |
| 57 virtual void OnInputGainChanged() OVERRIDE; | |
| 58 virtual void OnInputMuteChanged() OVERRIDE; | |
| 59 virtual void OnAudioNodesChanged() OVERRIDE; | |
| 60 virtual void OnActiveOutputNodeChanged() OVERRIDE; | |
| 61 virtual void OnActiveInputNodeChanged() OVERRIDE; | |
| 62 | |
| 63 private: | |
| 64 // Gets the current device list from CRAS, chooses the best input and output | |
| 65 // device, and activates them if they aren't already active. | |
|
James Cook
2014/08/27 23:18:33
I like how you always have descriptive function co
| |
| 66 void ActivateDevices(); | |
| 67 | |
| 68 DISALLOW_COPY_AND_ASSIGN(ShellAudioController); | |
| 69 }; | |
| 70 | |
| 71 } // namespace extensions | |
| 72 | |
| 73 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_AUDIO_CONTROLLER_CHROMEOS_H_ | |
| OLD | NEW |