| 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 COMPONENTS_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_ | 5 #ifndef CONTENT_SHELL_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_ |
| 6 #define COMPONENTS_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_ | 6 #define CONTENT_SHELL_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "gin/object_template_builder.h" | 13 #include "gin/object_template_builder.h" |
| 14 #include "gin/wrappable.h" | 14 #include "gin/wrappable.h" |
| 15 #include "third_party/WebKit/public/web/WebAXObject.h" | 15 #include "third_party/WebKit/public/web/WebAXObject.h" |
| 16 #include "v8/include/v8-util.h" | 16 #include "v8/include/v8-util.h" |
| 17 #include "v8/include/v8.h" | 17 #include "v8/include/v8.h" |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 class WebFrame; | 20 class WebFrame; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace test_runner { | 23 namespace test_runner { |
| 24 | 24 |
| 25 class WebAXObjectProxy : public gin::Wrappable<WebAXObjectProxy> { | 25 class WebAXObjectProxy : public gin::Wrappable<WebAXObjectProxy> { |
| 26 public: | 26 public: |
| 27 class Factory { | 27 class Factory { |
| 28 public: | 28 public: |
| 29 virtual ~Factory() { } | 29 virtual ~Factory() {} |
| 30 virtual v8::Local<v8::Object> GetOrCreate( | 30 virtual v8::Local<v8::Object> GetOrCreate( |
| 31 const blink::WebAXObject& object) = 0; | 31 const blink::WebAXObject& object) = 0; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 static gin::WrapperInfo kWrapperInfo; | 34 static gin::WrapperInfo kWrapperInfo; |
| 35 | 35 |
| 36 WebAXObjectProxy(const blink::WebAXObject& object, Factory* factory); | 36 WebAXObjectProxy(const blink::WebAXObject& object, Factory* factory); |
| 37 ~WebAXObjectProxy() override; | 37 ~WebAXObjectProxy() override; |
| 38 | 38 |
| 39 // gin::Wrappable: | 39 // gin::Wrappable: |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 std::string BoundsForRange(int start, int end); | 142 std::string BoundsForRange(int start, int end); |
| 143 v8::Local<v8::Object> ChildAtIndex(int index); | 143 v8::Local<v8::Object> ChildAtIndex(int index); |
| 144 v8::Local<v8::Object> ElementAtPoint(int x, int y); | 144 v8::Local<v8::Object> ElementAtPoint(int x, int y); |
| 145 v8::Local<v8::Object> TableHeader(); | 145 v8::Local<v8::Object> TableHeader(); |
| 146 v8::Local<v8::Object> RowHeaderAtIndex(unsigned index); | 146 v8::Local<v8::Object> RowHeaderAtIndex(unsigned index); |
| 147 v8::Local<v8::Object> ColumnHeaderAtIndex(unsigned index); | 147 v8::Local<v8::Object> ColumnHeaderAtIndex(unsigned index); |
| 148 std::string RowIndexRange(); | 148 std::string RowIndexRange(); |
| 149 std::string ColumnIndexRange(); | 149 std::string ColumnIndexRange(); |
| 150 v8::Local<v8::Object> CellForColumnAndRow(int column, int row); | 150 v8::Local<v8::Object> CellForColumnAndRow(int column, int row); |
| 151 void SetSelectedTextRange(int selection_start, int length); | 151 void SetSelectedTextRange(int selection_start, int length); |
| 152 void SetSelection(v8::Local<v8::Value> anchor_object, int anchor_offset, | 152 void SetSelection(v8::Local<v8::Value> anchor_object, |
| 153 v8::Local<v8::Value> focus_object, int focus_offset); | 153 int anchor_offset, |
| 154 v8::Local<v8::Value> focus_object, |
| 155 int focus_offset); |
| 154 bool IsAttributeSettable(const std::string& attribute); | 156 bool IsAttributeSettable(const std::string& attribute); |
| 155 bool IsPressActionSupported(); | 157 bool IsPressActionSupported(); |
| 156 bool IsIncrementActionSupported(); | 158 bool IsIncrementActionSupported(); |
| 157 bool IsDecrementActionSupported(); | 159 bool IsDecrementActionSupported(); |
| 158 v8::Local<v8::Object> ParentElement(); | 160 v8::Local<v8::Object> ParentElement(); |
| 159 void Increment(); | 161 void Increment(); |
| 160 void Decrement(); | 162 void Decrement(); |
| 161 void ShowMenu(); | 163 void ShowMenu(); |
| 162 void Press(); | 164 void Press(); |
| 163 bool SetValue(const std::string& value); | 165 bool SetValue(const std::string& value); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 }; | 206 }; |
| 205 | 207 |
| 206 class RootWebAXObjectProxy : public WebAXObjectProxy { | 208 class RootWebAXObjectProxy : public WebAXObjectProxy { |
| 207 public: | 209 public: |
| 208 RootWebAXObjectProxy(const blink::WebAXObject&, Factory*); | 210 RootWebAXObjectProxy(const blink::WebAXObject&, Factory*); |
| 209 | 211 |
| 210 v8::Local<v8::Object> GetChildAtIndex(unsigned index) override; | 212 v8::Local<v8::Object> GetChildAtIndex(unsigned index) override; |
| 211 bool IsRoot() const override; | 213 bool IsRoot() const override; |
| 212 }; | 214 }; |
| 213 | 215 |
| 214 | |
| 215 // Provides simple lifetime management of the WebAXObjectProxy instances: all | 216 // Provides simple lifetime management of the WebAXObjectProxy instances: all |
| 216 // WebAXObjectProxys ever created from the controller are stored in a list and | 217 // WebAXObjectProxys ever created from the controller are stored in a list and |
| 217 // cleared explicitly. | 218 // cleared explicitly. |
| 218 class WebAXObjectProxyList : public WebAXObjectProxy::Factory { | 219 class WebAXObjectProxyList : public WebAXObjectProxy::Factory { |
| 219 public: | 220 public: |
| 220 WebAXObjectProxyList(); | 221 WebAXObjectProxyList(); |
| 221 ~WebAXObjectProxyList() override; | 222 ~WebAXObjectProxyList() override; |
| 222 | 223 |
| 223 void Clear(); | 224 void Clear(); |
| 224 v8::Local<v8::Object> GetOrCreate(const blink::WebAXObject&) override; | 225 v8::Local<v8::Object> GetOrCreate(const blink::WebAXObject&) override; |
| 225 | 226 |
| 226 private: | 227 private: |
| 227 typedef v8::PersistentValueVector<v8::Object> ElementList; | 228 typedef v8::PersistentValueVector<v8::Object> ElementList; |
| 228 ElementList elements_; | 229 ElementList elements_; |
| 229 }; | 230 }; |
| 230 | 231 |
| 231 } // namespace test_runner | 232 } // namespace test_runner |
| 232 | 233 |
| 233 #endif // COMPONENTS_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_ | 234 #endif // CONTENT_SHELL_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_ |
| OLD | NEW |