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

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

Issue 9369009: Make content::ResourceContext be a real interface like the rest of the Content API (i.e. don't ha... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 8 years, 10 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_dispatcher_host.h" 5 #include "content/browser/speech/speech_input_dispatcher_host.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "content/browser/resource_context.h" 8 #include "content/browser/resource_context.h"
9 #include "content/browser/speech/speech_input_preferences.h" 9 #include "content/browser/speech/speech_input_preferences.h"
10 #include "content/common/speech_input_messages.h" 10 #include "content/common/speech_input_messages.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 SpeechInputManager* SpeechInputDispatcherHost::manager_; 109 SpeechInputManager* SpeechInputDispatcherHost::manager_;
110 110
111 void SpeechInputDispatcherHost::set_manager(SpeechInputManager* manager) { 111 void SpeechInputDispatcherHost::set_manager(SpeechInputManager* manager) {
112 manager_ = manager; 112 manager_ = manager;
113 } 113 }
114 114
115 SpeechInputDispatcherHost::SpeechInputDispatcherHost( 115 SpeechInputDispatcherHost::SpeechInputDispatcherHost(
116 int render_process_id, 116 int render_process_id,
117 net::URLRequestContextGetter* context_getter, 117 net::URLRequestContextGetter* context_getter,
118 SpeechInputPreferences* speech_input_preferences, 118 SpeechInputPreferences* speech_input_preferences,
119 const content::ResourceContext* resource_context) 119 content::ResourceContext* resource_context)
120 : render_process_id_(render_process_id), 120 : render_process_id_(render_process_id),
121 may_have_pending_requests_(false), 121 may_have_pending_requests_(false),
122 context_getter_(context_getter), 122 context_getter_(context_getter),
123 speech_input_preferences_(speech_input_preferences), 123 speech_input_preferences_(speech_input_preferences),
124 resource_context_(resource_context) { 124 resource_context_(resource_context) {
125 // This is initialized by Browser. Do not add any non-trivial 125 // This is initialized by Browser. Do not add any non-trivial
126 // initialization here, instead do it lazily when required (e.g. see the 126 // initialization here, instead do it lazily when required (e.g. see the
127 // method |manager()|) or add an Init() method. 127 // method |manager()|) or add an Init() method.
128 } 128 }
129 129
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 167 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
168 int caller_id = g_speech_input_callers.Get().CreateId( 168 int caller_id = g_speech_input_callers.Get().CreateId(
169 render_process_id_, params.render_view_id, params.request_id); 169 render_process_id_, params.render_view_id, params.request_id);
170 manager()->StartRecognition(this, caller_id, 170 manager()->StartRecognition(this, caller_id,
171 render_process_id_, 171 render_process_id_,
172 params.render_view_id, params.element_rect, 172 params.render_view_id, params.element_rect,
173 params.language, params.grammar, 173 params.language, params.grammar,
174 params.origin_url, 174 params.origin_url,
175 context_getter_.get(), 175 context_getter_.get(),
176 speech_input_preferences_.get(), 176 speech_input_preferences_.get(),
177 resource_context_->audio_manager()); 177 resource_context_->GetAudioManager());
178 } 178 }
179 179
180 void SpeechInputDispatcherHost::OnCancelRecognition(int render_view_id, 180 void SpeechInputDispatcherHost::OnCancelRecognition(int render_view_id,
181 int request_id) { 181 int request_id) {
182 int caller_id = g_speech_input_callers.Get().GetId( 182 int caller_id = g_speech_input_callers.Get().GetId(
183 render_process_id_, render_view_id, request_id); 183 render_process_id_, render_view_id, request_id);
184 if (caller_id) { 184 if (caller_id) {
185 manager()->CancelRecognition(caller_id); 185 manager()->CancelRecognition(caller_id);
186 // Request sequence ended so remove mapping. 186 // Request sequence ended so remove mapping.
187 g_speech_input_callers.Get().RemoveId(caller_id); 187 g_speech_input_callers.Get().RemoveId(caller_id);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 g_speech_input_callers.Get().render_view_id(caller_id); 227 g_speech_input_callers.Get().render_view_id(caller_id);
228 int caller_request_id = g_speech_input_callers.Get().request_id(caller_id); 228 int caller_request_id = g_speech_input_callers.Get().request_id(caller_id);
229 Send(new SpeechInputMsg_RecognitionComplete(caller_render_view_id, 229 Send(new SpeechInputMsg_RecognitionComplete(caller_render_view_id,
230 caller_request_id)); 230 caller_request_id));
231 // Request sequence ended, so remove mapping. 231 // Request sequence ended, so remove mapping.
232 g_speech_input_callers.Get().RemoveId(caller_id); 232 g_speech_input_callers.Get().RemoveId(caller_id);
233 VLOG(1) << "SpeechInputDispatcherHost::DidCompleteRecognition exit"; 233 VLOG(1) << "SpeechInputDispatcherHost::DidCompleteRecognition exit";
234 } 234 }
235 235
236 } // namespace speech_input 236 } // namespace speech_input
OLDNEW
« no previous file with comments | « content/browser/speech/speech_input_dispatcher_host.h ('k') | content/browser/speech/speech_input_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698