[safe-browsing] Database full hash matches like prefix match.
[chromium-blink-merge.git] / content / shell / renderer / test_runner / web_ax_object_proxy.h
blobe8bc25b93662233c1b735d07bed26b6b33dbad1c
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_
8 #include <string>
10 #include "base/basictypes.h"
11 #include "gin/object_template_builder.h"
12 #include "gin/wrappable.h"
13 #include "third_party/WebKit/public/web/WebAXObject.h"
14 #include "v8/include/v8-util.h"
15 #include "v8/include/v8.h"
17 namespace blink {
18 class WebFrame;
21 namespace content {
23 class WebAXObjectProxy : public gin::Wrappable<WebAXObjectProxy> {
24 public:
25 class Factory {
26 public:
27 virtual ~Factory() { }
28 virtual v8::Handle<v8::Object> GetOrCreate(
29 const blink::WebAXObject& object) = 0;
32 static gin::WrapperInfo kWrapperInfo;
34 WebAXObjectProxy(const blink::WebAXObject& object, Factory* factory);
35 virtual ~WebAXObjectProxy();
37 // gin::Wrappable:
38 virtual gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
39 v8::Isolate* isolate) OVERRIDE;
41 virtual v8::Handle<v8::Object> GetChildAtIndex(unsigned index);
42 virtual bool IsRoot() const;
43 bool IsEqualToObject(const blink::WebAXObject& object);
45 void NotificationReceived(blink::WebFrame* frame,
46 const std::string& notification_name);
48 protected:
49 const blink::WebAXObject& accessibility_object() const {
50 return accessibility_object_;
53 Factory* factory() const { return factory_; }
55 private:
56 friend class WebAXObjectProxyBindings;
58 // Bound properties.
59 std::string Role();
60 std::string Title();
61 std::string Description();
62 std::string HelpText();
63 std::string StringValue();
64 int X();
65 int Y();
66 int Width();
67 int Height();
68 int IntValue();
69 int MinValue();
70 int MaxValue();
71 std::string ValueDescription();
72 int ChildrenCount();
73 int InsertionPointLineNumber();
74 std::string SelectedTextRange();
75 bool IsEnabled();
76 bool IsRequired();
77 bool IsFocused();
78 bool IsFocusable();
79 bool IsSelected();
80 bool IsSelectable();
81 bool IsMultiSelectable();
82 bool IsSelectedOptionActive();
83 bool IsExpanded();
84 bool IsChecked();
85 bool IsVisible();
86 bool IsOffScreen();
87 bool IsCollapsed();
88 bool HasPopup();
89 bool IsValid();
90 bool IsReadOnly();
91 std::string Orientation();
92 int ClickPointX();
93 int ClickPointY();
94 int32_t RowCount();
95 int32_t ColumnCount();
96 bool IsClickable();
98 // Bound methods.
99 std::string AllAttributes();
100 std::string AttributesOfChildren();
101 int LineForIndex(int index);
102 std::string BoundsForRange(int start, int end);
103 v8::Handle<v8::Object> ChildAtIndex(int index);
104 v8::Handle<v8::Object> ElementAtPoint(int x, int y);
105 v8::Handle<v8::Object> TableHeader();
106 std::string RowIndexRange();
107 std::string ColumnIndexRange();
108 v8::Handle<v8::Object> CellForColumnAndRow(int column, int row);
109 v8::Handle<v8::Object> TitleUIElement();
110 void SetSelectedTextRange(int selection_start, int length);
111 bool IsAttributeSettable(const std::string& attribute);
112 bool IsPressActionSupported();
113 bool IsIncrementActionSupported();
114 bool IsDecrementActionSupported();
115 v8::Handle<v8::Object> ParentElement();
116 void Increment();
117 void Decrement();
118 void ShowMenu();
119 void Press();
120 bool IsEqual(v8::Handle<v8::Object> proxy);
121 void SetNotificationListener(v8::Handle<v8::Function> callback);
122 void UnsetNotificationListener();
123 void TakeFocus();
124 void ScrollToMakeVisible();
125 void ScrollToMakeVisibleWithSubFocus(int x, int y, int width, int height);
126 void ScrollToGlobalPoint(int x, int y);
127 int WordStart(int character_index);
128 int WordEnd(int character_index);
130 blink::WebAXObject accessibility_object_;
131 Factory* factory_;
133 v8::Persistent<v8::Function> notification_callback_;
135 DISALLOW_COPY_AND_ASSIGN(WebAXObjectProxy);
138 class RootWebAXObjectProxy : public WebAXObjectProxy {
139 public:
140 RootWebAXObjectProxy(const blink::WebAXObject&, Factory*);
142 virtual v8::Handle<v8::Object> GetChildAtIndex(unsigned index) OVERRIDE;
143 virtual bool IsRoot() const OVERRIDE;
147 // Provides simple lifetime management of the WebAXObjectProxy instances: all
148 // WebAXObjectProxys ever created from the controller are stored in a list and
149 // cleared explicitly.
150 class WebAXObjectProxyList : public WebAXObjectProxy::Factory {
151 public:
152 WebAXObjectProxyList();
153 virtual ~WebAXObjectProxyList();
155 void Clear();
156 virtual v8::Handle<v8::Object> GetOrCreate(
157 const blink::WebAXObject&) OVERRIDE;
158 v8::Handle<v8::Object> CreateRoot(const blink::WebAXObject&);
160 private:
161 typedef v8::PersistentValueVector<v8::Object> ElementList;
162 ElementList elements_;
165 } // namespace content
167 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_