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

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

Issue 17045010: Revert 207875 "Native Android accessibility." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 6 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: trunk/src/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityInjector.java
===================================================================
--- trunk/src/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityInjector.java (revision 207890)
+++ trunk/src/content/public/android/java/src/org/chromium/content/browser/accessibility/AccessibilityInjector.java (working copy)
@@ -130,17 +130,27 @@
if (!accessibilityIsAvailable()) return;
int axsParameterValue = getAxsUrlParameterValue();
- if (axsParameterValue != ACCESSIBILITY_SCRIPT_INJECTION_UNDEFINED) {
- return;
- }
+ if (axsParameterValue == ACCESSIBILITY_SCRIPT_INJECTION_UNDEFINED) {
+ try {
+ Field field = Settings.Secure.class.getField("ACCESSIBILITY_SCRIPT_INJECTION");
+ field.setAccessible(true);
+ String ACCESSIBILITY_SCRIPT_INJECTION = (String) field.get(null);
- String js = getScreenReaderInjectingJs();
- if (mContentViewCore.isDeviceAccessibilityScriptInjectionEnabled() &&
- js != null && mContentViewCore.isAlive()) {
- addOrRemoveAccessibilityApisIfNecessary();
- mContentViewCore.evaluateJavaScript(js, null);
- mInjectedScriptEnabled = true;
- mScriptInjected = true;
+ boolean onDeviceScriptInjectionEnabled = (Settings.Secure.getInt(
+ mContentViewCore.getContext().getContentResolver(),
+ ACCESSIBILITY_SCRIPT_INJECTION, 0) == 1);
+ String js = getScreenReaderInjectingJs();
+
+ if (onDeviceScriptInjectionEnabled && js != null && mContentViewCore.isAlive()) {
+ addOrRemoveAccessibilityApisIfNecessary();
+ mContentViewCore.evaluateJavaScript(js, null);
+ mInjectedScriptEnabled = true;
+ mScriptInjected = true;
+ }
+ } catch (NoSuchFieldException ex) {
+ } catch (IllegalArgumentException ex) {
+ } catch (IllegalAccessException ex) {
+ }
}
}
@@ -188,11 +198,10 @@
/**
* Sets whether or not the script is enabled. If the script is disabled, we also stop any
- * we output that is occurring. If the script has not yet been injected, injects it.
+ * we output that is occurring.
* @param enabled Whether or not to enable the script.
*/
public void setScriptEnabled(boolean enabled) {
- if (enabled && !mScriptInjected) injectAccessibilityScriptIntoPage();
if (!accessibilityIsAvailable() || mInjectedScriptEnabled == enabled) return;
mInjectedScriptEnabled = enabled;

Powered by Google App Engine
This is Rietveld 408576698