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

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

Issue 13486004: Audio extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Rahul's comments. Created 7 years, 8 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: chrome/browser/extensions/api/audio/audio_service.h
diff --git a/chrome/browser/extensions/api/audio/audio_service.h b/chrome/browser/extensions/api/audio/audio_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..9d3883ec921d00f6b1253317117f6486e4fbd077
--- /dev/null
+++ b/chrome/browser/extensions/api/audio/audio_service.h
@@ -0,0 +1,54 @@
+// Copyright (c) 2013 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 CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_SERVICE_H_
+#define CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_SERVICE_H_
+
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "chrome/common/extensions/api/audio.h"
+
+namespace extensions {
+
+typedef std::vector<linked_ptr<api::audio::OutputDeviceInfo> > OutputInfo;
+typedef std::vector<linked_ptr<api::audio::InputDeviceInfo> > InputInfo;
+
+class AudioService {
+ public:
+ class Observer {
+ public:
+ // Called when anything changes to the audio device configuration.
+ virtual void OnDeviceChanged() = 0;
+
+ protected:
+ virtual ~Observer() {}
+ };
+
+ // Callback type for completing to get audio device information.
+ typedef base::Callback<void(const OutputInfo&, const InputInfo&, bool)>
+ GetInfoCallback;
+
+ // Creates a platform-specific AudioService instance.
+ static AudioService* CreateInstance();
+
+ virtual ~AudioService() {}
+
+ // Called by listeners to this service to add/remove themselves as observers.
+ virtual void AddObserver(Observer* observer) = 0;
+ virtual void RemoveObserver(Observer* observer) = 0;
+
+ // Start to query audio device information. Should be called on UI thread.
+ // The |callback| will be invoked once the query is completed.
+ virtual void StartGetInfo(const GetInfoCallback& callback) = 0;
+
+ protected:
+ AudioService() {}
+
+ DISALLOW_COPY_AND_ASSIGN(AudioService);
+};
+
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_SERVICE_H_

Powered by Google App Engine
This is Rietveld 408576698