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/metrics/histogram.h"
12 #include "base/strings/string_util.h"
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",
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
;
42 if (!EnumProcessModules(process
, modules
, 0, &bytes_required
))
45 scoped_ptr
<char[]> buffer(new char[bytes_required
]);
46 modules
= reinterpret_cast<HMODULE
*>(buffer
.get());
48 if (!EnumProcessModules(process
, modules
, bytes_required
, &ignore
))
51 // Look for DLLs of assistive technology known to work with Chrome.
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"))
63 if (LowerCaseEqualsASCII(module_name
, "vbufbackend_gecko_ia2.dll"))
65 if (LowerCaseEqualsASCII(module_name
, "stsaw32.dll"))
67 if (LowerCaseEqualsASCII(module_name
, "zslhook.dll"))
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