Chromium Code Reviews| Index: extensions/shell/browser/shell_audio_controller_chromeos.h |
| diff --git a/extensions/shell/browser/shell_audio_controller_chromeos.h b/extensions/shell/browser/shell_audio_controller_chromeos.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..39222caafb0daaf15f401f27547b001eb5c470c4 |
| --- /dev/null |
| +++ b/extensions/shell/browser/shell_audio_controller_chromeos.h |
| @@ -0,0 +1,73 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef EXTENSIONS_SHELL_BROWSER_SHELL_AUDIO_CONTROLLER_CHROMEOS_H_ |
| +#define EXTENSIONS_SHELL_BROWSER_SHELL_AUDIO_CONTROLLER_CHROMEOS_H_ |
| + |
| +#include "base/macros.h" |
| +#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.
|
| +#include "chromeos/audio/audio_devices_pref_handler.h" |
| +#include "chromeos/audio/cras_audio_handler.h" |
| + |
| +namespace chromeos { |
| +class AudioDevicesPrefHandler; |
| +} |
| + |
| +namespace extensions { |
| + |
| +// Ensures that the "best" input and output audio devices are always active. |
| +class ShellAudioController : public chromeos::CrasAudioHandler::AudioObserver { |
| + public: |
| + // Requests max volume for all devices and doesn't bother saving prefs. |
| + class PrefHandler : public chromeos::AudioDevicesPrefHandler { |
| + public: |
| + PrefHandler(); |
| + |
| + // chromeos::AudioDevicesPrefHandler implementation: |
| + virtual double GetOutputVolumeValue( |
| + const chromeos::AudioDevice* device) OVERRIDE; |
| + virtual double GetInputGainValue( |
| + const chromeos::AudioDevice* device) OVERRIDE; |
| + virtual void SetVolumeGainValue(const chromeos::AudioDevice& device, |
| + double value) OVERRIDE; |
| + virtual bool GetMuteValue(const chromeos::AudioDevice& device) OVERRIDE; |
| + virtual void SetMuteValue(const chromeos::AudioDevice& device, |
| + bool mute_on) OVERRIDE; |
| + virtual bool GetAudioCaptureAllowedValue() OVERRIDE; |
| + virtual bool GetAudioOutputAllowedValue() OVERRIDE; |
| + virtual void AddAudioPrefObserver( |
| + chromeos::AudioPrefObserver* observer) OVERRIDE; |
| + virtual void RemoveAudioPrefObserver( |
| + chromeos::AudioPrefObserver* observer) OVERRIDE; |
| + |
| + protected: |
| + virtual ~PrefHandler(); |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(PrefHandler); |
| + }; |
| + |
| + ShellAudioController(); |
| + virtual ~ShellAudioController(); |
| + |
| + // chromeos::CrasAudioHandler::Observer implementation: |
| + virtual void OnOutputVolumeChanged() OVERRIDE; |
| + virtual void OnOutputMuteChanged() OVERRIDE; |
| + virtual void OnInputGainChanged() OVERRIDE; |
| + virtual void OnInputMuteChanged() OVERRIDE; |
| + virtual void OnAudioNodesChanged() OVERRIDE; |
| + virtual void OnActiveOutputNodeChanged() OVERRIDE; |
| + virtual void OnActiveInputNodeChanged() OVERRIDE; |
| + |
| + private: |
| + // Gets the current device list from CRAS, chooses the best input and output |
| + // 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
|
| + void ActivateDevices(); |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ShellAudioController); |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // EXTENSIONS_SHELL_BROWSER_SHELL_AUDIO_CONTROLLER_CHROMEOS_H_ |