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

Side by Side Diff: content/browser/speech/speech_input_manager.cc

Issue 8137005: Applying changes to the existing speech input code to support the extension API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixing unit tests. Created 9 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #include "content/browser/speech/speech_input_manager.h" 5 #include "content/browser/speech/speech_input_manager.h"
6 6
7 #include "content/browser/browser_thread.h" 7 #include "content/browser/browser_thread.h"
8 #include "content/browser/speech/speech_input_preferences.h" 8 #include "content/browser/speech/speech_input_preferences.h"
9 #include "media/audio/audio_manager.h" 9 #include "media/audio/audio_manager.h"
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } 112 }
113 } 113 }
114 } 114 }
115 115
116 void SpeechInputManager::StopRecording(int caller_id) { 116 void SpeechInputManager::StopRecording(int caller_id) {
117 DCHECK(HasPendingRequest(caller_id)); 117 DCHECK(HasPendingRequest(caller_id));
118 requests_[caller_id].recognizer->StopRecording(); 118 requests_[caller_id].recognizer->StopRecording();
119 } 119 }
120 120
121 void SpeechInputManager::SetRecognitionResult( 121 void SpeechInputManager::SetRecognitionResult(
122 int caller_id, bool error, const SpeechInputResultArray& result) { 122 int caller_id, bool error, const SpeechInputResult& result) {
123 DCHECK(HasPendingRequest(caller_id)); 123 DCHECK(HasPendingRequest(caller_id));
124 GetDelegate(caller_id)->SetRecognitionResult(caller_id, result); 124 GetDelegate(caller_id)->SetRecognitionResult(caller_id, result);
125 } 125 }
126 126
127 void SpeechInputManager::DidCompleteRecording(int caller_id) { 127 void SpeechInputManager::DidCompleteRecording(int caller_id) {
128 DCHECK(recording_caller_id_ == caller_id); 128 DCHECK(recording_caller_id_ == caller_id);
129 DCHECK(HasPendingRequest(caller_id)); 129 DCHECK(HasPendingRequest(caller_id));
130 recording_caller_id_ = 0; 130 recording_caller_id_ = 0;
131 GetDelegate(caller_id)->DidCompleteRecording(caller_id); 131 GetDelegate(caller_id)->DidCompleteRecording(caller_id);
132 ShowRecognizing(caller_id); 132 ShowRecognizing(caller_id);
133 } 133 }
134 134
135 void SpeechInputManager::DidCompleteRecognition(int caller_id) { 135 void SpeechInputManager::DidCompleteRecognition(int caller_id) {
136 GetDelegate(caller_id)->DidCompleteRecognition(caller_id); 136 GetDelegate(caller_id)->DidCompleteRecognition(caller_id);
137 requests_.erase(caller_id); 137 requests_.erase(caller_id);
138 DoClose(caller_id); 138 DoClose(caller_id);
139 } 139 }
140 140
141 void SpeechInputManager::DidSpeechInputStart(int caller_id) {
142 }
143
144 void SpeechInputManager::DidSpeechInputStop(int caller_id) {
145 }
146
147 void SpeechInputManager::OnRecording(int caller_id) {
148 }
149
141 void SpeechInputManager::OnRecognizerError( 150 void SpeechInputManager::OnRecognizerError(
142 int caller_id, SpeechRecognizer::ErrorCode error) { 151 int caller_id, SpeechRecognizer::ErrorCode error) {
143 if (caller_id == recording_caller_id_) 152 if (caller_id == recording_caller_id_)
144 recording_caller_id_ = 0; 153 recording_caller_id_ = 0;
145 requests_[caller_id].is_active = false; 154 requests_[caller_id].is_active = false;
146 ShowRecognizerError(caller_id, error); 155 ShowRecognizerError(caller_id, error);
147 } 156 }
148 157
149 void SpeechInputManager::DidStartReceivingAudio(int caller_id) { 158 void SpeechInputManager::DidStartReceivingAudio(int caller_id) {
150 DCHECK(HasPendingRequest(caller_id)); 159 DCHECK(HasPendingRequest(caller_id));
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 198
190 SpeechInputManager::SpeechInputRequest::SpeechInputRequest() 199 SpeechInputManager::SpeechInputRequest::SpeechInputRequest()
191 : delegate(NULL), 200 : delegate(NULL),
192 is_active(false) { 201 is_active(false) {
193 } 202 }
194 203
195 SpeechInputManager::SpeechInputRequest::~SpeechInputRequest() { 204 SpeechInputManager::SpeechInputRequest::~SpeechInputRequest() {
196 } 205 }
197 206
198 } // namespace speech_input 207 } // namespace speech_input
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698