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

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

Issue 6115001: Listen for tab close notifications and cancel active speech sessions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 11 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
« no previous file with comments | « chrome/browser/speech/speech_input_bubble_views.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/speech/speech_input_manager.h" 5 #include "chrome/browser/speech/speech_input_manager.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 virtual ~SpeechInputManagerImpl(); 132 virtual ~SpeechInputManagerImpl();
133 133
134 bool HasPendingRequest(int caller_id) const; 134 bool HasPendingRequest(int caller_id) const;
135 SpeechInputManagerDelegate* GetDelegate(int caller_id) const; 135 SpeechInputManagerDelegate* GetDelegate(int caller_id) const;
136 136
137 void CancelRecognitionAndInformDelegate(int caller_id); 137 void CancelRecognitionAndInformDelegate(int caller_id);
138 138
139 // Starts/restarts recognition for an existing request. 139 // Starts/restarts recognition for an existing request.
140 void StartRecognitionForRequest(int caller_id); 140 void StartRecognitionForRequest(int caller_id);
141 141
142 SpeechInputManagerDelegate* delegate_;
143 typedef std::map<int, SpeechInputRequest> SpeechRecognizerMap; 142 typedef std::map<int, SpeechInputRequest> SpeechRecognizerMap;
144 SpeechRecognizerMap requests_; 143 SpeechRecognizerMap requests_;
145 int recording_caller_id_; 144 int recording_caller_id_;
146 scoped_refptr<SpeechInputBubbleController> bubble_controller_; 145 scoped_refptr<SpeechInputBubbleController> bubble_controller_;
147 scoped_refptr<HardwareInfo> hardware_info_; 146 scoped_refptr<HardwareInfo> hardware_info_;
148 }; 147 };
149 148
150 static ::base::LazyInstance<SpeechInputManagerImpl> g_speech_input_manager_impl( 149 static ::base::LazyInstance<SpeechInputManagerImpl> g_speech_input_manager_impl(
151 base::LINKER_INITIALIZED); 150 base::LINKER_INITIALIZED);
152 151
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 // to the user, abort it since user has switched focus. Otherwise 354 // to the user, abort it since user has switched focus. Otherwise
356 // recognition has started and keep that going so user can start speaking to 355 // recognition has started and keep that going so user can start speaking to
357 // another element while this gets the results in parallel. 356 // another element while this gets the results in parallel.
358 if (recording_caller_id_ == caller_id || !requests_[caller_id].is_active) { 357 if (recording_caller_id_ == caller_id || !requests_[caller_id].is_active) {
359 CancelRecognitionAndInformDelegate(caller_id); 358 CancelRecognitionAndInformDelegate(caller_id);
360 } 359 }
361 } 360 }
362 } 361 }
363 362
364 } // namespace speech_input 363 } // namespace speech_input
OLDNEW
« no previous file with comments | « chrome/browser/speech/speech_input_bubble_views.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698