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

Unified Diff: extensions/browser/api/audio/audio_service.h

Issue 945103002: Add a new audio extension event OnLevelChanged. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
Index: extensions/browser/api/audio/audio_service.h
diff --git a/extensions/browser/api/audio/audio_service.h b/extensions/browser/api/audio/audio_service.h
index 6d985ebd23b1f8f660897a1dfdb0228be9f34aaf..24e2fb9d5ac8d90c106cbaff3349d5e5230d8702 100644
--- a/extensions/browser/api/audio/audio_service.h
+++ b/extensions/browser/api/audio/audio_service.h
@@ -17,6 +17,7 @@ namespace extensions {
using OutputInfo = std::vector<linked_ptr<core_api::audio::OutputDeviceInfo>>;
using InputInfo = std::vector<linked_ptr<core_api::audio::InputDeviceInfo>>;
+using DevicesInfo = std::vector<linked_ptr<core_api::audio::AudioDeviceInfo>>;
using DeviceIdList = std::vector<std::string>;
class AudioService {
@@ -26,6 +27,10 @@ class AudioService {
// Called when anything changes to the audio device configuration.
virtual void OnDeviceChanged() = 0;
+ // Called when the volume of an active output node changes.
+ virtual void OnOutputNodeVolumeChanged(const std::string& id,
+ double volume) = 0;
+
protected:
virtual ~Observer() {}
};
@@ -34,6 +39,9 @@ class AudioService {
typedef base::Callback<void(const OutputInfo&, const InputInfo&, bool)>
GetInfoCallback;
+ // Callback type for completing to get audio devices information.
+ typedef base::Callback<void(const DevicesInfo&, bool)> GetDeviceInfoCallback;
+
// Creates a platform-specific AudioService instance.
static AudioService* CreateInstance();
@@ -63,6 +71,10 @@ class AudioService {
int volume,
int gain) = 0;
+ // Starts to query audio devices information. Should be called on UI thread.
+ // The |callback| will be invoked once the query is completed.
+ virtual void StartGetDeviceInfo(const GetDeviceInfoCallback& callback) = 0;
+
protected:
AudioService() {}

Powered by Google App Engine
This is Rietveld 408576698