OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 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/accessibility_event_recorder.h" | 5 #include "content/browser/accessibility/accessibility_event_recorder.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 observer_ref_.InitializeInto())) { | 70 observer_ref_.InitializeInto())) { |
71 LOG(FATAL) << "Failed to create AXObserverRef"; | 71 LOG(FATAL) << "Failed to create AXObserverRef"; |
72 } | 72 } |
73 | 73 |
74 // Get an AXUIElement for the Chrome application. | 74 // Get an AXUIElement for the Chrome application. |
75 application_.reset(AXUIElementCreateApplication(pid)); | 75 application_.reset(AXUIElementCreateApplication(pid)); |
76 if (!application_.get()) | 76 if (!application_.get()) |
77 LOG(FATAL) << "Failed to create AXUIElement for application."; | 77 LOG(FATAL) << "Failed to create AXUIElement for application."; |
78 | 78 |
79 // Add the notifications we care about to the observer. | 79 // Add the notifications we care about to the observer. |
| 80 AddNotification(@"AXAutocorrectionOccurred"); |
| 81 AddNotification(@"AXExpandedChanged"); |
| 82 AddNotification(@"AXInvalidStatusChanged"); |
| 83 AddNotification(@"AXLiveRegionChanged"); |
| 84 AddNotification(@"AXLiveRegionCreated"); |
| 85 AddNotification(@"AXLoadComplete"); |
| 86 AddNotification(@"AXMenuItemSelected"); |
| 87 AddNotification(@"AXRowCollapsed"); |
| 88 AddNotification(@"AXRowExpanded"); |
80 AddNotification(NSAccessibilityFocusedUIElementChangedNotification); | 89 AddNotification(NSAccessibilityFocusedUIElementChangedNotification); |
| 90 AddNotification(NSAccessibilityRowCollapsedNotification); |
81 AddNotification(NSAccessibilityRowCountChangedNotification); | 91 AddNotification(NSAccessibilityRowCountChangedNotification); |
82 AddNotification(NSAccessibilitySelectedChildrenChangedNotification); | 92 AddNotification(NSAccessibilitySelectedChildrenChangedNotification); |
83 AddNotification(NSAccessibilitySelectedRowsChangedNotification); | 93 AddNotification(NSAccessibilitySelectedRowsChangedNotification); |
84 AddNotification(NSAccessibilitySelectedTextChangedNotification); | 94 AddNotification(NSAccessibilitySelectedTextChangedNotification); |
85 AddNotification(NSAccessibilityValueChangedNotification); | 95 AddNotification(NSAccessibilityValueChangedNotification); |
86 AddNotification(@"AXExpandedChanged"); | |
87 AddNotification(@"AXLayoutComplete"); | |
88 AddNotification(@"AXLiveRegionChanged"); | |
89 AddNotification(@"AXLoadComplete"); | |
90 AddNotification(@"AXRowCollapsed"); | |
91 AddNotification(@"AXRowExpanded"); | |
92 | 96 |
93 // Add the observer to the current message loop. | 97 // Add the observer to the current message loop. |
94 observer_run_loop_source_ = AXObserverGetRunLoopSource(observer_ref_.get()); | 98 observer_run_loop_source_ = AXObserverGetRunLoopSource(observer_ref_.get()); |
95 CFRunLoopAddSource(CFRunLoopGetCurrent(), observer_run_loop_source_, | 99 CFRunLoopAddSource(CFRunLoopGetCurrent(), observer_run_loop_source_, |
96 kCFRunLoopDefaultMode); | 100 kCFRunLoopDefaultMode); |
97 } | 101 } |
98 | 102 |
99 AccessibilityEventRecorderMac::~AccessibilityEventRecorderMac() { | 103 AccessibilityEventRecorderMac::~AccessibilityEventRecorderMac() { |
100 CFRunLoopRemoveSource(CFRunLoopGetCurrent(), observer_run_loop_source_, | 104 CFRunLoopRemoveSource(CFRunLoopGetCurrent(), observer_run_loop_source_, |
101 kCFRunLoopDefaultMode); | 105 kCFRunLoopDefaultMode); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 148 |
145 std::string value = | 149 std::string value = |
146 GetAXAttributeValue(element, NSAccessibilityValueAttribute); | 150 GetAXAttributeValue(element, NSAccessibilityValueAttribute); |
147 if (!value.empty()) | 151 if (!value.empty()) |
148 log += base::StringPrintf(" AXValue=\"%s\"", value.c_str()); | 152 log += base::StringPrintf(" AXValue=\"%s\"", value.c_str()); |
149 | 153 |
150 event_logs_.push_back(log); | 154 event_logs_.push_back(log); |
151 } | 155 } |
152 | 156 |
153 } // namespace content | 157 } // namespace content |
OLD | NEW |