| 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 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ | 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/sync_socket.h" |
| 15 #include "content/browser/renderer_host/media/media_stream_requester.h" | 16 #include "content/browser/renderer_host/media/media_stream_requester.h" |
| 16 #include "content/public/browser/speech_recognition_event_listener.h" | 17 #include "content/public/browser/speech_recognition_event_listener.h" |
| 17 #include "content/public/browser/speech_recognition_manager.h" | 18 #include "content/public/browser/speech_recognition_manager.h" |
| 18 #include "content/public/browser/speech_recognition_session_config.h" | 19 #include "content/public/browser/speech_recognition_session_config.h" |
| 19 #include "content/public/browser/speech_recognition_session_context.h" | 20 #include "content/public/browser/speech_recognition_session_context.h" |
| 20 #include "content/public/common/speech_recognition_error.h" | 21 #include "content/public/common/speech_recognition_error.h" |
| 21 | 22 |
| 22 namespace media { | 23 namespace media { |
| 23 class AudioManager; | 24 class AudioManager; |
| 25 class AudioParameters; |
| 24 } | 26 } |
| 25 | 27 |
| 26 namespace content { | 28 namespace content { |
| 27 class BrowserMainLoop; | 29 class BrowserMainLoop; |
| 28 class MediaStreamManager; | 30 class MediaStreamManager; |
| 29 class MediaStreamUIProxy; | 31 class MediaStreamUIProxy; |
| 30 class SpeechRecognitionManagerDelegate; | 32 class SpeechRecognitionManagerDelegate; |
| 31 class SpeechRecognizer; | 33 class SpeechRecognizer; |
| 32 | 34 |
| 33 // This is the manager for speech recognition. It is a single instance in | 35 // This is the manager for speech recognition. It is a single instance in |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 void OnSoundEnd(int session_id) override; | 86 void OnSoundEnd(int session_id) override; |
| 85 void OnAudioEnd(int session_id) override; | 87 void OnAudioEnd(int session_id) override; |
| 86 void OnRecognitionEnd(int session_id) override; | 88 void OnRecognitionEnd(int session_id) override; |
| 87 void OnRecognitionResults(int session_id, | 89 void OnRecognitionResults(int session_id, |
| 88 const SpeechRecognitionResults& result) override; | 90 const SpeechRecognitionResults& result) override; |
| 89 void OnRecognitionError(int session_id, | 91 void OnRecognitionError(int session_id, |
| 90 const SpeechRecognitionError& error) override; | 92 const SpeechRecognitionError& error) override; |
| 91 void OnAudioLevelsChange(int session_id, | 93 void OnAudioLevelsChange(int session_id, |
| 92 float volume, | 94 float volume, |
| 93 float noise_volume) override; | 95 float noise_volume) override; |
| 96 void OnAudioReceiverReady( |
| 97 int session_id, |
| 98 const media::AudioParameters& params, |
| 99 const base::SharedMemoryHandle memory, |
| 100 const base::SyncSocket::TransitDescriptor) override; |
| 94 | 101 |
| 95 SpeechRecognitionManagerDelegate* delegate() const { return delegate_.get(); } | 102 SpeechRecognitionManagerDelegate* delegate() const { return delegate_.get(); } |
| 96 | 103 |
| 97 protected: | 104 protected: |
| 98 // BrowserMainLoop is the only one allowed to istantiate and free us. | 105 // BrowserMainLoop is the only one allowed to istantiate and free us. |
| 99 friend class BrowserMainLoop; | 106 friend class BrowserMainLoop; |
| 100 // Needed for dtor. | 107 // Needed for dtor. |
| 101 friend struct base::DefaultDeleter<SpeechRecognitionManagerImpl>; | 108 friend struct base::DefaultDeleter<SpeechRecognitionManagerImpl>; |
| 102 SpeechRecognitionManagerImpl(media::AudioManager* audio_manager, | 109 SpeechRecognitionManagerImpl(media::AudioManager* audio_manager, |
| 103 MediaStreamManager* media_stream_manager); | 110 MediaStreamManager* media_stream_manager); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 191 |
| 185 // Used for posting asynchronous tasks (on the IO thread) without worrying | 192 // Used for posting asynchronous tasks (on the IO thread) without worrying |
| 186 // about this class being destroyed in the meanwhile (due to browser shutdown) | 193 // about this class being destroyed in the meanwhile (due to browser shutdown) |
| 187 // since tasks pending on a destroyed WeakPtr are automatically discarded. | 194 // since tasks pending on a destroyed WeakPtr are automatically discarded. |
| 188 base::WeakPtrFactory<SpeechRecognitionManagerImpl> weak_factory_; | 195 base::WeakPtrFactory<SpeechRecognitionManagerImpl> weak_factory_; |
| 189 }; | 196 }; |
| 190 | 197 |
| 191 } // namespace content | 198 } // namespace content |
| 192 | 199 |
| 193 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ | 200 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ |
| OLD | NEW |