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