OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_ACCESSIBILITY_CONTROLLER_H_ | |
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_ACCESSIBILITY_CONTROLLER_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "base/memory/weak_ptr.h" | |
11 #include "content/shell/renderer/test_runner/web_ax_object_proxy.h" | |
12 #include "third_party/WebKit/public/web/WebAXObject.h" | |
13 #include "v8/include/v8.h" | |
14 | |
15 namespace blink { | |
16 class WebFrame; | |
17 class WebString; | |
18 class WebView; | |
19 } | |
20 | |
21 namespace WebTestRunner { | |
22 class WebTestDelegate; | |
23 } | |
24 | |
25 namespace content { | |
26 | |
27 class AccessibilityController : | |
28 public base::SupportsWeakPtr<AccessibilityController> { | |
29 public: | |
30 AccessibilityController(); | |
31 ~AccessibilityController(); | |
32 | |
33 void Reset(); | |
34 void Install(blink::WebFrame* frame); | |
35 void SetFocusedElement(const blink::WebAXObject&); | |
36 bool ShouldLogAccessibilityEvents(); | |
37 void NotificationReceived(const blink::WebAXObject& target, | |
38 const std::string& notification_name); | |
39 | |
40 void SetDelegate(WebTestRunner::WebTestDelegate* delegate); | |
41 void SetWebView(blink::WebView* web_view); | |
42 | |
43 private: | |
44 friend class AccessibilityControllerBindings; | |
45 | |
46 // Bound methods and properties | |
47 void LogAccessibilityEvents(); | |
48 void SetNotificationListener(v8::Handle<v8::Function> callback); | |
49 void UnsetNotificationListener(); | |
50 v8::Handle<v8::Object> FocusedElement(); | |
51 v8::Handle<v8::Object> RootElement(); | |
52 v8::Handle<v8::Object> AccessibleElementById(const std::string& id); | |
53 | |
54 v8::Handle<v8::Object> FindAccessibleElementByIdRecursive( | |
55 const blink::WebAXObject&, const blink::WebString& id); | |
56 | |
57 // If true, will log all accessibility notifications. | |
58 bool log_accessibility_events_; | |
59 | |
60 blink::WebAXObject focused_element_; | |
61 blink::WebAXObject root_element_; | |
62 | |
63 WebAXObjectProxyList elements_; | |
64 | |
65 v8::Persistent<v8::Function> notification_callback_; | |
66 | |
67 WebTestRunner::WebTestDelegate* delegate_; | |
68 blink::WebView* web_view_; | |
69 | |
70 base::WeakPtrFactory<AccessibilityController> weak_factory_; | |
71 | |
72 DISALLOW_COPY_AND_ASSIGN(AccessibilityController); | |
73 }; | |
74 | |
75 } // namespace content | |
76 | |
77 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_ACCESSIBILITY_CONTROLLER_H_ | |
OLD | NEW |