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/browser/speech/speech_recognition_dispatcher_host.h" | 5 #include "content/browser/speech/speech_recognition_dispatcher_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "content/common/speech_recognition_messages.h" | 10 #include "content/common/speech_recognition_messages.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 SpeechRecognitionDispatcherHost::~SpeechRecognitionDispatcherHost() { | 36 SpeechRecognitionDispatcherHost::~SpeechRecognitionDispatcherHost() { |
37 if (SpeechRecognitionManager* sr_manager = manager()) | 37 if (SpeechRecognitionManager* sr_manager = manager()) |
38 sr_manager->AbortAllSessionsForListener(this); | 38 sr_manager->AbortAllSessionsForListener(this); |
39 } | 39 } |
40 | 40 |
41 SpeechRecognitionManager* SpeechRecognitionDispatcherHost::manager() { | 41 SpeechRecognitionManager* SpeechRecognitionDispatcherHost::manager() { |
42 if (manager_for_tests_) | 42 if (manager_for_tests_) |
43 return manager_for_tests_; | 43 return manager_for_tests_; |
44 | 44 |
45 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 45 return SpeechRecognitionManager::GetInstance(); |
46 if (command_line.HasSwitch(switches::kEnableScriptedSpeech)) | |
47 return SpeechRecognitionManager::GetInstance(); | |
48 | |
49 return NULL; | |
50 } | 46 } |
51 | 47 |
52 bool SpeechRecognitionDispatcherHost::OnMessageReceived( | 48 bool SpeechRecognitionDispatcherHost::OnMessageReceived( |
53 const IPC::Message& message, bool* message_was_ok) { | 49 const IPC::Message& message, bool* message_was_ok) { |
54 bool handled = true; | 50 bool handled = true; |
55 IPC_BEGIN_MESSAGE_MAP_EX(SpeechRecognitionDispatcherHost, message, | 51 IPC_BEGIN_MESSAGE_MAP_EX(SpeechRecognitionDispatcherHost, message, |
56 *message_was_ok) | 52 *message_was_ok) |
57 IPC_MESSAGE_HANDLER(SpeechRecognitionHostMsg_StartRequest, | 53 IPC_MESSAGE_HANDLER(SpeechRecognitionHostMsg_StartRequest, |
58 OnStartRequest) | 54 OnStartRequest) |
59 IPC_MESSAGE_HANDLER(SpeechRecognitionHostMsg_AbortRequest, | 55 IPC_MESSAGE_HANDLER(SpeechRecognitionHostMsg_AbortRequest, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 void SpeechRecognitionDispatcherHost::OnAudioLevelsChange(int session_id, | 185 void SpeechRecognitionDispatcherHost::OnAudioLevelsChange(int session_id, |
190 float volume, | 186 float volume, |
191 float noise_volume) { | 187 float noise_volume) { |
192 } | 188 } |
193 | 189 |
194 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete( | 190 void SpeechRecognitionDispatcherHost::OnEnvironmentEstimationComplete( |
195 int session_id) { | 191 int session_id) { |
196 } | 192 } |
197 | 193 |
198 } // namespace content | 194 } // namespace content |
OLD | NEW |