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_helper.h" | 5 #include "chrome/browser/chromeos/login/wizard_accessibility_helper.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/accessibility_util.h" | 10 #include "chrome/browser/chromeos/accessibility_util.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 85 | 85 |
| 86 bool WizardAccessibilityHelper::IsAccessibilityEnabled() { | 86 bool WizardAccessibilityHelper::IsAccessibilityEnabled() { |
| 87 return g_browser_process && | 87 return g_browser_process && |
| 88 g_browser_process->local_state()->GetBoolean( | 88 g_browser_process->local_state()->GetBoolean( |
| 89 prefs::kAccessibilityEnabled); | 89 prefs::kAccessibilityEnabled); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void WizardAccessibilityHelper::MaybeSpeak(const char* str, bool queue, | 92 void WizardAccessibilityHelper::MaybeSpeak(const char* str, bool queue, |
| 93 bool interruptible) { | 93 bool interruptible) { |
| 94 if (IsAccessibilityEnabled()) { | 94 if (IsAccessibilityEnabled()) { |
| 95 accessibility_handler_->Speak(str, queue, interruptible); | 95 accessibility::Speak(str, queue, interruptible); |
| 96 } | 96 } |
| 97 } | 97 } |
| 98 | 98 |
| 99 void WizardAccessibilityHelper::ToggleAccessibility() { | 99 void WizardAccessibilityHelper::ToggleAccessibility() { |
| 100 if (!IsAccessibilityEnabled()) { | 100 if (!IsAccessibilityEnabled()) { |
| 101 VLOG(1) << "Enabling accessibility."; | 101 VLOG(1) << "Enabling accessibility."; |
| 102 if (!registered_notifications_) | 102 if (!registered_notifications_) |
| 103 RegisterNotifications(); | 103 RegisterNotifications(); |
| 104 SetAccessibilityEnabled(true); | 104 SetAccessibilityEnabled(true); |
| 105 } else { | 105 } else { |
| 106 SetAccessibilityEnabled(false); | 106 SetAccessibilityEnabled(false); |
| 107 if (registered_notifications_) | 107 if (registered_notifications_) |
| 108 UnregisterNotifications(); | 108 UnregisterNotifications(); |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 | 111 |
| 112 void WizardAccessibilityHelper::SetAccessibilityEnabled(bool enabled) { | 112 void WizardAccessibilityHelper::SetAccessibilityEnabled(bool enabled) { |
| 113 bool doSpeak = (IsAccessibilityEnabled() != enabled); | 113 bool doSpeak = (IsAccessibilityEnabled() != enabled); |
| 114 accessibility::EnableAccessibility(enabled, NULL); | 114 accessibility::EnableAccessibility(enabled, NULL); |
| 115 if (doSpeak) { | 115 if (doSpeak) { |
| 116 accessibility_handler_->Speak(enabled ? | 116 accessibility::Speak(enabled ? |
| 117 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_ENABLED).c_str() : | 117 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_ENABLED).c_str() : |
| 118 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_DISABLED).c_str(), | 118 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_DISABLED).c_str(), |
| 119 false, true); | 119 false, true); |
|
hashimoto
2011/08/29 09:41:56
This code will speak the message twice because now
Zachary Kuznia
2011/08/30 08:03:36
Done.
| |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace chromeos | 123 } // namespace chromeos |
| OLD | NEW |