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