| 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/extensions/extension_accessibility_api.h" | 11 #include "chrome/browser/extensions/extension_accessibility_api.h" |
| 12 #include "chrome/browser/extensions/extension_tts_api_platform.h" | 12 #include "chrome/browser/extensions/extension_tts_api_platform.h" |
| 13 #include "chrome/browser/extensions/component_loader.h" | 13 #include "chrome/browser/extensions/component_loader.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" | 14 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/extensions/file_reader.h" | 15 #include "chrome/browser/extensions/file_reader.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/profiles/profile_manager.h" | 17 #include "chrome/browser/profiles/profile_manager.h" |
| 18 #include "chrome/common/extensions/extension_messages.h" | 18 #include "chrome/common/extensions/extension_messages.h" |
| 19 #include "chrome/common/extensions/extension_resource.h" | 19 #include "chrome/common/extensions/extension_resource.h" |
| 20 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 21 #include "content/browser/accessibility/browser_accessibility_state.h" |
| 21 #include "content/browser/renderer_host/render_view_host.h" | 22 #include "content/browser/renderer_host/render_view_host.h" |
| 22 #include "content/browser/tab_contents/tab_contents.h" | 23 #include "content/browser/tab_contents/tab_contents.h" |
| 23 #include "content/browser/webui/web_ui.h" | 24 #include "content/browser/webui/web_ui.h" |
| 24 #include "grit/browser_resources.h" | 25 #include "grit/browser_resources.h" |
| 25 #include "grit/generated_resources.h" | 26 #include "grit/generated_resources.h" |
| 26 #include "ui/base/l10n/l10n_util.h" | 27 #include "ui/base/l10n/l10n_util.h" |
| 27 #include "ui/base/resource/resource_bundle.h" | 28 #include "ui/base/resource/resource_bundle.h" |
| 28 | 29 |
| 29 namespace chromeos { | 30 namespace chromeos { |
| 30 namespace accessibility { | 31 namespace accessibility { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 LOG(INFO) << "Accessibility is already " << | 91 LOG(INFO) << "Accessibility is already " << |
| 91 (enabled ? "enabled" : "disabled") << ". Going to do nothing."; | 92 (enabled ? "enabled" : "disabled") << ". Going to do nothing."; |
| 92 return; | 93 return; |
| 93 } | 94 } |
| 94 | 95 |
| 95 g_browser_process->local_state()->SetBoolean( | 96 g_browser_process->local_state()->SetBoolean( |
| 96 prefs::kAccessibilityEnabled, enabled); | 97 prefs::kAccessibilityEnabled, enabled); |
| 97 g_browser_process->local_state()->ScheduleSavePersistentPrefs(); | 98 g_browser_process->local_state()->ScheduleSavePersistentPrefs(); |
| 98 ExtensionAccessibilityEventRouter::GetInstance()-> | 99 ExtensionAccessibilityEventRouter::GetInstance()-> |
| 99 SetAccessibilityEnabled(enabled); | 100 SetAccessibilityEnabled(enabled); |
| 101 BrowserAccessibilityState::GetInstance()->OnAccessibilityEnabledManually(); |
| 100 | 102 |
| 101 Speak(enabled ? | 103 Speak(enabled ? |
| 102 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_ENABLED).c_str() : | 104 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_ENABLED).c_str() : |
| 103 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_DISABLED).c_str()); | 105 l10n_util::GetStringUTF8(IDS_CHROMEOS_ACC_ACCESS_DISABLED).c_str()); |
| 104 | 106 |
| 105 // Load/Unload ChromeVox | 107 // Load/Unload ChromeVox |
| 106 Profile* profile = ProfileManager::GetDefaultProfile(); | 108 Profile* profile = ProfileManager::GetDefaultProfile(); |
| 107 ExtensionService* extension_service = | 109 ExtensionService* extension_service = |
| 108 profile->GetExtensionService(); | 110 profile->GetExtensionService(); |
| 109 std::string manifest = ResourceBundle::GetSharedInstance(). | 111 std::string manifest = ResourceBundle::GetSharedInstance(). |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 ExtensionTtsPlatformImpl::GetInstance()->Speak( | 154 ExtensionTtsPlatformImpl::GetInstance()->Speak( |
| 153 -1, // No utterance ID because we don't need a callback when it finishes. | 155 -1, // No utterance ID because we don't need a callback when it finishes. |
| 154 utterance, | 156 utterance, |
| 155 g_browser_process->GetApplicationLocale(), | 157 g_browser_process->GetApplicationLocale(), |
| 156 params); | 158 params); |
| 157 } | 159 } |
| 158 | 160 |
| 159 | 161 |
| 160 } // namespace accessibility | 162 } // namespace accessibility |
| 161 } // namespace chromeos | 163 } // namespace chromeos |
| OLD | NEW |