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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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_|. We are also using the same value in |
| 109 // input_tag_dispatcher_host.cc | 109 // input_tag_dispatcher_host.cc |
|
msw
2014/05/02 00:05:10
nit: this is no longer true, please update the com
hans
2014/05/02 02:36:27
Done.
| |
| 110 bool filter_profanities = | 110 bool filter_profanities = |
| 111 SpeechRecognitionManagerImpl::GetInstance() && | 111 SpeechRecognitionManagerImpl::GetInstance() && |
| 112 SpeechRecognitionManagerImpl::GetInstance()->delegate() && | 112 SpeechRecognitionManagerImpl::GetInstance()->delegate() && |
| 113 SpeechRecognitionManagerImpl::GetInstance()->delegate()-> | 113 SpeechRecognitionManagerImpl::GetInstance()->delegate()-> |
| 114 FilterProfanities(render_process_id_); | 114 FilterProfanities(render_process_id_); |
|
msw
2014/05/02 00:05:10
nit: This is the last user of FilterProfanities an
hans
2014/05/02 02:36:27
Yeah, I want to come back to this pref in a follow
| |
| 115 | 115 |
| 116 BrowserThread::PostTask( | 116 BrowserThread::PostTask( |
| 117 BrowserThread::IO, | 117 BrowserThread::IO, |
| 118 FROM_HERE, | 118 FROM_HERE, |
| 119 base::Bind(&SpeechRecognitionDispatcherHost::OnStartRequestOnIO, | 119 base::Bind(&SpeechRecognitionDispatcherHost::OnStartRequestOnIO, |
| 120 this, | 120 this, |
| 121 embedder_render_process_id, | 121 embedder_render_process_id, |
| 122 embedder_render_view_id, | 122 embedder_render_view_id, |
| 123 input_params, | 123 input_params, |
| 124 filter_profanities)); | 124 filter_profanities)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 void SpeechRecognitionDispatcherHost::OnStartRequestOnIO( | 127 void SpeechRecognitionDispatcherHost::OnStartRequestOnIO( |
| 128 int embedder_render_process_id, | 128 int embedder_render_process_id, |
| 129 int embedder_render_view_id, | 129 int embedder_render_view_id, |
| 130 const SpeechRecognitionHostMsg_StartRequest_Params& params, | 130 const SpeechRecognitionHostMsg_StartRequest_Params& params, |
| 131 bool filter_profanities) { | 131 bool filter_profanities) { |
| 132 SpeechRecognitionSessionContext context; | 132 SpeechRecognitionSessionContext context; |
| 133 context.context_name = params.origin_url; | 133 context.context_name = params.origin_url; |
| 134 context.render_process_id = render_process_id_; | 134 context.render_process_id = render_process_id_; |
| 135 context.render_view_id = params.render_view_id; | 135 context.render_view_id = params.render_view_id; |
| 136 context.embedder_render_process_id = embedder_render_process_id; | 136 context.embedder_render_process_id = embedder_render_process_id; |
| 137 context.embedder_render_view_id = embedder_render_view_id; | 137 context.embedder_render_view_id = embedder_render_view_id; |
| 138 if (embedder_render_process_id) | 138 if (embedder_render_process_id) |
| 139 context.guest_render_view_id = params.render_view_id; | 139 context.guest_render_view_id = params.render_view_id; |
| 140 context.request_id = params.request_id; | 140 context.request_id = params.request_id; |
| 141 context.requested_by_page_element = false; | |
| 142 | 141 |
| 143 SpeechRecognitionSessionConfig config; | 142 SpeechRecognitionSessionConfig config; |
| 144 config.is_legacy_api = false; | 143 config.is_legacy_api = false; |
| 145 config.language = params.language; | 144 config.language = params.language; |
| 146 config.grammars = params.grammars; | 145 config.grammars = params.grammars; |
| 147 config.max_hypotheses = params.max_hypotheses; | 146 config.max_hypotheses = params.max_hypotheses; |
| 148 config.origin_url = params.origin_url; | 147 config.origin_url = params.origin_url; |
| 149 config.initial_context = context; | 148 config.initial_context = context; |
| 150 config.url_request_context_getter = context_getter_.get(); | 149 config.url_request_context_getter = context_getter_.get(); |
| 151 config.filter_profanities = filter_profanities; | 150 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, | 250 void SpeechRecognitionDispatcherHost::OnAudioLevelsChange(int session_id, |
| 252 float volume, | 251 float volume, |
| 253 float noise_volume) { | 252 float noise_volume) { |
| 254 } | 253 } |
| 255 | 254 |
| 256 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete( | 255 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete( |
| 257 int session_id) { | 256 int session_id) { |
| 258 } | 257 } |
| 259 | 258 |
| 260 } // namespace content | 259 } // namespace content |
| OLD | NEW |