Reland the ULONG -> SIZE_T change from 317177
[chromium-blink-merge.git] / extensions / browser / api / audio / audio_api.h
blobddee1d5c75a0b13cf34fc8fb07016b9e42f11621
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 EXTENSIONS_BROWSER_API_AUDIO_AUDIO_API_H_
6 #define EXTENSIONS_BROWSER_API_AUDIO_AUDIO_API_H_
8 #include "extensions/browser/api/audio/audio_service.h"
9 #include "extensions/browser/browser_context_keyed_api_factory.h"
10 #include "extensions/browser/extension_function.h"
12 namespace extensions {
14 class AudioService;
16 class AudioAPI : public BrowserContextKeyedAPI, public AudioService::Observer {
17 public:
18 explicit AudioAPI(content::BrowserContext* context);
19 ~AudioAPI() override;
21 AudioService* GetService() const;
23 // BrowserContextKeyedAPI implementation.
24 static BrowserContextKeyedAPIFactory<AudioAPI>* GetFactoryInstance();
26 // AudioService::Observer implementation.
27 void OnDeviceChanged() override;
29 private:
30 friend class BrowserContextKeyedAPIFactory<AudioAPI>;
32 // BrowserContextKeyedAPI implementation.
33 static const char* service_name() {
34 return "AudioAPI";
37 content::BrowserContext* const browser_context_;
38 AudioService* service_;
41 class AudioGetInfoFunction : public AsyncExtensionFunction {
42 public:
43 DECLARE_EXTENSION_FUNCTION("audio.getInfo", AUDIO_GETINFO);
45 protected:
46 ~AudioGetInfoFunction() override {}
47 bool RunAsync() override;
49 private:
50 void OnGetInfoCompleted(const OutputInfo& output_info,
51 const InputInfo& input_info,
52 bool success);
55 class AudioSetActiveDevicesFunction : public SyncExtensionFunction {
56 public:
57 DECLARE_EXTENSION_FUNCTION("audio.setActiveDevices", AUDIO_SETACTIVEDEVICES);
59 protected:
60 ~AudioSetActiveDevicesFunction() override {}
61 bool RunSync() override;
64 class AudioSetPropertiesFunction : public SyncExtensionFunction {
65 public:
66 DECLARE_EXTENSION_FUNCTION("audio.setProperties", AUDIO_SETPROPERTIES);
68 protected:
69 ~AudioSetPropertiesFunction() override {}
70 bool RunSync() override;
74 } // namespace extensions
76 #endif // EXTENSIONS_BROWSER_API_AUDIO_AUDIO_API_H_