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.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_API_H_
8 #include "chrome/browser/extensions/api/audio/audio_service.h"
9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
10 #include "chrome/browser/extensions/chrome_extension_function.h"
12 namespace extensions {
16 class AudioAPI : public ProfileKeyedAPI,
17 public AudioService::Observer {
19 explicit AudioAPI(Profile* profile);
22 AudioService* GetService() const;
24 // ProfileKeyedAPI implementation.
25 static ProfileKeyedAPIFactory<AudioAPI>* GetFactoryInstance();
27 // AudioService::Observer implementation.
28 virtual void OnDeviceChanged() OVERRIDE;
31 friend class ProfileKeyedAPIFactory<AudioAPI>;
33 // ProfileKeyedAPI implementation.
34 static const char* service_name() {
38 Profile* const profile_;
39 AudioService* service_;
42 class AudioGetInfoFunction : public ChromeAsyncExtensionFunction {
44 DECLARE_EXTENSION_FUNCTION("audio.getInfo",
48 virtual ~AudioGetInfoFunction() {}
49 virtual bool RunImpl() OVERRIDE;
52 void OnGetInfoCompleted(const OutputInfo& output_info,
53 const InputInfo& input_info,
57 class AudioSetActiveDevicesFunction : public ChromeSyncExtensionFunction {
59 DECLARE_EXTENSION_FUNCTION("audio.setActiveDevices",
60 AUDIO_SETACTIVEDEVICES);
63 virtual ~AudioSetActiveDevicesFunction() {}
64 virtual bool RunImpl() OVERRIDE;
67 class AudioSetPropertiesFunction : public ChromeSyncExtensionFunction {
69 DECLARE_EXTENSION_FUNCTION("audio.setProperties",
73 virtual ~AudioSetPropertiesFunction() {}
74 virtual bool RunImpl() OVERRIDE;
78 } // namespace extensions
80 #endif // CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_API_H_