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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/common/speech_recognition_messages.h" | 9 #include "content/common/speech_recognition_messages.h" |
10 #include "content/renderer/render_view_impl.h" | 10 #include "content/renderer/render_view_impl.h" |
(...skipping 17 matching lines...) Expand all Loading... | |
28 SpeechRecognitionDispatcher::SpeechRecognitionDispatcher( | 28 SpeechRecognitionDispatcher::SpeechRecognitionDispatcher( |
29 RenderViewImpl* render_view) | 29 RenderViewImpl* render_view) |
30 : RenderViewObserver(render_view), | 30 : RenderViewObserver(render_view), |
31 recognizer_client_(NULL), | 31 recognizer_client_(NULL), |
32 next_id_(1) { | 32 next_id_(1) { |
33 } | 33 } |
34 | 34 |
35 SpeechRecognitionDispatcher::~SpeechRecognitionDispatcher() { | 35 SpeechRecognitionDispatcher::~SpeechRecognitionDispatcher() { |
36 } | 36 } |
37 | 37 |
38 void SpeechRecognitionDispatcher::AbortAllRecognitions() { | |
39 for (HandleMap::iterator iter = handle_map_.begin(); | |
40 iter != handle_map_.end(); | |
no longer working on chromium
2014/07/24 11:00:29
fix the indentation
| |
41 ++iter) { | |
42 // OnEnd event will be sent to the SpeechRecognition object later. | |
43 abort(iter->second, recognizer_client_); | |
44 } | |
45 } | |
46 | |
38 bool SpeechRecognitionDispatcher::OnMessageReceived( | 47 bool SpeechRecognitionDispatcher::OnMessageReceived( |
39 const IPC::Message& message) { | 48 const IPC::Message& message) { |
40 bool handled = true; | 49 bool handled = true; |
41 IPC_BEGIN_MESSAGE_MAP(SpeechRecognitionDispatcher, message) | 50 IPC_BEGIN_MESSAGE_MAP(SpeechRecognitionDispatcher, message) |
42 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_Started, OnRecognitionStarted) | 51 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_Started, OnRecognitionStarted) |
43 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioStarted, OnAudioStarted) | 52 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioStarted, OnAudioStarted) |
44 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_SoundStarted, OnSoundStarted) | 53 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_SoundStarted, OnSoundStarted) |
45 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_SoundEnded, OnSoundEnded) | 54 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_SoundEnded, OnSoundEnded) |
46 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioEnded, OnAudioEnded) | 55 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioEnded, OnAudioEnded) |
47 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_ErrorOccurred, OnErrorOccurred) | 56 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_ErrorOccurred, OnErrorOccurred) |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 } | 244 } |
236 | 245 |
237 const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID( | 246 const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID( |
238 int request_id) { | 247 int request_id) { |
239 HandleMap::iterator iter = handle_map_.find(request_id); | 248 HandleMap::iterator iter = handle_map_.find(request_id); |
240 DCHECK(iter != handle_map_.end()); | 249 DCHECK(iter != handle_map_.end()); |
241 return iter->second; | 250 return iter->second; |
242 } | 251 } |
243 | 252 |
244 } // namespace content | 253 } // namespace content |
OLD | NEW |