| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 embedder_render_process_id = | 99 embedder_render_process_id = |
| 100 guest->embedder_web_contents()->GetRenderProcessHost()->GetID(); | 100 guest->embedder_web_contents()->GetRenderProcessHost()->GetID(); |
| 101 DCHECK_NE(embedder_render_process_id, 0); | 101 DCHECK_NE(embedder_render_process_id, 0); |
| 102 embedder_render_view_id = | 102 embedder_render_view_id = |
| 103 guest->embedder_web_contents()->GetRenderViewHost()->GetRoutingID(); | 103 guest->embedder_web_contents()->GetRenderViewHost()->GetRoutingID(); |
| 104 DCHECK_NE(embedder_render_view_id, MSG_ROUTING_NONE); | 104 DCHECK_NE(embedder_render_view_id, MSG_ROUTING_NONE); |
| 105 } | 105 } |
| 106 | 106 |
| 107 // TODO(lazyboy): Check if filter_profanities should use |render_process_id| | 107 // TODO(lazyboy): Check if filter_profanities should use |render_process_id| |
| 108 // instead of |render_process_id_|. We are also using the same value in | 108 // instead of |render_process_id_|. |
| 109 // input_tag_dispatcher_host.cc | |
| 110 bool filter_profanities = | 109 bool filter_profanities = |
| 111 SpeechRecognitionManagerImpl::GetInstance() && | 110 SpeechRecognitionManagerImpl::GetInstance() && |
| 112 SpeechRecognitionManagerImpl::GetInstance()->delegate() && | 111 SpeechRecognitionManagerImpl::GetInstance()->delegate() && |
| 113 SpeechRecognitionManagerImpl::GetInstance()->delegate()-> | 112 SpeechRecognitionManagerImpl::GetInstance()->delegate()-> |
| 114 FilterProfanities(render_process_id_); | 113 FilterProfanities(render_process_id_); |
| 115 | 114 |
| 116 BrowserThread::PostTask( | 115 BrowserThread::PostTask( |
| 117 BrowserThread::IO, | 116 BrowserThread::IO, |
| 118 FROM_HERE, | 117 FROM_HERE, |
| 119 base::Bind(&SpeechRecognitionDispatcherHost::OnStartRequestOnIO, | 118 base::Bind(&SpeechRecognitionDispatcherHost::OnStartRequestOnIO, |
| (...skipping 11 matching lines...) Expand all Loading... |
| 131 bool filter_profanities) { | 130 bool filter_profanities) { |
| 132 SpeechRecognitionSessionContext context; | 131 SpeechRecognitionSessionContext context; |
| 133 context.context_name = params.origin_url; | 132 context.context_name = params.origin_url; |
| 134 context.render_process_id = render_process_id_; | 133 context.render_process_id = render_process_id_; |
| 135 context.render_view_id = params.render_view_id; | 134 context.render_view_id = params.render_view_id; |
| 136 context.embedder_render_process_id = embedder_render_process_id; | 135 context.embedder_render_process_id = embedder_render_process_id; |
| 137 context.embedder_render_view_id = embedder_render_view_id; | 136 context.embedder_render_view_id = embedder_render_view_id; |
| 138 if (embedder_render_process_id) | 137 if (embedder_render_process_id) |
| 139 context.guest_render_view_id = params.render_view_id; | 138 context.guest_render_view_id = params.render_view_id; |
| 140 context.request_id = params.request_id; | 139 context.request_id = params.request_id; |
| 141 context.requested_by_page_element = false; | |
| 142 | 140 |
| 143 SpeechRecognitionSessionConfig config; | 141 SpeechRecognitionSessionConfig config; |
| 144 config.is_legacy_api = false; | 142 config.is_legacy_api = false; |
| 145 config.language = params.language; | 143 config.language = params.language; |
| 146 config.grammars = params.grammars; | 144 config.grammars = params.grammars; |
| 147 config.max_hypotheses = params.max_hypotheses; | 145 config.max_hypotheses = params.max_hypotheses; |
| 148 config.origin_url = params.origin_url; | 146 config.origin_url = params.origin_url; |
| 149 config.initial_context = context; | 147 config.initial_context = context; |
| 150 config.url_request_context_getter = context_getter_.get(); | 148 config.url_request_context_getter = context_getter_.get(); |
| 151 config.filter_profanities = filter_profanities; | 149 config.filter_profanities = filter_profanities; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 void SpeechRecognitionDispatcherHost::OnAudioLevelsChange(int session_id, | 249 void SpeechRecognitionDispatcherHost::OnAudioLevelsChange(int session_id, |
| 252 float volume, | 250 float volume, |
| 253 float noise_volume) { | 251 float noise_volume) { |
| 254 } | 252 } |
| 255 | 253 |
| 256 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete( | 254 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete( |
| 257 int session_id) { | 255 int session_id) { |
| 258 } | 256 } |
| 259 | 257 |
| 260 } // namespace content | 258 } // namespace content |
| OLD | NEW |