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