| 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 <memory> |
| 9 #include <string> | 10 #include <string> |
| 10 | 11 |
| 11 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 13 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 14 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.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" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 void OnAudioLevelsChange(int session_id, | 92 void OnAudioLevelsChange(int session_id, |
| 92 float volume, | 93 float volume, |
| 93 float noise_volume) override; | 94 float noise_volume) override; |
| 94 | 95 |
| 95 SpeechRecognitionManagerDelegate* delegate() const { return delegate_.get(); } | 96 SpeechRecognitionManagerDelegate* delegate() const { return delegate_.get(); } |
| 96 | 97 |
| 97 protected: | 98 protected: |
| 98 // BrowserMainLoop is the only one allowed to istantiate and free us. | 99 // BrowserMainLoop is the only one allowed to istantiate and free us. |
| 99 friend class BrowserMainLoop; | 100 friend class BrowserMainLoop; |
| 100 // Needed for dtor. | 101 // Needed for dtor. |
| 101 friend struct base::DefaultDeleter<SpeechRecognitionManagerImpl>; | 102 friend std::default_delete<SpeechRecognitionManagerImpl>; |
| 102 SpeechRecognitionManagerImpl(media::AudioManager* audio_manager, | 103 SpeechRecognitionManagerImpl(media::AudioManager* audio_manager, |
| 103 MediaStreamManager* media_stream_manager); | 104 MediaStreamManager* media_stream_manager); |
| 104 ~SpeechRecognitionManagerImpl() override; | 105 ~SpeechRecognitionManagerImpl() override; |
| 105 | 106 |
| 106 private: | 107 private: |
| 107 // Data types for the internal Finite State Machine (FSM). | 108 // Data types for the internal Finite State Machine (FSM). |
| 108 enum FSMState { | 109 enum FSMState { |
| 109 SESSION_STATE_IDLE = 0, | 110 SESSION_STATE_IDLE = 0, |
| 110 SESSION_STATE_CAPTURING_AUDIO, | 111 SESSION_STATE_CAPTURING_AUDIO, |
| 111 SESSION_STATE_WAITING_FOR_RESULT, | 112 SESSION_STATE_WAITING_FOR_RESULT, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 | 185 |
| 185 // Used for posting asynchronous tasks (on the IO thread) without worrying | 186 // Used for posting asynchronous tasks (on the IO thread) without worrying |
| 186 // about this class being destroyed in the meanwhile (due to browser shutdown) | 187 // about this class being destroyed in the meanwhile (due to browser shutdown) |
| 187 // since tasks pending on a destroyed WeakPtr are automatically discarded. | 188 // since tasks pending on a destroyed WeakPtr are automatically discarded. |
| 188 base::WeakPtrFactory<SpeechRecognitionManagerImpl> weak_factory_; | 189 base::WeakPtrFactory<SpeechRecognitionManagerImpl> weak_factory_; |
| 189 }; | 190 }; |
| 190 | 191 |
| 191 } // namespace content | 192 } // namespace content |
| 192 | 193 |
| 193 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ | 194 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_MANAGER_IMPL_H_ |
| OLD | NEW |