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 "base/utf_string_conversions.h" | |
|
hans
2012/06/11 15:52:15
i can't see where this is used..
Primiano Tucci (use gerrit)
2012/06/11 17:03:22
Right, it was part some experiments later aborted.
| |
| 10 #include "content/common/speech_recognition_messages.h" | 11 #include "content/common/speech_recognition_messages.h" |
| 11 #include "content/public/browser/speech_recognition_manager.h" | 12 #include "content/public/browser/speech_recognition_manager.h" |
| 12 #include "content/public/browser/speech_recognition_preferences.h" | 13 #include "content/public/browser/speech_recognition_preferences.h" |
| 13 #include "content/public/browser/speech_recognition_session_config.h" | 14 #include "content/public/browser/speech_recognition_session_config.h" |
| 14 #include "content/public/browser/speech_recognition_session_context.h" | 15 #include "content/public/browser/speech_recognition_session_context.h" |
| 15 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
| 17 #include "googleurl/src/gurl.h" | |
| 16 | 18 |
| 17 using content::SpeechRecognitionManager; | 19 using content::SpeechRecognitionManager; |
| 18 using content::SpeechRecognitionSessionConfig; | 20 using content::SpeechRecognitionSessionConfig; |
| 19 using content::SpeechRecognitionSessionContext; | 21 using content::SpeechRecognitionSessionContext; |
| 20 | 22 |
| 21 namespace speech { | 23 namespace speech { |
| 22 SpeechRecognitionManager* SpeechRecognitionDispatcherHost::manager_for_tests_; | 24 SpeechRecognitionManager* SpeechRecognitionDispatcherHost::manager_for_tests_; |
| 23 | 25 |
| 24 void SpeechRecognitionDispatcherHost::SetManagerForTests( | 26 void SpeechRecognitionDispatcherHost::SetManagerForTests( |
| 25 SpeechRecognitionManager* manager) { | 27 SpeechRecognitionManager* manager) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 OnStopCaptureRequest) | 68 OnStopCaptureRequest) |
| 67 IPC_MESSAGE_UNHANDLED(handled = false) | 69 IPC_MESSAGE_UNHANDLED(handled = false) |
| 68 IPC_END_MESSAGE_MAP() | 70 IPC_END_MESSAGE_MAP() |
| 69 return handled; | 71 return handled; |
| 70 } | 72 } |
| 71 | 73 |
| 72 void SpeechRecognitionDispatcherHost::OnStartRequest( | 74 void SpeechRecognitionDispatcherHost::OnStartRequest( |
| 73 const SpeechRecognitionHostMsg_StartRequest_Params& params) { | 75 const SpeechRecognitionHostMsg_StartRequest_Params& params) { |
| 74 | 76 |
| 75 SpeechRecognitionSessionContext context; | 77 SpeechRecognitionSessionContext context; |
| 78 context.context_name = GURL(params.origin_url).spec(); | |
| 76 context.render_process_id = render_process_id_; | 79 context.render_process_id = render_process_id_; |
| 77 context.render_view_id = params.render_view_id; | 80 context.render_view_id = params.render_view_id; |
| 78 context.request_id = params.request_id; | 81 context.request_id = params.request_id; |
| 82 context.requested_by_page_element = false; | |
| 79 | 83 |
| 80 SpeechRecognitionSessionConfig config; | 84 SpeechRecognitionSessionConfig config; |
| 81 config.is_one_shot = params.is_one_shot; | 85 config.is_one_shot = params.is_one_shot; |
| 82 config.language = params.language; | 86 config.language = params.language; |
| 83 config.grammars = params.grammars; | 87 config.grammars = params.grammars; |
| 84 config.origin_url = params.origin_url; | 88 config.origin_url = params.origin_url; |
| 85 config.initial_context = context; | 89 config.initial_context = context; |
| 86 config.url_request_context_getter = context_getter_.get(); | 90 config.url_request_context_getter = context_getter_.get(); |
| 87 if (recognition_preferences_) { | 91 if (recognition_preferences_) { |
| 88 config.filter_profanities = recognition_preferences_->FilterProfanities(); | 92 config.filter_profanities = recognition_preferences_->FilterProfanities(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 error)); | 180 error)); |
| 177 } | 181 } |
| 178 | 182 |
| 179 // The events below are currently not used by speech JS APIs implementation. | 183 // The events below are currently not used by speech JS APIs implementation. |
| 180 void SpeechRecognitionDispatcherHost::OnAudioLevelsChange( | 184 void SpeechRecognitionDispatcherHost::OnAudioLevelsChange( |
| 181 int session_id, float volume, float noise_volume) {} | 185 int session_id, float volume, float noise_volume) {} |
| 182 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete( | 186 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete( |
| 183 int session_id) {} | 187 int session_id) {} |
| 184 | 188 |
| 185 } // namespace speech | 189 } // namespace speech |
| OLD | NEW |