| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ | 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "content/browser/speech/endpointer/endpointer.h" | 10 #include "content/browser/speech/endpointer/endpointer.h" |
| 11 #include "content/browser/speech/speech_recognition_engine.h" | 11 #include "content/browser/speech/speech_recognition_engine.h" |
| 12 #include "content/browser/speech/speech_recognizer.h" | 12 #include "content/browser/speech/speech_recognizer.h" |
| 13 #include "content/public/common/speech_recognition_error.h" | 13 #include "content/public/common/speech_recognition_error.h" |
| 14 #include "content/public/common/speech_recognition_result.h" | 14 #include "content/public/common/speech_recognition_result.h" |
| 15 #include "media/audio/audio_input_controller.h" | 15 #include "media/audio/audio_input_controller.h" |
| 16 #include "net/url_request/url_request_context_getter.h" | 16 #include "net/url_request/url_request_context_getter.h" |
| 17 | 17 |
| 18 namespace media { | 18 namespace media { |
| 19 class AudioBus; |
| 19 class AudioManager; | 20 class AudioManager; |
| 20 } | 21 } |
| 21 | 22 |
| 22 namespace content { | 23 namespace content { |
| 23 | 24 |
| 24 class SpeechRecognitionEventListener; | 25 class SpeechRecognitionEventListener; |
| 25 | 26 |
| 26 // Handles speech recognition for a session (identified by |session_id|), taking | 27 // Handles speech recognition for a session (identified by |session_id|), taking |
| 27 // care of audio capture, silence detection/endpointer and interaction with the | 28 // care of audio capture, silence detection/endpointer and interaction with the |
| 28 // SpeechRecognitionEngine. | 29 // SpeechRecognitionEngine. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 | 126 |
| 126 // Callback called on IO thread by audio_controller->Close(). | 127 // Callback called on IO thread by audio_controller->Close(). |
| 127 void OnAudioClosed(media::AudioInputController*); | 128 void OnAudioClosed(media::AudioInputController*); |
| 128 | 129 |
| 129 // AudioInputController::EventHandler methods. | 130 // AudioInputController::EventHandler methods. |
| 130 virtual void OnCreated(media::AudioInputController* controller) OVERRIDE {} | 131 virtual void OnCreated(media::AudioInputController* controller) OVERRIDE {} |
| 131 virtual void OnRecording(media::AudioInputController* controller) OVERRIDE {} | 132 virtual void OnRecording(media::AudioInputController* controller) OVERRIDE {} |
| 132 virtual void OnError(media::AudioInputController* controller, | 133 virtual void OnError(media::AudioInputController* controller, |
| 133 media::AudioInputController::ErrorCode error_code) OVERRIDE; | 134 media::AudioInputController::ErrorCode error_code) OVERRIDE; |
| 134 virtual void OnData(media::AudioInputController* controller, | 135 virtual void OnData(media::AudioInputController* controller, |
| 135 const uint8* data, uint32 size) OVERRIDE; | 136 const media::AudioBus* data) OVERRIDE; |
| 136 virtual void OnLog(media::AudioInputController* controller, | 137 virtual void OnLog(media::AudioInputController* controller, |
| 137 const std::string& message) OVERRIDE {} | 138 const std::string& message) OVERRIDE {} |
| 138 | 139 |
| 139 // SpeechRecognitionEngineDelegate methods. | 140 // SpeechRecognitionEngineDelegate methods. |
| 140 virtual void OnSpeechRecognitionEngineResults( | 141 virtual void OnSpeechRecognitionEngineResults( |
| 141 const SpeechRecognitionResults& results) OVERRIDE; | 142 const SpeechRecognitionResults& results) OVERRIDE; |
| 142 virtual void OnSpeechRecognitionEngineError( | 143 virtual void OnSpeechRecognitionEngineError( |
| 143 const SpeechRecognitionError& error) OVERRIDE; | 144 const SpeechRecognitionError& error) OVERRIDE; |
| 144 | 145 |
| 145 static media::AudioManager* audio_manager_for_tests_; | 146 static media::AudioManager* audio_manager_for_tests_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 159 // Converts data between native input format and a WebSpeech specific | 160 // Converts data between native input format and a WebSpeech specific |
| 160 // output format. | 161 // output format. |
| 161 scoped_ptr<SpeechRecognizerImpl::OnDataConverter> audio_converter_; | 162 scoped_ptr<SpeechRecognizerImpl::OnDataConverter> audio_converter_; |
| 162 | 163 |
| 163 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImpl); | 164 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImpl); |
| 164 }; | 165 }; |
| 165 | 166 |
| 166 } // namespace content | 167 } // namespace content |
| 167 | 168 |
| 168 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ | 169 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ |
| OLD | NEW |