Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(831)

Side by Side Diff: chrome/browser/chromeos/accessibility/speech_monitor.cc

Issue 2438893004: Revert of Make ChromeVox Next the default ChromeVox experience (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 kChromeVoxUpdateNotificationMessage[] =
12 "n to learn more about chrome vox Next.";
13 } // anonymous namespace 11 } // anonymous namespace
14 12
15 SpeechMonitor::SpeechMonitor() { 13 SpeechMonitor::SpeechMonitor() {
16 TtsController::GetInstance()->SetPlatformImpl(this); 14 TtsController::GetInstance()->SetPlatformImpl(this);
17 } 15 }
18 16
19 SpeechMonitor::~SpeechMonitor() { 17 SpeechMonitor::~SpeechMonitor() {
20 TtsController::GetInstance()->SetPlatformImpl(TtsPlatformImpl::GetInstance()); 18 TtsController::GetInstance()->SetPlatformImpl(TtsPlatformImpl::GetInstance());
21 } 19 }
22 20
23 std::string SpeechMonitor::GetNextUtterance() { 21 std::string SpeechMonitor::GetNextUtterance() {
24 if (utterance_queue_.empty()) { 22 if (utterance_queue_.empty()) {
25 loop_runner_ = new content::MessageLoopRunner(); 23 loop_runner_ = new content::MessageLoopRunner();
26 loop_runner_->Run(); 24 loop_runner_->Run();
27 loop_runner_ = NULL; 25 loop_runner_ = NULL;
28 } 26 }
29 std::string result = utterance_queue_.front(); 27 std::string result = utterance_queue_.front();
30 utterance_queue_.pop_front(); 28 utterance_queue_.pop_front();
31 return result; 29 return result;
32 } 30 }
33 31
34 bool SpeechMonitor::SkipChromeVoxEnabledMessage() { 32 bool SpeechMonitor::SkipChromeVoxEnabledMessage() {
35 bool saw_enabled_message = false;
36 bool saw_update_message = false;
37 while (true) { 33 while (true) {
38 if (utterance_queue_.empty()) { 34 if (utterance_queue_.empty()) {
39 loop_runner_ = new content::MessageLoopRunner(); 35 loop_runner_ = new content::MessageLoopRunner();
40 loop_runner_->Run(); 36 loop_runner_->Run();
41 loop_runner_ = NULL; 37 loop_runner_ = NULL;
42 } 38 }
43 std::string result = utterance_queue_.front(); 39 std::string result = utterance_queue_.front();
44 utterance_queue_.pop_front(); 40 utterance_queue_.pop_front();
45 saw_enabled_message |= result == kChromeVoxEnabledMessage; 41 if (result == kChromeVoxEnabledMessage)
46 saw_update_message |= result == kChromeVoxUpdateNotificationMessage;
47 if (saw_enabled_message && saw_update_message)
48 return true; 42 return true;
49 } 43 }
50 return false; 44 return false;
51 } 45 }
52 46
53 bool SpeechMonitor::PlatformImplAvailable() { 47 bool SpeechMonitor::PlatformImplAvailable() {
54 return true; 48 return true;
55 } 49 }
56 50
57 bool SpeechMonitor::Speak( 51 bool SpeechMonitor::Speak(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (utterance->text() == "") 89 if (utterance->text() == "")
96 return; 90 return;
97 91
98 VLOG(0) << "Speaking " << utterance->text(); 92 VLOG(0) << "Speaking " << utterance->text();
99 utterance_queue_.push_back(utterance->text()); 93 utterance_queue_.push_back(utterance->text());
100 if (loop_runner_.get()) 94 if (loop_runner_.get())
101 loop_runner_->Quit(); 95 loop_runner_->Quit();
102 } 96 }
103 97
104 } // namespace chromeos 98 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698