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