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