| 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/net/url_fetcher.h" | 15 #include "content/common/net/url_fetcher.h" |
| 15 #include "content/common/speech_input_result.h" | 16 #include "content/common/speech_input_result.h" |
| 16 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 17 | 18 |
| 18 class URLFetcher; | 19 class URLFetcher; |
| 19 | 20 |
| 20 namespace net { | 21 namespace net { |
| 21 class URLRequestContextGetter; | 22 class URLRequestContextGetter; |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace speech_input { | 25 namespace speech_input { |
| 25 | 26 |
| 26 // 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 |
| 27 // and get back recognition results. | 28 // and get back recognition results. |
| 28 class SpeechRecognitionRequest : public URLFetcher::Delegate { | 29 class SpeechRecognitionRequest : public URLFetcher::Delegate { |
| 29 public: | 30 public: |
| 30 // ID passed to URLFetcher::Create(). Used for testing. | 31 // ID passed to URLFetcher::Create(). Used for testing. |
| 31 static int url_fetcher_id_for_tests; | 32 static int url_fetcher_id_for_tests; |
| 32 | 33 |
| 33 // Interface for receiving callbacks from this object. | 34 // Interface for receiving callbacks from this object. |
| 34 class Delegate { | 35 class CONTENT_EXPORT Delegate { |
| 35 public: | 36 public: |
| 36 virtual void SetRecognitionResult( | 37 virtual void SetRecognitionResult( |
| 37 bool error, const SpeechInputResultArray& result) = 0; | 38 bool error, const SpeechInputResultArray& result) = 0; |
| 38 | 39 |
| 39 protected: | 40 protected: |
| 40 virtual ~Delegate() {} | 41 virtual ~Delegate() {} |
| 41 }; | 42 }; |
| 42 | 43 |
| 43 // |url| is the server address to which the request wil be sent. | 44 // |url| is the server address to which the request wil be sent. |
| 44 SpeechRecognitionRequest(net::URLRequestContextGetter* context, | 45 SpeechRecognitionRequest(net::URLRequestContextGetter* context, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 | 80 |
| 80 // This typedef is to workaround the issue with certain versions of | 81 // This typedef is to workaround the issue with certain versions of |
| 81 // Visual Studio where it gets confused between multiple Delegate | 82 // Visual Studio where it gets confused between multiple Delegate |
| 82 // classes and gives a C2500 error. (I saw this error on the try bots - | 83 // classes and gives a C2500 error. (I saw this error on the try bots - |
| 83 // the workaround was not needed for my machine). | 84 // the workaround was not needed for my machine). |
| 84 typedef SpeechRecognitionRequest::Delegate SpeechRecognitionRequestDelegate; | 85 typedef SpeechRecognitionRequest::Delegate SpeechRecognitionRequestDelegate; |
| 85 | 86 |
| 86 } // namespace speech_input | 87 } // namespace speech_input |
| 87 | 88 |
| 88 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ | 89 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ |
| OLD | NEW |