Remove PlatformFile from profile_browsertest
[chromium-blink-merge.git] / content / browser / accessibility / browser_accessibility_state_impl_win.cc
blob28f05e0e7ec2992feb43ec1f01a65ce6bb3beb2c
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.
5 #include "content/browser/accessibility/browser_accessibility_state_impl.h"
7 #include <windows.h>
8 #include <psapi.h>
10 #include "base/files/file_path.h"
11 #include "base/metrics/histogram.h"
12 #include "base/strings/string_util.h"
14 namespace content {
16 void 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!
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);
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);
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));
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;
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;
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;
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);
77 } // namespace content