| 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 CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_MANAGER_H_ |
| 6 #define CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_MANAGER_H_ | 6 #define CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // Used for API tests. | 33 // Used for API tests. |
| 34 class SpeechInputExtensionInterface { | 34 class SpeechInputExtensionInterface { |
| 35 public: | 35 public: |
| 36 SpeechInputExtensionInterface(); | 36 SpeechInputExtensionInterface(); |
| 37 virtual ~SpeechInputExtensionInterface(); | 37 virtual ~SpeechInputExtensionInterface(); |
| 38 | 38 |
| 39 // Called from the IO thread. | 39 // Called from the IO thread. |
| 40 virtual void StartRecording( | 40 virtual void StartRecording( |
| 41 content::SpeechRecognitionEventListener* listener, | 41 content::SpeechRecognitionEventListener* listener, |
| 42 net::URLRequestContextGetter* context_getter, | 42 net::URLRequestContextGetter* context_getter, |
| 43 int caller_id, | 43 int session_id, |
| 44 const std::string& language, | 44 const std::string& language, |
| 45 const std::string& grammar, | 45 const std::string& grammar, |
| 46 bool filter_profanities) = 0; | 46 bool filter_profanities) = 0; |
| 47 | 47 |
| 48 virtual void StopRecording(bool recognition_failed) = 0; | 48 virtual void StopRecording(bool recognition_failed) = 0; |
| 49 virtual bool HasAudioInputDevices() = 0; | 49 virtual bool HasAudioInputDevices() = 0; |
| 50 virtual bool IsCapturingAudio() = 0; | 50 virtual bool IsCapturingAudio() = 0; |
| 51 | 51 |
| 52 // Called from the UI thread. | 52 // Called from the UI thread. |
| 53 virtual bool HasValidRecognizer() = 0; | 53 virtual bool HasValidRecognizer() = 0; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 110 |
| 111 // Called by internal ProfileKeyedService class. | 111 // Called by internal ProfileKeyedService class. |
| 112 void ShutdownOnUIThread(); | 112 void ShutdownOnUIThread(); |
| 113 | 113 |
| 114 // Methods from content::NotificationObserver. | 114 // Methods from content::NotificationObserver. |
| 115 virtual void Observe(int type, | 115 virtual void Observe(int type, |
| 116 const content::NotificationSource& source, | 116 const content::NotificationSource& source, |
| 117 const content::NotificationDetails& details) OVERRIDE; | 117 const content::NotificationDetails& details) OVERRIDE; |
| 118 | 118 |
| 119 // Methods from SpeechRecognitionEventListener. | 119 // Methods from SpeechRecognitionEventListener. |
| 120 virtual void OnRecognitionStart(int caller_id) OVERRIDE; | 120 virtual void OnRecognitionStart(int session_id) OVERRIDE; |
| 121 virtual void OnAudioStart(int caller_id) OVERRIDE; | 121 virtual void OnAudioStart(int session_id) OVERRIDE; |
| 122 virtual void OnEnvironmentEstimationComplete(int caller_id) OVERRIDE; | 122 virtual void OnEnvironmentEstimationComplete(int session_id) OVERRIDE; |
| 123 virtual void OnSoundStart(int caller_id) OVERRIDE; | 123 virtual void OnSoundStart(int session_id) OVERRIDE; |
| 124 virtual void OnSoundEnd(int caller_id) OVERRIDE; | 124 virtual void OnSoundEnd(int session_id) OVERRIDE; |
| 125 virtual void OnAudioEnd(int caller_id) OVERRIDE; | 125 virtual void OnAudioEnd(int session_id) OVERRIDE; |
| 126 virtual void OnRecognitionResult( | 126 virtual void OnRecognitionResult( |
| 127 int caller_id, const content::SpeechRecognitionResult& result) OVERRIDE; | 127 int session_id, const content::SpeechRecognitionResult& result) OVERRIDE; |
| 128 virtual void OnRecognitionError( | 128 virtual void OnRecognitionError( |
| 129 int caller_id, const content::SpeechRecognitionError& error) OVERRIDE; | 129 int session_id, const content::SpeechRecognitionError& error) OVERRIDE; |
| 130 virtual void OnAudioLevelsChange(int caller_id, float volume, | 130 virtual void OnAudioLevelsChange(int session_id, float volume, |
| 131 float noise_volume) OVERRIDE; | 131 float noise_volume) OVERRIDE; |
| 132 virtual void OnRecognitionEnd(int caller_id) OVERRIDE; | 132 virtual void OnRecognitionEnd(int session_id) OVERRIDE; |
| 133 | 133 |
| 134 // Methods for API testing. | 134 // Methods for API testing. |
| 135 void SetSpeechInputExtensionInterface( | 135 void SetSpeechInputExtensionInterface( |
| 136 SpeechInputExtensionInterface* interface); | 136 SpeechInputExtensionInterface* interface); |
| 137 SpeechInputExtensionInterface* GetSpeechInputExtensionInterface(); | 137 SpeechInputExtensionInterface* GetSpeechInputExtensionInterface(); |
| 138 | 138 |
| 139 private: | 139 private: |
| 140 // SpeechInputExtensionInterface methods: | 140 // SpeechInputExtensionInterface methods: |
| 141 virtual bool IsCapturingAudio() OVERRIDE; | 141 virtual bool IsCapturingAudio() OVERRIDE; |
| 142 virtual bool HasAudioInputDevices() OVERRIDE; | 142 virtual bool HasAudioInputDevices() OVERRIDE; |
| 143 virtual bool HasValidRecognizer() OVERRIDE; | 143 virtual bool HasValidRecognizer() OVERRIDE; |
| 144 virtual void StartRecording( | 144 virtual void StartRecording( |
| 145 content::SpeechRecognitionEventListener* listener, | 145 content::SpeechRecognitionEventListener* listener, |
| 146 net::URLRequestContextGetter* context_getter, | 146 net::URLRequestContextGetter* context_getter, |
| 147 int caller_id, | 147 int session_id, |
| 148 const std::string& language, | 148 const std::string& language, |
| 149 const std::string& grammar, | 149 const std::string& grammar, |
| 150 bool filter_profanities) OVERRIDE; | 150 bool filter_profanities) OVERRIDE; |
| 151 | 151 |
| 152 virtual void StopRecording(bool recognition_failed) OVERRIDE; | 152 virtual void StopRecording(bool recognition_failed) OVERRIDE; |
| 153 | 153 |
| 154 // Internal methods. | 154 // Internal methods. |
| 155 void StartOnIOThread( | 155 void StartOnIOThread( |
| 156 net::URLRequestContextGetter* context_getter, | 156 net::URLRequestContextGetter* context_getter, |
| 157 const std::string& language, | 157 const std::string& language, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // Used in the UI thread. | 197 // Used in the UI thread. |
| 198 scoped_ptr<content::NotificationRegistrar> registrar_; | 198 scoped_ptr<content::NotificationRegistrar> registrar_; |
| 199 SpeechInputExtensionInterface* speech_interface_; | 199 SpeechInputExtensionInterface* speech_interface_; |
| 200 scoped_ptr<SpeechInputExtensionNotification> notification_; | 200 scoped_ptr<SpeechInputExtensionNotification> notification_; |
| 201 | 201 |
| 202 // Used in the IO thread. | 202 // Used in the IO thread. |
| 203 scoped_refptr<content::SpeechRecognizer> recognizer_; | 203 scoped_refptr<content::SpeechRecognizer> recognizer_; |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_MANAGER_H_ | 206 #endif // CHROME_BROWSER_SPEECH_SPEECH_INPUT_EXTENSION_MANAGER_H_ |
| OLD | NEW |