OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser.accessibility; | 5 package org.chromium.content.browser.accessibility; |
6 | 6 |
7 import android.accessibilityservice.AccessibilityServiceInfo; | 7 import android.accessibilityservice.AccessibilityServiceInfo; |
8 import android.content.Context; | 8 import android.content.Context; |
9 import android.content.pm.PackageManager; | 9 import android.content.pm.PackageManager; |
10 import android.os.Build; | 10 import android.os.Build; |
11 import android.os.Bundle; | 11 import android.os.Bundle; |
12 import android.os.Vibrator; | 12 import android.os.Vibrator; |
13 import android.provider.Settings; | 13 import android.provider.Settings; |
14 import android.speech.tts.TextToSpeech; | 14 import android.speech.tts.TextToSpeech; |
15 import android.util.Log; | 15 import android.util.Log; |
16 import android.view.View; | 16 import android.view.View; |
17 import android.view.accessibility.AccessibilityManager; | 17 import android.view.accessibility.AccessibilityManager; |
18 import android.view.accessibility.AccessibilityNodeInfo; | 18 import android.view.accessibility.AccessibilityNodeInfo; |
19 | 19 |
20 import com.googlecode.eyesfree.braille.selfbraille.SelfBrailleClient; | 20 import com.googlecode.eyesfree.braille.selfbraille.SelfBrailleClient; |
21 import com.googlecode.eyesfree.braille.selfbraille.WriteData; | 21 import com.googlecode.eyesfree.braille.selfbraille.WriteData; |
22 | 22 |
23 import org.apache.http.NameValuePair; | 23 import org.apache.http.NameValuePair; |
24 import org.apache.http.client.utils.URLEncodedUtils; | 24 import org.apache.http.client.utils.URLEncodedUtils; |
| 25 import org.chromium.base.CommandLine; |
25 import org.chromium.content.browser.ContentViewCore; | 26 import org.chromium.content.browser.ContentViewCore; |
26 import org.chromium.content.browser.JavascriptInterface; | 27 import org.chromium.content.browser.JavascriptInterface; |
27 import org.chromium.content.browser.WebContentsObserverAndroid; | 28 import org.chromium.content.browser.WebContentsObserverAndroid; |
28 import org.chromium.content.common.CommandLine; | 29 import org.chromium.content.common.ContentSwitches; |
29 import org.json.JSONException; | 30 import org.json.JSONException; |
30 import org.json.JSONObject; | 31 import org.json.JSONObject; |
31 | 32 |
32 import java.lang.reflect.Field; | 33 import java.lang.reflect.Field; |
33 import java.net.URI; | 34 import java.net.URI; |
34 import java.net.URISyntaxException; | 35 import java.net.URISyntaxException; |
35 import java.util.HashMap; | 36 import java.util.HashMap; |
36 import java.util.Iterator; | 37 import java.util.Iterator; |
37 import java.util.List; | 38 import java.util.List; |
38 | 39 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 | 106 |
106 /** | 107 /** |
107 * Creates an instance of the IceCreamSandwichAccessibilityInjector. | 108 * Creates an instance of the IceCreamSandwichAccessibilityInjector. |
108 * @param view The ContentViewCore that this AccessibilityInjector manages. | 109 * @param view The ContentViewCore that this AccessibilityInjector manages. |
109 */ | 110 */ |
110 protected AccessibilityInjector(ContentViewCore view) { | 111 protected AccessibilityInjector(ContentViewCore view) { |
111 super(view); | 112 super(view); |
112 mContentViewCore = view; | 113 mContentViewCore = view; |
113 | 114 |
114 mAccessibilityScreenReaderUrl = CommandLine.getInstance().getSwitchValue
( | 115 mAccessibilityScreenReaderUrl = CommandLine.getInstance().getSwitchValue
( |
115 CommandLine.ACCESSIBILITY_JAVASCRIPT_URL, DEFAULT_ACCESSIBILITY_
SCREEN_READER_URL); | 116 ContentSwitches.ACCESSIBILITY_JAVASCRIPT_URL, |
| 117 DEFAULT_ACCESSIBILITY_SCREEN_READER_URL); |
116 | 118 |
117 mHasVibratePermission = mContentViewCore.getContext().checkCallingOrSelf
Permission( | 119 mHasVibratePermission = mContentViewCore.getContext().checkCallingOrSelf
Permission( |
118 android.Manifest.permission.VIBRATE) == PackageManager.PERMISSIO
N_GRANTED; | 120 android.Manifest.permission.VIBRATE) == PackageManager.PERMISSIO
N_GRANTED; |
119 } | 121 } |
120 | 122 |
121 /** | 123 /** |
122 * Injects a <script> tag into the current web site that pulls in the Chrome
Vox script for | 124 * Injects a <script> tag into the current web site that pulls in the Chrome
Vox script for |
123 * accessibility support. Only injects if accessibility is turned on by | 125 * accessibility support. Only injects if accessibility is turned on by |
124 * {@link AccessibilityManager#isEnabled()}, accessibility script injection
is turned on, and | 126 * {@link AccessibilityManager#isEnabled()}, accessibility script injection
is turned on, and |
125 * javascript is enabled on this page. | 127 * javascript is enabled on this page. |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 */ | 392 */ |
391 private static class TextToSpeechWrapper { | 393 private static class TextToSpeechWrapper { |
392 private TextToSpeech mTextToSpeech; | 394 private TextToSpeech mTextToSpeech; |
393 private SelfBrailleClient mSelfBrailleClient; | 395 private SelfBrailleClient mSelfBrailleClient; |
394 private View mView; | 396 private View mView; |
395 | 397 |
396 public TextToSpeechWrapper(View view, Context context) { | 398 public TextToSpeechWrapper(View view, Context context) { |
397 mView = view; | 399 mView = view; |
398 mTextToSpeech = new TextToSpeech(context, null, null); | 400 mTextToSpeech = new TextToSpeech(context, null, null); |
399 mSelfBrailleClient = new SelfBrailleClient(context, CommandLine.getI
nstance().hasSwitch( | 401 mSelfBrailleClient = new SelfBrailleClient(context, CommandLine.getI
nstance().hasSwitch( |
400 CommandLine.ACCESSIBILITY_DEBUG_BRAILLE_SERVICE)); | 402 ContentSwitches.ACCESSIBILITY_DEBUG_BRAILLE_SERVICE)); |
401 } | 403 } |
402 | 404 |
403 @JavascriptInterface | 405 @JavascriptInterface |
404 @SuppressWarnings("unused") | 406 @SuppressWarnings("unused") |
405 public boolean isSpeaking() { | 407 public boolean isSpeaking() { |
406 return mTextToSpeech.isSpeaking(); | 408 return mTextToSpeech.isSpeaking(); |
407 } | 409 } |
408 | 410 |
409 @JavascriptInterface | 411 @JavascriptInterface |
410 @SuppressWarnings("unused") | 412 @SuppressWarnings("unused") |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 } | 459 } |
458 } | 460 } |
459 | 461 |
460 @SuppressWarnings("unused") | 462 @SuppressWarnings("unused") |
461 protected void shutdownInternal() { | 463 protected void shutdownInternal() { |
462 mTextToSpeech.shutdown(); | 464 mTextToSpeech.shutdown(); |
463 mSelfBrailleClient.shutdown(); | 465 mSelfBrailleClient.shutdown(); |
464 } | 466 } |
465 } | 467 } |
466 } | 468 } |
OLD | NEW |