Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Unified Diff: chrome/browser/speech/speech_input_manager.cc

Issue 6358007: Cancel any pending speech recognitions when the dispatcher host terminates. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/speech/speech_input_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/browser/speech/speech_input_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698