blob: d930177073930ad2f7a4e7192898dba7244ecdb1 [file] [log] [blame]
[email protected]3338bcf2012-05-09 20:26:151// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]95991732009-10-14 22:18:162// 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_TOOLS_TEST_SHELL_ACCESSIBILITY_UI_ELEMENT_H_
6#define WEBKIT_TOOLS_TEST_SHELL_ACCESSIBILITY_UI_ELEMENT_H_
7
8#include "webkit/glue/cpp_bound_class.h"
[email protected]c1d9cdc2011-01-17 06:50:019#include "third_party/WebKit/Source/WebKit/chromium/public/WebAccessibilityObject.h"
[email protected]95991732009-10-14 22:18:1610
[email protected]3338bcf2012-05-09 20:26:1511class AccessibilityUIElement : public webkit_glue::CppBoundClass {
[email protected]95991732009-10-14 22:18:1612 public:
13 class Factory {
14 public:
15 virtual ~Factory() { }
16 virtual AccessibilityUIElement* Create(
17 const WebKit::WebAccessibilityObject& object) = 0;
18 };
19
20 AccessibilityUIElement(
21 const WebKit::WebAccessibilityObject& accessibility_object,
22 Factory* factory);
[email protected]fadc607b62011-02-07 17:55:5023 virtual ~AccessibilityUIElement();
[email protected]95991732009-10-14 22:18:1624
25 virtual AccessibilityUIElement* GetChildAtIndex(unsigned index);
[email protected]fadc607b62011-02-07 17:55:5026 virtual bool IsRoot() const;
[email protected]95991732009-10-14 22:18:1627
[email protected]95991732009-10-14 22:18:1628 protected:
29 const WebKit::WebAccessibilityObject& accessibility_object() const {
30 return accessibility_object_;
31 }
32 Factory* factory() const { return factory_; }
33
34 private:
35 // Bound methods and properties.
[email protected]3338bcf2012-05-09 20:26:1536 void AllAttributesCallback(
37 const webkit_glue::CppArgumentList& args,
38 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:1639 void AttributesOfLinkedUIElementsCallback(
[email protected]3338bcf2012-05-09 20:26:1540 const webkit_glue::CppArgumentList& args,
41 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:1642 void AttributesOfDocumentLinksCallback(
[email protected]3338bcf2012-05-09 20:26:1543 const webkit_glue::CppArgumentList& args,
44 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:1645 void AttributesOfChildrenCallback(
[email protected]3338bcf2012-05-09 20:26:1546 const webkit_glue::CppArgumentList& args,
47 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:1648 void ParametrizedAttributeNamesCallback(
[email protected]3338bcf2012-05-09 20:26:1549 const webkit_glue::CppArgumentList& args,
50 webkit_glue::CppVariant* result);
51 void LineForIndexCallback(
52 const webkit_glue::CppArgumentList& args,
53 webkit_glue::CppVariant* result);
54 void BoundsForRangeCallback(
55 const webkit_glue::CppArgumentList& args,
56 webkit_glue::CppVariant* result);
57 void StringForRangeCallback(
58 const webkit_glue::CppArgumentList& args,
59 webkit_glue::CppVariant* result);
60 void ChildAtIndexCallback(
61 const webkit_glue::CppArgumentList& args,
62 webkit_glue::CppVariant* result);
63 void ElementAtPointCallback(
64 const webkit_glue::CppArgumentList& args,
65 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:1666 void AttributesOfColumnHeadersCallback(
[email protected]3338bcf2012-05-09 20:26:1567 const webkit_glue::CppArgumentList& args,
68 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:1669 void AttributesOfRowHeadersCallback(
[email protected]3338bcf2012-05-09 20:26:1570 const webkit_glue::CppArgumentList& args,
71 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:1672 void AttributesOfColumnsCallback(
[email protected]3338bcf2012-05-09 20:26:1573 const webkit_glue::CppArgumentList& args,
74 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:1675 void AttributesOfRowsCallback(
[email protected]3338bcf2012-05-09 20:26:1576 const webkit_glue::CppArgumentList& args,
77 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:1678 void AttributesOfVisibleCellsCallback(
[email protected]3338bcf2012-05-09 20:26:1579 const webkit_glue::CppArgumentList& args,
80 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:1681 void AttributesOfHeaderCallback(
[email protected]3338bcf2012-05-09 20:26:1582 const webkit_glue::CppArgumentList& args,
83 webkit_glue::CppVariant* result);
84 void IndexInTableCallback(
85 const webkit_glue::CppArgumentList& args,
86 webkit_glue::CppVariant* result);
87 void RowIndexRangeCallback(
88 const webkit_glue::CppArgumentList& args,
89 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:1690 void ColumnIndexRangeCallback(
[email protected]3338bcf2012-05-09 20:26:1591 const webkit_glue::CppArgumentList& args,
92 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:1693 void CellForColumnAndRowCallback(
[email protected]3338bcf2012-05-09 20:26:1594 const webkit_glue::CppArgumentList& args,
95 webkit_glue::CppVariant* result);
96 void TitleUIElementCallback(
97 const webkit_glue::CppArgumentList& args,
98 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:1699 void SetSelectedTextRangeCallback(
[email protected]3338bcf2012-05-09 20:26:15100 const webkit_glue::CppArgumentList& args,
101 webkit_glue::CppVariant* result);
102 void AttributeValueCallback(
103 const webkit_glue::CppArgumentList& args,
104 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:16105 void IsAttributeSettableCallback(
[email protected]3338bcf2012-05-09 20:26:15106 const webkit_glue::CppArgumentList& args,
107 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:16108 void IsActionSupportedCallback(
[email protected]3338bcf2012-05-09 20:26:15109 const webkit_glue::CppArgumentList& args,
110 webkit_glue::CppVariant* result);
111 void ParentElementCallback(
112 const webkit_glue::CppArgumentList& args,
113 webkit_glue::CppVariant* result);
114 void IncrementCallback(
115 const webkit_glue::CppArgumentList& args,
116 webkit_glue::CppVariant* result);
117 void DecrementCallback(
118 const webkit_glue::CppArgumentList& args,
119 webkit_glue::CppVariant* result);
120 void FallbackCallback(
121 const webkit_glue::CppArgumentList& args,
122 webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:16123
[email protected]3338bcf2012-05-09 20:26:15124 void ChildrenCountGetterCallback(webkit_glue::CppVariant* result);
125 void DescriptionGetterCallback(webkit_glue::CppVariant* result);
126 void IsEnabledGetterCallback(webkit_glue::CppVariant* result);
127 void IsSelectedGetterCallback(webkit_glue::CppVariant* result);
128 void RoleGetterCallback(webkit_glue::CppVariant* result);
129 void TitleGetterCallback(webkit_glue::CppVariant* result);
[email protected]95991732009-10-14 22:18:16130
[email protected]3338bcf2012-05-09 20:26:15131 webkit_glue::CppVariant subrole_;
132 webkit_glue::CppVariant language_;
133 webkit_glue::CppVariant x_;
134 webkit_glue::CppVariant y_;
135 webkit_glue::CppVariant width_;
136 webkit_glue::CppVariant height_;
137 webkit_glue::CppVariant click_point_x_;
138 webkit_glue::CppVariant click_point_y_;
139 webkit_glue::CppVariant int_value_;
140 webkit_glue::CppVariant min_value_;
141 webkit_glue::CppVariant max_value_;
142 webkit_glue::CppVariant children_count_;
143 webkit_glue::CppVariant insertion_point_line_number_;
144 webkit_glue::CppVariant selected_text_range;
145 webkit_glue::CppVariant is_required_;
146 webkit_glue::CppVariant value_description_;
[email protected]95991732009-10-14 22:18:16147
148 WebKit::WebAccessibilityObject accessibility_object_;
149 Factory* factory_;
150};
151
152
153class RootAccessibilityUIElement : public AccessibilityUIElement {
154 public:
155 RootAccessibilityUIElement(
156 const WebKit::WebAccessibilityObject& accessibility_object,
157 Factory* factory);
[email protected]fadc607b62011-02-07 17:55:50158 virtual ~RootAccessibilityUIElement();
[email protected]95991732009-10-14 22:18:16159
[email protected]0da6b4452011-11-16 21:36:16160 virtual AccessibilityUIElement* GetChildAtIndex(unsigned index) OVERRIDE;
161 virtual bool IsRoot() const OVERRIDE;
[email protected]95991732009-10-14 22:18:16162};
163
164
165// Provides simple lifetime management of the AccessibilityUIElement instances:
166// all AccessibilityUIElements ever created from the controller are stored in
167// a list and cleared explicitly.
168class AccessibilityUIElementList : public AccessibilityUIElement::Factory {
169 public:
[email protected]fadc607b62011-02-07 17:55:50170 AccessibilityUIElementList();
[email protected]95991732009-10-14 22:18:16171 virtual ~AccessibilityUIElementList();
172
173 void Clear();
174 virtual AccessibilityUIElement* Create(
[email protected]0da6b4452011-11-16 21:36:16175 const WebKit::WebAccessibilityObject& object) OVERRIDE;
[email protected]95991732009-10-14 22:18:16176 AccessibilityUIElement* CreateRoot(
177 const WebKit::WebAccessibilityObject& object);
178
179 private:
180 typedef std::vector<AccessibilityUIElement*> ElementList;
181 ElementList elements_;
182};
183
184#endif // WEBKIT_TOOLS_TEST_SHELL_ACCESSIBILITY_UI_ELEMENT_H_