| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/public/common/url_fetcher_delegate.h" | 15 #include "content/public/common/url_fetcher_delegate.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 | 17 |
| 18 class URLFetcher; | 18 class URLFetcher; |
| 19 | 19 |
| 20 namespace content { | 20 namespace content { |
| 21 struct SpeechInputResult; | 21 struct SpeechRecognitionResult; |
| 22 } | 22 } |
| 23 | 23 |
| 24 namespace net { | 24 namespace net { |
| 25 class URLRequestContextGetter; | 25 class URLRequestContextGetter; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace speech_input { | 28 namespace speech { |
| 29 | 29 |
| 30 // Provides a simple interface for sending recorded speech data to the server | 30 // Provides a simple interface for sending recorded speech data to the server |
| 31 // and get back recognition results. | 31 // and get back recognition results. |
| 32 class SpeechRecognitionRequest : public content::URLFetcherDelegate { | 32 class SpeechRecognitionRequest : public content::URLFetcherDelegate { |
| 33 public: | 33 public: |
| 34 // ID passed to URLFetcher::Create(). Used for testing. | 34 // ID passed to URLFetcher::Create(). Used for testing. |
| 35 CONTENT_EXPORT static int url_fetcher_id_for_tests; | 35 CONTENT_EXPORT static int url_fetcher_id_for_tests; |
| 36 | 36 |
| 37 // Interface for receiving callbacks from this object. | 37 // Interface for receiving callbacks from this object. |
| 38 class CONTENT_EXPORT Delegate { | 38 class CONTENT_EXPORT Delegate { |
| 39 public: | 39 public: |
| 40 virtual void SetRecognitionResult( | 40 virtual void SetRecognitionResult( |
| 41 const content::SpeechInputResult& result) = 0; | 41 const content::SpeechRecognitionResult& result) = 0; |
| 42 | 42 |
| 43 protected: | 43 protected: |
| 44 virtual ~Delegate() {} | 44 virtual ~Delegate() {} |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 // |url| is the server address to which the request wil be sent. | 47 // |url| is the server address to which the request wil be sent. |
| 48 CONTENT_EXPORT SpeechRecognitionRequest(net::URLRequestContextGetter* context, | 48 CONTENT_EXPORT SpeechRecognitionRequest(net::URLRequestContextGetter* context, |
| 49 Delegate* delegate); | 49 Delegate* delegate); |
| 50 | 50 |
| 51 CONTENT_EXPORT virtual ~SpeechRecognitionRequest(); | 51 CONTENT_EXPORT virtual ~SpeechRecognitionRequest(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionRequest); | 77 DISALLOW_COPY_AND_ASSIGN(SpeechRecognitionRequest); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 // This typedef is to workaround the issue with certain versions of | 80 // This typedef is to workaround the issue with certain versions of |
| 81 // Visual Studio where it gets confused between multiple Delegate | 81 // Visual Studio where it gets confused between multiple Delegate |
| 82 // 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 - |
| 83 // the workaround was not needed for my machine). | 83 // the workaround was not needed for my machine). |
| 84 typedef SpeechRecognitionRequest::Delegate SpeechRecognitionRequestDelegate; | 84 typedef SpeechRecognitionRequest::Delegate SpeechRecognitionRequestDelegate; |
| 85 | 85 |
| 86 } // namespace speech_input | 86 } // namespace speech |
| 87 | 87 |
| 88 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ | 88 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_ |
| OLD | NEW |