| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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.printing; | 5 package org.chromium.printing; |
| 6 | 6 |
| 7 import android.annotation.TargetApi; | 7 import android.annotation.TargetApi; |
| 8 import android.os.Build; | 8 import android.os.Build; |
| 9 import android.os.Bundle; | 9 import android.os.Bundle; |
| 10 import android.os.CancellationSignal; | 10 import android.os.CancellationSignal; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 void onLayoutCancelled(); | 49 void onLayoutCancelled(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 public static interface WriteResultCallbackWrapper { | 52 public static interface WriteResultCallbackWrapper { |
| 53 void onWriteFinished(PageRange[] pages); | 53 void onWriteFinished(PageRange[] pages); |
| 54 void onWriteFailed(CharSequence error); | 54 void onWriteFailed(CharSequence error); |
| 55 void onWriteCancelled(); | 55 void onWriteCancelled(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 public static class LayoutResultCallbackWrapperImpl implements LayoutResultC
allbackWrapper { | 58 public static class LayoutResultCallbackWrapperImpl implements LayoutResultC
allbackWrapper { |
| 59 private LayoutResultCallback mCallback = null; | 59 private LayoutResultCallback mCallback; |
| 60 public LayoutResultCallbackWrapperImpl(LayoutResultCallback callback) { | 60 public LayoutResultCallbackWrapperImpl(LayoutResultCallback callback) { |
| 61 assert callback != null; | 61 assert callback != null; |
| 62 mCallback = callback; | 62 mCallback = callback; |
| 63 } | 63 } |
| 64 | 64 |
| 65 @Override | 65 @Override |
| 66 public void onLayoutFinished(PrintDocumentInfo info, boolean changed) { | 66 public void onLayoutFinished(PrintDocumentInfo info, boolean changed) { |
| 67 mCallback.onLayoutFinished(info, changed); | 67 mCallback.onLayoutFinished(info, changed); |
| 68 } | 68 } |
| 69 | 69 |
| 70 @Override | 70 @Override |
| 71 public void onLayoutFailed(CharSequence error) { | 71 public void onLayoutFailed(CharSequence error) { |
| 72 mCallback.onLayoutFailed(error); | 72 mCallback.onLayoutFailed(error); |
| 73 } | 73 } |
| 74 | 74 |
| 75 @Override | 75 @Override |
| 76 public void onLayoutCancelled() { | 76 public void onLayoutCancelled() { |
| 77 mCallback.onLayoutCancelled(); | 77 mCallback.onLayoutCancelled(); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 public static class WriteResultCallbackWrapperImpl implements WriteResultCal
lbackWrapper { | 81 public static class WriteResultCallbackWrapperImpl implements WriteResultCal
lbackWrapper { |
| 82 private WriteResultCallback mCallback = null; | 82 private WriteResultCallback mCallback; |
| 83 public WriteResultCallbackWrapperImpl(WriteResultCallback callback) { | 83 public WriteResultCallbackWrapperImpl(WriteResultCallback callback) { |
| 84 assert callback != null; | 84 assert callback != null; |
| 85 mCallback = callback; | 85 mCallback = callback; |
| 86 } | 86 } |
| 87 | 87 |
| 88 @Override | 88 @Override |
| 89 public void onWriteFinished(PageRange[] pages) { | 89 public void onWriteFinished(PageRange[] pages) { |
| 90 mCallback.onWriteFinished(pages); | 90 mCallback.onWriteFinished(pages); |
| 91 } | 91 } |
| 92 | 92 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 mPdfGenerator.onWrite(ranges, destination, cancellationSignal, | 137 mPdfGenerator.onWrite(ranges, destination, cancellationSignal, |
| 138 new WriteResultCallbackWrapperImpl(callback)); | 138 new WriteResultCallbackWrapperImpl(callback)); |
| 139 } | 139 } |
| 140 | 140 |
| 141 @Override | 141 @Override |
| 142 public void onFinish() { | 142 public void onFinish() { |
| 143 super.onFinish(); | 143 super.onFinish(); |
| 144 mPdfGenerator.onFinish(); | 144 mPdfGenerator.onFinish(); |
| 145 } | 145 } |
| 146 } | 146 } |
| OLD | NEW |