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

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

Issue 7989001: Remove use of default request context and fix use of speech censor flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_input_manager.h" 5 #include "content/browser/speech/speech_input_manager.h"
6 6
7 #include "content/browser/browser_thread.h" 7 #include "content/browser/browser_thread.h"
8 #include "media/audio/audio_manager.h" 8 #include "media/audio/audio_manager.h"
9 9
10 namespace speech_input { 10 namespace speech_input {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } 45 }
46 46
47 void SpeechInputManager::StartRecognition( 47 void SpeechInputManager::StartRecognition(
48 SpeechInputManagerDelegate* delegate, 48 SpeechInputManagerDelegate* delegate,
49 int caller_id, 49 int caller_id,
50 int render_process_id, 50 int render_process_id,
51 int render_view_id, 51 int render_view_id,
52 const gfx::Rect& element_rect, 52 const gfx::Rect& element_rect,
53 const std::string& language, 53 const std::string& language,
54 const std::string& grammar, 54 const std::string& grammar,
55 const std::string& origin_url) { 55 const std::string& origin_url,
56 net::URLRequestContextGetter* context_getter,
57 bool censor_results) {
56 DCHECK(!HasPendingRequest(caller_id)); 58 DCHECK(!HasPendingRequest(caller_id));
57 59
58 ShowRecognitionRequested( 60 ShowRecognitionRequested(
59 caller_id, render_process_id, render_view_id, element_rect); 61 caller_id, render_process_id, render_view_id, element_rect);
60 GetRequestInfo(&can_report_metrics_, &request_info_); 62 GetRequestInfo(&can_report_metrics_, &request_info_);
61 63
62 SpeechInputRequest* request = &requests_[caller_id]; 64 SpeechInputRequest* request = &requests_[caller_id];
63 request->delegate = delegate; 65 request->delegate = delegate;
64 request->recognizer = new SpeechRecognizer( 66 request->recognizer = new SpeechRecognizer(
65 this, caller_id, language, grammar, censor_results(), 67 this, caller_id, language, grammar, censor_results, context_getter,
66 request_info_, can_report_metrics_ ? origin_url : ""); 68 request_info_, can_report_metrics_ ? origin_url : "");
67 request->is_active = false; 69 request->is_active = false;
68 70
69 StartRecognitionForRequest(caller_id); 71 StartRecognitionForRequest(caller_id);
70 } 72 }
71 73
72 void SpeechInputManager::StartRecognitionForRequest(int caller_id) { 74 void SpeechInputManager::StartRecognitionForRequest(int caller_id) {
73 DCHECK(HasPendingRequest(caller_id)); 75 DCHECK(HasPendingRequest(caller_id));
74 76
75 // If we are currently recording audio for another caller, abort that cleanly. 77 // If we are currently recording audio for another caller, abort that cleanly.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 // to the user, abort it since user has switched focus. Otherwise 180 // to the user, abort it since user has switched focus. Otherwise
179 // recognition has started and keep that going so user can start speaking to 181 // recognition has started and keep that going so user can start speaking to
180 // another element while this gets the results in parallel. 182 // another element while this gets the results in parallel.
181 if (recording_caller_id_ == caller_id || !requests_[caller_id].is_active) { 183 if (recording_caller_id_ == caller_id || !requests_[caller_id].is_active) {
182 CancelRecognitionAndInformDelegate(caller_id); 184 CancelRecognitionAndInformDelegate(caller_id);
183 } 185 }
184 } 186 }
185 } 187 }
186 188
187 } // namespace speech_input 189 } // namespace speech_input
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698