Chromium Code Reviews| 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/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/accessibility_util.h" | |
| 14 #include "chrome/browser/chromeos/cros/cros_library.h" | 15 #include "chrome/browser/chromeos/cros/cros_library.h" |
|
dmazzoni
2011/08/29 22:30:03
I think you can delete this, check for other inclu
Zachary Kuznia
2011/08/30 08:03:36
Done.
| |
| 15 #include "chrome/browser/chromeos/cros/speech_synthesis_library.h" | 16 #include "chrome/browser/chromeos/cros/speech_synthesis_library.h" |
| 16 #include "chrome/browser/extensions/extension_accessibility_api.h" | 17 #include "chrome/browser/extensions/extension_accessibility_api.h" |
| 17 #include "chrome/browser/extensions/extension_accessibility_api_constants.h" | 18 #include "chrome/browser/extensions/extension_accessibility_api_constants.h" |
| 18 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 19 #include "chrome/common/chrome_notification_types.h" | 20 #include "chrome/common/chrome_notification_types.h" |
| 20 #include "content/common/notification_details.h" | 21 #include "content/common/notification_details.h" |
| 21 #include "content/common/notification_source.h" | 22 #include "content/common/notification_source.h" |
| 22 #include "grit/generated_resources.h" | 23 #include "grit/generated_resources.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 24 | 25 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 | 103 |
| 103 void WizardAccessibilityHandler::Observe( | 104 void WizardAccessibilityHandler::Observe( |
| 104 int type, | 105 int type, |
| 105 const NotificationSource& source, | 106 const NotificationSource& source, |
| 106 const NotificationDetails& details) { | 107 const NotificationDetails& details) { |
| 107 const AccessibilityControlInfo *control_info = | 108 const AccessibilityControlInfo *control_info = |
| 108 Details<const AccessibilityControlInfo>(details).ptr(); | 109 Details<const AccessibilityControlInfo>(details).ptr(); |
| 109 std::string description; | 110 std::string description; |
| 110 EarconType earcon = NO_EARCON; | 111 EarconType earcon = NO_EARCON; |
| 111 DescribeAccessibilityEvent(type, control_info, &description, &earcon); | 112 DescribeAccessibilityEvent(type, control_info, &description, &earcon); |
| 112 Speak(description.c_str(), false, true); | 113 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 } | 114 } |
| 132 | 115 |
| 133 void WizardAccessibilityHandler::DescribeAccessibilityEvent( | 116 void WizardAccessibilityHandler::DescribeAccessibilityEvent( |
| 134 int event_type, | 117 int event_type, |
| 135 const AccessibilityControlInfo* control_info, | 118 const AccessibilityControlInfo* control_info, |
| 136 std::string* out_spoken_description, | 119 std::string* out_spoken_description, |
| 137 EarconType* out_earcon) { | 120 EarconType* out_earcon) { |
| 138 *out_spoken_description = std::string(); | 121 *out_spoken_description = std::string(); |
| 139 *out_earcon = NO_EARCON; | 122 *out_earcon = NO_EARCON; |
| 140 | 123 |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 437 } else if (!inserted.empty()) { | 420 } else if (!inserted.empty()) { |
| 438 // Speak inserted text. | 421 // Speak inserted text. |
| 439 AppendUtterance(inserted, out_spoken_description); | 422 AppendUtterance(inserted, out_spoken_description); |
| 440 } else if (!deleted.empty()) { | 423 } else if (!deleted.empty()) { |
| 441 // Speak deleted text. | 424 // Speak deleted text. |
| 442 AppendUtterance(deleted, out_spoken_description); | 425 AppendUtterance(deleted, out_spoken_description); |
| 443 } | 426 } |
| 444 } | 427 } |
| 445 | 428 |
| 446 } // namespace chromeos | 429 } // namespace chromeos |
| OLD | NEW |