OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_INPUT_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ |
6 #define CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ | 6 #define CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // Describes the microphone errors that are reported via ShowMicError. | 43 // Describes the microphone errors that are reported via ShowMicError. |
44 enum MicError { | 44 enum MicError { |
45 kNoDeviceAvailable = 0, | 45 kNoDeviceAvailable = 0, |
46 kDeviceInUse | 46 kDeviceInUse |
47 }; | 47 }; |
48 | 48 |
49 SpeechInputManager(); | 49 SpeechInputManager(); |
50 | 50 |
51 // Invokes the platform provided microphone settings UI in a non-blocking way, | 51 // Invokes the platform provided microphone settings UI in a non-blocking way, |
52 // via the BrowserThread::FILE thread. | 52 // via the BrowserThread::FILE thread. |
53 static void ShowAudioInputSettings(); | 53 static void ShowAudioInputSettings(AudioManager* audio_manager); |
54 | 54 |
55 virtual ~SpeechInputManager(); | 55 virtual ~SpeechInputManager(); |
56 | 56 |
57 // Handlers for requests from render views. | 57 // Handlers for requests from render views. |
58 | 58 |
59 // |delegate| is a weak pointer and should remain valid until | 59 // |delegate| is a weak pointer and should remain valid until |
60 // its |DidCompleteRecognition| method is called or recognition is cancelled. | 60 // its |DidCompleteRecognition| method is called or recognition is cancelled. |
61 // |render_process_id| is the ID of the renderer process initiating the | 61 // |render_process_id| is the ID of the renderer process initiating the |
62 // request. | 62 // request. |
63 // |element_rect| is the display bounds of the html element requesting speech | 63 // |element_rect| is the display bounds of the html element requesting speech |
64 // input (in page coordinates). | 64 // input (in page coordinates). |
65 virtual void StartRecognition(Delegate* delegate, | 65 virtual void StartRecognition(Delegate* delegate, |
66 int caller_id, | 66 int caller_id, |
67 int render_process_id, | 67 int render_process_id, |
68 int render_view_id, | 68 int render_view_id, |
69 const gfx::Rect& element_rect, | 69 const gfx::Rect& element_rect, |
70 const std::string& language, | 70 const std::string& language, |
71 const std::string& grammar, | 71 const std::string& grammar, |
72 const std::string& origin_url, | 72 const std::string& origin_url, |
73 net::URLRequestContextGetter* context_getter, | 73 net::URLRequestContextGetter* context_getter, |
74 SpeechInputPreferences* speech_input_prefs); | 74 SpeechInputPreferences* speech_input_prefs, |
| 75 AudioManager* audio_manager); |
75 virtual void CancelRecognition(int caller_id); | 76 virtual void CancelRecognition(int caller_id); |
76 virtual void CancelAllRequestsWithDelegate(Delegate* delegate); | 77 virtual void CancelAllRequestsWithDelegate(Delegate* delegate); |
77 virtual void StopRecording(int caller_id); | 78 virtual void StopRecording(int caller_id); |
78 | 79 |
79 // SpeechRecognizerDelegate methods. | 80 // SpeechRecognizerDelegate methods. |
80 virtual void DidStartReceivingAudio(int caller_id) OVERRIDE; | 81 virtual void DidStartReceivingAudio(int caller_id) OVERRIDE; |
81 virtual void SetRecognitionResult( | 82 virtual void SetRecognitionResult( |
82 int caller_id, | 83 int caller_id, |
83 const content::SpeechInputResult& result) OVERRIDE; | 84 const content::SpeechInputResult& result) OVERRIDE; |
84 virtual void DidCompleteRecording(int caller_id) OVERRIDE; | 85 virtual void DidCompleteRecording(int caller_id) OVERRIDE; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 168 |
168 // This typedef is to workaround the issue with certain versions of | 169 // This typedef is to workaround the issue with certain versions of |
169 // Visual Studio where it gets confused between multiple Delegate | 170 // Visual Studio where it gets confused between multiple Delegate |
170 // classes and gives a C2500 error. (I saw this error on the try bots - | 171 // classes and gives a C2500 error. (I saw this error on the try bots - |
171 // the workaround was not needed for my machine). | 172 // the workaround was not needed for my machine). |
172 typedef SpeechInputManager::Delegate SpeechInputManagerDelegate; | 173 typedef SpeechInputManager::Delegate SpeechInputManagerDelegate; |
173 | 174 |
174 } // namespace speech_input | 175 } // namespace speech_input |
175 | 176 |
176 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ | 177 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ |
OLD | NEW |