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 #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 Loading... |
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::OnRecognitionResults( | 332 void SpeechRecognitionManagerImpl::OnRecognitionResult( |
333 int session_id, const SpeechRecognitionResults& results) { | 333 int session_id, const SpeechRecognitionResult& result) { |
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->OnRecognitionResults(session_id, results); | 339 delegate_listener->OnRecognitionResult(session_id, result); |
340 if (SpeechRecognitionEventListener* listener = GetListener(session_id)) | 340 if (SpeechRecognitionEventListener* listener = GetListener(session_id)) |
341 listener->OnRecognitionResults(session_id, results); | 341 listener->OnRecognitionResult(session_id, result); |
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 Loading... |
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 |
OLD | NEW |