diff options
author | wychen <wychen@chromium.org> | 2015-11-13 13:00:55 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-13 21:01:53 +0000 |
commit | fb0595a36c10828cf7dcfdf4f0075ebb3a61798a (patch) | |
tree | 923b9d43473910f7becedba58e99b8bc3dac3990 /components/dom_distiller/android | |
parent | 12d28add8388f5ea5760783a2817eca3a9a722a1 (diff) | |
download | chromium_src-fb0595a36c10828cf7dcfdf4f0075ebb3a61798a.zip chromium_src-fb0595a36c10828cf7dcfdf4f0075ebb3a61798a.tar.gz chromium_src-fb0595a36c10828cf7dcfdf4f0075ebb3a61798a.tar.bz2 |
Hook up new distillability signal to DistillablePageUtils
A new push-based mechanism of distillability test (http://crrev.com/1434433002/)
is available in DistillablePageUtils.
BUG=509869
TEST=browser_tests --gtest_filter="Distillable*"
Review URL: https://codereview.chromium.org/1414283006
Cr-Commit-Position: refs/heads/master@{#359633}
Diffstat (limited to 'components/dom_distiller/android')
-rw-r--r-- | components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java b/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java index 0f7c794..959a71b 100644 --- a/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java +++ b/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java @@ -33,5 +33,30 @@ public final class DistillablePageUtils { private static native void nativeIsPageDistillable( WebContents webContents, boolean isMobileOptimized, PageDistillableCallback callback); -} + /** + * Delegate to receive distillability updates. + */ + public static interface PageDistillableDelegate { + /** + * Called when the distillability status changes. + * @param isDistillable Whether the page is distillable. + * @param isLast Whether the update is the last one for this page. + */ + public void onIsPageDistillableResult(boolean isDistillable, boolean isLast); + } + + public static void setDelegate(WebContents webContents, + PageDistillableDelegate delegate) { + nativeSetDelegate(webContents, delegate); + } + + @CalledByNative + private static void callOnIsPageDistillableUpdate( + PageDistillableDelegate delegate, boolean isDistillable, boolean isLast) { + delegate.onIsPageDistillableResult(isDistillable, isLast); + } + + private static native void nativeSetDelegate( + WebContents webContents, PageDistillableDelegate delegate); +} |