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

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

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: sigh 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 #include "content/browser/speech/speech_recognition_manager_impl.h" 5 #include "content/browser/speech/speech_recognition_manager_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/browser/browser_main_loop.h" 8 #include "content/browser/browser_main_loop.h"
9 #include "content/browser/renderer_host/media/media_stream_manager.h" 9 #include "content/browser/renderer_host/media/media_stream_manager.h"
10 #include "content/browser/speech/google_one_shot_remote_engine.h" 10 #include "content/browser/speech/google_one_shot_remote_engine.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 322
323 if (SpeechRecognitionEventListener* delegate_listener = GetDelegateListener()) 323 if (SpeechRecognitionEventListener* delegate_listener = GetDelegateListener())
324 delegate_listener->OnAudioEnd(session_id); 324 delegate_listener->OnAudioEnd(session_id);
325 if (SpeechRecognitionEventListener* listener = GetListener(session_id)) 325 if (SpeechRecognitionEventListener* listener = GetListener(session_id))
326 listener->OnAudioEnd(session_id); 326 listener->OnAudioEnd(session_id);
327 MessageLoop::current()->PostTask(FROM_HERE, 327 MessageLoop::current()->PostTask(FROM_HERE,
328 base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent, 328 base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent,
329 weak_factory_.GetWeakPtr(), session_id, EVENT_AUDIO_ENDED)); 329 weak_factory_.GetWeakPtr(), session_id, EVENT_AUDIO_ENDED));
330 } 330 }
331 331
332 void SpeechRecognitionManagerImpl::OnRecognitionResult( 332 void SpeechRecognitionManagerImpl::OnRecognitionResults(
333 int session_id, const SpeechRecognitionResult& result) { 333 int session_id, const SpeechRecognitionResults& results) {
334 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 334 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
335 if (!SessionExists(session_id)) 335 if (!SessionExists(session_id))
336 return; 336 return;
337 337
338 if (SpeechRecognitionEventListener* delegate_listener = GetDelegateListener()) 338 if (SpeechRecognitionEventListener* delegate_listener = GetDelegateListener())
339 delegate_listener->OnRecognitionResult(session_id, result); 339 delegate_listener->OnRecognitionResults(session_id, results);
340 if (SpeechRecognitionEventListener* listener = GetListener(session_id)) 340 if (SpeechRecognitionEventListener* listener = GetListener(session_id))
341 listener->OnRecognitionResult(session_id, result); 341 listener->OnRecognitionResults(session_id, results);
342 } 342 }
343 343
344 void SpeechRecognitionManagerImpl::OnRecognitionError( 344 void SpeechRecognitionManagerImpl::OnRecognitionError(
345 int session_id, const SpeechRecognitionError& error) { 345 int session_id, const SpeechRecognitionError& error) {
346 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 346 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
347 if (!SessionExists(session_id)) 347 if (!SessionExists(session_id))
348 return; 348 return;
349 349
350 if (SpeechRecognitionEventListener* delegate_listener = GetDelegateListener()) 350 if (SpeechRecognitionEventListener* delegate_listener = GetDelegateListener())
351 delegate_listener->OnRecognitionError(session_id, error); 351 delegate_listener->OnRecognitionError(session_id, error);
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 634
635 SpeechRecognitionManagerImpl::Session::Session() 635 SpeechRecognitionManagerImpl::Session::Session()
636 : id(kSessionIDInvalid), 636 : id(kSessionIDInvalid),
637 listener_is_active(true) { 637 listener_is_active(true) {
638 } 638 }
639 639
640 SpeechRecognitionManagerImpl::Session::~Session() { 640 SpeechRecognitionManagerImpl::Session::~Session() {
641 } 641 }
642 642
643 } // namespace content 643 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/speech/speech_recognition_manager_impl.h ('k') | content/browser/speech/speech_recognizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698