Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / components / dom_distiller / android / java / src / org / chromium / components / dom_distiller / core / DomDistillerUrlUtils.java
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
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      */
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      */
35     public static String getOriginalUrlFromDistillerUrl(String url) {
36         return nativeGetOriginalUrlFromDistillerUrl(url);
37     }
38
39     public static boolean isUrlReportable(String scheme, String url) {
40         return nativeIsUrlReportable(scheme, url);
41     }
42
43     private static native String nativeGetDistillerViewUrlFromUrl(String scheme, String url);
44     private static native String nativeGetOriginalUrlFromDistillerUrl(String viewerUrl);
45     private static native boolean nativeIsUrlReportable(String scheme, String url);
46 }