[safe-browsing] Database full hash matches like prefix match.
[chromium-blink-merge.git] / content / shell / renderer / test_runner / accessibility_controller.h
blob30e0131703bdc5a69a74e2833251494fae7af78a
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 CONTENT_SHELL_RENDERER_TEST_RUNNER_ACCESSIBILITY_CONTROLLER_H_
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_ACCESSIBILITY_CONTROLLER_H_
8 #include <vector>
10 #include "base/memory/weak_ptr.h"
11 #include "content/shell/renderer/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 WebTestRunner {
22 class WebTestDelegate;
25 namespace content {
27 class AccessibilityController :
28 public base::SupportsWeakPtr<AccessibilityController> {
29 public:
30 AccessibilityController();
31 ~AccessibilityController();
33 void Reset();
34 void Install(blink::WebFrame* frame);
35 void SetFocusedElement(const blink::WebAXObject&);
36 bool ShouldLogAccessibilityEvents();
37 void NotificationReceived(const blink::WebAXObject& target,
38 const std::string& notification_name);
40 void SetDelegate(WebTestRunner::WebTestDelegate* delegate);
41 void SetWebView(blink::WebView* web_view);
43 private:
44 friend class AccessibilityControllerBindings;
46 // Bound methods and properties
47 void LogAccessibilityEvents();
48 void SetNotificationListener(v8::Handle<v8::Function> callback);
49 void UnsetNotificationListener();
50 v8::Handle<v8::Object> FocusedElement();
51 v8::Handle<v8::Object> RootElement();
52 v8::Handle<v8::Object> AccessibleElementById(const std::string& id);
54 v8::Handle<v8::Object> FindAccessibleElementByIdRecursive(
55 const blink::WebAXObject&, const blink::WebString& id);
57 // If true, will log all accessibility notifications.
58 bool log_accessibility_events_;
60 blink::WebAXObject focused_element_;
61 blink::WebAXObject root_element_;
63 WebAXObjectProxyList elements_;
65 v8::Persistent<v8::Function> notification_callback_;
67 WebTestRunner::WebTestDelegate* delegate_;
68 blink::WebView* web_view_;
70 base::WeakPtrFactory<AccessibilityController> weak_factory_;
72 DISALLOW_COPY_AND_ASSIGN(AccessibilityController);
75 } // namespace content
77 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_ACCESSIBILITY_CONTROLLER_H_