| 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/renderer/speech_recognition_dispatcher.h" | 5 #include "content/renderer/speech_recognition_dispatcher.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_Ended, OnRecognitionEnded) | 59 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_Ended, OnRecognitionEnded) |
| 60 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_ResultRetrieved, | 60 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_ResultRetrieved, |
| 61 OnResultsRetrieved) | 61 OnResultsRetrieved) |
| 62 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioReceiverReady, | 62 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioReceiverReady, |
| 63 OnAudioReceiverReady) | 63 OnAudioReceiverReady) |
| 64 IPC_MESSAGE_UNHANDLED(handled = false) | 64 IPC_MESSAGE_UNHANDLED(handled = false) |
| 65 IPC_END_MESSAGE_MAP() | 65 IPC_END_MESSAGE_MAP() |
| 66 return handled; | 66 return handled; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void SpeechRecognitionDispatcher::OnDestruct() { |
| 70 delete this; |
| 71 } |
| 72 |
| 69 void SpeechRecognitionDispatcher::start( | 73 void SpeechRecognitionDispatcher::start( |
| 70 const WebSpeechRecognitionHandle& handle, | 74 const WebSpeechRecognitionHandle& handle, |
| 71 const WebSpeechRecognitionParams& params, | 75 const WebSpeechRecognitionParams& params, |
| 72 WebSpeechRecognizerClient* recognizer_client) { | 76 WebSpeechRecognizerClient* recognizer_client) { |
| 73 DCHECK(!recognizer_client_ || recognizer_client_ == recognizer_client); | 77 DCHECK(!recognizer_client_ || recognizer_client_ == recognizer_client); |
| 74 recognizer_client_ = recognizer_client; | 78 recognizer_client_ = recognizer_client; |
| 75 | 79 |
| 76 #if defined(ENABLE_WEBRTC) | 80 #if defined(ENABLE_WEBRTC) |
| 77 const blink::WebMediaStreamTrack track = params.audioTrack(); | 81 const blink::WebMediaStreamTrack track = params.audioTrack(); |
| 78 if (!track.isNull()) { | 82 if (!track.isNull()) { |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } | 320 } |
| 317 | 321 |
| 318 const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID( | 322 const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID( |
| 319 int request_id) { | 323 int request_id) { |
| 320 HandleMap::iterator iter = handle_map_.find(request_id); | 324 HandleMap::iterator iter = handle_map_.find(request_id); |
| 321 CHECK(iter != handle_map_.end()); | 325 CHECK(iter != handle_map_.end()); |
| 322 return iter->second; | 326 return iter->second; |
| 323 } | 327 } |
| 324 | 328 |
| 325 } // namespace content | 329 } // namespace content |
| OLD | NEW |