Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/browser/speech/speech_recognition_dispatcher_host.h" | 5 #include "content/browser/speech/speech_recognition_dispatcher_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 10 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 int embedder_render_process_id = 0; | 91 int embedder_render_process_id = 0; |
| 92 int embedder_render_view_id = MSG_ROUTING_NONE; | 92 int embedder_render_view_id = MSG_ROUTING_NONE; |
| 93 RenderViewHostImpl* render_view_host = | 93 RenderViewHostImpl* render_view_host = |
| 94 RenderViewHostImpl::FromID(render_process_id_, params.render_view_id); | 94 RenderViewHostImpl::FromID(render_process_id_, params.render_view_id); |
| 95 if (!render_view_host) { | 95 if (!render_view_host) { |
| 96 // RVH can be null if the tab was closed while continuous mode speech | 96 // RVH can be null if the tab was closed while continuous mode speech |
| 97 // recognition was running. This seems to happen on mac. | 97 // recognition was running. This seems to happen on mac. |
| 98 LOG(WARNING) << "SRDH::OnStartRequest, RenderViewHost does not exist"; | 98 LOG(WARNING) << "SRDH::OnStartRequest, RenderViewHost does not exist"; |
| 99 return; | 99 return; |
| 100 } | 100 } |
| 101 | |
| 101 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( | 102 WebContentsImpl* web_contents = static_cast<WebContentsImpl*>( |
| 102 WebContents::FromRenderViewHost(render_view_host)); | 103 WebContents::FromRenderViewHost(render_view_host)); |
| 103 BrowserPluginGuest* guest = web_contents->GetBrowserPluginGuest(); | 104 WebContentsImpl* outer_web_contents = web_contents->GetOuterWebContents(); |
| 104 if (guest) { | 105 if (outer_web_contents) { |
| 105 // If the speech API request was from a guest, save the context of the | 106 // If the speech API request was from an outer WebContents or a guest, save |
|
Charlie Reis
2015/09/24 05:09:14
s/outer/inner/, right?
lazyboy
2015/09/28 03:37:16
Yes, thanks.
Done.
| |
| 106 // embedder since we will use it to decide permission. | 107 // the context of the outer WebContents or the embedder since we will use it |
| 108 // to decide permission. | |
| 107 embedder_render_process_id = | 109 embedder_render_process_id = |
| 108 guest->embedder_web_contents()->GetRenderProcessHost()->GetID(); | 110 outer_web_contents->GetRenderProcessHost()->GetID(); |
| 109 DCHECK_NE(embedder_render_process_id, 0); | 111 DCHECK_NE(embedder_render_process_id, 0); |
| 110 embedder_render_view_id = | 112 embedder_render_view_id = |
| 111 guest->embedder_web_contents()->GetRenderViewHost()->GetRoutingID(); | 113 outer_web_contents->GetRenderViewHost()->GetRoutingID(); |
| 112 DCHECK_NE(embedder_render_view_id, MSG_ROUTING_NONE); | 114 DCHECK_NE(embedder_render_view_id, MSG_ROUTING_NONE); |
| 113 } | 115 } |
| 114 | 116 |
| 115 // TODO(lazyboy): Check if filter_profanities should use |render_process_id| | 117 // TODO(lazyboy): Check if filter_profanities should use |render_process_id| |
| 116 // instead of |render_process_id_|. | 118 // instead of |render_process_id_|. |
| 117 bool filter_profanities = | 119 bool filter_profanities = |
| 118 SpeechRecognitionManagerImpl::GetInstance() && | 120 SpeechRecognitionManagerImpl::GetInstance() && |
| 119 SpeechRecognitionManagerImpl::GetInstance()->delegate() && | 121 SpeechRecognitionManagerImpl::GetInstance()->delegate() && |
| 120 SpeechRecognitionManagerImpl::GetInstance()->delegate()-> | 122 SpeechRecognitionManagerImpl::GetInstance()->delegate()-> |
| 121 FilterProfanities(render_process_id_); | 123 FilterProfanities(render_process_id_); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 271 void SpeechRecognitionDispatcherHost::OnAudioLevelsChange(int session_id, | 273 void SpeechRecognitionDispatcherHost::OnAudioLevelsChange(int session_id, |
| 272 float volume, | 274 float volume, |
| 273 float noise_volume) { | 275 float noise_volume) { |
| 274 } | 276 } |
| 275 | 277 |
| 276 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete( | 278 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete( |
| 277 int session_id) { | 279 int session_id) { |
| 278 } | 280 } |
| 279 | 281 |
| 280 } // namespace content | 282 } // namespace content |
| OLD | NEW |