| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_input_manager.h" | 5 #include "content/browser/speech/speech_input_manager.h" |
| 6 | 6 |
| 7 #include "content/browser/browser_thread.h" | 7 #include "content/browser/browser_thread.h" |
| 8 #include "content/browser/speech/speech_input_preferences.h" | 8 #include "content/browser/speech/speech_input_preferences.h" |
| 9 #include "media/audio/audio_manager.h" | 9 #include "media/audio/audio_manager.h" |
| 10 | 10 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 void SpeechInputManager::StopRecording(int caller_id) { | 116 void SpeechInputManager::StopRecording(int caller_id) { |
| 117 DCHECK(HasPendingRequest(caller_id)); | 117 DCHECK(HasPendingRequest(caller_id)); |
| 118 requests_[caller_id].recognizer->StopRecording(); | 118 requests_[caller_id].recognizer->StopRecording(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void SpeechInputManager::SetRecognitionResult( | 121 void SpeechInputManager::SetRecognitionResult( |
| 122 int caller_id, bool error, const SpeechInputResultArray& result) { | 122 int caller_id, const SpeechInputResult& result) { |
| 123 DCHECK(HasPendingRequest(caller_id)); | 123 DCHECK(HasPendingRequest(caller_id)); |
| 124 GetDelegate(caller_id)->SetRecognitionResult(caller_id, result); | 124 GetDelegate(caller_id)->SetRecognitionResult(caller_id, result); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void SpeechInputManager::DidCompleteRecording(int caller_id) { | 127 void SpeechInputManager::DidCompleteRecording(int caller_id) { |
| 128 DCHECK(recording_caller_id_ == caller_id); | 128 DCHECK(recording_caller_id_ == caller_id); |
| 129 DCHECK(HasPendingRequest(caller_id)); | 129 DCHECK(HasPendingRequest(caller_id)); |
| 130 recording_caller_id_ = 0; | 130 recording_caller_id_ = 0; |
| 131 GetDelegate(caller_id)->DidCompleteRecording(caller_id); | 131 GetDelegate(caller_id)->DidCompleteRecording(caller_id); |
| 132 ShowRecognizing(caller_id); | 132 ShowRecognizing(caller_id); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void SpeechInputManager::DidCompleteRecognition(int caller_id) { | 135 void SpeechInputManager::DidCompleteRecognition(int caller_id) { |
| 136 GetDelegate(caller_id)->DidCompleteRecognition(caller_id); | 136 GetDelegate(caller_id)->DidCompleteRecognition(caller_id); |
| 137 requests_.erase(caller_id); | 137 requests_.erase(caller_id); |
| 138 DoClose(caller_id); | 138 DoClose(caller_id); |
| 139 } | 139 } |
| 140 | 140 |
| 141 void SpeechInputManager::DidStartReceivingSpeech(int caller_id) { |
| 142 } |
| 143 |
| 144 void SpeechInputManager::DidStopReceivingSpeech(int caller_id) { |
| 145 } |
| 146 |
| 141 void SpeechInputManager::OnRecognizerError( | 147 void SpeechInputManager::OnRecognizerError( |
| 142 int caller_id, SpeechRecognizer::ErrorCode error) { | 148 int caller_id, SpeechInputError error) { |
| 143 if (caller_id == recording_caller_id_) | 149 if (caller_id == recording_caller_id_) |
| 144 recording_caller_id_ = 0; | 150 recording_caller_id_ = 0; |
| 145 requests_[caller_id].is_active = false; | 151 requests_[caller_id].is_active = false; |
| 146 ShowRecognizerError(caller_id, error); | 152 ShowRecognizerError(caller_id, error); |
| 147 } | 153 } |
| 148 | 154 |
| 149 void SpeechInputManager::DidStartReceivingAudio(int caller_id) { | 155 void SpeechInputManager::DidStartReceivingAudio(int caller_id) { |
| 150 DCHECK(HasPendingRequest(caller_id)); | 156 DCHECK(HasPendingRequest(caller_id)); |
| 151 DCHECK(recording_caller_id_ == caller_id); | 157 DCHECK(recording_caller_id_ == caller_id); |
| 152 ShowRecording(caller_id); | 158 ShowRecording(caller_id); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 195 |
| 190 SpeechInputManager::SpeechInputRequest::SpeechInputRequest() | 196 SpeechInputManager::SpeechInputRequest::SpeechInputRequest() |
| 191 : delegate(NULL), | 197 : delegate(NULL), |
| 192 is_active(false) { | 198 is_active(false) { |
| 193 } | 199 } |
| 194 | 200 |
| 195 SpeechInputManager::SpeechInputRequest::~SpeechInputRequest() { | 201 SpeechInputManager::SpeechInputRequest::~SpeechInputRequest() { |
| 196 } | 202 } |
| 197 | 203 |
| 198 } // namespace speech_input | 204 } // namespace speech_input |
| OLD | NEW |