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, bool error, 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::DidSpeechInputStart(int caller_id) { |
| 142 } |
| 143 |
| 144 void SpeechInputManager::DidSpeechInputStop(int caller_id) { |
| 145 } |
| 146 |
| 147 void SpeechInputManager::OnRecording(int caller_id) { |
| 148 } |
| 149 |
141 void SpeechInputManager::OnRecognizerError( | 150 void SpeechInputManager::OnRecognizerError( |
142 int caller_id, SpeechRecognizer::ErrorCode error) { | 151 int caller_id, SpeechRecognizer::ErrorCode error) { |
143 if (caller_id == recording_caller_id_) | 152 if (caller_id == recording_caller_id_) |
144 recording_caller_id_ = 0; | 153 recording_caller_id_ = 0; |
145 requests_[caller_id].is_active = false; | 154 requests_[caller_id].is_active = false; |
146 ShowRecognizerError(caller_id, error); | 155 ShowRecognizerError(caller_id, error); |
147 } | 156 } |
148 | 157 |
149 void SpeechInputManager::DidStartReceivingAudio(int caller_id) { | 158 void SpeechInputManager::DidStartReceivingAudio(int caller_id) { |
150 DCHECK(HasPendingRequest(caller_id)); | 159 DCHECK(HasPendingRequest(caller_id)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 198 |
190 SpeechInputManager::SpeechInputRequest::SpeechInputRequest() | 199 SpeechInputManager::SpeechInputRequest::SpeechInputRequest() |
191 : delegate(NULL), | 200 : delegate(NULL), |
192 is_active(false) { | 201 is_active(false) { |
193 } | 202 } |
194 | 203 |
195 SpeechInputManager::SpeechInputRequest::~SpeechInputRequest() { | 204 SpeechInputManager::SpeechInputRequest::~SpeechInputRequest() { |
196 } | 205 } |
197 | 206 |
198 } // namespace speech_input | 207 } // namespace speech_input |
OLD | NEW |