Enable right clicking on the applist doodle web contents and log the data.
[chromium-blink-merge.git] / content / shell / renderer / test_runner / web_ax_object_proxy.h
blob4a99a9e8950c6010e0c0d82e72a23a667550f009
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 ~WebAXObjectProxy() override;
37 // gin::Wrappable:
38 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);
47 void Reset();
49 protected:
50 const blink::WebAXObject& accessibility_object() const {
51 return accessibility_object_;
54 Factory* factory() const { return factory_; }
56 private:
57 friend class WebAXObjectProxyBindings;
59 // Bound properties.
60 std::string Role();
61 std::string Title();
62 std::string Description();
63 std::string HelpText();
64 std::string StringValue();
65 std::string Language();
66 int X();
67 int Y();
68 int Width();
69 int Height();
70 int IntValue();
71 int MinValue();
72 int MaxValue();
73 std::string ValueDescription();
74 int ChildrenCount();
75 int InsertionPointLineNumber();
76 std::string SelectedTextRange();
77 bool IsEnabled();
78 bool IsRequired();
79 bool IsFocused();
80 bool IsFocusable();
81 bool IsSelected();
82 bool IsSelectable();
83 bool IsMultiSelectable();
84 bool IsSelectedOptionActive();
85 bool IsExpanded();
86 bool IsChecked();
87 bool IsVisible();
88 bool IsOffScreen();
89 bool IsCollapsed();
90 bool HasPopup();
91 bool IsValid();
92 bool IsReadOnly();
93 std::string Orientation();
94 int ClickPointX();
95 int ClickPointY();
96 int32_t RowCount();
97 int32_t RowHeadersCount();
98 int32_t ColumnCount();
99 int32_t ColumnHeadersCount();
100 bool IsClickable();
101 bool IsButtonStateMixed();
103 // Bound methods.
104 v8::Handle<v8::Object> AriaControlsElementAtIndex(unsigned index);
105 v8::Handle<v8::Object> AriaFlowToElementAtIndex(unsigned index);
106 v8::Handle<v8::Object> AriaOwnsElementAtIndex(unsigned index);
107 std::string AllAttributes();
108 std::string AttributesOfChildren();
109 int LineForIndex(int index);
110 std::string BoundsForRange(int start, int end);
111 v8::Handle<v8::Object> ChildAtIndex(int index);
112 v8::Handle<v8::Object> ElementAtPoint(int x, int y);
113 v8::Handle<v8::Object> TableHeader();
114 v8::Handle<v8::Object> RowHeaderAtIndex(unsigned index);
115 v8::Handle<v8::Object> ColumnHeaderAtIndex(unsigned index);
116 std::string RowIndexRange();
117 std::string ColumnIndexRange();
118 v8::Handle<v8::Object> CellForColumnAndRow(int column, int row);
119 v8::Handle<v8::Object> TitleUIElement();
120 void SetSelectedTextRange(int selection_start, int length);
121 bool IsAttributeSettable(const std::string& attribute);
122 bool IsPressActionSupported();
123 bool IsIncrementActionSupported();
124 bool IsDecrementActionSupported();
125 v8::Handle<v8::Object> ParentElement();
126 void Increment();
127 void Decrement();
128 void ShowMenu();
129 void Press();
130 bool IsEqual(v8::Handle<v8::Object> proxy);
131 void SetNotificationListener(v8::Handle<v8::Function> callback);
132 void UnsetNotificationListener();
133 void TakeFocus();
134 void ScrollToMakeVisible();
135 void ScrollToMakeVisibleWithSubFocus(int x, int y, int width, int height);
136 void ScrollToGlobalPoint(int x, int y);
137 int WordStart(int character_index);
138 int WordEnd(int character_index);
140 blink::WebAXObject accessibility_object_;
141 Factory* factory_;
143 v8::Persistent<v8::Function> notification_callback_;
145 DISALLOW_COPY_AND_ASSIGN(WebAXObjectProxy);
148 class RootWebAXObjectProxy : public WebAXObjectProxy {
149 public:
150 RootWebAXObjectProxy(const blink::WebAXObject&, Factory*);
152 v8::Handle<v8::Object> GetChildAtIndex(unsigned index) override;
153 bool IsRoot() const override;
157 // Provides simple lifetime management of the WebAXObjectProxy instances: all
158 // WebAXObjectProxys ever created from the controller are stored in a list and
159 // cleared explicitly.
160 class WebAXObjectProxyList : public WebAXObjectProxy::Factory {
161 public:
162 WebAXObjectProxyList();
163 ~WebAXObjectProxyList() override;
165 void Clear();
166 v8::Handle<v8::Object> GetOrCreate(const blink::WebAXObject&) override;
167 v8::Handle<v8::Object> CreateRoot(const blink::WebAXObject&);
169 private:
170 typedef v8::PersistentValueVector<v8::Object> ElementList;
171 ElementList elements_;
174 } // namespace content
176 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_AX_OBJECT_PROXY_H_