Home | History | Annotate | Download | only in accessibility
      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
      3 // found in the LICENSE file.
      4 
      5 #ifndef CHROME_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COCOA_H_
      6 #define CHROME_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COCOA_H_
      7 #pragma once
      8 
      9 #import <Cocoa/Cocoa.h>
     10 
     11 #import "base/memory/scoped_nsobject.h"
     12 #import "chrome/browser/accessibility/browser_accessibility_delegate_mac.h"
     13 #include "chrome/browser/accessibility/browser_accessibility.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 // Inheriting from NSView rather than NSObject as clients cannot add
     20 // observers to pure NSObject derived classes.
     21 @interface BrowserAccessibilityCocoa : NSView {
     22  @private
     23   BrowserAccessibility* browserAccessibility_;
     24   scoped_nsobject<NSMutableArray> children_;
     25   id<BrowserAccessibilityDelegateCocoa> delegate_;
     26 }
     27 
     28 // This creates a cocoa browser accessibility object around
     29 // the cross platform BrowserAccessibility object.  The delegate is
     30 // used to communicate with the host renderer.  None of these
     31 // parameters can be null.
     32 - (id)initWithObject:(BrowserAccessibility*)accessibility
     33             delegate:(id<BrowserAccessibilityDelegateCocoa>)delegate;
     34 
     35 // Invalidate children for a non-ignored ancestor (including self).
     36 - (void)childrenChanged;
     37 
     38 // Children is an array of BrowserAccessibility objects, representing
     39 // the accessibility children of this object.
     40 @property(nonatomic, readonly) NSArray* children;
     41 // isIgnored returns whether or not the accessibility object
     42 // should be ignored by the accessibility hierarchy.
     43 @property(nonatomic, readonly, getter=isIgnored) BOOL ignored;
     44 // The origin of this object in the page's document.
     45 // This is relative to webkit's top-left origin, not Cocoa's
     46 // bottom-left origin.
     47 @property(nonatomic, readonly) NSPoint origin;
     48 // A string indicating the role of this object as far as accessibility
     49 // is concerned.
     50 @property(nonatomic, readonly) NSString* role;
     51 // The size of this object.
     52 @property(nonatomic, readonly) NSSize size;
     53 
     54 @end
     55 
     56 #endif // CHROME_BROWSER_ACCESSIBILITY_BROWSER_ACCESSIBILITY_COCOA_H_
     57