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_STREAMING_REMOTE_ENGINE_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_GOOGLE_STREAMING_REMOTE_ENGINE_H_ |
6 #define CONTENT_BROWSER_SPEECH_GOOGLE_STREAMING_REMOTE_ENGINE_H_ | 6 #define CONTENT_BROWSER_SPEECH_GOOGLE_STREAMING_REMOTE_ENGINE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 public NON_EXPORTED_BASE(base::NonThreadSafe) { | 50 public NON_EXPORTED_BASE(base::NonThreadSafe) { |
51 public: | 51 public: |
52 // Duration of each audio packet. | 52 // Duration of each audio packet. |
53 static const int kAudioPacketIntervalMs; | 53 static const int kAudioPacketIntervalMs; |
54 | 54 |
55 // IDs passed to URLFetcher::Create(). Used for testing. | 55 // IDs passed to URLFetcher::Create(). Used for testing. |
56 static const int kUpstreamUrlFetcherIdForTesting; | 56 static const int kUpstreamUrlFetcherIdForTesting; |
57 static const int kDownstreamUrlFetcherIdForTesting; | 57 static const int kDownstreamUrlFetcherIdForTesting; |
58 | 58 |
59 explicit GoogleStreamingRemoteEngine(net::URLRequestContextGetter* context); | 59 explicit GoogleStreamingRemoteEngine(net::URLRequestContextGetter* context); |
60 virtual ~GoogleStreamingRemoteEngine(); | 60 ~GoogleStreamingRemoteEngine() override; |
61 | 61 |
62 // SpeechRecognitionEngine methods. | 62 // SpeechRecognitionEngine methods. |
63 virtual void SetConfig(const SpeechRecognitionEngineConfig& config) override; | 63 void SetConfig(const SpeechRecognitionEngineConfig& config) override; |
64 virtual void StartRecognition() override; | 64 void StartRecognition() override; |
65 virtual void EndRecognition() override; | 65 void EndRecognition() override; |
66 virtual void TakeAudioChunk(const AudioChunk& data) override; | 66 void TakeAudioChunk(const AudioChunk& data) override; |
67 virtual void AudioChunksEnded() override; | 67 void AudioChunksEnded() override; |
68 virtual bool IsRecognitionPending() const override; | 68 bool IsRecognitionPending() const override; |
69 virtual int GetDesiredAudioChunkDurationMs() const override; | 69 int GetDesiredAudioChunkDurationMs() const override; |
70 | 70 |
71 // net::URLFetcherDelegate methods. | 71 // net::URLFetcherDelegate methods. |
72 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; | 72 void OnURLFetchComplete(const net::URLFetcher* source) override; |
73 virtual void OnURLFetchDownloadProgress(const net::URLFetcher* source, | 73 void OnURLFetchDownloadProgress(const net::URLFetcher* source, |
74 int64 current, int64 total) override; | 74 int64 current, |
| 75 int64 total) override; |
75 | 76 |
76 private: | 77 private: |
77 // Response status codes from the speech recognition webservice. | 78 // Response status codes from the speech recognition webservice. |
78 static const int kWebserviceStatusNoError; | 79 static const int kWebserviceStatusNoError; |
79 static const int kWebserviceStatusErrorNoMatch; | 80 static const int kWebserviceStatusErrorNoMatch; |
80 | 81 |
81 // Data types for the internal Finite State Machine (FSM). | 82 // Data types for the internal Finite State Machine (FSM). |
82 enum FSMState { | 83 enum FSMState { |
83 STATE_IDLE = 0, | 84 STATE_IDLE = 0, |
84 STATE_BOTH_STREAMS_CONNECTED, | 85 STATE_BOTH_STREAMS_CONNECTED, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 bool got_last_definitive_result_; | 153 bool got_last_definitive_result_; |
153 bool is_dispatching_event_; | 154 bool is_dispatching_event_; |
154 FSMState state_; | 155 FSMState state_; |
155 | 156 |
156 DISALLOW_COPY_AND_ASSIGN(GoogleStreamingRemoteEngine); | 157 DISALLOW_COPY_AND_ASSIGN(GoogleStreamingRemoteEngine); |
157 }; | 158 }; |
158 | 159 |
159 } // namespace content | 160 } // namespace content |
160 | 161 |
161 #endif // CONTENT_BROWSER_SPEECH_GOOGLE_STREAMING_REMOTE_ENGINE_H_ | 162 #endif // CONTENT_BROWSER_SPEECH_GOOGLE_STREAMING_REMOTE_ENGINE_H_ |
OLD | NEW |