| 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_RECOGNIZER_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ |
| 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ | 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 virtual ~Delegate() {} | 83 virtual ~Delegate() {} |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 SpeechRecognizer(Delegate* delegate, | 86 SpeechRecognizer(Delegate* delegate, |
| 87 int caller_id, | 87 int caller_id, |
| 88 const std::string& language, | 88 const std::string& language, |
| 89 const std::string& grammar, | 89 const std::string& grammar, |
| 90 net::URLRequestContextGetter* context_getter, | 90 net::URLRequestContextGetter* context_getter, |
| 91 bool censor_results, | 91 bool filter_profanities, |
| 92 const std::string& hardware_info, | 92 const std::string& hardware_info, |
| 93 const std::string& origin_url); | 93 const std::string& origin_url); |
| 94 virtual ~SpeechRecognizer(); | 94 virtual ~SpeechRecognizer(); |
| 95 | 95 |
| 96 // Starts audio recording and does recognition after recording ends. The same | 96 // Starts audio recording and does recognition after recording ends. The same |
| 97 // SpeechRecognizer instance can be used multiple times for speech recognition | 97 // SpeechRecognizer instance can be used multiple times for speech recognition |
| 98 // though each recognition request can be made only after the previous one | 98 // though each recognition request can be made only after the previous one |
| 99 // completes (i.e. after receiving Delegate::DidCompleteRecognition). | 99 // completes (i.e. after receiving Delegate::DidCompleteRecognition). |
| 100 bool StartRecording(); | 100 bool StartRecording(); |
| 101 | 101 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 131 | 131 |
| 132 void HandleOnError(int error_code); // Handles OnError in the IO thread. | 132 void HandleOnError(int error_code); // Handles OnError in the IO thread. |
| 133 | 133 |
| 134 // Handles OnData in the IO thread. Takes ownership of |data|. | 134 // Handles OnData in the IO thread. Takes ownership of |data|. |
| 135 void HandleOnData(std::string* data); | 135 void HandleOnData(std::string* data); |
| 136 | 136 |
| 137 Delegate* delegate_; | 137 Delegate* delegate_; |
| 138 int caller_id_; | 138 int caller_id_; |
| 139 std::string language_; | 139 std::string language_; |
| 140 std::string grammar_; | 140 std::string grammar_; |
| 141 bool censor_results_; | 141 bool filter_profanities_; |
| 142 std::string hardware_info_; | 142 std::string hardware_info_; |
| 143 std::string origin_url_; | 143 std::string origin_url_; |
| 144 | 144 |
| 145 scoped_ptr<SpeechRecognitionRequest> request_; | 145 scoped_ptr<SpeechRecognitionRequest> request_; |
| 146 scoped_refptr<media::AudioInputController> audio_controller_; | 146 scoped_refptr<media::AudioInputController> audio_controller_; |
| 147 scoped_refptr<net::URLRequestContextGetter> context_getter_; | 147 scoped_refptr<net::URLRequestContextGetter> context_getter_; |
| 148 AudioEncoder::Codec codec_; | 148 AudioEncoder::Codec codec_; |
| 149 scoped_ptr<AudioEncoder> encoder_; | 149 scoped_ptr<AudioEncoder> encoder_; |
| 150 Endpointer endpointer_; | 150 Endpointer endpointer_; |
| 151 int num_samples_recorded_; | 151 int num_samples_recorded_; |
| 152 float audio_level_; | 152 float audio_level_; |
| 153 | 153 |
| 154 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer); | 154 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer); |
| 155 }; | 155 }; |
| 156 | 156 |
| 157 // This typedef is to workaround the issue with certain versions of | 157 // This typedef is to workaround the issue with certain versions of |
| 158 // Visual Studio where it gets confused between multiple Delegate | 158 // Visual Studio where it gets confused between multiple Delegate |
| 159 // classes and gives a C2500 error. (I saw this error on the try bots - | 159 // classes and gives a C2500 error. (I saw this error on the try bots - |
| 160 // the workaround was not needed for my machine). | 160 // the workaround was not needed for my machine). |
| 161 typedef SpeechRecognizer::Delegate SpeechRecognizerDelegate; | 161 typedef SpeechRecognizer::Delegate SpeechRecognizerDelegate; |
| 162 | 162 |
| 163 } // namespace speech_input | 163 } // namespace speech_input |
| 164 | 164 |
| 165 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ | 165 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ |
| OLD | NEW |