| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SPEECH_INPUT_MANAGER_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SPEECH_INPUT_MANAGER_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/memory/singleton.h" | |
| 11 #include "content/common/notification_observer.h" | |
| 12 #include "content/common/notification_registrar.h" | |
| 13 #include <string> | |
| 14 | |
| 15 class Extension; | |
| 16 class NotificationDetails; | |
| 17 class NotificationSource; | |
| 18 class Profile; | |
| 19 | |
| 20 // Manages the speech input requests and responses from the extensions | |
| 21 // associated to the given profile. | |
| 22 class ExtensionSpeechInputManager : public NotificationObserver, | |
| 23 public base::RefCountedThreadSafe<ExtensionSpeechInputManager> { | |
| 24 public: | |
| 25 // Should not be used directly. Managed by a ProfileKeyedServiceFactory. | |
| 26 explicit ExtensionSpeechInputManager(Profile* profile); | |
| 27 | |
| 28 // Returns the corresponding manager for the given profile, creating | |
| 29 // a new one if required. | |
| 30 static ExtensionSpeechInputManager* GetForProfile(Profile* profile); | |
| 31 | |
| 32 // Initialize the ProfileKeyedServiceFactory. | |
| 33 static void InitializeFactory(); | |
| 34 | |
| 35 // Methods from NotificationObserver. | |
| 36 virtual void Observe(int type, | |
| 37 const NotificationSource& source, | |
| 38 const NotificationDetails& details); | |
| 39 | |
| 40 // Request to start speech recognition for the provided extension. | |
| 41 void Start(const Extension *extension); | |
| 42 | |
| 43 // Request to stop an ongoing speech recognition. | |
| 44 void Stop(const Extension *extension); | |
| 45 | |
| 46 // Called by internal ProfileKeyedService class. | |
| 47 void ShutdownOnUIThread(); | |
| 48 | |
| 49 private: | |
| 50 void ExtensionUnloaded(const std::string& id); | |
| 51 | |
| 52 friend class base::RefCountedThreadSafe<ExtensionSpeechInputManager>; | |
| 53 class Factory; | |
| 54 | |
| 55 virtual ~ExtensionSpeechInputManager(); | |
| 56 | |
| 57 Profile* profile_; | |
| 58 scoped_refptr<Extension> extension_; | |
| 59 NotificationRegistrar registrar_; | |
| 60 }; | |
| 61 | |
| 62 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SPEECH_INPUT_MANAGER_H_ | |
| OLD | NEW |