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"; |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 std::string result = utterance_queue_.front(); | 30 std::string result = utterance_queue_.front(); |
31 utterance_queue_.pop_front(); | 31 utterance_queue_.pop_front(); |
32 return result; | 32 return result; |
33 } | 33 } |
34 | 34 |
35 bool SpeechMonitor::SkipChromeVoxEnabledMessage() { | 35 bool SpeechMonitor::SkipChromeVoxEnabledMessage() { |
36 return SkipChromeVoxMessage(kChromeVoxEnabledMessage); | 36 return SkipChromeVoxMessage(kChromeVoxEnabledMessage); |
37 } | 37 } |
38 | 38 |
| 39 bool SpeechMonitor::DidStop() { |
| 40 return did_stop_; |
| 41 } |
| 42 |
39 bool SpeechMonitor::SkipChromeVoxMessage(const std::string& message) { | 43 bool SpeechMonitor::SkipChromeVoxMessage(const std::string& message) { |
40 while (true) { | 44 while (true) { |
41 if (utterance_queue_.empty()) { | 45 if (utterance_queue_.empty()) { |
42 loop_runner_ = new content::MessageLoopRunner(); | 46 loop_runner_ = new content::MessageLoopRunner(); |
43 loop_runner_->Run(); | 47 loop_runner_->Run(); |
44 loop_runner_ = NULL; | 48 loop_runner_ = NULL; |
45 } | 49 } |
46 std::string result = utterance_queue_.front(); | 50 std::string result = utterance_queue_.front(); |
47 utterance_queue_.pop_front(); | 51 utterance_queue_.pop_front(); |
48 if (result == message) | 52 if (result == message) |
(...skipping 14 matching lines...) Expand all Loading... |
63 const UtteranceContinuousParameters& params) { | 67 const UtteranceContinuousParameters& params) { |
64 TtsController::GetInstance()->OnTtsEvent( | 68 TtsController::GetInstance()->OnTtsEvent( |
65 utterance_id, | 69 utterance_id, |
66 TTS_EVENT_END, | 70 TTS_EVENT_END, |
67 static_cast<int>(utterance.size()), | 71 static_cast<int>(utterance.size()), |
68 std::string()); | 72 std::string()); |
69 return true; | 73 return true; |
70 } | 74 } |
71 | 75 |
72 bool SpeechMonitor::StopSpeaking() { | 76 bool SpeechMonitor::StopSpeaking() { |
| 77 did_stop_ = true; |
73 return true; | 78 return true; |
74 } | 79 } |
75 | 80 |
76 bool SpeechMonitor::IsSpeaking() { | 81 bool SpeechMonitor::IsSpeaking() { |
77 return false; | 82 return false; |
78 } | 83 } |
79 | 84 |
80 void SpeechMonitor::GetVoices(std::vector<VoiceData>* out_voices) { | 85 void SpeechMonitor::GetVoices(std::vector<VoiceData>* out_voices) { |
81 out_voices->push_back(VoiceData()); | 86 out_voices->push_back(VoiceData()); |
82 VoiceData& voice = out_voices->back(); | 87 VoiceData& voice = out_voices->back(); |
(...skipping 16 matching lines...) Expand all Loading... |
99 utterance->text() == kChromeVoxUpdate2) | 104 utterance->text() == kChromeVoxUpdate2) |
100 return; | 105 return; |
101 | 106 |
102 VLOG(0) << "Speaking " << utterance->text(); | 107 VLOG(0) << "Speaking " << utterance->text(); |
103 utterance_queue_.push_back(utterance->text()); | 108 utterance_queue_.push_back(utterance->text()); |
104 if (loop_runner_.get()) | 109 if (loop_runner_.get()) |
105 loop_runner_->Quit(); | 110 loop_runner_->Quit(); |
106 } | 111 } |
107 | 112 |
108 } // namespace chromeos | 113 } // namespace chromeos |
OLD | NEW |