Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(268)

Side by Side Diff: content/renderer/speech_recognition_dispatcher.cc

Issue 416053002: Revert of Turn webspeech on/off when tab goes fore/background (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/speech_recognition_dispatcher.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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();
41 ++iter) {
42 // OnEnd event will be sent to the SpeechRecognition object later.
43 abort(iter->second, recognizer_client_);
44 }
45 }
46
47 bool SpeechRecognitionDispatcher::OnMessageReceived( 38 bool SpeechRecognitionDispatcher::OnMessageReceived(
48 const IPC::Message& message) { 39 const IPC::Message& message) {
49 bool handled = true; 40 bool handled = true;
50 IPC_BEGIN_MESSAGE_MAP(SpeechRecognitionDispatcher, message) 41 IPC_BEGIN_MESSAGE_MAP(SpeechRecognitionDispatcher, message)
51 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_Started, OnRecognitionStarted) 42 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_Started, OnRecognitionStarted)
52 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioStarted, OnAudioStarted) 43 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioStarted, OnAudioStarted)
53 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_SoundStarted, OnSoundStarted) 44 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_SoundStarted, OnSoundStarted)
54 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_SoundEnded, OnSoundEnded) 45 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_SoundEnded, OnSoundEnded)
55 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioEnded, OnAudioEnded) 46 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioEnded, OnAudioEnded)
56 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_ErrorOccurred, OnErrorOccurred) 47 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_ErrorOccurred, OnErrorOccurred)
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 } 235 }
245 236
246 const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID( 237 const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID(
247 int request_id) { 238 int request_id) {
248 HandleMap::iterator iter = handle_map_.find(request_id); 239 HandleMap::iterator iter = handle_map_.find(request_id);
249 DCHECK(iter != handle_map_.end()); 240 DCHECK(iter != handle_map_.end());
250 return iter->second; 241 return iter->second;
251 } 242 }
252 243
253 } // namespace content 244 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/speech_recognition_dispatcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698