OLD | NEW |
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 "content/browser/accessibility/browser_accessibility_state_impl.h" | 5 #include "content/browser/accessibility/browser_accessibility_state_impl.h" |
6 | 6 |
7 #include <windows.h> | |
8 #include <psapi.h> | 7 #include <psapi.h> |
9 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <windows.h> |
| 10 |
| 11 #include <memory> |
10 | 12 |
11 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
12 #include "base/macros.h" | 14 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/metrics/histogram.h" | 15 #include "base/metrics/histogram.h" |
15 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
16 | 17 |
17 namespace content { | 18 namespace content { |
18 | 19 |
19 void BrowserAccessibilityStateImpl::UpdatePlatformSpecificHistograms() { | 20 void BrowserAccessibilityStateImpl::UpdatePlatformSpecificHistograms() { |
20 // NOTE: this method is run from the file thread to reduce jank, since | 21 // NOTE: this method is run from the file thread to reduce jank, since |
21 // there's no guarantee these system calls will return quickly. Be careful | 22 // there's no guarantee these system calls will return quickly. Be careful |
22 // not to add any code that isn't safe to run from a non-main thread! | 23 // not to add any code that isn't safe to run from a non-main thread! |
23 | 24 |
(...skipping 14 matching lines...) Expand all Loading... |
38 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinStickyKeys", | 39 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinStickyKeys", |
39 0 != (sticky_keys.dwFlags & SKF_STICKYKEYSON)); | 40 0 != (sticky_keys.dwFlags & SKF_STICKYKEYSON)); |
40 | 41 |
41 // Get the file paths of all DLLs loaded. | 42 // Get the file paths of all DLLs loaded. |
42 HANDLE process = GetCurrentProcess(); | 43 HANDLE process = GetCurrentProcess(); |
43 HMODULE* modules = NULL; | 44 HMODULE* modules = NULL; |
44 DWORD bytes_required; | 45 DWORD bytes_required; |
45 if (!EnumProcessModules(process, modules, 0, &bytes_required)) | 46 if (!EnumProcessModules(process, modules, 0, &bytes_required)) |
46 return; | 47 return; |
47 | 48 |
48 scoped_ptr<char[]> buffer(new char[bytes_required]); | 49 std::unique_ptr<char[]> buffer(new char[bytes_required]); |
49 modules = reinterpret_cast<HMODULE*>(buffer.get()); | 50 modules = reinterpret_cast<HMODULE*>(buffer.get()); |
50 DWORD ignore; | 51 DWORD ignore; |
51 if (!EnumProcessModules(process, modules, bytes_required, &ignore)) | 52 if (!EnumProcessModules(process, modules, bytes_required, &ignore)) |
52 return; | 53 return; |
53 | 54 |
54 // Look for DLLs of assistive technology known to work with Chrome. | 55 // Look for DLLs of assistive technology known to work with Chrome. |
55 bool jaws = false; | 56 bool jaws = false; |
56 bool nvda = false; | 57 bool nvda = false; |
57 bool satogo = false; | 58 bool satogo = false; |
58 bool zoomtext = false; | 59 bool zoomtext = false; |
(...skipping 12 matching lines...) Expand all Loading... |
71 zoomtext = true; | 72 zoomtext = true; |
72 } | 73 } |
73 | 74 |
74 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinJAWS", jaws); | 75 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinJAWS", jaws); |
75 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinNVDA", nvda); | 76 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinNVDA", nvda); |
76 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinSAToGo", satogo); | 77 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinSAToGo", satogo); |
77 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinZoomText", zoomtext); | 78 UMA_HISTOGRAM_BOOLEAN("Accessibility.WinZoomText", zoomtext); |
78 } | 79 } |
79 | 80 |
80 } // namespace content | 81 } // namespace content |
OLD | NEW |