Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Unified Diff: extensions/shell/browser/shell_audio_controller_chromeos.h

Issue 515573003: app_shell: Do simple audio initialization. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wrap line Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/shell/app_shell.gyp ('k') | extensions/shell/browser/shell_audio_controller_chromeos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ea7d446bdc822810e8443e3e416ae1eb87512895
--- /dev/null
+++ b/extensions/shell/browser/shell_audio_controller_chromeos.h
@@ -0,0 +1,72 @@
+// 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 "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.
+ void ActivateDevices();
+
+ DISALLOW_COPY_AND_ASSIGN(ShellAudioController);
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_SHELL_BROWSER_SHELL_AUDIO_CONTROLLER_CHROMEOS_H_
« no previous file with comments | « extensions/shell/app_shell.gyp ('k') | extensions/shell/browser/shell_audio_controller_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698