// Here begins the SpeechRecognitionEventListener interface implementation,
// which will simply relay the events to the proper listener registered for the
-// particular session (most likely InputTagSpeechDispatcherHost) and to the
-// catch-all listener provided by the delegate (if any).
+// particular session and to the catch-all listener provided by the delegate
+// (if any).
void SpeechRecognitionManagerImpl::OnRecognitionStart(int session_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
SessionsTable::iterator iter = sessions_.find(session_id);
if (iter->second->ui) {
// Notify the UI that the devices are being used.
- iter->second->ui->OnStarted(base::Closure());
+ iter->second->ui->OnStarted(base::Closure(),
+ MediaStreamUIProxy::WindowIdCallback());
}
DCHECK_EQ(primary_session_id_, session_id);
return GetSession(session_id)->context;
}
-void SpeechRecognitionManagerImpl::AbortAllSessionsForListener(
- SpeechRecognitionEventListener* listener) {
+void SpeechRecognitionManagerImpl::AbortAllSessionsForRenderProcess(
+ int render_process_id) {
// This method gracefully destroys sessions for the listener. However, since
// the listener itself is likely to be destroyed after this call, we avoid
// dispatching further events to it, marking the |listener_is_active| flag.
for (SessionsTable::iterator it = sessions_.begin(); it != sessions_.end();
++it) {
Session* session = it->second;
- if (session->config.event_listener == listener) {
+ if (session->context.render_process_id == render_process_id) {
AbortSession(session->id);
session->listener_is_active = false;
}
SpeechRecognitionEventListener* SpeechRecognitionManagerImpl::GetListener(
int session_id) const {
Session* session = GetSession(session_id);
- return session->listener_is_active ? session->config.event_listener : NULL;
+ if (session->listener_is_active && session->config.event_listener)
+ return session->config.event_listener.get();
+ return NULL;
}
SpeechRecognitionEventListener*