Chromium Code Reviews| Index: chrome/browser/speech/speech_input_extension_manager.h |
| =================================================================== |
| --- chrome/browser/speech/speech_input_extension_manager.h (revision 176116) |
| +++ chrome/browser/speech/speech_input_extension_manager.h (working copy) |
| @@ -11,6 +11,7 @@ |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/synchronization/lock.h" |
| +#include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/speech_recognition_event_listener.h" |
| @@ -89,9 +90,6 @@ |
| // a new one if required. |
| static SpeechInputExtensionManager* GetForProfile(Profile* profile); |
| - // Initialize the ProfileKeyedServiceFactory. |
| - static void InitializeFactory(); |
| - |
| // Request to start speech recognition for the provided extension. |
| bool Start(const std::string& extension_id, |
| const std::string& language, |
| @@ -188,7 +186,6 @@ |
| virtual ~SpeechInputExtensionManager(); |
| friend class base::RefCountedThreadSafe<SpeechInputExtensionManager>; |
| - class Factory; |
| // Lock used to allow exclusive access to the state variable and methods that |
| // either read or write on it. This is required since the speech code |
| @@ -212,4 +209,39 @@ |
| int speech_recognition_session_id_; |
| }; |
| +namespace extensions { |
| + |
| +class SpeechInputAPI : public ProfileKeyedAPI { |
| + public: |
| + explicit SpeechInputAPI(Profile* profile); |
| + virtual ~SpeechInputAPI(); |
| + |
| + // Convenience method to get the SpeechInputExtensionAPI for a profile. |
| + static SpeechInputAPI* GetForProfile(Profile* profile); |
| + |
| + // ProfileKeyedAPI implementation. |
| + static ProfileKeyedAPIFactory<SpeechInputAPI>* GetFactoryInstance(); |
| + |
| + SpeechInputExtensionManager* manager() const { return manager_.get(); } |
| + |
| + private: |
| + friend class ProfileKeyedAPIFactory<SpeechInputAPI>; |
| + |
| + // ProfileKeyedAPI implementation. |
| + static const char* service_name() { |
| + return "SpeechInputAPI"; |
| + } |
| + static const bool kServiceIsNULLWhileTesting = true; |
| + static const bool kServiceRedirectedInIncognito = false; |
|
Yoyo Zhou
2013/01/16 01:37:19
false is the default.
SanjoyPal
2013/01/16 01:52:23
Done.
|
| + static const bool kServiceIsCreatedWithProfile = true; |
| + // Methods from ProfileKeyedService. |
| + virtual void Shutdown() OVERRIDE { |
|
Yoyo Zhou
2013/01/16 01:37:19
I would prefer if this was not inlined in the head
SanjoyPal
2013/01/16 01:52:23
Done.
|
| + manager()->ShutdownOnUIThread(); |
| + } |
| + |
| + scoped_refptr<SpeechInputExtensionManager> manager_; |
| +}; |
| + |
| +} // namespace extensions |
| + |
| #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_MANAGER_H_ |