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/speech/speech_input_preferences.h" | 8 #include "content/browser/speech/speech_input_preferences.h" |
9 #include "content/common/speech_input_messages.h" | 9 #include "content/common/speech_input_messages.h" |
10 #include "content/public/browser/content_browser_client.h" | 10 #include "content/public/browser/content_browser_client.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 }; | 42 }; |
43 friend struct base::DefaultLazyInstanceTraits<SpeechInputCallers>; | 43 friend struct base::DefaultLazyInstanceTraits<SpeechInputCallers>; |
44 | 44 |
45 SpeechInputCallers(); | 45 SpeechInputCallers(); |
46 | 46 |
47 std::map<int, CallerInfo> callers_; | 47 std::map<int, CallerInfo> callers_; |
48 int next_id_; | 48 int next_id_; |
49 }; | 49 }; |
50 | 50 |
51 static base::LazyInstance<SpeechInputDispatcherHost::SpeechInputCallers> | 51 static base::LazyInstance<SpeechInputDispatcherHost::SpeechInputCallers> |
52 g_speech_input_callers(base::LINKER_INITIALIZED); | 52 g_speech_input_callers = LAZY_INSTANCE_INITIALIZER; |
53 | 53 |
54 SpeechInputDispatcherHost::SpeechInputCallers::SpeechInputCallers() | 54 SpeechInputDispatcherHost::SpeechInputCallers::SpeechInputCallers() |
55 : next_id_(1) { | 55 : next_id_(1) { |
56 } | 56 } |
57 | 57 |
58 int SpeechInputDispatcherHost::SpeechInputCallers::GetId(int render_process_id, | 58 int SpeechInputDispatcherHost::SpeechInputCallers::GetId(int render_process_id, |
59 int render_view_id, | 59 int render_view_id, |
60 int request_id) { | 60 int request_id) { |
61 for (std::map<int, CallerInfo>::iterator it = callers_.begin(); | 61 for (std::map<int, CallerInfo>::iterator it = callers_.begin(); |
62 it != callers_.end(); it++) { | 62 it != callers_.end(); it++) { |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 g_speech_input_callers.Get().render_view_id(caller_id); | 222 g_speech_input_callers.Get().render_view_id(caller_id); |
223 int caller_request_id = g_speech_input_callers.Get().request_id(caller_id); | 223 int caller_request_id = g_speech_input_callers.Get().request_id(caller_id); |
224 Send(new SpeechInputMsg_RecognitionComplete(caller_render_view_id, | 224 Send(new SpeechInputMsg_RecognitionComplete(caller_render_view_id, |
225 caller_request_id)); | 225 caller_request_id)); |
226 // Request sequence ended, so remove mapping. | 226 // Request sequence ended, so remove mapping. |
227 g_speech_input_callers.Get().RemoveId(caller_id); | 227 g_speech_input_callers.Get().RemoveId(caller_id); |
228 VLOG(1) << "SpeechInputDispatcherHost::DidCompleteRecognition exit"; | 228 VLOG(1) << "SpeechInputDispatcherHost::DidCompleteRecognition exit"; |
229 } | 229 } |
230 | 230 |
231 } // namespace speech_input | 231 } // namespace speech_input |
OLD | NEW |