| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.content.Context; | 7 import android.content.Context; |
| 8 import android.os.Bundle; | 8 import android.os.Bundle; |
| 9 import android.os.SystemClock; | 9 import android.os.SystemClock; |
| 10 import android.view.accessibility.AccessibilityNodeInfo; | 10 import android.view.accessibility.AccessibilityNodeInfo; |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 * Performs an action and attempts to wait for a result. | 178 * Performs an action and attempts to wait for a result. |
| 179 * | 179 * |
| 180 * @param contentView The ContentViewCore to perform the action on. | 180 * @param contentView The ContentViewCore to perform the action on. |
| 181 * @param code Javascript code that evaluates to a result. | 181 * @param code Javascript code that evaluates to a result. |
| 182 * @return The result of the action. | 182 * @return The result of the action. |
| 183 */ | 183 */ |
| 184 private boolean performAction(ContentViewCore contentView, String code)
{ | 184 private boolean performAction(ContentViewCore contentView, String code)
{ |
| 185 final int resultId = mResultIdCounter.getAndIncrement(); | 185 final int resultId = mResultIdCounter.getAndIncrement(); |
| 186 final String js = String.format(Locale.US, JAVASCRIPT_ACTION_TEMPLAT
E, code, | 186 final String js = String.format(Locale.US, JAVASCRIPT_ACTION_TEMPLAT
E, code, |
| 187 mInterfaceName, resultId); | 187 mInterfaceName, resultId); |
| 188 contentView.evaluateJavaScript(js, null); | 188 contentView.getWebContents().evaluateJavaScript(js, null); |
| 189 | 189 |
| 190 return getResultAndClear(resultId); | 190 return getResultAndClear(resultId); |
| 191 } | 191 } |
| 192 | 192 |
| 193 /** | 193 /** |
| 194 * Gets the result of a request to perform an accessibility action. | 194 * Gets the result of a request to perform an accessibility action. |
| 195 * | 195 * |
| 196 * @param resultId The result id to match the result with the request. | 196 * @param resultId The result id to match the result with the request. |
| 197 * @return The result of the request. | 197 * @return The result of the request. |
| 198 */ | 198 */ |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 synchronized (mResultLock) { | 256 synchronized (mResultLock) { |
| 257 if (resultId > mResultId) { | 257 if (resultId > mResultId) { |
| 258 mResult = Boolean.parseBoolean(result); | 258 mResult = Boolean.parseBoolean(result); |
| 259 mResultId = resultId; | 259 mResultId = resultId; |
| 260 } | 260 } |
| 261 mResultLock.notifyAll(); | 261 mResultLock.notifyAll(); |
| 262 } | 262 } |
| 263 } | 263 } |
| 264 } | 264 } |
| 265 } | 265 } |
| OLD | NEW |