diff options
| author | Selim Gurun <sgurun@google.com> | 2013-08-20 07:04:20 -0700 |
|---|---|---|
| committer | Selim Gurun <sgurun@google.com> | 2013-08-20 15:18:31 -0700 |
| commit | fc3f4ee8a0fb2c50ad77f4c9ceae5590a021f3e4 (patch) | |
| tree | 2cb859b911afff43f0dea1b2a70a8284ef5110cd /core/java/android/webkit/WebView.java | |
| parent | 74596aaa75ee648ca6593e98e94e76aa5a34ba4a (diff) | |
| download | frameworks_base-fc3f4ee8a0fb2c50ad77f4c9ceae5590a021f3e4.zip frameworks_base-fc3f4ee8a0fb2c50ad77f4c9ceae5590a021f3e4.tar.gz frameworks_base-fc3f4ee8a0fb2c50ad77f4c9ceae5590a021f3e4.tar.bz2 | |
Added the callback signal.
Bug:10190508
Change-Id: I52b327e0724938e1de7ce7550d26563364ff1589
Diffstat (limited to 'core/java/android/webkit/WebView.java')
| -rw-r--r-- | core/java/android/webkit/WebView.java | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java index 03bde70..1b57d50 100644 --- a/core/java/android/webkit/WebView.java +++ b/core/java/android/webkit/WebView.java @@ -28,6 +28,7 @@ import android.graphics.drawable.Drawable; import android.net.http.SslCertificate; import android.os.Build; import android.os.Bundle; +import android.os.CancellationSignal; import android.os.Looper; import android.os.Message; import android.os.StrictMode; @@ -1043,24 +1044,26 @@ public class WebView extends AbsoluteLayout * @param width The page width. Should be larger than 0. * @param height The page height. Should be larger than 0. * @param resultCallback A callback to be invoked when the PDF content is exported. - * A true indicates success, and a false failure. - * - * TODO: explain method parameters, margins, consider making the callback - * return more meaningful information, explain any threading concerns, HW - * draw limitations, and make it public. - * TODO: at the moment we are asking app to provide paper size information (width - * and height). This is likely not ideal (I think need margin info too). - * Another approach would be using PrintAttributes. This is to be clarified later. - * - * TODO: explain this webview will not draw during export (onDraw will clear to - * background color) so recommend taking it offscreen, or putting in a layer with an - * overlaid progress UI / spinner. + * A true indicates success, and a false failure. Cannot be null. + * @param cancellationSignal Signal for cancelling the PDF conversion request. Must not + * be null. + * + * The PDF conversion is done asynchronously and the PDF output is written to the provided + * outputstream. The caller should not close the outputstream until the resultCallback is + * called, indicating PDF conversion is complete. Webview cannot be drawn during the pdf + * export so the application is recommended to take it offscreen, or putting in a layer + * with an overlaid progress UI / spinner. + * + * If the caller cancels the task using the cancellationSignal, the cancellation will be + * acked using the resultCallback signal. + * + * TODO(sgurun) margins, explain the units, make it public. * @hide */ public void exportToPdf(OutputStream out, int width, int height, - ValueCallback<Boolean> resultCallback) { + ValueCallback<Boolean> resultCallback, CancellationSignal cancellationSignal) { checkThread(); - mProvider.exportToPdf(out, width, height, resultCallback); + mProvider.exportToPdf(out, width, height, resultCallback, cancellationSignal); } /** |
