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