Chromium Code Reviews| 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 11 matching lines...) Expand all Loading... | |
| 22 // handles requests received from various render views and makes sure only one | 22 // handles requests received from various render views and makes sure only one |
| 23 // of them can use speech recognition at a time. It also sends recognition | 23 // of them can use speech recognition at a time. It also sends recognition |
| 24 // results and status events to the render views when required. | 24 // results and status events to the render views when required. |
| 25 class CONTENT_EXPORT SpeechInputManager : public SpeechRecognizerDelegate { | 25 class CONTENT_EXPORT SpeechInputManager : public SpeechRecognizerDelegate { |
| 26 public: | 26 public: |
| 27 // Implemented by the dispatcher host to relay events to the render views. | 27 // Implemented by the dispatcher host to relay events to the render views. |
| 28 class Delegate { | 28 class Delegate { |
| 29 public: | 29 public: |
| 30 virtual void SetRecognitionResult( | 30 virtual void SetRecognitionResult( |
| 31 int caller_id, | 31 int caller_id, |
| 32 const SpeechInputResultArray& result) = 0; | 32 const SpeechInputResult& result) = 0; |
| 33 virtual void DidCompleteRecording(int caller_id) = 0; | 33 virtual void DidCompleteRecording(int caller_id) = 0; |
| 34 virtual void DidCompleteRecognition(int caller_id) = 0; | 34 virtual void DidCompleteRecognition(int caller_id) = 0; |
| 35 | 35 |
| 36 protected: | 36 protected: |
| 37 virtual ~Delegate() {} | 37 virtual ~Delegate() {} |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 SpeechInputManager(); | 40 SpeechInputManager(); |
| 41 | 41 |
| 42 // Invokes the platform provided microphone settings UI in a non-blocking way, | 42 // Invokes the platform provided microphone settings UI in a non-blocking way, |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 64 net::URLRequestContextGetter* context_getter, | 64 net::URLRequestContextGetter* context_getter, |
| 65 SpeechInputPreferences* speech_input_prefs); | 65 SpeechInputPreferences* speech_input_prefs); |
| 66 virtual void CancelRecognition(int caller_id); | 66 virtual void CancelRecognition(int caller_id); |
| 67 virtual void CancelAllRequestsWithDelegate(Delegate* delegate); | 67 virtual void CancelAllRequestsWithDelegate(Delegate* delegate); |
| 68 virtual void StopRecording(int caller_id); | 68 virtual void StopRecording(int caller_id); |
| 69 | 69 |
| 70 // SpeechRecognizer::Delegate methods. | 70 // SpeechRecognizer::Delegate methods. |
| 71 virtual void DidStartReceivingAudio(int caller_id); | 71 virtual void DidStartReceivingAudio(int caller_id); |
| 72 virtual void SetRecognitionResult(int caller_id, | 72 virtual void SetRecognitionResult(int caller_id, |
| 73 bool error, | 73 bool error, |
| 74 const SpeechInputResultArray& result); | 74 const SpeechInputResult& result); |
| 75 virtual void DidCompleteRecording(int caller_id); | 75 virtual void DidCompleteRecording(int caller_id); |
| 76 virtual void DidCompleteRecognition(int caller_id); | 76 virtual void DidCompleteRecognition(int caller_id); |
| 77 virtual void DidSpeechInputStart(int caller_id); | |
|
Satish
2011/10/04 20:36:33
please use the new OVERRIDE annotation for all ove
Leandro GraciĆ” Gil
2011/10/05 22:09:00
Done.
| |
| 78 virtual void DidSpeechInputStop(int caller_id); | |
| 79 virtual void OnRecording(int caller_id); | |
| 80 | |
| 77 virtual void OnRecognizerError(int caller_id, | 81 virtual void OnRecognizerError(int caller_id, |
| 78 SpeechRecognizer::ErrorCode error); | 82 SpeechRecognizer::ErrorCode error); |
| 79 virtual void DidCompleteEnvironmentEstimation(int caller_id); | 83 virtual void DidCompleteEnvironmentEstimation(int caller_id); |
| 80 virtual void SetInputVolume(int caller_id, float volume, float noise_volume); | 84 virtual void SetInputVolume(int caller_id, float volume, float noise_volume); |
| 81 | 85 |
| 82 protected: | 86 protected: |
| 83 // The pure virtual methods are used for displaying the current state of | 87 // The pure virtual methods are used for displaying the current state of |
| 84 // recognition and for fetching optional request information. | 88 // recognition and for fetching optional request information. |
| 85 | 89 |
| 86 // Get the optional request information if available. | 90 // Get the optional request information if available. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 149 | 153 |
| 150 // This typedef is to workaround the issue with certain versions of | 154 // This typedef is to workaround the issue with certain versions of |
| 151 // Visual Studio where it gets confused between multiple Delegate | 155 // Visual Studio where it gets confused between multiple Delegate |
| 152 // classes and gives a C2500 error. (I saw this error on the try bots - | 156 // classes and gives a C2500 error. (I saw this error on the try bots - |
| 153 // the workaround was not needed for my machine). | 157 // the workaround was not needed for my machine). |
| 154 typedef SpeechInputManager::Delegate SpeechInputManagerDelegate; | 158 typedef SpeechInputManager::Delegate SpeechInputManagerDelegate; |
| 155 | 159 |
| 156 } // namespace speech_input | 160 } // namespace speech_input |
| 157 | 161 |
| 158 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ | 162 #endif // CONTENT_BROWSER_SPEECH_SPEECH_INPUT_MANAGER_H_ |
| OLD | NEW |