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 27 matching lines...) Expand all Loading... |
38 virtual void StartRecording( | 38 virtual void StartRecording( |
39 content::SpeechRecognizerDelegate* delegate, | 39 content::SpeechRecognizerDelegate* delegate, |
40 net::URLRequestContextGetter* context_getter, | 40 net::URLRequestContextGetter* context_getter, |
41 int caller_id, | 41 int caller_id, |
42 const std::string& language, | 42 const std::string& language, |
43 const std::string& grammar, | 43 const std::string& grammar, |
44 bool filter_profanities) = 0; | 44 bool filter_profanities) = 0; |
45 | 45 |
46 virtual void StopRecording(bool recognition_failed) = 0; | 46 virtual void StopRecording(bool recognition_failed) = 0; |
47 virtual bool HasAudioInputDevices() = 0; | 47 virtual bool HasAudioInputDevices() = 0; |
48 virtual bool IsRecordingInProcess() = 0; | 48 virtual bool IsCapturingAudio() = 0; |
49 | 49 |
50 // Called from the UI thread. | 50 // Called from the UI thread. |
51 virtual bool HasValidRecognizer() = 0; | 51 virtual bool HasValidRecognizer() = 0; |
52 }; | 52 }; |
53 | 53 |
54 // Manages the speech input requests and responses from the extensions | 54 // Manages the speech input requests and responses from the extensions |
55 // associated to the given profile. | 55 // associated to the given profile. |
56 class SpeechInputExtensionManager | 56 class SpeechInputExtensionManager |
57 : public base::RefCountedThreadSafe<SpeechInputExtensionManager>, | 57 : public base::RefCountedThreadSafe<SpeechInputExtensionManager>, |
58 public content::SpeechRecognizerDelegate, | 58 public content::SpeechRecognizerDelegate, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 virtual void SetInputVolume(int caller_id, float volume, | 131 virtual void SetInputVolume(int caller_id, float volume, |
132 float noise_volume) OVERRIDE; | 132 float noise_volume) 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 IsRecordingInProcess() 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::SpeechRecognizerDelegate* delegate, | 145 content::SpeechRecognizerDelegate* delegate, |
146 net::URLRequestContextGetter* context_getter, | 146 net::URLRequestContextGetter* context_getter, |
147 int caller_id, | 147 int caller_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 |
(...skipping 45 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 |