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