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

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

Issue 10663018: Changing tab closure handling logic in speech recognition code and cleaning bubble controller. (Spe… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Slight refactor to fix a bug on mac + rebase Created 8 years, 5 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) 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/speech/google_one_shot_remote_engine.h" 9 #include "content/browser/speech/google_one_shot_remote_engine.h"
10 #include "content/browser/speech/google_streaming_remote_engine.h" 10 #include "content/browser/speech/google_streaming_remote_engine.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 for (SessionsTable::iterator it = sessions_.begin(); it != sessions_.end(); 331 for (SessionsTable::iterator it = sessions_.begin(); it != sessions_.end();
332 ++it) { 332 ++it) {
333 Session& session = it->second; 333 Session& session = it->second;
334 if (session.config.event_listener == listener) { 334 if (session.config.event_listener == listener) {
335 AbortSession(session.id); 335 AbortSession(session.id);
336 session.listener_is_active = false; 336 session.listener_is_active = false;
337 } 337 }
338 } 338 }
339 } 339 }
340 340
341 void SpeechRecognitionManagerImpl::AbortAllSessionsForRenderer(
342 int render_process_id, int render_view_id) {
343 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
344 for (SessionsTable::iterator it = sessions_.begin(); it != sessions_.end();
345 ++it) {
346 Session& session = it->second;
347 if (session.context.render_process_id == render_process_id &&
348 session.context.render_view_id == render_view_id) {
349 AbortSession(session.id);
350 }
351 }
352 }
353
341 // ----------------------- Core FSM implementation --------------------------- 354 // ----------------------- Core FSM implementation ---------------------------
342 void SpeechRecognitionManagerImpl::DispatchEvent(int session_id, 355 void SpeechRecognitionManagerImpl::DispatchEvent(int session_id,
343 FSMEvent event) { 356 FSMEvent event) {
344 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 357 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
345 358
346 // There are some corner cases in which the session might be deleted (due to 359 // There are some corner cases in which the session might be deleted (due to
347 // an EndRecognition event) between a request (e.g. Abort) and its dispatch. 360 // an EndRecognition event) between a request (e.g. Abort) and its dispatch.
348 if (!SessionExists(session_id)) 361 if (!SessionExists(session_id))
349 return; 362 return;
350 363
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 542
530 SpeechRecognitionManagerImpl::Session::Session() 543 SpeechRecognitionManagerImpl::Session::Session()
531 : id(kSessionIDInvalid), 544 : id(kSessionIDInvalid),
532 listener_is_active(true) { 545 listener_is_active(true) {
533 } 546 }
534 547
535 SpeechRecognitionManagerImpl::Session::~Session() { 548 SpeechRecognitionManagerImpl::Session::~Session() {
536 } 549 }
537 550
538 } // namespace speech 551 } // namespace speech
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698