Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_util.cc

Issue 11414232: Add Chrome OS accessibility histograms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase, fix style errors Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "ash/high_contrast/high_contrast_controller.h" 9 #include "ash/high_contrast/high_contrast_controller.h"
10 #include "ash/magnifier/magnification_controller.h" 10 #include "ash/magnifier/magnification_controller.h"
11 #include "ash/magnifier/partial_magnification_controller.h" 11 #include "ash/magnifier/partial_magnification_controller.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/bind_helpers.h" 14 #include "base/bind_helpers.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/metrics/histogram.h"
16 #include "chrome/browser/accessibility/accessibility_extension_api.h" 17 #include "chrome/browser/accessibility/accessibility_extension_api.h"
17 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 19 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
19 #include "chrome/browser/extensions/component_loader.h" 20 #include "chrome/browser/extensions/component_loader.h"
20 #include "chrome/browser/extensions/extension_service.h" 21 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/extensions/file_reader.h" 22 #include "chrome/browser/extensions/file_reader.h"
22 #include "chrome/browser/prefs/pref_service.h" 23 #include "chrome/browser/prefs/pref_service.h"
23 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
24 #include "chrome/browser/profiles/profile_manager.h" 25 #include "chrome/browser/profiles/profile_manager.h"
25 #include "chrome/browser/speech/extension_api/tts_extension_api_controller.h" 26 #include "chrome/browser/speech/extension_api/tts_extension_api_controller.h"
26 #include "chrome/browser/ui/singleton_tabs.h" 27 #include "chrome/browser/ui/singleton_tabs.h"
27 #include "chrome/common/extensions/extension.h" 28 #include "chrome/common/extensions/extension.h"
28 #include "chrome/common/extensions/extension_messages.h" 29 #include "chrome/common/extensions/extension_messages.h"
29 #include "chrome/common/extensions/extension_resource.h" 30 #include "chrome/common/extensions/extension_resource.h"
30 #include "chrome/common/extensions/user_script.h" 31 #include "chrome/common/extensions/user_script.h"
31 #include "chrome/common/pref_names.h" 32 #include "chrome/common/pref_names.h"
32 #include "chrome/common/url_constants.h" 33 #include "chrome/common/url_constants.h"
34 #include "content/public/browser/browser_accessibility_state.h"
33 #include "content/public/browser/render_process_host.h" 35 #include "content/public/browser/render_process_host.h"
34 #include "content/public/browser/render_view_host.h" 36 #include "content/public/browser/render_view_host.h"
35 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
36 #include "content/public/browser/web_ui.h" 38 #include "content/public/browser/web_ui.h"
37 #include "googleurl/src/gurl.h" 39 #include "googleurl/src/gurl.h"
38 #include "grit/browser_resources.h" 40 #include "grit/browser_resources.h"
39 #include "grit/generated_resources.h" 41 #include "grit/generated_resources.h"
40 #include "ui/base/l10n/l10n_util.h" 42 #include "ui/base/l10n/l10n_util.h"
41 #include "ui/base/resource/resource_bundle.h" 43 #include "ui/base/resource/resource_bundle.h"
42 44
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 106 }
105 Run(); 107 Run();
106 } 108 }
107 109
108 std::string extension_id_; 110 std::string extension_id_;
109 int render_process_id_; 111 int render_process_id_;
110 int render_view_id_; 112 int render_view_id_;
111 std::queue<ExtensionResource> resources_; 113 std::queue<ExtensionResource> resources_;
112 }; 114 };
113 115
116 void UpdateChromeOSAccessibilityHistograms() {
117 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosSpokenFeedback",
118 IsSpokenFeedbackEnabled());
119 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosHighContrast",
120 IsHighContrastEnabled());
121 UMA_HISTOGRAM_BOOLEAN("Accessibility.CrosVirtualKeyboard",
122 IsVirtualKeyboardEnabled());
123 UMA_HISTOGRAM_ENUMERATION("Accessibility.CrosScreenMagnifier",
124 GetMagnifierType(),
davidjames 2012/12/01 18:44:57 It looks like this call to GetMagnifierType() is i
125 3);
126 }
127
128 void Initialize() {
129 content::BrowserAccessibilityState::GetInstance()->AddHistogramCallback(
130 base::Bind(&UpdateChromeOSAccessibilityHistograms));
131 }
132
114 void EnableSpokenFeedback(bool enabled, content::WebUI* login_web_ui) { 133 void EnableSpokenFeedback(bool enabled, content::WebUI* login_web_ui) {
115 bool spoken_feedback_enabled = g_browser_process && 134 bool spoken_feedback_enabled = g_browser_process &&
116 g_browser_process->local_state()->GetBoolean( 135 g_browser_process->local_state()->GetBoolean(
117 prefs::kSpokenFeedbackEnabled); 136 prefs::kSpokenFeedbackEnabled);
118 if (spoken_feedback_enabled == enabled) { 137 if (spoken_feedback_enabled == enabled) {
119 DLOG(INFO) << "Spoken feedback is already " << 138 DLOG(INFO) << "Spoken feedback is already " <<
120 (enabled ? "enabled" : "disabled") << ". Going to do nothing."; 139 (enabled ? "enabled" : "disabled") << ". Going to do nothing.";
121 return; 140 return;
122 } 141 }
123 142
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 bool IsHighContrastEnabled() { 259 bool IsHighContrastEnabled() {
241 if (!g_browser_process) { 260 if (!g_browser_process) {
242 return false; 261 return false;
243 } 262 }
244 PrefService* prefs = g_browser_process->local_state(); 263 PrefService* prefs = g_browser_process->local_state();
245 bool high_contrast_enabled = prefs && 264 bool high_contrast_enabled = prefs &&
246 prefs->GetBoolean(prefs::kHighContrastEnabled); 265 prefs->GetBoolean(prefs::kHighContrastEnabled);
247 return high_contrast_enabled; 266 return high_contrast_enabled;
248 } 267 }
249 268
269 bool IsVirtualKeyboardEnabled() {
270 if (!g_browser_process) {
271 return false;
272 }
273 PrefService* prefs = g_browser_process->local_state();
274 bool virtual_keyboard_enabled = prefs &&
275 prefs->GetBoolean(prefs::kVirtualKeyboardEnabled);
276 return virtual_keyboard_enabled;
277 }
278
250 ash::MagnifierType GetMagnifierType() { 279 ash::MagnifierType GetMagnifierType() {
251 if (!MagnificationManager::GetInstance()) 280 if (!MagnificationManager::GetInstance())
252 return ash::MAGNIFIER_OFF; 281 return ash::MAGNIFIER_OFF;
253 return MagnificationManager::GetInstance()->GetMagnifierType(); 282 return MagnificationManager::GetInstance()->GetMagnifierType();
254 } 283 }
255 284
256 ash::MagnifierType MagnifierTypeFromName(const char type_name[]) { 285 ash::MagnifierType MagnifierTypeFromName(const char type_name[]) {
257 if (0 == strcmp(type_name, kScreenMagnifierFull)) 286 if (0 == strcmp(type_name, kScreenMagnifierFull))
258 return ash::MAGNIFIER_FULL; 287 return ash::MAGNIFIER_FULL;
259 else if (0 == strcmp(type_name, kScreenMagnifierPartial)) 288 else if (0 == strcmp(type_name, kScreenMagnifierPartial))
(...skipping 18 matching lines...) Expand all
278 if (IsSpokenFeedbackEnabled()) 307 if (IsSpokenFeedbackEnabled())
279 Speak(utterance); 308 Speak(utterance);
280 } 309 }
281 310
282 void ShowAccessibilityHelp(Browser* browser) { 311 void ShowAccessibilityHelp(Browser* browser) {
283 chrome::ShowSingletonTab(browser, GURL(chrome::kChromeAccessibilityHelpURL)); 312 chrome::ShowSingletonTab(browser, GURL(chrome::kChromeAccessibilityHelpURL));
284 } 313 }
285 314
286 } // namespace accessibility 315 } // namespace accessibility
287 } // namespace chromeos 316 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/accessibility/accessibility_util.h ('k') | chrome/browser/chromeos/chrome_browser_main_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698