Index: content/browser/speech/speech_recognition_manager_impl.h |
diff --git a/content/browser/speech/speech_recognition_manager_impl.h b/content/browser/speech/speech_recognition_manager_impl.h |
index 6088a5a18228bcb95d0c76dc89c3ab8aff43f7fe..72feaf06868f759b79bef7b55d1bb525863151db 100644 |
--- a/content/browser/speech/speech_recognition_manager_impl.h |
+++ b/content/browser/speech/speech_recognition_manager_impl.h |
@@ -20,6 +20,7 @@ |
#include "content/public/common/speech_recognition_error.h" |
namespace content { |
+class BrowserMainLoop; |
class SpeechRecognitionManagerDelegate; |
} |
@@ -51,6 +52,8 @@ class CONTENT_EXPORT SpeechRecognitionManagerImpl : |
public NON_EXPORTED_BASE(content::SpeechRecognitionManager), |
public content::SpeechRecognitionEventListener { |
public: |
+ // Returns the current SpeechRecognitionManagerImpl. Can be called only after |
+ // the RecognitionMnager has been created (by BrowserMainLoop). |
static SpeechRecognitionManagerImpl* GetInstance(); |
// SpeechRecognitionManager implementation. |
@@ -90,8 +93,9 @@ class CONTENT_EXPORT SpeechRecognitionManagerImpl : |
float noise_volume) OVERRIDE; |
protected: |
- // Private constructor to enforce singleton. |
- friend struct DefaultSingletonTraits<SpeechRecognitionManagerImpl>; |
+ // BrowserMainLoop is the only one allowed to istantiate and free us. |
+ friend class content::BrowserMainLoop; |
+ friend class scoped_ptr<SpeechRecognitionManagerImpl>; // Needed for dtor. |
SpeechRecognitionManagerImpl(); |
virtual ~SpeechRecognitionManagerImpl(); |
@@ -158,7 +162,7 @@ class CONTENT_EXPORT SpeechRecognitionManagerImpl : |
int session_id_capturing_audio_; |
int last_session_id_; |
bool is_dispatching_event_; |
- content::SpeechRecognitionManagerDelegate* delegate_; |
+ scoped_ptr<content::SpeechRecognitionManagerDelegate> delegate_; |
}; |
} // namespace speech |