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

Unified Diff: content/browser/speech/speech_recognition_manager_impl.cc

Issue 364123002: [Cross-Site Isolation] Migrate entire MediaStream verticals to be per-RenderFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improved/Stabilized tab capture API impl, plus RFID fixes in desktop capture and speech recog. Created 6 years, 5 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
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;
}

Powered by Google App Engine
This is Rietveld 408576698