OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/renderer/speech_input_dispatcher.h" | 5 #include "content/renderer/speech_input_dispatcher.h" |
6 | 6 |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "content/common/speech_input_messages.h" | 8 #include "content/common/speech_input_messages.h" |
9 #include "content/renderer/render_view.h" | 9 #include "content/renderer/render_view.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 VLOG(1) << "SpeechInputDispatcher::cancelRecognition exit"; | 77 VLOG(1) << "SpeechInputDispatcher::cancelRecognition exit"; |
78 } | 78 } |
79 | 79 |
80 void SpeechInputDispatcher::stopRecording(int request_id) { | 80 void SpeechInputDispatcher::stopRecording(int request_id) { |
81 VLOG(1) << "SpeechInputDispatcher::stopRecording enter"; | 81 VLOG(1) << "SpeechInputDispatcher::stopRecording enter"; |
82 Send(new SpeechInputHostMsg_StopRecording(routing_id(), request_id)); | 82 Send(new SpeechInputHostMsg_StopRecording(routing_id(), request_id)); |
83 VLOG(1) << "SpeechInputDispatcher::stopRecording exit"; | 83 VLOG(1) << "SpeechInputDispatcher::stopRecording exit"; |
84 } | 84 } |
85 | 85 |
86 void SpeechInputDispatcher::OnSpeechRecognitionResult( | 86 void SpeechInputDispatcher::OnSpeechRecognitionResult( |
87 int request_id, const speech_input::SpeechInputResultArray& result) { | 87 int request_id, |
| 88 const speech_input::SpeechInputResult& result) { |
88 VLOG(1) << "SpeechInputDispatcher::OnSpeechRecognitionResult enter"; | 89 VLOG(1) << "SpeechInputDispatcher::OnSpeechRecognitionResult enter"; |
89 WebKit::WebSpeechInputResultArray webkit_result(result.size()); | 90 WebKit::WebSpeechInputResultArray webkit_result(result.hypotheses.size()); |
90 for (size_t i = 0; i < result.size(); ++i) | 91 for (size_t i = 0; i < result.hypotheses.size(); ++i) { |
91 webkit_result[i].set(result[i].utterance, result[i].confidence); | 92 webkit_result[i].set(result.hypotheses[i].utterance, |
| 93 result.hypotheses[i].confidence); |
| 94 } |
92 listener_->setRecognitionResult(request_id, webkit_result); | 95 listener_->setRecognitionResult(request_id, webkit_result); |
93 VLOG(1) << "SpeechInputDispatcher::OnSpeechRecognitionResult exit"; | 96 VLOG(1) << "SpeechInputDispatcher::OnSpeechRecognitionResult exit"; |
94 } | 97 } |
95 | 98 |
96 void SpeechInputDispatcher::OnSpeechRecordingComplete(int request_id) { | 99 void SpeechInputDispatcher::OnSpeechRecordingComplete(int request_id) { |
97 VLOG(1) << "SpeechInputDispatcher::OnSpeechRecordingComplete enter"; | 100 VLOG(1) << "SpeechInputDispatcher::OnSpeechRecordingComplete enter"; |
98 listener_->didCompleteRecording(request_id); | 101 listener_->didCompleteRecording(request_id); |
99 VLOG(1) << "SpeechInputDispatcher::OnSpeechRecordingComplete exit"; | 102 VLOG(1) << "SpeechInputDispatcher::OnSpeechRecordingComplete exit"; |
100 } | 103 } |
101 | 104 |
(...skipping 26 matching lines...) Expand all Loading... |
128 return; | 131 return; |
129 if (!input_element->isSpeechInputEnabled()) | 132 if (!input_element->isSpeechInputEnabled()) |
130 return; | 133 return; |
131 | 134 |
132 if (input_element->getSpeechInputState() == WebInputElement::Idle) { | 135 if (input_element->getSpeechInputState() == WebInputElement::Idle) { |
133 input_element->startSpeechInput(); | 136 input_element->startSpeechInput(); |
134 } else { | 137 } else { |
135 input_element->stopSpeechInput(); | 138 input_element->stopSpeechInput(); |
136 } | 139 } |
137 } | 140 } |
OLD | NEW |