Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(418)

Side by Side Diff: content/browser/speech/google_one_shot_remote_engine.h

Issue 10233010: Introducing new data types and IPC messages for scripted JS speech recognition APIs (Speech CL2.0) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added CONTENT_EXPORT to SpeechRecognitionEngine::Config Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 namespace net { 26 namespace net {
27 class URLRequestContextGetter; 27 class URLRequestContextGetter;
28 } 28 }
29 29
30 namespace speech { 30 namespace speech {
31 31
32 class AudioChunk; 32 class AudioChunk;
33 33
34 struct CONTENT_EXPORT GoogleOneShotRemoteEngineConfig {
35 std::string language;
36 std::string grammar;
37 bool filter_profanities;
38 std::string hardware_info;
39 std::string origin_url;
40 int audio_sample_rate;
41 int audio_num_bits_per_sample;
42
43 GoogleOneShotRemoteEngineConfig();
44 ~GoogleOneShotRemoteEngineConfig();
45 };
46
47 // Implements a SpeechRecognitionEngine by means of remote interaction with 34 // Implements a SpeechRecognitionEngine by means of remote interaction with
48 // Google speech recognition webservice. 35 // Google speech recognition webservice.
49 class CONTENT_EXPORT GoogleOneShotRemoteEngine 36 class CONTENT_EXPORT GoogleOneShotRemoteEngine
50 : public NON_EXPORTED_BASE(SpeechRecognitionEngine), 37 : public NON_EXPORTED_BASE(SpeechRecognitionEngine),
51 public content::URLFetcherDelegate { 38 public content::URLFetcherDelegate {
52 public: 39 public:
53 // Duration of each audio packet. 40 // Duration of each audio packet.
54 static const int kAudioPacketIntervalMs; 41 static const int kAudioPacketIntervalMs;
55 // ID passed to URLFetcher::Create(). Used for testing. 42 // ID passed to URLFetcher::Create(). Used for testing.
56 static int url_fetcher_id_for_tests; 43 static int url_fetcher_id_for_tests;
57 44
58 explicit GoogleOneShotRemoteEngine(net::URLRequestContextGetter* context); 45 explicit GoogleOneShotRemoteEngine(net::URLRequestContextGetter* context);
59 virtual ~GoogleOneShotRemoteEngine(); 46 virtual ~GoogleOneShotRemoteEngine();
60 void SetConfig(const GoogleOneShotRemoteEngineConfig& config);
61 47
62 // SpeechRecognitionEngine methods. 48 // SpeechRecognitionEngine methods.
49 virtual void SetConfig(const SpeechRecognitionEngineConfig& config) OVERRIDE;
63 virtual void StartRecognition() OVERRIDE; 50 virtual void StartRecognition() OVERRIDE;
64 virtual void EndRecognition() OVERRIDE; 51 virtual void EndRecognition() OVERRIDE;
65 virtual void TakeAudioChunk(const AudioChunk& data) OVERRIDE; 52 virtual void TakeAudioChunk(const AudioChunk& data) OVERRIDE;
66 virtual void AudioChunksEnded() OVERRIDE; 53 virtual void AudioChunksEnded() OVERRIDE;
67 virtual bool IsRecognitionPending() const OVERRIDE; 54 virtual bool IsRecognitionPending() const OVERRIDE;
68 virtual int GetDesiredAudioChunkDurationMs() const OVERRIDE; 55 virtual int GetDesiredAudioChunkDurationMs() const OVERRIDE;
69 56
70 // content::URLFetcherDelegate methods. 57 // content::URLFetcherDelegate methods.
71 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; 58 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE;
72 59
73 private: 60 private:
74 GoogleOneShotRemoteEngineConfig config_; 61 SpeechRecognitionEngineConfig config_;
75 scoped_ptr<content::URLFetcher> url_fetcher_; 62 scoped_ptr<content::URLFetcher> url_fetcher_;
76 scoped_refptr<net::URLRequestContextGetter> url_context_; 63 scoped_refptr<net::URLRequestContextGetter> url_context_;
77 scoped_ptr<AudioEncoder> encoder_; 64 scoped_ptr<AudioEncoder> encoder_;
78 65
79 DISALLOW_COPY_AND_ASSIGN(GoogleOneShotRemoteEngine); 66 DISALLOW_COPY_AND_ASSIGN(GoogleOneShotRemoteEngine);
80 }; 67 };
81 68
82 } // namespace speech 69 } // namespace speech
83 70
84 #endif // CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_ 71 #endif // CONTENT_BROWSER_SPEECH_GOOGLE_ONE_SHOT_REMOTE_ENGINE_H_
OLDNEW
« no previous file with comments | « chrome/browser/speech/speech_input_extension_apitest.cc ('k') | content/browser/speech/google_one_shot_remote_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698