Chromium Code Reviews| 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 4b0827a6b62bb53544695c310d57f048e15bc2e3..50883f87a720d2a202d83b40fd39be35645ff90e 100644 |
| --- a/content/browser/speech/speech_recognition_manager_impl.cc |
| +++ b/content/browser/speech/speech_recognition_manager_impl.cc |
| @@ -14,6 +14,9 @@ |
| #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/render_view_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" |
| @@ -194,15 +197,23 @@ 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_view_id, |
| - context.request_id, |
| - StreamOptions(true, false), |
| - GURL(context.context_name), |
| - base::Bind( |
| - &SpeechRecognitionManagerImpl::MediaRequestPermissionCallback, |
| - weak_factory_.GetWeakPtr(), session_id)); |
| + // TODO(miu): This is a hack to allow SpeechRecognition to operate with the |
| + // MediaStreamManager, which partitions requests per RenderFrame, not per |
| + // RenderView. http://crbug.com/390749 |
| + RenderViewHost* const rvh = RenderViewHost::FromID( |
| + context.render_process_id, context.render_view_id); |
|
ncarter (slow)
2014/07/11 22:32:25
This code seems misplaced; you can't get an RVH on
miu
2014/07/12 03:16:29
Done. Yeah, I oops'ed; and also noticed the trybo
|
| + RenderFrameHost* const main_frame = rvh ? rvh->GetMainFrame() : NULL; |
| + if (main_frame) { |
| + context.label = media_stream_manager_->MakeMediaAccessRequest( |
| + main_frame->GetProcess()->GetID(), |
| + main_frame->GetRoutingID(), |
| + context.request_id, |
| + StreamOptions(true, false), |
| + GURL(context.context_name), |
| + base::Bind( |
| + &SpeechRecognitionManagerImpl::MediaRequestPermissionCallback, |
| + weak_factory_.GetWeakPtr(), session_id)); |
| + } |
| return; |
| } |