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 3// found in the LICENSE file. 4 5#include "content/browser/accessibility/browser_accessibility_state_impl.h" 6 7#include <windows.h> 8#include <psapi.h> 9 10#include "base/files/file_path.h" 11#include "base/metrics/histogram.h" 12#include "base/strings/string_util.h" 13 14namespace content { 15 16void BrowserAccessibilityStateImpl::UpdatePlatformSpecificHistograms() { 17 // NOTE: this method is run from the file thread to reduce jank, since 18 // there's no guarantee these system calls will return quickly. Be careful 19 // not to add any code that isn't safe to run from a non-main thread! 20 21 AUDIODESCRIPTION audio_description = {0}; 22 audio_description.cbSize = sizeof(AUDIODESCRIPTION); 23 SystemParametersInfo(SPI_GETAUDIODESCRIPTION, 0, &audio_description, 0); 24 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinAudioDescription", 25 !!audio_description.Enabled); 26 27 BOOL win_screen_reader = FALSE; 28 SystemParametersInfo(SPI_GETSCREENREADER, 0, &win_screen_reader, 0); 29 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinScreenReader", 30 !!win_screen_reader); 31 32 STICKYKEYS sticky_keys = {0}; 33 sticky_keys.cbSize = sizeof(STICKYKEYS); 34 SystemParametersInfo(SPI_GETSTICKYKEYS, 0, &sticky_keys, 0); 35 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinStickyKeys", 36 0 != (sticky_keys.dwFlags & SKF_STICKYKEYSON)); 37 38 // Get the file paths of all DLLs loaded. 39 HANDLE process = GetCurrentProcess(); 40 HMODULE* modules = NULL; 41 DWORD bytes_required; 42 if (!EnumProcessModules(process, modules, 0, &bytes_required)) 43 return; 44 45 scoped_ptr<char[]> buffer(new char[bytes_required]); 46 modules = reinterpret_cast<HMODULE*>(buffer.get()); 47 DWORD ignore; 48 if (!EnumProcessModules(process, modules, bytes_required, &ignore)) 49 return; 50 51 // Look for DLLs of assistive technology known to work with Chrome. 52 bool jaws = false; 53 bool nvda = false; 54 bool satogo = false; 55 bool zoomtext = false; 56 size_t module_count = bytes_required / sizeof(HMODULE); 57 for (size_t i = 0; i < module_count; i++) { 58 TCHAR filename[MAX_PATH]; 59 GetModuleFileName(modules[i], filename, sizeof(filename)); 60 base::string16 module_name(base::FilePath(filename).BaseName().value()); 61 if (LowerCaseEqualsASCII(module_name, "fsdomsrv.dll")) 62 jaws = true; 63 if (LowerCaseEqualsASCII(module_name, "vbufbackend_gecko_ia2.dll")) 64 nvda = true; 65 if (LowerCaseEqualsASCII(module_name, "stsaw32.dll")) 66 satogo = true; 67 if (LowerCaseEqualsASCII(module_name, "zslhook.dll")) 68 zoomtext = true; 69 } 70 71 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinJAWS", jaws); 72 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinNVDA", nvda); 73 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinSAToGo", satogo); 74 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinZoomText", zoomtext); 75} 76 77} // namespace content 78