Extension syncing: Introduce a NeedsSync pref
[chromium-blink-merge.git] / components / test_runner / accessibility_controller.h
blob8617b1077ec2ab8199b688cf985b6245c5a8ce7e
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.
5 #ifndef COMPONENTS_TEST_RUNNER_ACCESSIBILITY_CONTROLLER_H_
6 #define COMPONENTS_TEST_RUNNER_ACCESSIBILITY_CONTROLLER_H_
8 #include <vector>
10 #include "base/memory/weak_ptr.h"
11 #include "components/test_runner/web_ax_object_proxy.h"
12 #include "third_party/WebKit/public/web/WebAXObject.h"
13 #include "v8/include/v8.h"
15 namespace blink {
16 class WebFrame;
17 class WebString;
18 class WebView;
21 namespace test_runner {
23 class WebTestDelegate;
25 class AccessibilityController :
26 public base::SupportsWeakPtr<AccessibilityController> {
27 public:
28 AccessibilityController();
29 ~AccessibilityController();
31 void Reset();
32 void Install(blink::WebFrame* frame);
33 void SetFocusedElement(const blink::WebAXObject&);
34 bool ShouldLogAccessibilityEvents();
35 void NotificationReceived(const blink::WebAXObject& target,
36 const std::string& notification_name);
38 void SetDelegate(WebTestDelegate* delegate);
39 void SetWebView(blink::WebView* web_view);
41 private:
42 friend class AccessibilityControllerBindings;
44 // Bound methods and properties
45 void LogAccessibilityEvents();
46 void SetNotificationListener(v8::Local<v8::Function> callback);
47 void UnsetNotificationListener();
48 v8::Local<v8::Object> FocusedElement();
49 v8::Local<v8::Object> RootElement();
50 v8::Local<v8::Object> AccessibleElementById(const std::string& id);
52 v8::Local<v8::Object> FindAccessibleElementByIdRecursive(
53 const blink::WebAXObject&, const blink::WebString& id);
55 // If true, will log all accessibility notifications.
56 bool log_accessibility_events_;
58 blink::WebAXObject focused_element_;
59 blink::WebAXObject root_element_;
61 WebAXObjectProxyList elements_;
63 v8::Persistent<v8::Function> notification_callback_;
65 WebTestDelegate* delegate_;
66 blink::WebView* web_view_;
68 base::WeakPtrFactory<AccessibilityController> weak_factory_;
70 DISALLOW_COPY_AND_ASSIGN(AccessibilityController);
73 } // namespace test_runner
75 #endif // COMPONENTS_TEST_RUNNER_ACCESSIBILITY_CONTROLLER_H_