OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_SERVICE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_SERVICE_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" |
| 10 #include "chrome/common/extensions/api/audio.h" |
| 11 |
| 12 namespace extensions { |
| 13 |
| 14 typedef std::vector<linked_ptr<api::audio::OutputDeviceInfo> > OutputInfo; |
| 15 typedef std::vector<linked_ptr<api::audio::InputDeviceInfo> > InputInfo; |
| 16 |
| 17 class AudioService { |
| 18 public: |
| 19 class Observer { |
| 20 public: |
| 21 // Called when anything changes to the audio device configuration. |
| 22 virtual void OnDeviceChanged() = 0; |
| 23 |
| 24 protected: |
| 25 virtual ~Observer() {} |
| 26 }; |
| 27 |
| 28 // Callback type for completing to get audio device information. |
| 29 typedef base::Callback<void(const OutputInfo&, const InputInfo&, bool)> |
| 30 GetInfoCallback; |
| 31 |
| 32 // Creates a platform-specific AudioService instance. |
| 33 static AudioService* CreateInstance(); |
| 34 |
| 35 virtual ~AudioService() {} |
| 36 |
| 37 // Called by listeners to this service to add/remove themselves as observers. |
| 38 virtual void AddObserver(Observer* observer) = 0; |
| 39 virtual void RemoveObserver(Observer* observer) = 0; |
| 40 |
| 41 // Start to query audio device information. Should be called on UI thread. |
| 42 // The |callback| will be invoked once the query is completed. |
| 43 virtual void StartGetInfo(const GetInfoCallback& callback) = 0; |
| 44 |
| 45 protected: |
| 46 AudioService() {} |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(AudioService); |
| 49 }; |
| 50 |
| 51 |
| 52 } // namespace extensions |
| 53 |
| 54 #endif // CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_SERVICE_H_ |
OLD | NEW |