| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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.components.dom_distiller.content; | 5 package org.chromium.components.dom_distiller.content; |
| 6 | 6 |
| 7 import org.chromium.base.annotations.CalledByNative; | 7 import org.chromium.base.annotations.CalledByNative; |
| 8 import org.chromium.base.annotations.JNINamespace; | 8 import org.chromium.base.annotations.JNINamespace; |
| 9 import org.chromium.content_public.browser.WebContents; | 9 import org.chromium.content_public.browser.WebContents; |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * Provides access to the native dom_distiller::IsPageDistillable function. | 12 * Provides access to the native dom_distiller::IsPageDistillable function. |
| 13 */ | 13 */ |
| 14 @JNINamespace("dom_distiller::android") | 14 @JNINamespace("dom_distiller::android") |
| 15 public final class DistillablePageUtils { | 15 public final class DistillablePageUtils { |
| 16 /** | 16 /** |
| 17 * Callback for handling the result of isPageDistillable. | 17 * Callback for handling the result of isPageDistillable. |
| 18 */ | 18 */ |
| 19 public static interface PageDistillableCallback { | 19 public static interface PageDistillableCallback { |
| 20 public void onIsPageDistillableResult(boolean isDistillable); | 20 public void onIsPageDistillableResult(boolean isDistillable, boolean isL
ast); |
| 21 } | 21 } |
| 22 | 22 |
| 23 public static void isPageDistillable(WebContents webContents, boolean isMobi
leOptimized, | 23 public static void setCallback(WebContents webContents, |
| 24 PageDistillableCallback callback) { | 24 PageDistillableCallback callback) { |
| 25 nativeIsPageDistillable(webContents, isMobileOptimized, callback); | 25 nativeSetCallback(webContents, callback); |
| 26 } | 26 } |
| 27 | 27 |
| 28 @CalledByNative | 28 @CalledByNative |
| 29 private static void callOnIsPageDistillableResult( | 29 private static void callOnIsPageDistillableResult( |
| 30 PageDistillableCallback callback, boolean isDistillable) { | 30 PageDistillableCallback callback, boolean isDistillable, boolean isL
ast) { |
| 31 callback.onIsPageDistillableResult(isDistillable); | 31 callback.onIsPageDistillableResult(isDistillable, isLast); |
| 32 } | 32 } |
| 33 | 33 |
| 34 private static native void nativeIsPageDistillable( | 34 private static native void nativeSetCallback( |
| 35 WebContents webContents, boolean isMobileOptimized, PageDistillableC
allback callback); | 35 WebContents webContents, PageDistillableCallback callback); |
| 36 } | 36 } |
| 37 | |
| OLD | NEW |