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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COCOA_H_
6 #define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COCOA_H_
8 #import <Cocoa/Cocoa.h>
10 #import "base/mac/scoped_nsobject.h"
11 #include "content/browser/accessibility/browser_accessibility.h"
12 #include "content/browser/accessibility/browser_accessibility_manager.h"
14 // BrowserAccessibilityCocoa is a cocoa wrapper around the BrowserAccessibility
15 // object. The renderer converts webkit's accessibility tree into a
16 // WebAccessibility tree and passes it to the browser process over IPC.
17 // This class converts it into a format Cocoa can query.
18 @interface BrowserAccessibilityCocoa
: NSObject
{
20 content::BrowserAccessibility
* browserAccessibility_
;
21 base::scoped_nsobject
<NSMutableArray
> children_
;
24 // This creates a cocoa browser accessibility object around
25 // the cross platform BrowserAccessibility object, which can't be null.
26 - (id
)initWithObject
:(content::BrowserAccessibility
*)accessibility
;
28 // Clear this object's pointer to the wrapped BrowserAccessibility object
29 // because the wrapped object has been deleted, but this object may
30 // persist if the system still has references to it.
33 // Invalidate children for a non-ignored ancestor (including self).
34 - (void)childrenChanged
;
36 // Convenience method to get the internal, cross-platform role
37 // from browserAccessibility_.
38 - (ui::AXRole
)internalRole
;
40 // Convenience method to get the BrowserAccessibilityDelegate from
42 - (content::BrowserAccessibilityDelegate
*)delegate
;
44 // Get the BrowserAccessibility that this object wraps.
45 - (content::BrowserAccessibility
*)browserAccessibility
;
47 // Convert the local objet's origin to a global point.
48 - (NSPoint
)pointInScreen
:(NSPoint
)origin
51 // Return the method name for the given attribute. For testing only.
52 - (NSString
*)methodNameForAttribute
:(NSString
*)attribute
;
54 // Swap the children array with the given scoped_nsobject.
55 - (void)swapChildren
:(base::scoped_nsobject
<NSMutableArray
>*)other
;
57 // Internally-used method.
58 @
property(nonatomic
, readonly
) NSPoint origin
;
60 // Children is an array of BrowserAccessibility objects, representing
61 // the accessibility children of this object.
62 @
property(nonatomic
, readonly
) NSString
* accessKey
;
63 @
property(nonatomic
, readonly
) NSNumber
* ariaAtomic
;
64 @
property(nonatomic
, readonly
) NSNumber
* ariaBusy
;
65 @
property(nonatomic
, readonly
) NSString
* ariaLive
;
66 @
property(nonatomic
, readonly
) NSString
* ariaRelevant
;
67 @
property(nonatomic
, readonly
) NSArray
* children
;
68 @
property(nonatomic
, readonly
) NSArray
* columns
;
69 @
property(nonatomic
, readonly
) NSArray
* columnHeaders
;
70 @
property(nonatomic
, readonly
) NSValue
* columnIndexRange
;
71 @
property(nonatomic
, readonly
) NSString
* description
;
72 @
property(nonatomic
, readonly
) NSNumber
* disclosing
;
73 @
property(nonatomic
, readonly
) id disclosedByRow
;
74 @
property(nonatomic
, readonly
) NSNumber
* disclosureLevel
;
75 @
property(nonatomic
, readonly
) id disclosedRows
;
76 @
property(nonatomic
, readonly
) NSNumber
* enabled
;
77 @
property(nonatomic
, readonly
) NSNumber
* focused
;
78 @
property(nonatomic
, readonly
) NSString
* help
;
79 // isIgnored returns whether or not the accessibility object
80 // should be ignored by the accessibility hierarchy.
81 @
property(nonatomic
, readonly
, getter
=isIgnored
) BOOL ignored
;
82 // Index of a row, column, or tree item.
83 @
property(nonatomic
, readonly
) NSNumber
* index
;
84 @
property(nonatomic
, readonly
) NSString
* invalid
;
85 @
property(nonatomic
, readonly
) NSString
* placeholderValue
;
86 @
property(nonatomic
, readonly
) NSNumber
* loaded
;
87 @
property(nonatomic
, readonly
) NSNumber
* loadingProgress
;
88 @
property(nonatomic
, readonly
) NSNumber
* maxValue
;
89 @
property(nonatomic
, readonly
) NSNumber
* minValue
;
90 @
property(nonatomic
, readonly
) NSNumber
* numberOfCharacters
;
91 @
property(nonatomic
, readonly
) NSString
* orientation
;
92 @
property(nonatomic
, readonly
) id parent
;
93 @
property(nonatomic
, readonly
) NSValue
* position
;
94 @
property(nonatomic
, readonly
) NSNumber
* required
;
95 // A string indicating the role of this object as far as accessibility
97 @
property(nonatomic
, readonly
) NSString
* role
;
98 @
property(nonatomic
, readonly
) NSString
* roleDescription
;
99 @
property(nonatomic
, readonly
) NSArray
* rowHeaders
;
100 @
property(nonatomic
, readonly
) NSValue
* rowIndexRange
;
101 @
property(nonatomic
, readonly
) NSArray
* rows
;
102 @
property(nonatomic
, readonly
) NSArray
* selectedChildren
;
103 // The size of this object.
104 @
property(nonatomic
, readonly
) NSValue
* size
;
105 // A string indicating the subrole of this object as far as accessibility
107 @
property(nonatomic
, readonly
) NSString
* subrole
;
108 // The tabs owned by a tablist.
109 @
property(nonatomic
, readonly
) NSArray
* tabs
;
110 @
property(nonatomic
, readonly
) NSString
* title
;
111 @
property(nonatomic
, readonly
) id titleUIElement
;
112 @
property(nonatomic
, readonly
) NSURL
* url
;
113 @
property(nonatomic
, readonly
) NSString
* value
;
114 @
property(nonatomic
, readonly
) NSString
* valueDescription
;
115 @
property(nonatomic
, readonly
) NSValue
* visibleCharacterRange
;
116 @
property(nonatomic
, readonly
) NSArray
* visibleCells
;
117 @
property(nonatomic
, readonly
) NSArray
* visibleChildren
;
118 @
property(nonatomic
, readonly
) NSArray
* visibleColumns
;
119 @
property(nonatomic
, readonly
) NSArray
* visibleRows
;
120 @
property(nonatomic
, readonly
) NSNumber
* visited
;
121 @
property(nonatomic
, readonly
) id window
;
124 #endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COCOA_H_