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

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

Issue 11421103: Update the Speech Api to support array(s) of result items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix issue with page reloads and add a TODO. Created 8 years 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_SPEECH_RECOGNIZER_H_ 5 #ifndef CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_
6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ 6 #define CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 EVENT_MAX_VALUE = EVENT_AUDIO_ERROR 76 EVENT_MAX_VALUE = EVENT_AUDIO_ERROR
77 }; 77 };
78 78
79 struct FSMEventArgs { 79 struct FSMEventArgs {
80 explicit FSMEventArgs(FSMEvent event_value); 80 explicit FSMEventArgs(FSMEvent event_value);
81 ~FSMEventArgs(); 81 ~FSMEventArgs();
82 82
83 FSMEvent event; 83 FSMEvent event;
84 int audio_error_code; 84 int audio_error_code;
85 scoped_refptr<AudioChunk> audio_data; 85 scoped_refptr<AudioChunk> audio_data;
86 SpeechRecognitionResult engine_result; 86 SpeechRecognitionResults engine_results;
87 SpeechRecognitionError engine_error; 87 SpeechRecognitionError engine_error;
88 }; 88 };
89 89
90 virtual ~SpeechRecognizer(); 90 virtual ~SpeechRecognizer();
91 91
92 // Entry point for pushing any new external event into the recognizer FSM. 92 // Entry point for pushing any new external event into the recognizer FSM.
93 void DispatchEvent(const FSMEventArgs& event_args); 93 void DispatchEvent(const FSMEventArgs& event_args);
94 94
95 // Defines the behavior of the recognizer FSM, selecting the appropriate 95 // Defines the behavior of the recognizer FSM, selecting the appropriate
96 // transition according to the current state and event. 96 // transition according to the current state and event.
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 // AudioInputController::EventHandler methods. 129 // AudioInputController::EventHandler methods.
130 virtual void OnCreated(media::AudioInputController* controller) OVERRIDE {} 130 virtual void OnCreated(media::AudioInputController* controller) OVERRIDE {}
131 virtual void OnRecording(media::AudioInputController* controller) OVERRIDE {} 131 virtual void OnRecording(media::AudioInputController* controller) OVERRIDE {}
132 virtual void OnError(media::AudioInputController* controller, 132 virtual void OnError(media::AudioInputController* controller,
133 int error_code) OVERRIDE; 133 int error_code) OVERRIDE;
134 virtual void OnData(media::AudioInputController* controller, 134 virtual void OnData(media::AudioInputController* controller,
135 const uint8* data, uint32 size) OVERRIDE; 135 const uint8* data, uint32 size) OVERRIDE;
136 136
137 // SpeechRecognitionEngineDelegate methods. 137 // SpeechRecognitionEngineDelegate methods.
138 virtual void OnSpeechRecognitionEngineResult( 138 virtual void OnSpeechRecognitionEngineResults(
139 const SpeechRecognitionResult& result) OVERRIDE; 139 const SpeechRecognitionResults& results) OVERRIDE;
140 virtual void OnSpeechRecognitionEngineError( 140 virtual void OnSpeechRecognitionEngineError(
141 const SpeechRecognitionError& error) OVERRIDE; 141 const SpeechRecognitionError& error) OVERRIDE;
142 142
143 static media::AudioManager* audio_manager_for_tests_; 143 static media::AudioManager* audio_manager_for_tests_;
144 144
145 SpeechRecognitionEventListener* listener_; 145 SpeechRecognitionEventListener* listener_;
146 scoped_ptr<SpeechRecognitionEngine> recognition_engine_; 146 scoped_ptr<SpeechRecognitionEngine> recognition_engine_;
147 Endpointer endpointer_; 147 Endpointer endpointer_;
148 scoped_refptr<media::AudioInputController> audio_controller_; 148 scoped_refptr<media::AudioInputController> audio_controller_;
149 int session_id_; 149 int session_id_;
150 int num_samples_recorded_; 150 int num_samples_recorded_;
151 float audio_level_; 151 float audio_level_;
152 bool is_dispatching_event_; 152 bool is_dispatching_event_;
153 bool is_single_shot_; 153 bool is_single_shot_;
154 FSMState state_; 154 FSMState state_;
155 155
156 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer); 156 DISALLOW_COPY_AND_ASSIGN(SpeechRecognizer);
157 }; 157 };
158 158
159 } // namespace content 159 } // namespace content
160 160
161 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_ 161 #endif // CONTENT_BROWSER_SPEECH_SPEECH_RECOGNIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698