OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_ | 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_ |
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_ | 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "gin/object_template_builder.h" | 11 #include "gin/object_template_builder.h" |
12 #include "gin/wrappable.h" | 12 #include "gin/wrappable.h" |
13 #include "third_party/WebKit/public/web/WebAXObject.h" | 13 #include "third_party/WebKit/public/web/WebAXObject.h" |
14 #include "v8/include/v8-util.h" | 14 #include "v8/include/v8-util.h" |
15 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 class WebFrame; | 18 class WebFrame; |
19 } | 19 } |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class WebAXObjectProxy : public gin::Wrappable<WebAXObjectProxy> { | 23 class WebAXObjectProxy : public gin::Wrappable<WebAXObjectProxy> { |
24 public: | 24 public: |
25 class Factory { | 25 class Factory { |
26 public: | 26 public: |
27 virtual ~Factory() { } | 27 virtual ~Factory() { } |
28 virtual v8::Handle<v8::Object> GetOrCreate( | 28 virtual v8::Local<v8::Object> GetOrCreate( |
29 const blink::WebAXObject& object) = 0; | 29 const blink::WebAXObject& object) = 0; |
30 }; | 30 }; |
31 | 31 |
32 static gin::WrapperInfo kWrapperInfo; | 32 static gin::WrapperInfo kWrapperInfo; |
33 | 33 |
34 WebAXObjectProxy(const blink::WebAXObject& object, Factory* factory); | 34 WebAXObjectProxy(const blink::WebAXObject& object, Factory* factory); |
35 ~WebAXObjectProxy() override; | 35 ~WebAXObjectProxy() override; |
36 | 36 |
37 // gin::Wrappable: | 37 // gin::Wrappable: |
38 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( | 38 gin::ObjectTemplateBuilder GetObjectTemplateBuilder( |
39 v8::Isolate* isolate) override; | 39 v8::Isolate* isolate) override; |
40 | 40 |
41 virtual v8::Handle<v8::Object> GetChildAtIndex(unsigned index); | 41 virtual v8::Local<v8::Object> GetChildAtIndex(unsigned index); |
42 virtual bool IsRoot() const; | 42 virtual bool IsRoot() const; |
43 bool IsEqualToObject(const blink::WebAXObject& object); | 43 bool IsEqualToObject(const blink::WebAXObject& object); |
44 | 44 |
45 void NotificationReceived(blink::WebFrame* frame, | 45 void NotificationReceived(blink::WebFrame* frame, |
46 const std::string& notification_name); | 46 const std::string& notification_name); |
47 void Reset(); | 47 void Reset(); |
48 | 48 |
49 protected: | 49 protected: |
50 const blink::WebAXObject& accessibility_object() const { | 50 const blink::WebAXObject& accessibility_object() const { |
51 return accessibility_object_; | 51 return accessibility_object_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 int ClickPointX(); | 95 int ClickPointX(); |
96 int ClickPointY(); | 96 int ClickPointY(); |
97 int32_t RowCount(); | 97 int32_t RowCount(); |
98 int32_t RowHeadersCount(); | 98 int32_t RowHeadersCount(); |
99 int32_t ColumnCount(); | 99 int32_t ColumnCount(); |
100 int32_t ColumnHeadersCount(); | 100 int32_t ColumnHeadersCount(); |
101 bool IsClickable(); | 101 bool IsClickable(); |
102 bool IsButtonStateMixed(); | 102 bool IsButtonStateMixed(); |
103 | 103 |
104 // Bound methods. | 104 // Bound methods. |
105 v8::Handle<v8::Object> AriaControlsElementAtIndex(unsigned index); | 105 v8::Local<v8::Object> AriaControlsElementAtIndex(unsigned index); |
106 v8::Handle<v8::Object> AriaFlowToElementAtIndex(unsigned index); | 106 v8::Local<v8::Object> AriaFlowToElementAtIndex(unsigned index); |
107 v8::Handle<v8::Object> AriaOwnsElementAtIndex(unsigned index); | 107 v8::Local<v8::Object> AriaOwnsElementAtIndex(unsigned index); |
108 std::string AllAttributes(); | 108 std::string AllAttributes(); |
109 std::string AttributesOfChildren(); | 109 std::string AttributesOfChildren(); |
110 int LineForIndex(int index); | 110 int LineForIndex(int index); |
111 std::string BoundsForRange(int start, int end); | 111 std::string BoundsForRange(int start, int end); |
112 v8::Handle<v8::Object> ChildAtIndex(int index); | 112 v8::Local<v8::Object> ChildAtIndex(int index); |
113 v8::Handle<v8::Object> ElementAtPoint(int x, int y); | 113 v8::Local<v8::Object> ElementAtPoint(int x, int y); |
114 v8::Handle<v8::Object> TableHeader(); | 114 v8::Local<v8::Object> TableHeader(); |
115 v8::Handle<v8::Object> RowHeaderAtIndex(unsigned index); | 115 v8::Local<v8::Object> RowHeaderAtIndex(unsigned index); |
116 v8::Handle<v8::Object> ColumnHeaderAtIndex(unsigned index); | 116 v8::Local<v8::Object> ColumnHeaderAtIndex(unsigned index); |
117 std::string RowIndexRange(); | 117 std::string RowIndexRange(); |
118 std::string ColumnIndexRange(); | 118 std::string ColumnIndexRange(); |
119 v8::Handle<v8::Object> CellForColumnAndRow(int column, int row); | 119 v8::Local<v8::Object> CellForColumnAndRow(int column, int row); |
120 void SetSelectedTextRange(int selection_start, int length); | 120 void SetSelectedTextRange(int selection_start, int length); |
121 bool IsAttributeSettable(const std::string& attribute); | 121 bool IsAttributeSettable(const std::string& attribute); |
122 bool IsPressActionSupported(); | 122 bool IsPressActionSupported(); |
123 bool IsIncrementActionSupported(); | 123 bool IsIncrementActionSupported(); |
124 bool IsDecrementActionSupported(); | 124 bool IsDecrementActionSupported(); |
125 v8::Handle<v8::Object> ParentElement(); | 125 v8::Local<v8::Object> ParentElement(); |
126 void Increment(); | 126 void Increment(); |
127 void Decrement(); | 127 void Decrement(); |
128 void ShowMenu(); | 128 void ShowMenu(); |
129 void Press(); | 129 void Press(); |
130 bool IsEqual(v8::Handle<v8::Object> proxy); | 130 bool IsEqual(v8::Local<v8::Object> proxy); |
131 void SetNotificationListener(v8::Handle<v8::Function> callback); | 131 void SetNotificationListener(v8::Local<v8::Function> callback); |
132 void UnsetNotificationListener(); | 132 void UnsetNotificationListener(); |
133 void TakeFocus(); | 133 void TakeFocus(); |
134 void ScrollToMakeVisible(); | 134 void ScrollToMakeVisible(); |
135 void ScrollToMakeVisibleWithSubFocus(int x, int y, int width, int height); | 135 void ScrollToMakeVisibleWithSubFocus(int x, int y, int width, int height); |
136 void ScrollToGlobalPoint(int x, int y); | 136 void ScrollToGlobalPoint(int x, int y); |
137 int WordStart(int character_index); | 137 int WordStart(int character_index); |
138 int WordEnd(int character_index); | 138 int WordEnd(int character_index); |
139 | 139 |
140 // DEPRECATED accessible name and description accessors | 140 // DEPRECATED accessible name and description accessors |
141 std::string DeprecatedTitle(); | 141 std::string DeprecatedTitle(); |
142 std::string DeprecatedDescription(); | 142 std::string DeprecatedDescription(); |
143 std::string DeprecatedHelpText(); | 143 std::string DeprecatedHelpText(); |
144 v8::Handle<v8::Object> DeprecatedTitleUIElement(); | 144 v8::Local<v8::Object> DeprecatedTitleUIElement(); |
145 | 145 |
146 // NEW accessible name and description accessors | 146 // NEW accessible name and description accessors |
147 std::string Name(); | 147 std::string Name(); |
148 std::string NameFrom(); | 148 std::string NameFrom(); |
149 int NameElementCount(); | 149 int NameElementCount(); |
150 v8::Handle<v8::Object> NameElementAtIndex(unsigned index); | 150 v8::Local<v8::Object> NameElementAtIndex(unsigned index); |
151 | 151 |
152 blink::WebAXObject accessibility_object_; | 152 blink::WebAXObject accessibility_object_; |
153 Factory* factory_; | 153 Factory* factory_; |
154 | 154 |
155 v8::Persistent<v8::Function> notification_callback_; | 155 v8::Persistent<v8::Function> notification_callback_; |
156 | 156 |
157 DISALLOW_COPY_AND_ASSIGN(WebAXObjectProxy); | 157 DISALLOW_COPY_AND_ASSIGN(WebAXObjectProxy); |
158 }; | 158 }; |
159 | 159 |
160 class RootWebAXObjectProxy : public WebAXObjectProxy { | 160 class RootWebAXObjectProxy : public WebAXObjectProxy { |
161 public: | 161 public: |
162 RootWebAXObjectProxy(const blink::WebAXObject&, Factory*); | 162 RootWebAXObjectProxy(const blink::WebAXObject&, Factory*); |
163 | 163 |
164 v8::Handle<v8::Object> GetChildAtIndex(unsigned index) override; | 164 v8::Local<v8::Object> GetChildAtIndex(unsigned index) override; |
165 bool IsRoot() const override; | 165 bool IsRoot() const override; |
166 }; | 166 }; |
167 | 167 |
168 | 168 |
169 // Provides simple lifetime management of the WebAXObjectProxy instances: all | 169 // Provides simple lifetime management of the WebAXObjectProxy instances: all |
170 // WebAXObjectProxys ever created from the controller are stored in a list and | 170 // WebAXObjectProxys ever created from the controller are stored in a list and |
171 // cleared explicitly. | 171 // cleared explicitly. |
172 class WebAXObjectProxyList : public WebAXObjectProxy::Factory { | 172 class WebAXObjectProxyList : public WebAXObjectProxy::Factory { |
173 public: | 173 public: |
174 WebAXObjectProxyList(); | 174 WebAXObjectProxyList(); |
175 ~WebAXObjectProxyList() override; | 175 ~WebAXObjectProxyList() override; |
176 | 176 |
177 void Clear(); | 177 void Clear(); |
178 v8::Handle<v8::Object> GetOrCreate(const blink::WebAXObject&) override; | 178 v8::Local<v8::Object> GetOrCreate(const blink::WebAXObject&) override; |
179 | 179 |
180 private: | 180 private: |
181 typedef v8::PersistentValueVector<v8::Object> ElementList; | 181 typedef v8::PersistentValueVector<v8::Object> ElementList; |
182 ElementList elements_; | 182 ElementList elements_; |
183 }; | 183 }; |
184 | 184 |
185 } // namespace content | 185 } // namespace content |
186 | 186 |
187 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_ | 187 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_ |
OLD | NEW |