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 // TODO(dtseng): should this be forward declared here? | |
20 extern "C" void NSAccessibilityUnregisterUniqueIdForUIElement(id element); | |
Nico
2011/08/02 22:07:14
Is this SPI / a weak symbol? Can it resolve to NUL
David Tseng
2011/08/03 00:13:22
This is SPI from AppKit. There's no guarantee of i
Nico
2011/08/04 14:29:02
Ok. Add a comment that says that this is SPI that'
| |
21 | |
19 typedef WebAccessibility::IntAttribute IntAttribute; | 22 typedef WebAccessibility::IntAttribute IntAttribute; |
20 typedef WebAccessibility::StringAttribute StringAttribute; | 23 typedef WebAccessibility::StringAttribute StringAttribute; |
21 | 24 |
22 namespace { | 25 namespace { |
23 | 26 |
24 // Returns an autoreleased copy of the WebAccessibility's attribute. | 27 // Returns an autoreleased copy of the WebAccessibility's attribute. |
25 NSString* NSStringForStringAttribute( | 28 NSString* NSStringForStringAttribute( |
26 const std::map<StringAttribute, string16>& attributes, | 29 const std::map<StringAttribute, string16>& attributes, |
27 StringAttribute attribute) { | 30 StringAttribute attribute) { |
28 std::map<StringAttribute, string16>::const_iterator iter = | 31 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])) { | 243 if ((self = [super init])) { |
241 browserAccessibility_ = accessibility; | 244 browserAccessibility_ = accessibility; |
242 delegate_ = delegate; | 245 delegate_ = delegate; |
243 } | 246 } |
244 return self; | 247 return self; |
245 } | 248 } |
246 | 249 |
247 // Deletes our associated BrowserAccessibilityMac. | 250 // Deletes our associated BrowserAccessibilityMac. |
248 - (void)dealloc { | 251 - (void)dealloc { |
249 if (browserAccessibility_) { | 252 if (browserAccessibility_) { |
253 NSAccessibilityUnregisterUniqueIdForUIElement(self); | |
250 delete browserAccessibility_; | 254 delete browserAccessibility_; |
251 browserAccessibility_ = NULL; | 255 browserAccessibility_ = NULL; |
252 } | 256 } |
253 | 257 |
254 [super dealloc]; | 258 [super dealloc]; |
255 } | 259 } |
256 | 260 |
257 // Returns an array of BrowserAccessibilityCocoa objects, representing the | 261 // Returns an array of BrowserAccessibilityCocoa objects, representing the |
258 // accessibility children of this object. | 262 // accessibility children of this object. |
259 - (NSArray*)children { | 263 - (NSArray*)children { |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
823 return ([self hash] == [object hash]); | 827 return ([self hash] == [object hash]); |
824 } | 828 } |
825 | 829 |
826 - (NSUInteger)hash { | 830 - (NSUInteger)hash { |
827 // Potentially called during dealloc. | 831 // Potentially called during dealloc. |
828 if (!browserAccessibility_) | 832 if (!browserAccessibility_) |
829 return [super hash]; | 833 return [super hash]; |
830 return browserAccessibility_->renderer_id(); | 834 return browserAccessibility_->renderer_id(); |
831 } | 835 } |
832 | 836 |
837 - (BOOL)accessibilityShouldUseUniqueId { | |
838 return YES; | |
839 } | |
840 | |
833 @end | 841 @end |
834 | 842 |
OLD | NEW |