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" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "content/browser/speech/audio_encoder.h" | 13 #include "content/browser/speech/audio_encoder.h" |
14 #include "content/browser/speech/speech_recognition_engine.h" | 14 #include "content/browser/speech/speech_recognition_engine.h" |
15 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
17 #include "net/url_request/url_fetcher_delegate.h" | 17 #include "net/url_request/url_fetcher_delegate.h" |
18 | 18 |
19 namespace content { | |
20 struct SpeechRecognitionResult; | |
21 class URLFetcher; | |
22 } | |
23 | |
24 namespace net { | 19 namespace net { |
25 class URLRequestContextGetter; | 20 class URLRequestContextGetter; |
26 } | 21 } |
27 | 22 |
28 namespace speech { | 23 namespace content { |
29 | |
30 class AudioChunk; | |
31 | 24 |
32 // Implements a SpeechRecognitionEngine by means of remote interaction with | 25 // Implements a SpeechRecognitionEngine by means of remote interaction with |
33 // Google speech recognition webservice. | 26 // Google speech recognition webservice. |
34 class CONTENT_EXPORT GoogleOneShotRemoteEngine | 27 class CONTENT_EXPORT GoogleOneShotRemoteEngine |
35 : public NON_EXPORTED_BASE(SpeechRecognitionEngine), | 28 : public NON_EXPORTED_BASE(SpeechRecognitionEngine), |
36 public net::URLFetcherDelegate { | 29 public net::URLFetcherDelegate { |
37 public: | 30 public: |
38 // Duration of each audio packet. | 31 // Duration of each audio packet. |
39 static const int kAudioPacketIntervalMs; | 32 static const int kAudioPacketIntervalMs; |
40 // ID passed to URLFetcher::Create(). Used for testing. | 33 // ID passed to URLFetcher::Create(). Used for testing. |
(...skipping 16 matching lines...) Expand all Loading... |
57 | 50 |
58 private: | 51 private: |
59 SpeechRecognitionEngineConfig config_; | 52 SpeechRecognitionEngineConfig config_; |
60 scoped_ptr<net::URLFetcher> url_fetcher_; | 53 scoped_ptr<net::URLFetcher> url_fetcher_; |
61 scoped_refptr<net::URLRequestContextGetter> url_context_; | 54 scoped_refptr<net::URLRequestContextGetter> url_context_; |
62 scoped_ptr<AudioEncoder> encoder_; | 55 scoped_ptr<AudioEncoder> encoder_; |
63 | 56 |
64 DISALLOW_COPY_AND_ASSIGN(GoogleOneShotRemoteEngine); | 57 DISALLOW_COPY_AND_ASSIGN(GoogleOneShotRemoteEngine); |
65 }; | 58 }; |
66 | 59 |
67 } // namespace speech | 60 } // namespace content |
68 | 61 |
69 #endif // CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_ | 62 #endif // CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_ |
OLD | NEW |