OLD | NEW |
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/content_browser_client.h" | 8 #include "content/browser/content_browser_client.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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 int SpeechInputDispatcherHost::SpeechInputCallers::request_id(int id) { | 100 int SpeechInputDispatcherHost::SpeechInputCallers::request_id(int id) { |
101 return callers_[id].request_id; | 101 return callers_[id].request_id; |
102 } | 102 } |
103 | 103 |
104 //-------------------------- SpeechInputDispatcherHost ------------------------- | 104 //-------------------------- SpeechInputDispatcherHost ------------------------- |
105 | 105 |
106 SpeechInputManager* SpeechInputDispatcherHost::manager_; | 106 SpeechInputManager* SpeechInputDispatcherHost::manager_; |
107 | 107 |
| 108 void SpeechInputDispatcherHost::set_manager(SpeechInputManager* manager) { |
| 109 manager_ = manager; |
| 110 } |
| 111 |
108 SpeechInputDispatcherHost::SpeechInputDispatcherHost( | 112 SpeechInputDispatcherHost::SpeechInputDispatcherHost( |
109 int render_process_id, | 113 int render_process_id, |
110 net::URLRequestContextGetter* context_getter, | 114 net::URLRequestContextGetter* context_getter, |
111 SpeechInputPreferences* speech_input_preferences) | 115 SpeechInputPreferences* speech_input_preferences) |
112 : render_process_id_(render_process_id), | 116 : render_process_id_(render_process_id), |
113 may_have_pending_requests_(false), | 117 may_have_pending_requests_(false), |
114 context_getter_(context_getter), | 118 context_getter_(context_getter), |
115 speech_input_preferences_(speech_input_preferences) { | 119 speech_input_preferences_(speech_input_preferences) { |
116 // This is initialized by Browser. Do not add any non-trivial | 120 // This is initialized by Browser. Do not add any non-trivial |
117 // initialization here, instead do it lazily when required (e.g. see the | 121 // initialization here, instead do it lazily when required (e.g. see the |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 g_speech_input_callers.Get().render_view_id(caller_id); | 220 g_speech_input_callers.Get().render_view_id(caller_id); |
217 int caller_request_id = g_speech_input_callers.Get().request_id(caller_id); | 221 int caller_request_id = g_speech_input_callers.Get().request_id(caller_id); |
218 Send(new SpeechInputMsg_RecognitionComplete(caller_render_view_id, | 222 Send(new SpeechInputMsg_RecognitionComplete(caller_render_view_id, |
219 caller_request_id)); | 223 caller_request_id)); |
220 // Request sequence ended, so remove mapping. | 224 // Request sequence ended, so remove mapping. |
221 g_speech_input_callers.Get().RemoveId(caller_id); | 225 g_speech_input_callers.Get().RemoveId(caller_id); |
222 VLOG(1) << "SpeechInputDispatcherHost::DidCompleteRecognition exit"; | 226 VLOG(1) << "SpeechInputDispatcherHost::DidCompleteRecognition exit"; |
223 } | 227 } |
224 | 228 |
225 } // namespace speech_input | 229 } // namespace speech_input |
OLD | NEW |