OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/accessibility_util.h" | 5 #include "chrome/browser/chromeos/accessibility/accessibility_util.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "chrome/browser/accessibility/accessibility_extension_api.h" | 12 #include "chrome/browser/accessibility/accessibility_extension_api.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/extensions/component_loader.h" | 14 #include "chrome/browser/extensions/component_loader.h" |
15 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/extensions/file_reader.h" | 16 #include "chrome/browser/extensions/file_reader.h" |
17 #include "chrome/browser/prefs/pref_service.h" | 17 #include "chrome/browser/prefs/pref_service.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
20 #include "chrome/browser/speech/extension_api/tts_extension_api_platform.h" | 20 #include "chrome/browser/speech/extension_api/tts_extension_api_platform.h" |
| 21 #include "chrome/common/extensions/extension.h" |
21 #include "chrome/common/extensions/extension_messages.h" | 22 #include "chrome/common/extensions/extension_messages.h" |
22 #include "chrome/common/extensions/extension_resource.h" | 23 #include "chrome/common/extensions/extension_resource.h" |
23 #include "chrome/common/extensions/user_script.h" | 24 #include "chrome/common/extensions/user_script.h" |
24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
25 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
27 #include "content/public/browser/web_ui.h" | 28 #include "content/public/browser/web_ui.h" |
28 #include "grit/browser_resources.h" | 29 #include "grit/browser_resources.h" |
29 #include "grit/generated_resources.h" | 30 #include "grit/generated_resources.h" |
30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 enabled ? IDS_CHROMEOS_ACC_SPOKEN_FEEDBACK_ENABLED : | 110 enabled ? IDS_CHROMEOS_ACC_SPOKEN_FEEDBACK_ENABLED : |
110 IDS_CHROMEOS_ACC_SPOKEN_FEEDBACK_DISABLED).c_str()); | 111 IDS_CHROMEOS_ACC_SPOKEN_FEEDBACK_DISABLED).c_str()); |
111 | 112 |
112 // Load/Unload ChromeVox | 113 // Load/Unload ChromeVox |
113 Profile* profile = ProfileManager::GetDefaultProfile(); | 114 Profile* profile = ProfileManager::GetDefaultProfile(); |
114 ExtensionService* extension_service = | 115 ExtensionService* extension_service = |
115 profile->GetExtensionService(); | 116 profile->GetExtensionService(); |
116 FilePath path = FilePath(extension_misc::kAccessExtensionPath) | 117 FilePath path = FilePath(extension_misc::kAccessExtensionPath) |
117 .AppendASCII(extension_misc::kChromeVoxDirectoryName); | 118 .AppendASCII(extension_misc::kChromeVoxDirectoryName); |
118 if (enabled) { // Load ChromeVox | 119 if (enabled) { // Load ChromeVox |
119 const Extension* extension = | 120 const extensions::Extension* extension = |
120 extension_service->component_loader()->Add(IDR_CHROMEVOX_MANIFEST, | 121 extension_service->component_loader()->Add(IDR_CHROMEVOX_MANIFEST, |
121 path); | 122 path); |
122 | 123 |
123 if (login_web_ui) { | 124 if (login_web_ui) { |
124 RenderViewHost* render_view_host = | 125 RenderViewHost* render_view_host = |
125 login_web_ui->GetWebContents()->GetRenderViewHost(); | 126 login_web_ui->GetWebContents()->GetRenderViewHost(); |
126 // Set a flag to tell ChromeVox that it's just been enabled, | 127 // Set a flag to tell ChromeVox that it's just been enabled, |
127 // so that it won't interrupt our speech feedback enabled message. | 128 // so that it won't interrupt our speech feedback enabled message. |
128 ExtensionMsg_ExecuteCode_Params params; | 129 ExtensionMsg_ExecuteCode_Params params; |
129 params.request_id = 0; | 130 params.request_id = 0; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 return spoken_feedback_enabled; | 205 return spoken_feedback_enabled; |
205 } | 206 } |
206 | 207 |
207 void MaybeSpeak(const std::string& utterance) { | 208 void MaybeSpeak(const std::string& utterance) { |
208 if (IsSpokenFeedbackEnabled()) | 209 if (IsSpokenFeedbackEnabled()) |
209 Speak(utterance); | 210 Speak(utterance); |
210 } | 211 } |
211 | 212 |
212 } // namespace accessibility | 213 } // namespace accessibility |
213 } // namespace chromeos | 214 } // namespace chromeos |
OLD | NEW |