| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_public.browser; | 5 package org.chromium.content_public.browser; |
| 6 | 6 |
| 7 import android.os.Parcelable; | 7 import android.os.Parcelable; |
| 8 | 8 |
| 9 import org.chromium.base.VisibleForTesting; | 9 import org.chromium.base.VisibleForTesting; |
| 10 | 10 |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 | 211 |
| 212 /** | 212 /** |
| 213 * Resumes the requests for a newly created window. | 213 * Resumes the requests for a newly created window. |
| 214 */ | 214 */ |
| 215 void resumeLoadingCreatedWebContents(); | 215 void resumeLoadingCreatedWebContents(); |
| 216 | 216 |
| 217 /** | 217 /** |
| 218 * Injects the passed Javascript code in the current page and evaluates it. | 218 * Injects the passed Javascript code in the current page and evaluates it. |
| 219 * If a result is required, pass in a callback. | 219 * If a result is required, pass in a callback. |
| 220 * | 220 * |
| 221 * It is not possible to use this method to evaluate JavaScript on web | |
| 222 * content, only on WebUI pages. | |
| 223 * | |
| 224 * @param script The Javascript to execute. | |
| 225 * @param callback The callback to be fired off when a result is ready. The
script's | |
| 226 * result will be json encoded and passed as the parameter,
and the call | |
| 227 * will be made on the main thread. | |
| 228 * If no result is required, pass null. | |
| 229 */ | |
| 230 void evaluateJavaScript(String script, JavaScriptCallback callback); | |
| 231 | |
| 232 /** | |
| 233 * Injects the passed Javascript code in the current page and evaluates it. | |
| 234 * If a result is required, pass in a callback. | |
| 235 * | |
| 236 * @param script The Javascript to execute. | 221 * @param script The Javascript to execute. |
| 237 * @param callback The callback to be fired off when a result is ready. The
script's | 222 * @param callback The callback to be fired off when a result is ready. The
script's |
| 238 * result will be json encoded and passed as the parameter,
and the call | 223 * result will be json encoded and passed as the parameter,
and the call |
| 239 * will be made on the main thread. | 224 * will be made on the main thread. |
| 240 * If no result is required, pass null. | 225 * If no result is required, pass null. |
| 241 */ | 226 */ |
| 242 @VisibleForTesting | 227 @VisibleForTesting |
| 243 void evaluateJavaScriptForTests(String script, JavaScriptCallback callback); | 228 void evaluateJavaScript(String script, JavaScriptCallback callback); |
| 244 | 229 |
| 245 /** | 230 /** |
| 246 * Adds a log message to dev tools console. |level| must be a value of | 231 * Adds a log message to dev tools console. |level| must be a value of |
| 247 * org.chromium.content_public.common.ConsoleMessageLevel. | 232 * org.chromium.content_public.common.ConsoleMessageLevel. |
| 248 */ | 233 */ |
| 249 void addMessageToDevToolsConsole(int level, String message); | 234 void addMessageToDevToolsConsole(int level, String message); |
| 250 | 235 |
| 251 /** | 236 /** |
| 252 * Returns whether the initial empty page has been accessed by a script from
another | 237 * Returns whether the initial empty page has been accessed by a script from
another |
| 253 * page. Always false after the first commit. | 238 * page. Always false after the first commit. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 */ | 277 */ |
| 293 void addObserver(WebContentsObserver observer); | 278 void addObserver(WebContentsObserver observer); |
| 294 | 279 |
| 295 /** | 280 /** |
| 296 * Remove an observer from the WebContents | 281 * Remove an observer from the WebContents |
| 297 * | 282 * |
| 298 * @param observer The observer to remove. | 283 * @param observer The observer to remove. |
| 299 */ | 284 */ |
| 300 void removeObserver(WebContentsObserver observer); | 285 void removeObserver(WebContentsObserver observer); |
| 301 } | 286 } |
| OLD | NEW |