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 |
(...skipping 16 matching lines...) Expand all Loading... |
27 // Provides a simple interface for sending recorded speech data to the server | 27 // Provides a simple interface for sending recorded speech data to the server |
28 // and get back recognition results. | 28 // and get back recognition results. |
29 class SpeechRecognitionRequest : public URLFetcher::Delegate { | 29 class SpeechRecognitionRequest : public URLFetcher::Delegate { |
30 public: | 30 public: |
31 // ID passed to URLFetcher::Create(). Used for testing. | 31 // ID passed to URLFetcher::Create(). Used for testing. |
32 CONTENT_EXPORT static int url_fetcher_id_for_tests; | 32 CONTENT_EXPORT static int url_fetcher_id_for_tests; |
33 | 33 |
34 // Interface for receiving callbacks from this object. | 34 // Interface for receiving callbacks from this object. |
35 class CONTENT_EXPORT Delegate { | 35 class CONTENT_EXPORT Delegate { |
36 public: | 36 public: |
37 virtual void SetRecognitionResult( | 37 virtual void SetRecognitionResult(const SpeechInputResult& result) = 0; |
38 bool error, const SpeechInputResultArray& result) = 0; | |
39 | 38 |
40 protected: | 39 protected: |
41 virtual ~Delegate() {} | 40 virtual ~Delegate() {} |
42 }; | 41 }; |
43 | 42 |
44 // |url| is the server address to which the request wil be sent. | 43 // |url| is the server address to which the request wil be sent. |
45 CONTENT_EXPORT SpeechRecognitionRequest(net::URLRequestContextGetter* context, | 44 CONTENT_EXPORT SpeechRecognitionRequest(net::URLRequestContextGetter* context, |
46 Delegate* delegate); | 45 Delegate* delegate); |
47 | 46 |
48 CONTENT_EXPORT virtual ~SpeechRecognitionRequest(); | 47 CONTENT_EXPORT virtual ~SpeechRecognitionRequest(); |
(...skipping 27 matching lines...) Expand all Loading... |
76 | 75 |
77 // This typedef is to workaround the issue with certain versions of | 76 // This typedef is to workaround the issue with certain versions of |
78 // Visual Studio where it gets confused between multiple Delegate | 77 // Visual Studio where it gets confused between multiple Delegate |
79 // classes and gives a C2500 error. (I saw this error on the try bots - | 78 // classes and gives a C2500 error. (I saw this error on the try bots - |
80 // the workaround was not needed for my machine). | 79 // the workaround was not needed for my machine). |
81 typedef SpeechRecognitionRequest::Delegate SpeechRecognitionRequestDelegate; | 80 typedef SpeechRecognitionRequest::Delegate SpeechRecognitionRequestDelegate; |
82 | 81 |
83 } // namespace speech_input | 82 } // namespace speech_input |
84 | 83 |
85 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ | 84 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ |
OLD | NEW |