summaryrefslogtreecommitdiffstats
path: root/components/dom_distiller/android
diff options
context:
space:
mode:
Diffstat (limited to 'components/dom_distiller/android')
-rw-r--r--components/dom_distiller/android/BUILD.gn15
-rw-r--r--components/dom_distiller/android/DEPS3
-rw-r--r--components/dom_distiller/android/component_jni_registrar.cc3
-rw-r--r--components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/content/DEPS3
-rw-r--r--components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java37
5 files changed, 59 insertions, 2 deletions
diff --git a/components/dom_distiller/android/BUILD.gn b/components/dom_distiller/android/BUILD.gn
index 3bda4e9..2cc4dc7 100644
--- a/components/dom_distiller/android/BUILD.gn
+++ b/components/dom_distiller/android/BUILD.gn
@@ -4,18 +4,29 @@
import("//build/config/android/rules.gni")
-# GYP: //components/dom_distiller.gypi:dom_distiller_core_java
android_library("dom_distiller_core_java") {
deps = [
"//base:base_java",
]
+ java_files = [
+ "java/src/org/chromium/components/dom_distiller/core/DomDistillerService.java",
+ "java/src/org/chromium/components/dom_distiller/core/DomDistillerUrlUtils.java",
+ "java/src/org/chromium/components/dom_distiller/core/DistilledPagePrefs.java",
+ ]
srcjar_deps = [
":dom_distiller_core_font_family_javagen",
":dom_distiller_core_theme_javagen",
]
+}
- DEPRECATED_java_in_dir = "java/src"
+# GYP: //components/dom_distiller.gypi:dom_distiller_java
+android_library("dom_distiller_content_java") {
+ deps = [
+ ":dom_distiller_core_java",
+ "//content/public/android:content_java",
+ ]
+ java_files = [ "java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java" ]
}
# GYP: //components/dom_distiller.gypi:dom_distiller_core_font_family_java
diff --git a/components/dom_distiller/android/DEPS b/components/dom_distiller/android/DEPS
new file mode 100644
index 0000000..54004a2
--- /dev/null
+++ b/components/dom_distiller/android/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+components/dom_distiller",
+]
diff --git a/components/dom_distiller/android/component_jni_registrar.cc b/components/dom_distiller/android/component_jni_registrar.cc
index f631a2d..2ea4b57 100644
--- a/components/dom_distiller/android/component_jni_registrar.cc
+++ b/components/dom_distiller/android/component_jni_registrar.cc
@@ -7,6 +7,7 @@
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
#include "base/basictypes.h"
+#include "components/dom_distiller/content/distillable_page_utils_android.h"
#include "components/dom_distiller/core/distilled_page_prefs_android.h"
#include "components/dom_distiller/core/dom_distiller_service_android.h"
#include "components/dom_distiller/core/url_utils_android.h"
@@ -20,6 +21,8 @@ static base::android::RegistrationMethod kDomDistillerRegisteredMethods[] = {
{"DomDistillerService", DomDistillerServiceAndroid::Register},
{"DomDistillerUrlUtils",
dom_distiller::url_utils::android::RegisterUrlUtils},
+ {"DistillablePageUtils",
+ dom_distiller::android::RegisterDistillablePageUtils},
};
bool RegisterDomDistiller(JNIEnv* env) {
diff --git a/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/content/DEPS b/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/content/DEPS
new file mode 100644
index 0000000..0d019e1
--- /dev/null
+++ b/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/content/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+ "+content/public/android/java",
+]
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
new file mode 100644
index 0000000..03e2a15
--- /dev/null
+++ b/components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java
@@ -0,0 +1,37 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.components.dom_distiller.content;
+
+import org.chromium.base.CalledByNative;
+import org.chromium.base.JNINamespace;
+import org.chromium.content_public.browser.WebContents;
+
+/**
+ * Provides access to the native dom_distiller::IsPageDistillable function.
+ */
+@JNINamespace("dom_distiller::android")
+public final class DistillablePageUtils {
+ /**
+ * Callback for handling the result of isPageDistillable.
+ */
+ public static interface PageDistillableCallback {
+ public void onIsPageDistillableResult(boolean isDistillable);
+ }
+
+ public static void isPageDistillable(
+ WebContents webContents, PageDistillableCallback callback) {
+ nativeIsPageDistillable(webContents, callback);
+ }
+
+ @CalledByNative
+ private static void callOnIsPageDistillableResult(
+ PageDistillableCallback callback, boolean isDistillable) {
+ callback.onIsPageDistillableResult(isDistillable);
+ }
+
+ private static native void nativeIsPageDistillable(
+ WebContents webContents, PageDistillableCallback callback);
+}
+