KitKatBrowserAccessibilityManager.java revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
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 5package org.chromium.content.browser.accessibility; 6 7import android.view.accessibility.AccessibilityEvent; 8import android.view.accessibility.AccessibilityNodeInfo; 9 10import org.chromium.base.JNINamespace; 11import 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@JNINamespace("content") 18public class KitKatBrowserAccessibilityManager extends JellyBeanBrowserAccessibilityManager { 19 KitKatBrowserAccessibilityManager(long nativeBrowserAccessibilityManagerAndroid, 20 ContentViewCore contentViewCore) { 21 super(nativeBrowserAccessibilityManagerAndroid, contentViewCore); 22 } 23 24 @Override 25 protected void setAccessibilityNodeInfoKitKatAttributes(AccessibilityNodeInfo node, 26 boolean canOpenPopup, 27 boolean contentInvalid, 28 boolean dismissable, 29 boolean multiLine, 30 int inputType, 31 int liveRegion) { 32 node.setCanOpenPopup(canOpenPopup); 33 node.setContentInvalid(contentInvalid); 34 node.setDismissable(contentInvalid); 35 node.setMultiLine(multiLine); 36 node.setInputType(inputType); 37 node.setLiveRegion(liveRegion); 38 } 39 40 @Override 41 protected void setAccessibilityNodeInfoCollectionInfo(AccessibilityNodeInfo node, 42 int rowCount, int columnCount, boolean hierarchical) { 43 node.setCollectionInfo(AccessibilityNodeInfo.CollectionInfo.obtain( 44 rowCount, columnCount, hierarchical)); 45 } 46 47 @Override 48 protected void setAccessibilityNodeInfoCollectionItemInfo(AccessibilityNodeInfo node, 49 int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading) { 50 node.setCollectionItemInfo(AccessibilityNodeInfo.CollectionItemInfo.obtain( 51 rowIndex, rowSpan, columnIndex, columnSpan, heading)); 52 } 53 54 @Override 55 protected void setAccessibilityNodeInfoRangeInfo(AccessibilityNodeInfo node, 56 int rangeType, float min, float max, float current) { 57 node.setRangeInfo(AccessibilityNodeInfo.RangeInfo.obtain( 58 rangeType, min, max, current)); 59 } 60 61 @Override 62 protected void setAccessibilityEventKitKatAttributes(AccessibilityEvent event, 63 boolean canOpenPopup, 64 boolean contentInvalid, 65 boolean dismissable, 66 boolean multiLine, 67 int inputType, 68 int liveRegion) { 69 // This is just a fallback for pre-KitKat systems. 70 // Do nothing on KitKat and higher. 71 } 72 73 @Override 74 protected void setAccessibilityEventCollectionInfo(AccessibilityEvent event, 75 int rowCount, int columnCount, boolean hierarchical) { 76 // This is just a fallback for pre-KitKat systems. 77 // Do nothing on KitKat and higher. 78 } 79 80 @Override 81 protected void setAccessibilityEventCollectionItemInfo(AccessibilityEvent event, 82 int rowIndex, int rowSpan, int columnIndex, int columnSpan, boolean heading) { 83 // This is just a fallback for pre-KitKat systems. 84 // Do nothing on KitKat and higher. 85 } 86 87 @Override 88 protected void setAccessibilityEventRangeInfo(AccessibilityEvent event, 89 int rangeType, float min, float max, float current) { 90 // This is just a fallback for pre-KitKat systems. 91 // Do nothing on KitKat and higher. 92 } 93} 94