1 | // Copyright 2013 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 | package org.chromium.content.browser.accessibility; |
6 | |
7 | import android.os.Bundle; |
8 | import android.view.accessibility.AccessibilityEvent; |
9 | import android.view.accessibility.AccessibilityNodeInfo; |
10 | import android.view.accessibility.AccessibilityNodeProvider; |
11 | |
12 | import org.chromium.base.JNINamespace; |
13 | import org.chromium.content.browser.ContentViewCore; |
14 | |
15 | import java.util.List; |
16 | |
17 | /** |
18 | * Subclass of BrowserAccessibilityManager for JellyBean that creates an |
19 | * AccessibilityNodeProvider and delegates its implementation to this object. |
20 | */ |
21 | @JNINamespace("content") |
22 | public class JellyBeanBrowserAccessibilityManager extends BrowserAccessibilityManager { |
23 | private AccessibilityNodeProvider mAccessibilityNodeProvider; |
24 | |
25 | JellyBeanBrowserAccessibilityManager(int nativeBrowserAccessibilityManagerAndroid, |
26 | ContentViewCore contentViewCore) { |
27 | super(nativeBrowserAccessibilityManagerAndroid, contentViewCore); |
28 | |
29 | final BrowserAccessibilityManager delegate = this; |
30 | mAccessibilityNodeProvider = new AccessibilityNodeProvider() { |
31 | @Override |
32 | public AccessibilityNodeInfo createAccessibilityNodeInfo(int virtualViewId) { |
33 | return delegate.createAccessibilityNodeInfo(virtualViewId); |
34 | } |
35 | |
36 | @Override |
37 | public List<AccessibilityNodeInfo> findAccessibilityNodeInfosByText(String text, |
38 | int virtualViewId) { |
39 | return delegate.findAccessibilityNodeInfosByText(text, virtualViewId); |
40 | } |
41 | |
42 | @Override |
43 | public boolean performAction(int virtualViewId, int action, Bundle arguments) { |
44 | return delegate.performAction(virtualViewId, action, arguments); |
45 | } |
46 | }; |
47 | } |
48 | |
49 | @Override |
50 | public AccessibilityNodeProvider getAccessibilityNodeProvider() { |
51 | return mAccessibilityNodeProvider; |
52 | } |
53 | } |