blob: 6bad8f1533ac4b0f4808d1428026f29473084ef7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
// 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_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_API_H_
#include "chrome/browser/extensions/api/audio/audio_service.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "extensions/browser/browser_context_keyed_api_factory.h"
namespace extensions {
class AudioService;
class AudioAPI : public BrowserContextKeyedAPI, public AudioService::Observer {
public:
explicit AudioAPI(content::BrowserContext* context);
virtual ~AudioAPI();
AudioService* GetService() const;
// BrowserContextKeyedAPI implementation.
static BrowserContextKeyedAPIFactory<AudioAPI>* GetFactoryInstance();
// AudioService::Observer implementation.
virtual void OnDeviceChanged() override;
private:
friend class BrowserContextKeyedAPIFactory<AudioAPI>;
// BrowserContextKeyedAPI implementation.
static const char* service_name() {
return "AudioAPI";
}
content::BrowserContext* const browser_context_;
AudioService* service_;
};
class AudioGetInfoFunction : public ChromeAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("audio.getInfo",
AUDIO_GETINFO);
protected:
virtual ~AudioGetInfoFunction() {}
virtual bool RunAsync() override;
private:
void OnGetInfoCompleted(const OutputInfo& output_info,
const InputInfo& input_info,
bool success);
};
class AudioSetActiveDevicesFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("audio.setActiveDevices",
AUDIO_SETACTIVEDEVICES);
protected:
virtual ~AudioSetActiveDevicesFunction() {}
virtual bool RunSync() override;
};
class AudioSetPropertiesFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("audio.setProperties",
AUDIO_SETPROPERTIES);
protected:
virtual ~AudioSetPropertiesFunction() {}
virtual bool RunSync() override;
};
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_API_H_
|