| 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_RECOGNITION_REQUEST_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ |
| 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ | 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "content/common/net/url_fetcher.h" | 15 #include "content/common/net/url_fetcher.h" |
| 16 #include "content/common/speech_input_result.h" | 16 #include "content/common/speech_input_result.h" |
| 17 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 18 | 18 |
| 19 class SpeechInputPreferences; |
| 19 class URLFetcher; | 20 class URLFetcher; |
| 20 | 21 |
| 21 namespace net { | 22 namespace net { |
| 22 class URLRequestContextGetter; | 23 class URLRequestContextGetter; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace speech_input { | 26 namespace speech_input { |
| 26 | 27 |
| 27 // Provides a simple interface for sending recorded speech data to the server | 28 // Provides a simple interface for sending recorded speech data to the server |
| 28 // and get back recognition results. | 29 // and get back recognition results. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 45 SpeechRecognitionRequest(net::URLRequestContextGetter* context, | 46 SpeechRecognitionRequest(net::URLRequestContextGetter* context, |
| 46 Delegate* delegate); | 47 Delegate* delegate); |
| 47 | 48 |
| 48 virtual ~SpeechRecognitionRequest(); | 49 virtual ~SpeechRecognitionRequest(); |
| 49 | 50 |
| 50 // Sends a new request with the given audio data, returns true if successful. | 51 // Sends a new request with the given audio data, returns true if successful. |
| 51 // The same object can be used to send multiple requests but only after the | 52 // The same object can be used to send multiple requests but only after the |
| 52 // previous request has completed. | 53 // previous request has completed. |
| 53 void Start(const std::string& language, | 54 void Start(const std::string& language, |
| 54 const std::string& grammar, | 55 const std::string& grammar, |
| 55 bool censor_results, | 56 SpeechInputPreferences* speech_input_prefs, |
| 56 const std::string& hardware_info, | 57 const std::string& hardware_info, |
| 57 const std::string& origin_url, | 58 const std::string& origin_url, |
| 58 const std::string& content_type); | 59 const std::string& content_type); |
| 59 | 60 |
| 60 // Send a single chunk of audio immediately to the server. | 61 // Send a single chunk of audio immediately to the server. |
| 61 void UploadAudioChunk(const std::string& audio_data, bool is_last_chunk); | 62 void UploadAudioChunk(const std::string& audio_data, bool is_last_chunk); |
| 62 | 63 |
| 63 bool HasPendingRequest() { return url_fetcher_ != NULL; } | 64 bool HasPendingRequest() { return url_fetcher_ != NULL; } |
| 64 | 65 |
| 65 // URLFetcher::Delegate methods. | 66 // URLFetcher::Delegate methods. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 80 | 81 |
| 81 // This typedef is to workaround the issue with certain versions of | 82 // This typedef is to workaround the issue with certain versions of |
| 82 // Visual Studio where it gets confused between multiple Delegate | 83 // Visual Studio where it gets confused between multiple Delegate |
| 83 // classes and gives a C2500 error. (I saw this error on the try bots - | 84 // classes and gives a C2500 error. (I saw this error on the try bots - |
| 84 // the workaround was not needed for my machine). | 85 // the workaround was not needed for my machine). |
| 85 typedef SpeechRecognitionRequest::Delegate SpeechRecognitionRequestDelegate; | 86 typedef SpeechRecognitionRequest::Delegate SpeechRecognitionRequestDelegate; |
| 86 | 87 |
| 87 } // namespace speech_input | 88 } // namespace speech_input |
| 88 | 89 |
| 89 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ | 90 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ |
| OLD | NEW |