Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1818)

Unified Diff: content/public/android/java/src/org/chromium/content/browser/accessibility/LollipopAccessibilityInjector.java

Issue 1100823004: Remove AccessibilityInjector support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Chrome cast shell Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/android/java/src/org/chromium/content/browser/accessibility/LollipopAccessibilityInjector.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/accessibility/LollipopAccessibilityInjector.java b/content/public/android/java/src/org/chromium/content/browser/accessibility/LollipopAccessibilityInjector.java
deleted file mode 100644
index d7737eb586e49bf0c091aad20128f8e6821301a0..0000000000000000000000000000000000000000
--- a/content/public/android/java/src/org/chromium/content/browser/accessibility/LollipopAccessibilityInjector.java
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package org.chromium.content.browser.accessibility;
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.os.Build;
-import android.os.Bundle;
-import android.view.View;
-import android.view.accessibility.AccessibilityNodeInfo;
-
-import org.chromium.content.browser.ContentViewCore;
-import org.chromium.content.browser.JavascriptInterface;
-import org.json.JSONException;
-import org.json.JSONObject;
-
-import java.util.Iterator;
-
-/**
- * Handles injecting accessibility Javascript and related Javascript -> Java APIs for Lollipop and
- * newer devices.
- */
-@TargetApi(Build.VERSION_CODES.LOLLIPOP)
-class LollipopAccessibilityInjector extends JellyBeanAccessibilityInjector {
- /**
- * Constructs an instance of the LollipopAccessibilityInjector.
- * @param view The ContentViewCore that this AccessibilityInjector manages.
- */
- protected LollipopAccessibilityInjector(ContentViewCore view) {
- super(view);
- }
-
- @Override
- public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
- info.setMovementGranularities(
- AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER
- | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_WORD
- | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_LINE
- | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PARAGRAPH
- | AccessibilityNodeInfo.MOVEMENT_GRANULARITY_PAGE);
- info.addAction(
- AccessibilityNodeInfo.AccessibilityAction.ACTION_NEXT_AT_MOVEMENT_GRANULARITY);
- info.addAction(
- AccessibilityNodeInfo.AccessibilityAction.ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY);
- info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_NEXT_HTML_ELEMENT);
- info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_PREVIOUS_HTML_ELEMENT);
- info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_CLICK);
- info.setClickable(true);
- }
-
- @Override
- protected TextToSpeechWrapper createTextToSpeechWrapper(View view, Context context) {
- return new LTextToSpeechWrapper(view, context);
- }
-
- protected static class LTextToSpeechWrapper extends AccessibilityInjector.TextToSpeechWrapper {
- private LTextToSpeechWrapper(View view, Context context) {
- super(view, context);
- }
-
- @Override
- @JavascriptInterface
- @SuppressWarnings("unused")
- public int speak(String text, int queueMode, String jsonParams) {
- // Try to pull the params from the JSON string.
- Bundle bundle = null;
- try {
- if (jsonParams != null) {
- bundle = new Bundle();
- JSONObject json = new JSONObject(jsonParams);
-
- // Using legacy API here.
- @SuppressWarnings("unchecked")
- Iterator<String> keyIt = json.keys();
-
- while (keyIt.hasNext()) {
- String key = keyIt.next();
- // Only add parameters that are raw data types.
- if (json.optJSONObject(key) == null && json.optJSONArray(key) == null) {
- bundle.putCharSequence(key, json.getString(key));
- }
- }
- }
- } catch (JSONException e) {
- bundle = null;
- }
-
- return mTextToSpeech.speak(text, queueMode, bundle, null);
- }
- }
-}

Powered by Google App Engine
This is Rietveld 408576698