OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef EXTENSIONS_BROWSER_API_AUDIO_AUDIO_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_AUDIO_AUDIO_API_H_ |
6 #define EXTENSIONS_BROWSER_API_AUDIO_AUDIO_API_H_ | 6 #define EXTENSIONS_BROWSER_API_AUDIO_AUDIO_API_H_ |
7 | 7 |
8 #include "extensions/browser/api/audio/audio_service.h" | 8 #include "extensions/browser/api/audio/audio_service.h" |
9 #include "extensions/browser/browser_context_keyed_api_factory.h" | 9 #include "extensions/browser/browser_context_keyed_api_factory.h" |
10 #include "extensions/browser/extension_function.h" | 10 #include "extensions/browser/extension_function.h" |
11 | 11 |
12 namespace extensions { | 12 namespace extensions { |
13 | 13 |
14 class AudioService; | 14 class AudioService; |
15 | 15 |
16 class AudioAPI : public BrowserContextKeyedAPI, public AudioService::Observer { | 16 class AudioAPI : public BrowserContextKeyedAPI, public AudioService::Observer { |
17 public: | 17 public: |
18 explicit AudioAPI(content::BrowserContext* context); | 18 explicit AudioAPI(content::BrowserContext* context); |
19 ~AudioAPI() override; | 19 ~AudioAPI() override; |
20 | 20 |
21 AudioService* GetService() const; | 21 AudioService* GetService() const; |
22 | 22 |
23 // BrowserContextKeyedAPI implementation. | 23 // BrowserContextKeyedAPI implementation. |
24 static BrowserContextKeyedAPIFactory<AudioAPI>* GetFactoryInstance(); | 24 static BrowserContextKeyedAPIFactory<AudioAPI>* GetFactoryInstance(); |
25 | 25 |
26 // AudioService::Observer implementation. | 26 // AudioService::Observer implementation. |
27 void OnDeviceChanged() override; | 27 void OnDeviceChanged() override; |
| 28 void OnOutputNodeVolumeChanged(const std::string& id, double volume) override; |
28 | 29 |
29 private: | 30 private: |
30 friend class BrowserContextKeyedAPIFactory<AudioAPI>; | 31 friend class BrowserContextKeyedAPIFactory<AudioAPI>; |
31 | 32 |
32 // BrowserContextKeyedAPI implementation. | 33 // BrowserContextKeyedAPI implementation. |
33 static const char* service_name() { | 34 static const char* service_name() { |
34 return "AudioAPI"; | 35 return "AudioAPI"; |
35 } | 36 } |
36 | 37 |
37 content::BrowserContext* const browser_context_; | 38 content::BrowserContext* const browser_context_; |
(...skipping 25 matching lines...) Expand all Loading... |
63 | 64 |
64 class AudioSetPropertiesFunction : public SyncExtensionFunction { | 65 class AudioSetPropertiesFunction : public SyncExtensionFunction { |
65 public: | 66 public: |
66 DECLARE_EXTENSION_FUNCTION("audio.setProperties", AUDIO_SETPROPERTIES); | 67 DECLARE_EXTENSION_FUNCTION("audio.setProperties", AUDIO_SETPROPERTIES); |
67 | 68 |
68 protected: | 69 protected: |
69 ~AudioSetPropertiesFunction() override {} | 70 ~AudioSetPropertiesFunction() override {} |
70 bool RunSync() override; | 71 bool RunSync() override; |
71 }; | 72 }; |
72 | 73 |
| 74 class AudioGetDeviceInfoFunction : public AsyncExtensionFunction { |
| 75 public: |
| 76 DECLARE_EXTENSION_FUNCTION("audio.getDeviceInfo", AUDIO_GETDEVICEINFO); |
| 77 |
| 78 protected: |
| 79 ~AudioGetDeviceInfoFunction() override {} |
| 80 bool RunAsync() override; |
| 81 |
| 82 private: |
| 83 void OnGetDeviceInfoCompleted(const DevicesInfo& devices_info, bool success); |
| 84 }; |
73 | 85 |
74 } // namespace extensions | 86 } // namespace extensions |
75 | 87 |
76 #endif // EXTENSIONS_BROWSER_API_AUDIO_AUDIO_API_H_ | 88 #endif // EXTENSIONS_BROWSER_API_AUDIO_AUDIO_API_H_ |
OLD | NEW |