| 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 "chrome/browser/speech/chrome_speech_input_manager.h" | 5 #include "chrome/browser/speech/chrome_speech_input_manager.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/synchronization/lock.h" | 9 #include "base/synchronization/lock.h" |
| 10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 int caller_id, float volume, float noise_volume) { | 141 int caller_id, float volume, float noise_volume) { |
| 142 bubble_controller_->SetBubbleInputVolume(caller_id, volume, noise_volume); | 142 bubble_controller_->SetBubbleInputVolume(caller_id, volume, noise_volume); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void ChromeSpeechInputManager::ShowNoMicError(int caller_id) { | 145 void ChromeSpeechInputManager::ShowNoMicError(int caller_id) { |
| 146 bubble_controller_->SetBubbleMessage( | 146 bubble_controller_->SetBubbleMessage( |
| 147 caller_id, l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_NO_MIC)); | 147 caller_id, l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_NO_MIC)); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void ChromeSpeechInputManager::ShowRecognizerError( | 150 void ChromeSpeechInputManager::ShowRecognizerError( |
| 151 int caller_id, SpeechRecognizer::ErrorCode error) { | 151 int caller_id, SpeechInputError error) { |
| 152 struct ErrorMessageMapEntry { | 152 struct ErrorMessageMapEntry { |
| 153 SpeechRecognizer::ErrorCode error; | 153 SpeechInputError error; |
| 154 int message_id; | 154 int message_id; |
| 155 }; | 155 }; |
| 156 ErrorMessageMapEntry error_message_map[] = { | 156 ErrorMessageMapEntry error_message_map[] = { |
| 157 { | 157 { |
| 158 SpeechRecognizer::RECOGNIZER_ERROR_CAPTURE, IDS_SPEECH_INPUT_MIC_ERROR | 158 kErrorAudio, IDS_SPEECH_INPUT_MIC_ERROR |
| 159 }, { | 159 }, { |
| 160 SpeechRecognizer::RECOGNIZER_ERROR_NO_SPEECH, IDS_SPEECH_INPUT_NO_SPEECH | 160 kErrorNoSpeech, IDS_SPEECH_INPUT_NO_SPEECH |
| 161 }, { | 161 }, { |
| 162 SpeechRecognizer::RECOGNIZER_ERROR_NO_RESULTS, IDS_SPEECH_INPUT_NO_RESULTS | 162 kErrorNoMatch, IDS_SPEECH_INPUT_NO_RESULTS |
| 163 }, { | 163 }, { |
| 164 SpeechRecognizer::RECOGNIZER_ERROR_NETWORK, IDS_SPEECH_INPUT_NET_ERROR | 164 kErrorNetwork, IDS_SPEECH_INPUT_NET_ERROR |
| 165 } | 165 } |
| 166 }; | 166 }; |
| 167 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(error_message_map); ++i) { | 167 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(error_message_map); ++i) { |
| 168 if (error_message_map[i].error == error) { | 168 if (error_message_map[i].error == error) { |
| 169 bubble_controller_->SetBubbleMessage( | 169 bubble_controller_->SetBubbleMessage( |
| 170 caller_id, | 170 caller_id, |
| 171 l10n_util::GetStringUTF16(error_message_map[i].message_id)); | 171 l10n_util::GetStringUTF16(error_message_map[i].message_id)); |
| 172 return; | 172 return; |
| 173 } | 173 } |
| 174 } | 174 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 195 StartRecognitionForRequest(caller_id); | 195 StartRecognitionForRequest(caller_id); |
| 196 } | 196 } |
| 197 } | 197 } |
| 198 | 198 |
| 199 void ChromeSpeechInputManager::InfoBubbleFocusChanged(int caller_id) { | 199 void ChromeSpeechInputManager::InfoBubbleFocusChanged(int caller_id) { |
| 200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 201 OnFocusChanged(caller_id); | 201 OnFocusChanged(caller_id); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace speech_input | 204 } // namespace speech_input |
| OLD | NEW |