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/accessibility_util.h" | 5 #include "chrome/browser/chromeos/accessibility_util.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 10 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 g_browser_process->local_state()->GetBoolean( | 86 g_browser_process->local_state()->GetBoolean( |
87 prefs::kAccessibilityEnabled); | 87 prefs::kAccessibilityEnabled); |
88 if (accessibility_enabled == enabled) { | 88 if (accessibility_enabled == enabled) { |
89 LOG(INFO) << "Accessibility is already " << | 89 LOG(INFO) << "Accessibility is already " << |
90 (enabled ? "enabled" : "disabled") << ". Going to do nothing."; | 90 (enabled ? "enabled" : "disabled") << ". Going to do nothing."; |
91 return; | 91 return; |
92 } | 92 } |
93 | 93 |
94 g_browser_process->local_state()->SetBoolean( | 94 g_browser_process->local_state()->SetBoolean( |
95 prefs::kAccessibilityEnabled, enabled); | 95 prefs::kAccessibilityEnabled, enabled); |
96 // Explicitly call SavePersistentPrefs instead of ScheduleSavePersistentPrefs | 96 g_browser_process->local_state()->ScheduleSavePersistentPrefs(); |
97 // so that this change gets written immediately, in case the user shuts | |
98 // down right now. TODO(dmazzoni) switch this back to | |
99 // ScheduleSavePersistentPrefs once http://crosbug.com/19491 is fixed. | |
100 g_browser_process->local_state()->SavePersistentPrefs(); | |
101 ExtensionAccessibilityEventRouter::GetInstance()-> | 97 ExtensionAccessibilityEventRouter::GetInstance()-> |
102 SetAccessibilityEnabled(enabled); | 98 SetAccessibilityEnabled(enabled); |
103 | 99 |
104 Speak(enabled ? | 100 Speak(enabled ? |
105 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_ENABLED).c_str() : | 101 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_ENABLED).c_str() : |
106 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_DISABLED).c_str(), | 102 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_DISABLED).c_str(), |
107 false, true); | 103 false, true); |
108 | 104 |
109 // Load/Unload ChromeVox | 105 // Load/Unload ChromeVox |
110 Profile* profile = ProfileManager::GetDefaultProfile(); | 106 Profile* profile = ProfileManager::GetDefaultProfile(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 bool accessibility_enabled = g_browser_process && | 168 bool accessibility_enabled = g_browser_process && |
173 g_browser_process->local_state()->GetBoolean( | 169 g_browser_process->local_state()->GetBoolean( |
174 prefs::kAccessibilityEnabled); | 170 prefs::kAccessibilityEnabled); |
175 if (accessibility_enabled) { | 171 if (accessibility_enabled) { |
176 Speak(speak_str, queue, interruptible); | 172 Speak(speak_str, queue, interruptible); |
177 } | 173 } |
178 } | 174 } |
179 | 175 |
180 } // namespace accessibility | 176 } // namespace accessibility |
181 } // namespace chromeos | 177 } // namespace chromeos |
OLD | NEW |