summaryrefslogtreecommitdiffstats
path: root/content/browser/speech/speech_recognizer_impl.h
diff options
context:
space:
mode:
authorprimiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-24 10:58:24 +0000
committerprimiano@chromium.org <primiano@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-24 10:58:24 +0000
commitd305111d5d25b32277e9b844832d19e08321db80 (patch)
tree62794788d05700882f2c4b6133df6bf8460a18fa /content/browser/speech/speech_recognizer_impl.h
parent909fd560e81d4df154acfff63dd276297842b3b8 (diff)
downloadchromium_src-d305111d5d25b32277e9b844832d19e08321db80.zip
chromium_src-d305111d5d25b32277e9b844832d19e08321db80.tar.gz
chromium_src-d305111d5d25b32277e9b844832d19e08321db80.tar.bz2
SpeechInputExtensionManager now interface (exclusively) with SpeechRecognitionManagerDelegate (Speech CL1.11)
This is a re-submit of r138498 which was reverted in r138568. Fixes introduced by this CL: - Added a check on speech_input_extensions_manager shutdown to assert that the speech_recognition_manager has not been unexpectedly destroyed (happens in some tests). - Added WeakPtr to speech_recognition_manager_impl so that it can be destroyed ungracefully without crashing. Original CL description: - The tray icon and balloon handing has been moved from speech_input_extensions_manager to chrome_speech_recognition_manager_delegate, since that code (tray icon) will be used also for continuous recognition. - Removed the SpeechRecognizer interface from /content/public (thus de-virtualized and refcounted the SpeechRecognizerImpl) BUG=116954,129408 TEST=browser_tests on Linux ChromiumOS (dbg) Review URL: https://chromiumcodereview.appspot.com/10440011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138765 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/speech/speech_recognizer_impl.h')
-rw-r--r--content/browser/speech/speech_recognizer_impl.h24
1 files changed, 10 insertions, 14 deletions
diff --git a/content/browser/speech/speech_recognizer_impl.h b/content/browser/speech/speech_recognizer_impl.h
index 1aa2eaa..8179e2743 100644
--- a/content/browser/speech/speech_recognizer_impl.h
+++ b/content/browser/speech/speech_recognizer_impl.h
@@ -11,7 +11,6 @@
#include "base/memory/scoped_ptr.h"
#include "content/browser/speech/endpointer/endpointer.h"
#include "content/browser/speech/speech_recognition_engine.h"
-#include "content/public/browser/speech_recognizer.h"
#include "content/public/common/speech_recognition_error.h"
#include "content/public/common/speech_recognition_result.h"
#include "media/audio/audio_input_controller.h"
@@ -27,15 +26,13 @@ class AudioManager;
namespace speech {
-// TODO(primiano) Next CL: Remove the Impl suffix and the exported
-// /content/public/browser/speech_recognizer.h interface since this class should
-// not be visible outside (currently we need it for speech input extension API).
+// TODO(primiano) Next CL: Remove the Impl suffix.
// Handles speech recognition for a session (identified by |session_id|), taking
// care of audio capture, silence detection/endpointer and interaction with the
// SpeechRecognitionEngine.
class CONTENT_EXPORT SpeechRecognizerImpl
- : public NON_EXPORTED_BASE(content::SpeechRecognizer),
+ : public base::RefCountedThreadSafe<SpeechRecognizerImpl>,
public media::AudioInputController::EventHandler,
public NON_EXPORTED_BASE(SpeechRecognitionEngineDelegate) {
public:
@@ -50,18 +47,15 @@ class CONTENT_EXPORT SpeechRecognizerImpl
int session_id,
SpeechRecognitionEngine* engine);
- // content::SpeechRecognizer methods.
- virtual void StartRecognition() OVERRIDE;
- virtual void AbortRecognition() OVERRIDE;
- virtual void StopAudioCapture() OVERRIDE;
- virtual bool IsActive() const OVERRIDE;
- virtual bool IsCapturingAudio() const OVERRIDE;
+ void StartRecognition();
+ void AbortRecognition();
+ void StopAudioCapture();
+ bool IsActive() const;
+ bool IsCapturingAudio() const;
const SpeechRecognitionEngine& recognition_engine() const;
- protected:
- virtual ~SpeechRecognizerImpl();
-
private:
+ friend class base::RefCountedThreadSafe<SpeechRecognizerImpl>;
friend class SpeechRecognizerImplTest;
enum FSMState {
@@ -96,6 +90,8 @@ class CONTENT_EXPORT SpeechRecognizerImpl
content::SpeechRecognitionError engine_error;
};
+ virtual ~SpeechRecognizerImpl();
+
// Entry point for pushing any new external event into the recognizer FSM.
void DispatchEvent(const FSMEventArgs& event_args);