| 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 "chrome/browser/accessibility_events.h" | 7 #include "chrome/browser/accessibility_events.h" |
| 8 #include "chrome/browser/chromeos/cros/cros_library.h" | 8 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 9 #include "chrome/browser/chromeos/cros/speech_synthesis_library.h" | 9 #include "chrome/browser/chromeos/cros/speech_synthesis_library.h" |
| 10 #include "chrome/common/notification_service.h" | 10 #include "chrome/common/notification_service.h" |
| 11 | 11 |
| 12 void WizardAccessibilityHandler::Observe( | 12 void WizardAccessibilityHandler::Observe( |
| 13 NotificationType type, | 13 NotificationType type, |
| 14 const NotificationSource& source, | 14 const NotificationSource& source, |
| 15 const NotificationDetails& details) { | 15 const NotificationDetails& details) { |
| 16 const AccessibilityControlInfo *info = NULL; | 16 const AccessibilityControlInfo *info = NULL; |
| 17 info = Details<const AccessibilityControlInfo>(details).ptr(); | 17 info = Details<const AccessibilityControlInfo>(details).ptr(); |
| 18 switch (type.value) { | 18 switch (type.value) { |
| 19 case NotificationType::ACCESSIBILITY_CONTROL_FOCUSED: | 19 case NotificationType::ACCESSIBILITY_CONTROL_FOCUSED: |
| 20 Speak(info->name().c_str()); | 20 Speak(info->name().c_str(), false, true); |
| 21 break; | 21 break; |
| 22 case NotificationType::ACCESSIBILITY_CONTROL_ACTION: | 22 case NotificationType::ACCESSIBILITY_CONTROL_ACTION: |
| 23 break; | 23 break; |
| 24 case NotificationType::ACCESSIBILITY_TEXT_CHANGED: | 24 case NotificationType::ACCESSIBILITY_TEXT_CHANGED: |
| 25 break; | 25 break; |
| 26 case NotificationType::ACCESSIBILITY_MENU_OPENED: | 26 case NotificationType::ACCESSIBILITY_MENU_OPENED: |
| 27 break; | 27 break; |
| 28 case NotificationType::ACCESSIBILITY_MENU_CLOSED: | 28 case NotificationType::ACCESSIBILITY_MENU_CLOSED: |
| 29 break; | 29 break; |
| 30 default: | 30 default: |
| 31 NOTREACHED() << "Cannot recognize notification type: " << type.value; | 31 NOTREACHED() << "Cannot recognize notification type: " << type.value; |
| 32 break; | 32 break; |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 void WizardAccessibilityHandler::Speak(const char* speak_str) { | 36 void WizardAccessibilityHandler::Speak(const char* speak_str, |
| 37 bool queue, |
| 38 bool interruptible) { |
| 37 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) { | 39 if (chromeos::CrosLibrary::Get()->EnsureLoaded()) { |
| 38 chromeos::CrosLibrary::Get()->GetSpeechSynthesisLibrary()-> | 40 if (queue || !interruptible) { |
| 39 StopSpeaking(); | 41 std::string props = ""; |
| 42 props.append("enqueue="); |
| 43 props.append(queue ? "1;" : "0;"); |
| 44 props.append("interruptible="); |
| 45 props.append(interruptible ? "1;" : "0;"); |
| 46 chromeos::CrosLibrary::Get()->GetSpeechSynthesisLibrary()-> |
| 47 SetSpeakProperties(props.c_str()); |
| 48 } |
| 40 chromeos::CrosLibrary::Get()->GetSpeechSynthesisLibrary()-> | 49 chromeos::CrosLibrary::Get()->GetSpeechSynthesisLibrary()-> |
| 41 Speak(speak_str); | 50 Speak(speak_str); |
| 42 } | 51 } |
| 43 } | 52 } |
| OLD | NEW |