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