| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chromeos/accessibility/speech_monitor.h" | 5 #include "chrome/browser/chromeos/accessibility/speech_monitor.h" |
| 6 | 6 |
| 7 namespace chromeos { | 7 namespace chromeos { |
| 8 | 8 |
| 9 namespace { | 9 namespace { |
| 10 const char kChromeVoxEnabledMessage[] = "chrome vox spoken feedback is ready"; | 10 const char kChromeVoxEnabledMessage[] = "chrome vox spoken feedback is ready"; |
| 11 const char kChromeVoxAlertMessage[] = "Alert"; |
| 12 const char kChromeVoxUpdate1[] = "chrome vox Updated Press chrome vox o,"; |
| 13 const char kChromeVoxUpdate2[] = "n to learn more about chrome vox Next."; |
| 11 } // namespace | 14 } // namespace |
| 12 | 15 |
| 13 SpeechMonitor::SpeechMonitor() { | 16 SpeechMonitor::SpeechMonitor() { |
| 14 TtsController::GetInstance()->SetPlatformImpl(this); | 17 TtsController::GetInstance()->SetPlatformImpl(this); |
| 15 } | 18 } |
| 16 | 19 |
| 17 SpeechMonitor::~SpeechMonitor() { | 20 SpeechMonitor::~SpeechMonitor() { |
| 18 TtsController::GetInstance()->SetPlatformImpl(TtsPlatformImpl::GetInstance()); | 21 TtsController::GetInstance()->SetPlatformImpl(TtsPlatformImpl::GetInstance()); |
| 19 } | 22 } |
| 20 | 23 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 voice.name = "SpeechMonitor"; | 84 voice.name = "SpeechMonitor"; |
| 82 voice.events.insert(TTS_EVENT_END); | 85 voice.events.insert(TTS_EVENT_END); |
| 83 } | 86 } |
| 84 | 87 |
| 85 std::string SpeechMonitor::error() { | 88 std::string SpeechMonitor::error() { |
| 86 return ""; | 89 return ""; |
| 87 } | 90 } |
| 88 | 91 |
| 89 void SpeechMonitor::WillSpeakUtteranceWithVoice(const Utterance* utterance, | 92 void SpeechMonitor::WillSpeakUtteranceWithVoice(const Utterance* utterance, |
| 90 const VoiceData& voice_data) { | 93 const VoiceData& voice_data) { |
| 94 // Blacklist some phrases. |
| 91 // Filter out empty utterances which can be used to trigger a start event from | 95 // Filter out empty utterances which can be used to trigger a start event from |
| 92 // tts as an earcon sync. | 96 // tts as an earcon sync. |
| 93 if (utterance->text() == "") | 97 if (utterance->text() == "" || utterance->text() == kChromeVoxAlertMessage || |
| 98 utterance->text() == kChromeVoxUpdate1 || |
| 99 utterance->text() == kChromeVoxUpdate2) |
| 94 return; | 100 return; |
| 95 | 101 |
| 96 VLOG(0) << "Speaking " << utterance->text(); | 102 VLOG(0) << "Speaking " << utterance->text(); |
| 97 utterance_queue_.push_back(utterance->text()); | 103 utterance_queue_.push_back(utterance->text()); |
| 98 if (loop_runner_.get()) | 104 if (loop_runner_.get()) |
| 99 loop_runner_->Quit(); | 105 loop_runner_->Quit(); |
| 100 } | 106 } |
| 101 | 107 |
| 102 } // namespace chromeos | 108 } // namespace chromeos |
| OLD | NEW |