| 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 has been tested on 10.5, |
| 20 // 10.6, and 10.7. |
| 21 extern "C" void NSAccessibilityUnregisterUniqueIdForUIElement(id element); |
| 22 |
| 19 typedef WebAccessibility::IntAttribute IntAttribute; | 23 typedef WebAccessibility::IntAttribute IntAttribute; |
| 20 typedef WebAccessibility::StringAttribute StringAttribute; | 24 typedef WebAccessibility::StringAttribute StringAttribute; |
| 21 | 25 |
| 22 namespace { | 26 namespace { |
| 23 | 27 |
| 24 // Returns an autoreleased copy of the WebAccessibility's attribute. | 28 // Returns an autoreleased copy of the WebAccessibility's attribute. |
| 25 NSString* NSStringForStringAttribute( | 29 NSString* NSStringForStringAttribute( |
| 26 const std::map<StringAttribute, string16>& attributes, | 30 const std::map<StringAttribute, string16>& attributes, |
| 27 StringAttribute attribute) { | 31 StringAttribute attribute) { |
| 28 std::map<StringAttribute, string16>::const_iterator iter = | 32 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])) { | 244 if ((self = [super init])) { |
| 241 browserAccessibility_ = accessibility; | 245 browserAccessibility_ = accessibility; |
| 242 delegate_ = delegate; | 246 delegate_ = delegate; |
| 243 } | 247 } |
| 244 return self; | 248 return self; |
| 245 } | 249 } |
| 246 | 250 |
| 247 // Deletes our associated BrowserAccessibilityMac. | 251 // Deletes our associated BrowserAccessibilityMac. |
| 248 - (void)dealloc { | 252 - (void)dealloc { |
| 249 if (browserAccessibility_) { | 253 if (browserAccessibility_) { |
| 254 NSAccessibilityUnregisterUniqueIdForUIElement(self); |
| 250 delete browserAccessibility_; | 255 delete browserAccessibility_; |
| 251 browserAccessibility_ = NULL; | 256 browserAccessibility_ = NULL; |
| 252 } | 257 } |
| 253 | 258 |
| 254 [super dealloc]; | 259 [super dealloc]; |
| 255 } | 260 } |
| 256 | 261 |
| 257 // Returns an array of BrowserAccessibilityCocoa objects, representing the | 262 // Returns an array of BrowserAccessibilityCocoa objects, representing the |
| 258 // accessibility children of this object. | 263 // accessibility children of this object. |
| 259 - (NSArray*)children { | 264 - (NSArray*)children { |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 823 return ([self hash] == [object hash]); | 828 return ([self hash] == [object hash]); |
| 824 } | 829 } |
| 825 | 830 |
| 826 - (NSUInteger)hash { | 831 - (NSUInteger)hash { |
| 827 // Potentially called during dealloc. | 832 // Potentially called during dealloc. |
| 828 if (!browserAccessibility_) | 833 if (!browserAccessibility_) |
| 829 return [super hash]; | 834 return [super hash]; |
| 830 return browserAccessibility_->renderer_id(); | 835 return browserAccessibility_->renderer_id(); |
| 831 } | 836 } |
| 832 | 837 |
| 838 - (BOOL)accessibilityShouldUseUniqueId { |
| 839 return YES; |
| 840 } |
| 841 |
| 833 @end | 842 @end |
| 834 | 843 |
| OLD | NEW |