Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "base/i18n/char_iterator.h" | 10 #include "base/i18n/char_iterator.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
| 13 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 14 #include "chrome/browser/accessibility_events.h" | 14 #include "chrome/browser/accessibility_events.h" |
| 15 #include "chrome/browser/chromeos/cros/cros_library.h" | 15 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 16 #include "chrome/browser/chromeos/cros/speech_synthesis_library.h" | |
| 17 #include "chrome/browser/extensions/extension_accessibility_api.h" | 16 #include "chrome/browser/extensions/extension_accessibility_api.h" |
| 18 #include "chrome/browser/extensions/extension_accessibility_api_constants.h" | 17 #include "chrome/browser/extensions/extension_accessibility_api_constants.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/common/notification_registrar.h" | 19 #include "chrome/common/notification_registrar.h" |
| 21 #include "chrome/common/notification_service.h" | 20 #include "chrome/common/notification_service.h" |
| 22 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 23 | 22 |
| 24 namespace keys = extension_accessibility_api_constants; | 23 namespace keys = extension_accessibility_api_constants; |
| 25 | 24 |
| 26 namespace { | 25 namespace { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 void WizardAccessibilityHandler::Observe( | 101 void WizardAccessibilityHandler::Observe( |
| 103 NotificationType type, | 102 NotificationType type, |
| 104 const NotificationSource& source, | 103 const NotificationSource& source, |
| 105 const NotificationDetails& details) { | 104 const NotificationDetails& details) { |
| 106 const AccessibilityControlInfo *control_info = | 105 const AccessibilityControlInfo *control_info = |
| 107 Details<const AccessibilityControlInfo>(details).ptr(); | 106 Details<const AccessibilityControlInfo>(details).ptr(); |
| 108 std::string description; | 107 std::string description; |
| 109 EarconType earcon = NO_EARCON; | 108 EarconType earcon = NO_EARCON; |
| 110 DescribeAccessibilityEvent(type, control_info, &description, &earcon); | 109 DescribeAccessibilityEvent(type, control_info, &description, &earcon); |
| 111 Speak(description.c_str(), false, true); | 110 Speak(description.c_str(), false, true); |
| 111 if (earcon != NO_EARCON) { | |
| 112 PlayEarcon(earcon); | |
| 113 } | |
|
xiyuan
2010/12/15 23:07:20
nit: you don't need wrap one-liner in "{}"
| |
| 114 } | |
| 115 | |
| 116 void WizardAccessibilityHandler::PlayEarcon(EarconType earcon_type) { | |
| 117 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) { | |
| 118 chromeos::CrosLibrary::Get()->GetSpeechSynthesisLibrary()-> | |
| 119 PlayEarcon(earcon_type); | |
| 120 } | |
| 112 } | 121 } |
| 113 | 122 |
| 114 void WizardAccessibilityHandler::Speak(const char* speak_str, | 123 void WizardAccessibilityHandler::Speak(const char* speak_str, |
| 115 bool queue, | 124 bool queue, |
| 116 bool interruptible) { | 125 bool interruptible) { |
| 117 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) { | 126 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) { |
| 118 if (queue || !interruptible) { | 127 if (queue || !interruptible) { |
| 119 std::string props = ""; | 128 std::string props = ""; |
| 120 props.append("enqueue="); | 129 props.append("enqueue="); |
| 121 props.append(queue ? "1;" : "0;"); | 130 props.append(queue ? "1;" : "0;"); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 } else if (inserted.size() > 0) { | 445 } else if (inserted.size() > 0) { |
| 437 // Speak inserted text. | 446 // Speak inserted text. |
| 438 AppendUtterance(inserted, out_spoken_description); | 447 AppendUtterance(inserted, out_spoken_description); |
| 439 } else if (deleted.size() > 0) { | 448 } else if (deleted.size() > 0) { |
| 440 // Speak deleted text. | 449 // Speak deleted text. |
| 441 AppendUtterance(deleted, out_spoken_description); | 450 AppendUtterance(deleted, out_spoken_description); |
| 442 } | 451 } |
| 443 } | 452 } |
| 444 | 453 |
| 445 } // namespace chromeos | 454 } // namespace chromeos |
| OLD | NEW |