OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2006-2008 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 WEBKIT_GLUE_GLUE_ACCESSIBILITY_OBJECT_H_ |
| 6 #define WEBKIT_GLUE_GLUE_ACCESSIBILITY_OBJECT_H_ |
| 7 |
| 8 #include "AccessibilityObjectWrapper.h" |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "webkit/glue/webaccessibility.h" |
| 12 |
| 13 namespace WebCore { |
| 14 class AccessibilityObject; |
| 15 enum AccessibilityRole; |
| 16 } |
| 17 |
| 18 //////////////////////////////////////////////////////////////////////////////// |
| 19 // |
| 20 // GlueAccessibilityObject |
| 21 // |
| 22 // Operations that access the underlying WebKit DOM directly, exposing |
| 23 // accessibility information to the GlueAccessibilityManager. Also provides a |
| 24 // platform-independent wrapper to WebKit's AccessibilityObject. |
| 25 //////////////////////////////////////////////////////////////////////////////// |
| 26 class GlueAccessibilityObject : public WebCore::AccessibilityObjectWrapper { |
| 27 public: |
| 28 static GlueAccessibilityObject* CreateInstance(WebCore::AccessibilityObject*); |
| 29 |
| 30 // Performs the default action on a given object. |
| 31 bool DoDefaultAction(int child_id); |
| 32 |
| 33 // Retrieves the child element or child object at a given point on the screen. |
| 34 GlueAccessibilityObject* HitTest(long x, long y); |
| 35 |
| 36 // Retrieves the specified object's current screen location. |
| 37 bool Location(long* left, |
| 38 long* top, |
| 39 long* width, |
| 40 long* height, |
| 41 int child_id); |
| 42 |
| 43 // Traverses to another UI element and retrieves the object. |
| 44 GlueAccessibilityObject* Navigate( |
| 45 webkit_glue::WebAccessibility::Direction dir, |
| 46 int start_child_id); |
| 47 |
| 48 // Retrieves an GlueAccessibilityObject pointer for the specified [child_id]. |
| 49 GlueAccessibilityObject* GetChild(int child_id); |
| 50 |
| 51 // Retrieves the number of accessible children. |
| 52 bool ChildCount(long* count); |
| 53 |
| 54 // Retrieves a string that describes the object's default action. |
| 55 bool DefaultAction(int child_id, WebCore::String* action); |
| 56 |
| 57 // Retrieves the object's description. |
| 58 bool Description(int child_id, WebCore::String* description); |
| 59 |
| 60 // Retrieves the object that has the keyboard focus. |
| 61 GlueAccessibilityObject* GetFocusedChild(); |
| 62 |
| 63 // Retrieves the help information associated with the object. |
| 64 bool HelpText(int child_id, WebCore::String* help); |
| 65 |
| 66 // Retrieves the specified object's shortcut. |
| 67 bool KeyboardShortcut(int child_id, WebCore::String* shortcut); |
| 68 |
| 69 // Retrieves the name of the specified object. |
| 70 bool Name(int child_id, WebCore::String* name); |
| 71 |
| 72 // Retrieves the GlueAccessibilityObject of the object's parent. In the case |
| 73 // of the root object (where the parent is the containing window), it is up |
| 74 // to the browser side to handle this. |
| 75 GlueAccessibilityObject* GetParent(); |
| 76 |
| 77 // Retrieves information describing the role of the specified object. |
| 78 bool Role(int child_id, long* role); |
| 79 |
| 80 // Retrieves the current state of the specified object. |
| 81 bool State(int child_id, long* state); |
| 82 |
| 83 // Returns the value associated with the object. |
| 84 bool Value(int child_id, WebCore::String* value); |
| 85 |
| 86 // WebCore::AccessiblityObjectWrapper. |
| 87 virtual void detach() { |
| 88 if (m_object) |
| 89 m_object = 0; |
| 90 } |
| 91 |
| 92 protected: |
| 93 explicit GlueAccessibilityObject(WebCore::AccessibilityObject*); |
| 94 virtual ~GlueAccessibilityObject() {} |
| 95 |
| 96 // Helper functions. |
| 97 WebCore::String name() const; |
| 98 WebCore::String value() const; |
| 99 WebCore::String description() const; |
| 100 webkit_glue::WebAccessibility::Role role() const; |
| 101 |
| 102 // Retrieves the AccessibilityObject for a given [child_id]. Returns false if |
| 103 // [child_id] is less than 0, or if no valid AccessibilityObject is found. |
| 104 // A [child_id] of 0 is treated as referring to the current object itself. |
| 105 bool GetAccessibilityObjectForChild(int child_id, |
| 106 WebCore::AccessibilityObject*&) const; |
| 107 |
| 108 // Wraps the given AccessibilityObject in a GlueAccessibilityObject and |
| 109 // returns it. If the AccessibilityObject already has a wrapper assigned, that |
| 110 // one is returned. Otherwise, a new instance of GlueAccessibilityObject is |
| 111 // created and assigned as the wrapper. |
| 112 static GlueAccessibilityObject* ToWrapper(WebCore::AccessibilityObject*); |
| 113 |
| 114 private: |
| 115 DISALLOW_COPY_AND_ASSIGN(GlueAccessibilityObject); |
| 116 }; |
| 117 |
| 118 #endif // WEBKIT_GLUE_GLUE_ACCESSIBILITY_OBJECT_H_ |
OLD | NEW |