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