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 3 // found in the LICENSE file. 4 5 package org.chromium.components.dom_distiller.core; 6 7 import org.chromium.base.JNINamespace; 8 9 /** 10 * Wrapper for the dom_distiller::url_utils. 11 */ 12 @JNINamespace("dom_distiller::url_utils::android") 13 public final class DomDistillerUrlUtils { 14 DomDistillerUrlUtils()15 private DomDistillerUrlUtils() { 16 } 17 18 /** 19 * Returns the URL for viewing distilled content for a URL. 20 * 21 * @param scheme The scheme for the DOM Distiller source. 22 * @param url The URL to distill. 23 * @return the URL to load to get the distilled version of a page. 24 */ getDistillerViewUrlFromUrl(String scheme, String url)25 public static String getDistillerViewUrlFromUrl(String scheme, String url) { 26 return nativeGetDistillerViewUrlFromUrl(scheme, url); 27 } 28 29 /** 30 * Returns the original URL of a distillation given the viewer URL. 31 * 32 * @param url The current viewer URL. 33 * @return the URL of the original page. 34 */ getOriginalUrlFromDistillerUrl(String url)35 public static String getOriginalUrlFromDistillerUrl(String url) { 36 return nativeGetOriginalUrlFromDistillerUrl(url); 37 } 38 isUrlReportable(String scheme, String url)39 public static boolean isUrlReportable(String scheme, String url) { 40 return nativeIsUrlReportable(scheme, url); 41 } 42 nativeGetDistillerViewUrlFromUrl(String scheme, String url)43 private static native String nativeGetDistillerViewUrlFromUrl(String scheme, String url); nativeGetOriginalUrlFromDistillerUrl(String viewerUrl)44 private static native String nativeGetOriginalUrlFromDistillerUrl(String viewerUrl); nativeIsUrlReportable(String scheme, String url)45 private static native boolean nativeIsUrlReportable(String scheme, String url); 46 } 47