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

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

Issue 415933002: Turn webspeech on/off when tab goes fore/background (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge the previous change Created 6 years, 5 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 Send(new SpeechRecognitionHostMsg_AbortAllRequests(
40 routing_id()));
41 }
42
38 bool SpeechRecognitionDispatcher::OnMessageReceived( 43 bool SpeechRecognitionDispatcher::OnMessageReceived(
39 const IPC::Message& message) { 44 const IPC::Message& message) {
40 bool handled = true; 45 bool handled = true;
41 IPC_BEGIN_MESSAGE_MAP(SpeechRecognitionDispatcher, message) 46 IPC_BEGIN_MESSAGE_MAP(SpeechRecognitionDispatcher, message)
42 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_Started, OnRecognitionStarted) 47 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_Started, OnRecognitionStarted)
43 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioStarted, OnAudioStarted) 48 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioStarted, OnAudioStarted)
44 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_SoundStarted, OnSoundStarted) 49 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_SoundStarted, OnSoundStarted)
45 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_SoundEnded, OnSoundEnded) 50 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_SoundEnded, OnSoundEnded)
46 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioEnded, OnAudioEnded) 51 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_AudioEnded, OnAudioEnded)
47 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_ErrorOccurred, OnErrorOccurred) 52 IPC_MESSAGE_HANDLER(SpeechRecognitionMsg_ErrorOccurred, OnErrorOccurred)
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } 240 }
236 241
237 const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID( 242 const WebSpeechRecognitionHandle& SpeechRecognitionDispatcher::GetHandleFromID(
238 int request_id) { 243 int request_id) {
239 HandleMap::iterator iter = handle_map_.find(request_id); 244 HandleMap::iterator iter = handle_map_.find(request_id);
240 DCHECK(iter != handle_map_.end()); 245 DCHECK(iter != handle_map_.end());
241 return iter->second; 246 return iter->second;
242 } 247 }
243 248
244 } // namespace content 249 } // 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