Index: content/browser/speech/speech_recognition_manager_impl.cc |
diff --git a/content/browser/speech/speech_recognition_manager_impl.cc b/content/browser/speech/speech_recognition_manager_impl.cc |
index e1c329815aa86e9bd4f2244087c9ed7e04f93e54..6bad70fce718915659a74eb690c063e9ebc5988b 100644 |
--- a/content/browser/speech/speech_recognition_manager_impl.cc |
+++ b/content/browser/speech/speech_recognition_manager_impl.cc |
@@ -282,20 +282,18 @@ void SpeechRecognitionManagerImpl::OnRecognitionEnd(int session_id) { |
this->AsWeakPtr(), session_id, EVENT_RECOGNITION_ENDED)); |
} |
-// TODO(primiano) After CL2: if we see that both InputTagDispatcherHost and |
-// SpeechRecognitionDispatcherHost do the same lookup operations, implement the |
-// lookup method directly here. |
-int SpeechRecognitionManagerImpl::LookupSessionByContext( |
- Callback<bool(const SpeechRecognitionSessionContext&)> matcher) const { |
+int SpeechRecognitionManagerImpl::GetSession( |
+ int render_process_id, int render_view_id, int request_id) const { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
SessionsTable::const_iterator iter; |
- // Note: the callback (matcher) must NEVER perform non-const calls on us. |
for(iter = sessions_.begin(); iter != sessions_.end(); ++iter) { |
const int session_id = iter->first; |
- const Session& session = iter->second; |
- bool matches = matcher.Run(session.context); |
- if (matches) |
+ const SpeechRecognitionSessionContext& context = iter->second.context; |
+ if (context.render_process_id == render_process_id && |
+ context.render_view_id == render_view_id && |
+ context.request_id == request_id) { |
return session_id; |
+ } |
} |
return kSessionIDInvalid; |
} |