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 * |
221 * @param script The Javascript to execute. | 236 * @param script The Javascript to execute. |
222 * @param callback The callback to be fired off when a result is ready. The
script's | 237 * @param callback The callback to be fired off when a result is ready. The
script's |
223 * result will be json encoded and passed as the parameter,
and the call | 238 * result will be json encoded and passed as the parameter,
and the call |
224 * will be made on the main thread. | 239 * will be made on the main thread. |
225 * If no result is required, pass null. | 240 * If no result is required, pass null. |
226 */ | 241 */ |
227 @VisibleForTesting | 242 @VisibleForTesting |
228 void evaluateJavaScript(String script, JavaScriptCallback callback); | 243 void evaluateJavaScriptForTests(String script, JavaScriptCallback callback); |
229 | 244 |
230 /** | 245 /** |
231 * Adds a log message to dev tools console. |level| must be a value of | 246 * Adds a log message to dev tools console. |level| must be a value of |
232 * org.chromium.content_public.common.ConsoleMessageLevel. | 247 * org.chromium.content_public.common.ConsoleMessageLevel. |
233 */ | 248 */ |
234 void addMessageToDevToolsConsole(int level, String message); | 249 void addMessageToDevToolsConsole(int level, String message); |
235 | 250 |
236 /** | 251 /** |
237 * Returns whether the initial empty page has been accessed by a script from
another | 252 * Returns whether the initial empty page has been accessed by a script from
another |
238 * page. Always false after the first commit. | 253 * page. Always false after the first commit. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 */ | 292 */ |
278 void addObserver(WebContentsObserver observer); | 293 void addObserver(WebContentsObserver observer); |
279 | 294 |
280 /** | 295 /** |
281 * Remove an observer from the WebContents | 296 * Remove an observer from the WebContents |
282 * | 297 * |
283 * @param observer The observer to remove. | 298 * @param observer The observer to remove. |
284 */ | 299 */ |
285 void removeObserver(WebContentsObserver observer); | 300 void removeObserver(WebContentsObserver observer); |
286 } | 301 } |
OLD | NEW |