| 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/api/profile_keyed_api_factory.h" | |
| 10 #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" |
| 11 | 11 |
| 12 namespace extensions { | 12 namespace extensions { |
| 13 | 13 |
| 14 class AudioService; | 14 class AudioService; |
| 15 | 15 |
| 16 class AudioAPI : public ProfileKeyedAPI, | 16 class AudioAPI : public BrowserContextKeyedAPI, public AudioService::Observer { |
| 17 public AudioService::Observer { | |
| 18 public: | 17 public: |
| 19 explicit AudioAPI(content::BrowserContext* context); | 18 explicit AudioAPI(content::BrowserContext* context); |
| 20 virtual ~AudioAPI(); | 19 virtual ~AudioAPI(); |
| 21 | 20 |
| 22 AudioService* GetService() const; | 21 AudioService* GetService() const; |
| 23 | 22 |
| 24 // ProfileKeyedAPI implementation. | 23 // BrowserContextKeyedAPI implementation. |
| 25 static ProfileKeyedAPIFactory<AudioAPI>* GetFactoryInstance(); | 24 static BrowserContextKeyedAPIFactory<AudioAPI>* GetFactoryInstance(); |
| 26 | 25 |
| 27 // AudioService::Observer implementation. | 26 // AudioService::Observer implementation. |
| 28 virtual void OnDeviceChanged() OVERRIDE; | 27 virtual void OnDeviceChanged() OVERRIDE; |
| 29 | 28 |
| 30 private: | 29 private: |
| 31 friend class ProfileKeyedAPIFactory<AudioAPI>; | 30 friend class BrowserContextKeyedAPIFactory<AudioAPI>; |
| 32 | 31 |
| 33 // ProfileKeyedAPI implementation. | 32 // BrowserContextKeyedAPI implementation. |
| 34 static const char* service_name() { | 33 static const char* service_name() { |
| 35 return "AudioAPI"; | 34 return "AudioAPI"; |
| 36 } | 35 } |
| 37 | 36 |
| 38 content::BrowserContext* const browser_context_; | 37 content::BrowserContext* const browser_context_; |
| 39 AudioService* service_; | 38 AudioService* service_; |
| 40 }; | 39 }; |
| 41 | 40 |
| 42 class AudioGetInfoFunction : public ChromeAsyncExtensionFunction { | 41 class AudioGetInfoFunction : public ChromeAsyncExtensionFunction { |
| 43 public: | 42 public: |
| (...skipping 27 matching lines...) Expand all Loading... |
| 71 | 70 |
| 72 protected: | 71 protected: |
| 73 virtual ~AudioSetPropertiesFunction() {} | 72 virtual ~AudioSetPropertiesFunction() {} |
| 74 virtual bool RunImpl() OVERRIDE; | 73 virtual bool RunImpl() OVERRIDE; |
| 75 }; | 74 }; |
| 76 | 75 |
| 77 | 76 |
| 78 } // namespace extensions | 77 } // namespace extensions |
| 79 | 78 |
| 80 #endif // CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_API_H_ | 79 #endif // CHROME_BROWSER_EXTENSIONS_API_AUDIO_AUDIO_API_H_ |
| OLD | NEW |