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.
5 #ifndef EXTENSIONS_SHELL_BROWSER_SHELL_AUDIO_CONTROLLER_CHROMEOS_H_
6 #define EXTENSIONS_SHELL_BROWSER_SHELL_AUDIO_CONTROLLER_CHROMEOS_H_
8 #include "base/macros.h"
9 #include "chromeos/audio/cras_audio_handler.h"
11 namespace extensions
{
13 // Ensures that the "best" input and output audio devices are always active.
14 class ShellAudioController
: public chromeos::CrasAudioHandler::AudioObserver
{
16 ShellAudioController();
17 ~ShellAudioController() override
;
19 // chromeos::CrasAudioHandler::Observer implementation:
20 void OnOutputNodeVolumeChanged(uint64_t node_id
, int volume
) override
;
21 void OnOutputMuteChanged(bool mute_on
, bool system_adjust
) override
;
22 void OnInputNodeGainChanged(uint64_t node_id
, int gain
) override
;
23 void OnInputMuteChanged(bool mute_on
) override
;
24 void OnAudioNodesChanged() override
;
25 void OnActiveOutputNodeChanged() override
;
26 void OnActiveInputNodeChanged() override
;
29 // Gets the current device list from CRAS, chooses the best input and output
30 // device, and activates them if they aren't already active.
31 void ActivateDevices();
33 DISALLOW_COPY_AND_ASSIGN(ShellAudioController
);
36 } // namespace extensions
38 #endif // EXTENSIONS_SHELL_BROWSER_SHELL_AUDIO_CONTROLLER_CHROMEOS_H_