| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/renderer_host/media/media_stream_ui_proxy.h" | 10 #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 base::MessageLoop::current()->PostTask( | 283 base::MessageLoop::current()->PostTask( |
| 284 FROM_HERE, | 284 FROM_HERE, |
| 285 base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent, | 285 base::Bind(&SpeechRecognitionManagerImpl::DispatchEvent, |
| 286 weak_factory_.GetWeakPtr(), | 286 weak_factory_.GetWeakPtr(), |
| 287 session_id, | 287 session_id, |
| 288 EVENT_STOP_CAPTURE)); | 288 EVENT_STOP_CAPTURE)); |
| 289 } | 289 } |
| 290 | 290 |
| 291 // Here begins the SpeechRecognitionEventListener interface implementation, | 291 // Here begins the SpeechRecognitionEventListener interface implementation, |
| 292 // which will simply relay the events to the proper listener registered for the | 292 // which will simply relay the events to the proper listener registered for the |
| 293 // particular session (most likely InputTagSpeechDispatcherHost) and to the | 293 // particular session and to the catch-all listener provided by the delegate |
| 294 // catch-all listener provided by the delegate (if any). | 294 // (if any). |
| 295 | 295 |
| 296 void SpeechRecognitionManagerImpl::OnRecognitionStart(int session_id) { | 296 void SpeechRecognitionManagerImpl::OnRecognitionStart(int session_id) { |
| 297 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 297 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 298 if (!SessionExists(session_id)) | 298 if (!SessionExists(session_id)) |
| 299 return; | 299 return; |
| 300 | 300 |
| 301 SessionsTable::iterator iter = sessions_.find(session_id); | 301 SessionsTable::iterator iter = sessions_.find(session_id); |
| 302 if (iter->second->ui) { | 302 if (iter->second->ui) { |
| 303 // Notify the UI that the devices are being used. | 303 // Notify the UI that the devices are being used. |
| 304 iter->second->ui->OnStarted(base::Closure(), | 304 iter->second->ui->OnStarted(base::Closure(), |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 SpeechRecognitionManagerImpl::Session::Session() | 691 SpeechRecognitionManagerImpl::Session::Session() |
| 692 : id(kSessionIDInvalid), | 692 : id(kSessionIDInvalid), |
| 693 abort_requested(false), | 693 abort_requested(false), |
| 694 listener_is_active(true) { | 694 listener_is_active(true) { |
| 695 } | 695 } |
| 696 | 696 |
| 697 SpeechRecognitionManagerImpl::Session::~Session() { | 697 SpeechRecognitionManagerImpl::Session::~Session() { |
| 698 } | 698 } |
| 699 | 699 |
| 700 } // namespace content | 700 } // namespace content |
| OLD | NEW |