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 1a054204c4477a7e6c4c09abfd11a54aeea7443c..66e92294f746803ca82fce794a6e404be93d366e 100644 |
--- a/content/browser/speech/speech_recognition_manager_impl.cc |
+++ b/content/browser/speech/speech_recognition_manager_impl.cc |
@@ -14,6 +14,8 @@ |
#include "content/browser/speech/speech_recognizer_impl.h" |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/content_browser_client.h" |
+#include "content/public/browser/render_frame_host.h" |
+#include "content/public/browser/render_process_host.h" |
#include "content/public/browser/resource_context.h" |
#include "content/public/browser/speech_recognition_event_listener.h" |
#include "content/public/browser/speech_recognition_manager_delegate.h" |
@@ -195,8 +197,8 @@ void SpeechRecognitionManagerImpl::RecognitionAllowedCallback(int session_id, |
if (ask_user) { |
SpeechRecognitionSessionContext& context = session->context; |
context.label = media_stream_manager_->MakeMediaAccessRequest( |
- context.render_process_id, |
- context.render_frame_id, |
+ context.render_frame_host->GetProcess()->GetID(), |
+ context.render_frame_host->GetRoutingID(), |
context.request_id, |
StreamOptions(true, false), |
GURL(context.context_name), |
@@ -431,14 +433,13 @@ void SpeechRecognitionManagerImpl::OnRecognitionEnd(int session_id) { |
} |
int SpeechRecognitionManagerImpl::GetSession( |
- int render_process_id, int render_view_id, int request_id) const { |
+ RenderFrameHost* render_frame_host, int request_id) const { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
SessionsTable::const_iterator iter; |
for(iter = sessions_.begin(); iter != sessions_.end(); ++iter) { |
const int session_id = iter->first; |
const SpeechRecognitionSessionContext& context = iter->second->context; |
- if (context.render_process_id == render_process_id && |
- context.render_view_id == render_view_id && |
+ if (context.render_frame_host == render_frame_host && |
context.request_id == request_id) { |
return session_id; |
} |
@@ -451,33 +452,16 @@ SpeechRecognitionManagerImpl::GetSessionContext(int session_id) const { |
return GetSession(session_id)->context; |
} |
-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. |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
- for (SessionsTable::iterator it = sessions_.begin(); it != sessions_.end(); |
- ++it) { |
- Session* session = it->second; |
- if (session->context.render_process_id == render_process_id) { |
- AbortSession(session->id); |
- session->listener_is_active = false; |
- } |
- } |
-} |
+void SpeechRecognitionManagerImpl::AbortAllSessionsForRenderFrame( |
+ RenderFrameHost* render_frame_host) { |
+ DCHECK(render_frame_host); |
+ DCHECK_CURRENTLY_ON(BrowserThread::IO); |
-void SpeechRecognitionManagerImpl::AbortAllSessionsForRenderView( |
- int render_process_id, |
- int render_view_id) { |
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
for (SessionsTable::iterator it = sessions_.begin(); it != sessions_.end(); |
++it) { |
Session* session = it->second; |
- if (session->context.render_process_id == render_process_id && |
- session->context.render_view_id == render_view_id) { |
+ if (session->context.render_frame_host == render_frame_host) |
AbortSession(session->id); |
- } |
} |
} |