| 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; | |
| 20 class AudioManager; | 19 class AudioManager; |
| 21 } | 20 } |
| 22 | 21 |
| 23 namespace content { | 22 namespace content { |
| 24 | 23 |
| 25 class SpeechRecognitionEventListener; | 24 class SpeechRecognitionEventListener; |
| 26 | 25 |
| 27 // Handles speech recognition for a session (identified by |session_id|), taking | 26 // Handles speech recognition for a session (identified by |session_id|), taking |
| 28 // care of audio capture, silence detection/endpointer and interaction with the | 27 // care of audio capture, silence detection/endpointer and interaction with the |
| 29 // SpeechRecognitionEngine. | 28 // SpeechRecognitionEngine. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 | 125 |
| 127 // Callback called on IO thread by audio_controller->Close(). | 126 // Callback called on IO thread by audio_controller->Close(). |
| 128 void OnAudioClosed(media::AudioInputController*); | 127 void OnAudioClosed(media::AudioInputController*); |
| 129 | 128 |
| 130 // AudioInputController::EventHandler methods. | 129 // AudioInputController::EventHandler methods. |
| 131 virtual void OnCreated(media::AudioInputController* controller) OVERRIDE {} | 130 virtual void OnCreated(media::AudioInputController* controller) OVERRIDE {} |
| 132 virtual void OnRecording(media::AudioInputController* controller) OVERRIDE {} | 131 virtual void OnRecording(media::AudioInputController* controller) OVERRIDE {} |
| 133 virtual void OnError(media::AudioInputController* controller, | 132 virtual void OnError(media::AudioInputController* controller, |
| 134 media::AudioInputController::ErrorCode error_code) OVERRIDE; | 133 media::AudioInputController::ErrorCode error_code) OVERRIDE; |
| 135 virtual void OnData(media::AudioInputController* controller, | 134 virtual void OnData(media::AudioInputController* controller, |
| 136 const media::AudioBus* data) OVERRIDE; | 135 const uint8* data, uint32 size) OVERRIDE; |
| 137 virtual void OnLog(media::AudioInputController* controller, | 136 virtual void OnLog(media::AudioInputController* controller, |
| 138 const std::string& message) OVERRIDE {} | 137 const std::string& message) OVERRIDE {} |
| 139 | 138 |
| 140 // SpeechRecognitionEngineDelegate methods. | 139 // SpeechRecognitionEngineDelegate methods. |
| 141 virtual void OnSpeechRecognitionEngineResults( | 140 virtual void OnSpeechRecognitionEngineResults( |
| 142 const SpeechRecognitionResults& results) OVERRIDE; | 141 const SpeechRecognitionResults& results) OVERRIDE; |
| 143 virtual void OnSpeechRecognitionEngineError( | 142 virtual void OnSpeechRecognitionEngineError( |
| 144 const SpeechRecognitionError& error) OVERRIDE; | 143 const SpeechRecognitionError& error) OVERRIDE; |
| 145 | 144 |
| 146 static media::AudioManager* audio_manager_for_tests_; | 145 static media::AudioManager* audio_manager_for_tests_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 160 // Converts data between native input format and a WebSpeech specific | 159 // Converts data between native input format and a WebSpeech specific |
| 161 // output format. | 160 // output format. |
| 162 scoped_ptr<SpeechRecognizerImpl::OnDataConverter> audio_converter_; | 161 scoped_ptr<SpeechRecognizerImpl::OnDataConverter> audio_converter_; |
| 163 | 162 |
| 164 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImpl); | 163 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizerImpl); |
| 165 }; | 164 }; |
| 166 | 165 |
| 167 } // namespace content | 166 } // namespace content |
| 168 | 167 |
| 169 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ | 168 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_IMPL_H_ |
| OLD | NEW |