bf452ae129648a2ab722899f6d9492aea43b8189
[platform/framework/web/crosswalk.git] / src / content / public / android / java / src / org / chromium / content / browser / accessibility / KitKatBrowserAccessibilityManager.java
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.view.accessibility.AccessibilityEvent;
8 import android.view.accessibility.AccessibilityNodeInfo;
9
10 import org.chromium.base.JNINamespace;
11 import org.chromium.content.browser.ContentViewCore;
12
13 /**
14  * Subclass of BrowserAccessibilityManager for KitKat that creates an
15  * AccessibilityNodeProvider and delegates its implementation to this object.
16  *
17  * THIS CLASS IS NOT USED! A bug in the KitKat framework prevents us
18  * from using these new APIs. We can re-enable this class after the next
19  * Android system update. http://crbug.com/348088/
20  */
21 @JNINamespace("content")
22 public class KitKatBrowserAccessibilityManager extends JellyBeanBrowserAccessibilityManager {
23     KitKatBrowserAccessibilityManager(long nativeBrowserAccessibilityManagerAndroid,
24             ContentViewCore contentViewCore) {
25         super(nativeBrowserAccessibilityManagerAndroid, contentViewCore);
26     }
27
28     @Override
29     protected void setAccessibilityNodeInfoKitKatAttributes(AccessibilityNodeInfo node,
30             boolean canOpenPopup,
31             boolean contentInvalid,
32             boolean dismissable,
33             boolean multiLine,
34             int inputType,
35             int liveRegion) {
36         node.setCanOpenPopup(canOpenPopup);
37         node.setContentInvalid(contentInvalid);
38         node.setDismissable(contentInvalid);
39         node.setMultiLine(multiLine);
40         node.setInputType(inputType);
41         node.setLiveRegion(liveRegion);
42     }
43
44     @Override
45     protected void setAccessibilityNodeInfoCollectionInfo(AccessibilityNodeInfo node,
46             int rowCount, int columnCount, boolean hierarchical) {
47         node.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain(
48                 rowCount, columnCount, hierarchical));
49     }
50
51     @Override
52     protected void setAccessibilityNodeInfoCollectionItemInfo(AccessibilityNodeInfo node,
53             int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading) {
54         node.setCollectionItemInfo(AccessibilityNodeInfo.CollectionItemInfo.obtain(
55                 rowIndex, rowSpan, columnIndex, columnSpan, heading));
56     }
57
58     @Override
59     protected void setAccessibilityNodeInfoRangeInfo(AccessibilityNodeInfo node,
60             int rangeType, float min, float max, float current) {
61         node.setRangeInfo(AccessibilityNodeInfo.RangeInfo.obtain(
62                 rangeType, min, max, current));
63     }
64
65     @Override
66     protected void setAccessibilityEventKitKatAttributes(AccessibilityEvent event,
67             boolean canOpenPopup,
68             boolean contentInvalid,
69             boolean dismissable,
70             boolean multiLine,
71             int inputType,
72             int liveRegion) {
73         // This is just a fallback for pre-KitKat systems.
74         // Do nothing on KitKat and higher.
75     }
76
77     @Override
78     protected void setAccessibilityEventCollectionInfo(AccessibilityEvent event,
79             int rowCount, int columnCount, boolean hierarchical) {
80         // This is just a fallback for pre-KitKat systems.
81         // Do nothing on KitKat and higher.
82     }
83
84     @Override
85     protected void setAccessibilityEventCollectionItemInfo(AccessibilityEvent event,
86             int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading) {
87         // This is just a fallback for pre-KitKat systems.
88         // Do nothing on KitKat and higher.
89     }
90
91     @Override
92     protected void setAccessibilityEventRangeInfo(AccessibilityEvent event,
93             int rangeType, float min, float max, float current) {
94         // This is just a fallback for pre-KitKat systems.
95         // Do nothing on KitKat and higher.
96     }
97 }