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.
4
5#ifndef CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COCOA_H_
6#define CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COCOA_H_
7
8#import <Cocoa/Cocoa.h>
9
10#import "base/mac/scoped_nsobject.h"
11#include "content/browser/accessibility/browser_accessibility.h"
12#import "content/browser/accessibility/browser_accessibility_delegate_mac.h"
13#include "content/common/accessibility_node_data.h"
14
15// BrowserAccessibilityCocoa is a cocoa wrapper around the BrowserAccessibility
16// object. The renderer converts webkit's accessibility tree into a
17// WebAccessibility tree and passes it to the browser process over IPC.
18// This class converts it into a format Cocoa can query.
19@interface BrowserAccessibilityCocoa : NSObject {
20 @private
21  content::BrowserAccessibility* browserAccessibility_;
22  base::scoped_nsobject<NSMutableArray> children_;
23  id<BrowserAccessibilityDelegateCocoa> delegate_;
24}
25
26// This creates a cocoa browser accessibility object around
27// the cross platform BrowserAccessibility object.  The delegate is
28// used to communicate with the host renderer.  None of these
29// parameters can be null.
30- (id)initWithObject:(content::BrowserAccessibility*)accessibility
31            delegate:(id<BrowserAccessibilityDelegateCocoa>)delegate;
32
33// Clear this object's pointer to the wrapped BrowserAccessibility object
34// because the wrapped object has been deleted, but this object may
35// persist if the system still has references to it.
36- (void)detach;
37
38// Invalidate children for a non-ignored ancestor (including self).
39- (void)childrenChanged;
40
41// Convenience method to get the internal, cross-platform role
42// from browserAccessibility_.
43- (content::AccessibilityNodeData::Role)internalRole;
44
45// Return the method name for the given attribute. For testing only.
46- (NSString*)methodNameForAttribute:(NSString*)attribute;
47
48// Internally-used method.
49@property(nonatomic, readonly) NSPoint origin;
50
51// Children is an array of BrowserAccessibility objects, representing
52// the accessibility children of this object.
53@property(nonatomic, readonly) NSString* accessKey;
54@property(nonatomic, readonly) NSNumber* ariaAtomic;
55@property(nonatomic, readonly) NSNumber* ariaBusy;
56@property(nonatomic, readonly) NSString* ariaLive;
57@property(nonatomic, readonly) NSString* ariaRelevant;
58@property(nonatomic, readonly) NSArray* children;
59@property(nonatomic, readonly) NSArray* columns;
60@property(nonatomic, readonly) NSArray* columnHeaders;
61@property(nonatomic, readonly) NSValue* columnIndexRange;
62@property(nonatomic, readonly) NSString* description;
63@property(nonatomic, readonly) NSNumber* disclosing;
64@property(nonatomic, readonly) id disclosedByRow;
65@property(nonatomic, readonly) NSNumber* disclosureLevel;
66@property(nonatomic, readonly) id disclosedRows;
67@property(nonatomic, readonly) NSNumber* enabled;
68@property(nonatomic, readonly) NSNumber* focused;
69@property(nonatomic, readonly) NSString* help;
70// isIgnored returns whether or not the accessibility object
71// should be ignored by the accessibility hierarchy.
72@property(nonatomic, readonly, getter=isIgnored) BOOL ignored;
73// Index of a row, column, or tree item.
74@property(nonatomic, readonly) NSNumber* index;
75@property(nonatomic, readonly) NSString* invalid;
76@property(nonatomic, readonly) NSNumber* loaded;
77@property(nonatomic, readonly) NSNumber* loadingProgress;
78@property(nonatomic, readonly) NSNumber* maxValue;
79@property(nonatomic, readonly) NSNumber* minValue;
80@property(nonatomic, readonly) NSNumber* numberOfCharacters;
81@property(nonatomic, readonly) NSString* orientation;
82@property(nonatomic, readonly) id parent;
83@property(nonatomic, readonly) NSValue* position;
84@property(nonatomic, readonly) NSNumber* required;
85// A string indicating the role of this object as far as accessibility
86// is concerned.
87@property(nonatomic, readonly) NSString* role;
88@property(nonatomic, readonly) NSString* roleDescription;
89@property(nonatomic, readonly) NSArray* rowHeaders;
90@property(nonatomic, readonly) NSValue* rowIndexRange;
91@property(nonatomic, readonly) NSArray* rows;
92// The size of this object.
93@property(nonatomic, readonly) NSValue* size;
94// A string indicating the subrole of this object as far as accessibility
95// is concerned.
96@property(nonatomic, readonly) NSString* subrole;
97// The tabs owned by a tablist.
98@property(nonatomic, readonly) NSArray* tabs;
99@property(nonatomic, readonly) NSString* title;
100@property(nonatomic, readonly) id titleUIElement;
101@property(nonatomic, readonly) NSString* url;
102@property(nonatomic, readonly) NSString* value;
103@property(nonatomic, readonly) NSString* valueDescription;
104@property(nonatomic, readonly) NSValue* visibleCharacterRange;
105@property(nonatomic, readonly) NSArray* visibleCells;
106@property(nonatomic, readonly) NSArray* visibleColumns;
107@property(nonatomic, readonly) NSArray* visibleRows;
108@property(nonatomic, readonly) NSNumber* visited;
109@property(nonatomic, readonly) id window;
110@end
111
112#endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COCOA_H_
113