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

Side by Side Diff: chrome/browser/chromeos/login/wizard_accessibility_handler.cc

Issue 7781004: Move Speak() in accessibility_utils, speak enable and disable strings when (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused headers Created 9 years, 3 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 | Annotate | Revision Log
OLDNEW
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/chromeos/login/wizard_accessibility_handler.h" 5 #include "chrome/browser/chromeos/login/wizard_accessibility_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/i18n/char_iterator.h" 9 #include "base/i18n/char_iterator.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/string_number_conversions.h" 12 #include "base/string_number_conversions.h"
13 #include "chrome/browser/accessibility_events.h" 13 #include "chrome/browser/accessibility_events.h"
14 #include "chrome/browser/chromeos/cros/cros_library.h" 14 #include "chrome/browser/chromeos/accessibility_util.h"
15 #include "chrome/browser/chromeos/cros/speech_synthesis_library.h"
16 #include "chrome/browser/extensions/extension_accessibility_api.h" 15 #include "chrome/browser/extensions/extension_accessibility_api.h"
17 #include "chrome/browser/extensions/extension_accessibility_api_constants.h" 16 #include "chrome/browser/extensions/extension_accessibility_api_constants.h"
18 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
19 #include "chrome/common/chrome_notification_types.h" 18 #include "chrome/common/chrome_notification_types.h"
20 #include "content/common/notification_details.h" 19 #include "content/common/notification_details.h"
21 #include "content/common/notification_source.h" 20 #include "content/common/notification_source.h"
22 #include "grit/generated_resources.h" 21 #include "grit/generated_resources.h"
23 #include "ui/base/l10n/l10n_util.h" 22 #include "ui/base/l10n/l10n_util.h"
24 23
25 namespace keys = extension_accessibility_api_constants; 24 namespace keys = extension_accessibility_api_constants;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 101
103 void WizardAccessibilityHandler::Observe( 102 void WizardAccessibilityHandler::Observe(
104 int type, 103 int type,
105 const NotificationSource& source, 104 const NotificationSource& source,
106 const NotificationDetails& details) { 105 const NotificationDetails& details) {
107 const AccessibilityControlInfo *control_info = 106 const AccessibilityControlInfo *control_info =
108 Details<const AccessibilityControlInfo>(details).ptr(); 107 Details<const AccessibilityControlInfo>(details).ptr();
109 std::string description; 108 std::string description;
110 EarconType earcon = NO_EARCON; 109 EarconType earcon = NO_EARCON;
111 DescribeAccessibilityEvent(type, control_info, &description, &earcon); 110 DescribeAccessibilityEvent(type, control_info, &description, &earcon);
112 Speak(description.c_str(), false, true); 111 accessibility::Speak(description.c_str(), false, true);
113 }
114
115 void WizardAccessibilityHandler::Speak(const char* speak_str,
116 bool queue,
117 bool interruptible) {
118 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) {
119 if (queue || !interruptible) {
120 std::string props = "";
121 props.append("enqueue=");
122 props.append(queue ? "1;" : "0;");
123 props.append("interruptible=");
124 props.append(interruptible ? "1;" : "0;");
125 chromeos::CrosLibrary::Get()->GetSpeechSynthesisLibrary()->
126 SetSpeakProperties(props.c_str());
127 }
128 chromeos::CrosLibrary::Get()->GetSpeechSynthesisLibrary()->
129 Speak(speak_str);
130 }
131 } 112 }
132 113
133 void WizardAccessibilityHandler::DescribeAccessibilityEvent( 114 void WizardAccessibilityHandler::DescribeAccessibilityEvent(
134 int event_type, 115 int event_type,
135 const AccessibilityControlInfo* control_info, 116 const AccessibilityControlInfo* control_info,
136 std::string* out_spoken_description, 117 std::string* out_spoken_description,
137 EarconType* out_earcon) { 118 EarconType* out_earcon) {
138 *out_spoken_description = std::string(); 119 *out_spoken_description = std::string();
139 *out_earcon = NO_EARCON; 120 *out_earcon = NO_EARCON;
140 121
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } else if (!inserted.empty()) { 418 } else if (!inserted.empty()) {
438 // Speak inserted text. 419 // Speak inserted text.
439 AppendUtterance(inserted, out_spoken_description); 420 AppendUtterance(inserted, out_spoken_description);
440 } else if (!deleted.empty()) { 421 } else if (!deleted.empty()) {
441 // Speak deleted text. 422 // Speak deleted text.
442 AppendUtterance(deleted, out_spoken_description); 423 AppendUtterance(deleted, out_spoken_description);
443 } 424 }
444 } 425 }
445 426
446 } // namespace chromeos 427 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698