Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1583)

Unified Diff: chrome/browser/speech/speech_input_extension_manager.h

Issue 11779002: Make specch input extension api a PKS. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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,36 @@
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 kServiceIsCreatedWithProfile = true;
+ // Methods from ProfileKeyedService.
+ virtual void Shutdown() OVERRIDE;
+
+ scoped_refptr<SpeechInputExtensionManager> manager_;
+};
+
+} // namespace extensions
+
#endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_MANAGER_H_
« no previous file with comments | « chrome/browser/profiles/profile_dependency_manager.cc ('k') | chrome/browser/speech/speech_input_extension_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698