OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <execinfo.h> | 5 #include <execinfo.h> |
6 | 6 |
7 #import "content/browser/accessibility/browser_accessibility_cocoa.h" | 7 #import "content/browser/accessibility/browser_accessibility_cocoa.h" |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/string16.h" | 11 #include "base/string16.h" |
12 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "content/browser/accessibility/browser_accessibility_manager.h" | 14 #include "content/browser/accessibility/browser_accessibility_manager.h" |
15 #include "content/common/content_client.h" | 15 #include "content/common/content_client.h" |
16 #include "grit/webkit_strings.h" | 16 #include "grit/webkit_strings.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" |
18 | 18 |
| 19 // See http://openradar.appspot.com/9896491. This SPI has been tested on 10.5, |
| 20 // 10.6, and 10.7. It allows accessibility clients to observe events posted on |
| 21 // this object. |
| 22 extern "C" void NSAccessibilityUnregisterUniqueIdForUIElement(id element); |
| 23 |
19 typedef WebAccessibility::IntAttribute IntAttribute; | 24 typedef WebAccessibility::IntAttribute IntAttribute; |
20 typedef WebAccessibility::StringAttribute StringAttribute; | 25 typedef WebAccessibility::StringAttribute StringAttribute; |
21 | 26 |
22 namespace { | 27 namespace { |
23 | 28 |
24 // Returns an autoreleased copy of the WebAccessibility's attribute. | 29 // Returns an autoreleased copy of the WebAccessibility's attribute. |
25 NSString* NSStringForStringAttribute( | 30 NSString* NSStringForStringAttribute( |
26 const std::map<StringAttribute, string16>& attributes, | 31 const std::map<StringAttribute, string16>& attributes, |
27 StringAttribute attribute) { | 32 StringAttribute attribute) { |
28 std::map<StringAttribute, string16>::const_iterator iter = | 33 std::map<StringAttribute, string16>::const_iterator iter = |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 if ((self = [super init])) { | 245 if ((self = [super init])) { |
241 browserAccessibility_ = accessibility; | 246 browserAccessibility_ = accessibility; |
242 delegate_ = delegate; | 247 delegate_ = delegate; |
243 } | 248 } |
244 return self; | 249 return self; |
245 } | 250 } |
246 | 251 |
247 // Deletes our associated BrowserAccessibilityMac. | 252 // Deletes our associated BrowserAccessibilityMac. |
248 - (void)dealloc { | 253 - (void)dealloc { |
249 if (browserAccessibility_) { | 254 if (browserAccessibility_) { |
| 255 NSAccessibilityUnregisterUniqueIdForUIElement(self); |
250 delete browserAccessibility_; | 256 delete browserAccessibility_; |
251 browserAccessibility_ = NULL; | 257 browserAccessibility_ = NULL; |
252 } | 258 } |
253 | 259 |
254 [super dealloc]; | 260 [super dealloc]; |
255 } | 261 } |
256 | 262 |
257 // Returns an array of BrowserAccessibilityCocoa objects, representing the | 263 // Returns an array of BrowserAccessibilityCocoa objects, representing the |
258 // accessibility children of this object. | 264 // accessibility children of this object. |
259 - (NSArray*)children { | 265 - (NSArray*)children { |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
823 return ([self hash] == [object hash]); | 829 return ([self hash] == [object hash]); |
824 } | 830 } |
825 | 831 |
826 - (NSUInteger)hash { | 832 - (NSUInteger)hash { |
827 // Potentially called during dealloc. | 833 // Potentially called during dealloc. |
828 if (!browserAccessibility_) | 834 if (!browserAccessibility_) |
829 return [super hash]; | 835 return [super hash]; |
830 return browserAccessibility_->renderer_id(); | 836 return browserAccessibility_->renderer_id(); |
831 } | 837 } |
832 | 838 |
| 839 - (BOOL)accessibilityShouldUseUniqueId { |
| 840 return YES; |
| 841 } |
| 842 |
833 @end | 843 @end |
834 | 844 |
OLD | NEW |