| OLD | NEW |
| 1 // Copyright (c) 2012 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_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_ |
| 6 #define CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_ | 6 #define CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 class AudioChunk; | 30 class AudioChunk; |
| 31 | 31 |
| 32 // Implements a SpeechRecognitionEngine by means of remote interaction with | 32 // Implements a SpeechRecognitionEngine by means of remote interaction with |
| 33 // Google speech recognition webservice. | 33 // Google speech recognition webservice. |
| 34 class CONTENT_EXPORT GoogleOneShotRemoteEngine | 34 class CONTENT_EXPORT GoogleOneShotRemoteEngine |
| 35 : public NON_EXPORTED_BASE(SpeechRecognitionEngine), | 35 : public NON_EXPORTED_BASE(SpeechRecognitionEngine), |
| 36 public net::URLFetcherDelegate { | 36 public net::URLFetcherDelegate { |
| 37 public: | 37 public: |
| 38 // Duration of each audio packet. | 38 // Duration of each audio packet. |
| 39 static const int kAudioPacketIntervalMs; | 39 enum { kAudioPacketIntervalMs = 100 }; |
| 40 |
| 40 // ID passed to URLFetcher::Create(). Used for testing. | 41 // ID passed to URLFetcher::Create(). Used for testing. |
| 41 static int url_fetcher_id_for_tests; | 42 static int url_fetcher_id_for_tests; |
| 42 | 43 |
| 43 explicit GoogleOneShotRemoteEngine(net::URLRequestContextGetter* context); | 44 explicit GoogleOneShotRemoteEngine(net::URLRequestContextGetter* context); |
| 44 virtual ~GoogleOneShotRemoteEngine(); | 45 virtual ~GoogleOneShotRemoteEngine(); |
| 45 | 46 |
| 46 // SpeechRecognitionEngine methods. | 47 // SpeechRecognitionEngine methods. |
| 47 virtual void SetConfig(const SpeechRecognitionEngineConfig& config) OVERRIDE; | 48 virtual void SetConfig(const SpeechRecognitionEngineConfig& config) OVERRIDE; |
| 48 virtual void StartRecognition() OVERRIDE; | 49 virtual void StartRecognition() OVERRIDE; |
| 49 virtual void EndRecognition() OVERRIDE; | 50 virtual void EndRecognition() OVERRIDE; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 60 scoped_ptr<net::URLFetcher> url_fetcher_; | 61 scoped_ptr<net::URLFetcher> url_fetcher_; |
| 61 scoped_refptr<net::URLRequestContextGetter> url_context_; | 62 scoped_refptr<net::URLRequestContextGetter> url_context_; |
| 62 scoped_ptr<AudioEncoder> encoder_; | 63 scoped_ptr<AudioEncoder> encoder_; |
| 63 | 64 |
| 64 DISALLOW_COPY_AND_ASSIGN(GoogleOneShotRemoteEngine); | 65 DISALLOW_COPY_AND_ASSIGN(GoogleOneShotRemoteEngine); |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 } // namespace speech | 68 } // namespace speech |
| 68 | 69 |
| 69 #endif // CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_ | 70 #endif // CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_ |
| OLD | NEW |