OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/speech/speech_recognizer.h" | 5 #include "content/browser/speech/speech_recognizer.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "content/browser/browser_main_loop.h" | 10 #include "content/browser/browser_main_loop.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return is_capturing_audio; | 148 return is_capturing_audio; |
149 } | 149 } |
150 | 150 |
151 const SpeechRecognitionEngine& | 151 const SpeechRecognitionEngine& |
152 SpeechRecognizer::recognition_engine() const { | 152 SpeechRecognizer::recognition_engine() const { |
153 return *(recognition_engine_.get()); | 153 return *(recognition_engine_.get()); |
154 } | 154 } |
155 | 155 |
156 SpeechRecognizer::~SpeechRecognizer() { | 156 SpeechRecognizer::~SpeechRecognizer() { |
157 endpointer_.EndSession(); | 157 endpointer_.EndSession(); |
158 if (audio_controller_.get()) { | 158 if (audio_controller_) { |
159 audio_controller_->Close(base::Bind(&KeepAudioControllerRefcountedForDtor, | 159 audio_controller_->Close(base::Bind(&KeepAudioControllerRefcountedForDtor, |
160 audio_controller_)); | 160 audio_controller_)); |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
164 // Invoked in the audio thread. | 164 // Invoked in the audio thread. |
165 void SpeechRecognizer::OnError(AudioInputController* controller) { | 165 void SpeechRecognizer::OnError(AudioInputController* controller) { |
166 FSMEventArgs event_args(EVENT_AUDIO_ERROR); | 166 FSMEventArgs event_args(EVENT_AUDIO_ERROR); |
167 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 167 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
168 base::Bind(&SpeechRecognizer::DispatchEvent, | 168 base::Bind(&SpeechRecognizer::DispatchEvent, |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 SpeechRecognizer::FSMEventArgs::FSMEventArgs(FSMEvent event_value) | 657 SpeechRecognizer::FSMEventArgs::FSMEventArgs(FSMEvent event_value) |
658 : event(event_value), | 658 : event(event_value), |
659 audio_data(NULL), | 659 audio_data(NULL), |
660 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { | 660 engine_error(SPEECH_RECOGNITION_ERROR_NONE) { |
661 } | 661 } |
662 | 662 |
663 SpeechRecognizer::FSMEventArgs::~FSMEventArgs() { | 663 SpeechRecognizer::FSMEventArgs::~FSMEventArgs() { |
664 } | 664 } |
665 | 665 |
666 } // namespace content | 666 } // namespace content |
OLD | NEW |