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#include "content/browser/accessibility/browser_accessibility_manager.h" 13 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 { 19 @private 20 content::BrowserAccessibility* browserAccessibility_; 21 base::scoped_nsobject<NSMutableArray> children_; 22} 23 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; 27 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. 31- (void)detach; 32 33// Invalidate children for a non-ignored ancestor (including self). 34- (void)childrenChanged; 35 36// Convenience method to get the internal, cross-platform role 37// from browserAccessibility_. 38- (ui::AXRole)internalRole; 39 40// Convenience method to get the BrowserAccessibilityDelegate from 41// the manager. 42- (content::BrowserAccessibilityDelegate*)delegate; 43 44// Convert the local objet's origin to a global point. 45- (NSPoint)pointInScreen:(NSPoint)origin 46 size:(NSSize)size; 47 48// Return the method name for the given attribute. For testing only. 49- (NSString*)methodNameForAttribute:(NSString*)attribute; 50 51// Swap the children array with the given scoped_nsobject. 52- (void)swapChildren:(base::scoped_nsobject<NSMutableArray>*)other; 53 54// Internally-used method. 55@property(nonatomic, readonly) NSPoint origin; 56 57// Children is an array of BrowserAccessibility objects, representing 58// the accessibility children of this object. 59@property(nonatomic, readonly) NSString* accessKey; 60@property(nonatomic, readonly) NSNumber* ariaAtomic; 61@property(nonatomic, readonly) NSNumber* ariaBusy; 62@property(nonatomic, readonly) NSString* ariaLive; 63@property(nonatomic, readonly) NSString* ariaRelevant; 64@property(nonatomic, readonly) NSArray* children; 65@property(nonatomic, readonly) NSArray* columns; 66@property(nonatomic, readonly) NSArray* columnHeaders; 67@property(nonatomic, readonly) NSValue* columnIndexRange; 68@property(nonatomic, readonly) NSString* description; 69@property(nonatomic, readonly) NSNumber* disclosing; 70@property(nonatomic, readonly) id disclosedByRow; 71@property(nonatomic, readonly) NSNumber* disclosureLevel; 72@property(nonatomic, readonly) id disclosedRows; 73@property(nonatomic, readonly) NSNumber* enabled; 74@property(nonatomic, readonly) NSNumber* focused; 75@property(nonatomic, readonly) NSString* help; 76// isIgnored returns whether or not the accessibility object 77// should be ignored by the accessibility hierarchy. 78@property(nonatomic, readonly, getter=isIgnored) BOOL ignored; 79// Index of a row, column, or tree item. 80@property(nonatomic, readonly) NSNumber* index; 81@property(nonatomic, readonly) NSString* invalid; 82@property(nonatomic, readonly) NSNumber* loaded; 83@property(nonatomic, readonly) NSNumber* loadingProgress; 84@property(nonatomic, readonly) NSNumber* maxValue; 85@property(nonatomic, readonly) NSNumber* minValue; 86@property(nonatomic, readonly) NSNumber* numberOfCharacters; 87@property(nonatomic, readonly) NSString* orientation; 88@property(nonatomic, readonly) id parent; 89@property(nonatomic, readonly) NSValue* position; 90@property(nonatomic, readonly) NSNumber* required; 91// A string indicating the role of this object as far as accessibility 92// is concerned. 93@property(nonatomic, readonly) NSString* role; 94@property(nonatomic, readonly) NSString* roleDescription; 95@property(nonatomic, readonly) NSArray* rowHeaders; 96@property(nonatomic, readonly) NSValue* rowIndexRange; 97@property(nonatomic, readonly) NSArray* rows; 98@property(nonatomic, readonly) NSArray* selectedChildren; 99// The size of this object. 100@property(nonatomic, readonly) NSValue* size; 101// A string indicating the subrole of this object as far as accessibility 102// is concerned. 103@property(nonatomic, readonly) NSString* subrole; 104// The tabs owned by a tablist. 105@property(nonatomic, readonly) NSArray* tabs; 106@property(nonatomic, readonly) NSString* title; 107@property(nonatomic, readonly) id titleUIElement; 108@property(nonatomic, readonly) NSURL* url; 109@property(nonatomic, readonly) NSString* value; 110@property(nonatomic, readonly) NSString* valueDescription; 111@property(nonatomic, readonly) NSValue* visibleCharacterRange; 112@property(nonatomic, readonly) NSArray* visibleCells; 113@property(nonatomic, readonly) NSArray* visibleChildren; 114@property(nonatomic, readonly) NSArray* visibleColumns; 115@property(nonatomic, readonly) NSArray* visibleRows; 116@property(nonatomic, readonly) NSNumber* visited; 117@property(nonatomic, readonly) id window; 118@end 119 120#endif // CONTENT_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COCOA_H_ 121