| Index: chrome/browser/speech/speech_input_manager.cc
|
| diff --git a/chrome/browser/speech/speech_input_manager.cc b/chrome/browser/speech/speech_input_manager.cc
|
| index f59a3b75a06166a60ce53f616c88a31c43325922..56a87c9dd5bc167ae04231ad07b07d2bdc00a60e 100644
|
| --- a/chrome/browser/speech/speech_input_manager.cc
|
| +++ b/chrome/browser/speech/speech_input_manager.cc
|
| @@ -111,6 +111,8 @@ class SpeechInputManagerImpl : public SpeechInputManager,
|
| const std::string& origin_url);
|
| virtual void CancelRecognition(int caller_id);
|
| virtual void StopRecording(int caller_id);
|
| + virtual void CancelAllRequestsWithDelegate(
|
| + SpeechInputManagerDelegate* delegate);
|
|
|
| // SpeechRecognizer::Delegate methods.
|
| virtual void SetRecognitionResult(int caller_id,
|
| @@ -265,6 +267,20 @@ void SpeechInputManagerImpl::CancelRecognition(int caller_id) {
|
| bubble_controller_->CloseBubble(caller_id);
|
| }
|
|
|
| +void SpeechInputManagerImpl::CancelAllRequestsWithDelegate(
|
| + SpeechInputManagerDelegate* delegate) {
|
| + SpeechRecognizerMap::iterator it = requests_.begin();
|
| + while (it != requests_.end()) {
|
| + if (it->second.delegate == delegate) {
|
| + CancelRecognition(it->first);
|
| + // This map will have very few elements so it is simpler to restart.
|
| + it = requests_.begin();
|
| + } else {
|
| + ++it;
|
| + }
|
| + }
|
| +}
|
| +
|
| void SpeechInputManagerImpl::StopRecording(int caller_id) {
|
| DCHECK(HasPendingRequest(caller_id));
|
| requests_[caller_id].recognizer->StopRecording();
|
|
|