0

Remove dom_distiller core dependency on content

This change removes the top level android directory from dom_distiller
and splits it into content/browser/android and core/android. The two
directories now each have their own JNI registrar that allows them to
depend on appropriate parts of the component.

BUG=562769
TBR=yfriedman@chromium.org

Review-Url: https://codereview.chromium.org/2252963004
Cr-Commit-Position: refs/heads/master@{#415400}
This commit is contained in:
mdjones
2016-08-30 12:49:50 -07:00
committed by Commit bot
parent 883f8d10f4
commit fd194b3382
22 changed files with 126 additions and 47 deletions
chrome
android
BUILD.gn
java
javatests
browser
components/dom_distiller
tools/android/eclipse

@ -232,8 +232,8 @@ android_library("chrome_java") {
":document_tab_model_info_proto_java",
"//blimp/client/public:public_java",
"//components/bookmarks/common/android:bookmarks_java",
"//components/dom_distiller/android:dom_distiller_content_java",
"//components/dom_distiller/android:dom_distiller_core_java",
"//components/dom_distiller/content/browser/android:dom_distiller_content_java",
"//components/dom_distiller/core/android:dom_distiller_core_java",
"//components/gcm_driver/android:gcm_driver_java",
"//components/gcm_driver/instance_id/android:instance_id_driver_java",
"//components/invalidation/impl:java",
@ -379,7 +379,7 @@ android_library("chrome_test_java") {
"//chrome/android/webapk/libs/runtime_library:webapk_service_aidl_java",
"//chrome/test/android:chrome_java_test_support",
"//components/bookmarks/common/android:bookmarks_java",
"//components/dom_distiller/android:dom_distiller_core_java",
"//components/dom_distiller/core/android:dom_distiller_core_java",
"//components/gcm_driver/android:gcm_driver_java",
"//components/invalidation/impl:java",
"//components/invalidation/impl:javatests",

@ -1,8 +1,8 @@
include_rules = [
"+blimp/client/public/android/java/src/org/chromium/blimp_public",
"+components/bookmarks/common/android/java/src/org/chromium/components/bookmarks",
"+components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/content",
"+components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/core",
"+components/dom_distiller/content/browser/android/java/src/org/chromium/components/dom_distiller/content",
"+components/dom_distiller/core/android/java/src/org/chromium/components/dom_distiller/core",
"+components/gcm_driver/android/java/src/org/chromium/components/gcm_driver",
"+components/location/android/java",
"+components/navigation_interception",

@ -1,6 +1,6 @@
include_rules = [
"+components/bookmarks/common/android/java/src/org/chromium/components/bookmarks",
"+components/dom_distiller/android/java/src/org/chromium/components/dom_distiller/core",
"+components/dom_distiller/core/android/java/src/org/chromium/components/dom_distiller/core",
"+components/gcm_driver/android/java/src/org/chromium/components/gcm_driver",
"+components/location/android/java",
"+components/navigation_interception",

@ -153,7 +153,8 @@
#include "chrome/browser/ui/android/toolbar/toolbar_model_android.h"
#include "chrome/browser/ui/android/usb_chooser_dialog_android.h"
#include "chrome/browser/ui/android/website_settings_popup_android.h"
#include "components/dom_distiller/android/component_jni_registrar.h"
#include "components/dom_distiller/content/browser/android/content_jni_registrar.h"
#include "components/dom_distiller/core/android/core_jni_registrar.h"
#include "components/gcm_driver/android/component_jni_registrar.h"
#include "components/gcm_driver/instance_id/android/component_jni_registrar.h"
#include "components/invalidation/impl/android/component_jni_registrar.h"
@ -180,7 +181,9 @@ namespace android {
static base::android::RegistrationMethod kChromeRegisteredMethods[] = {
// Register JNI for components we depend on.
{"AppMenuDragHelper", RegisterAppMenuDragHelper},
{"DomDistiller", dom_distiller::android::RegisterDomDistiller},
{"DomDistillerContent",
dom_distiller::content::android::RegisterDomDistiller},
{"DomDistillerCore", dom_distiller::core::android::RegisterDomDistiller},
{"ChromeDownloadDelegate", RegisterChromeDownloadDelegate},
{"GCMDriver", gcm::android::RegisterGCMDriverJni},
{"InstanceID", instance_id::android::RegisterInstanceIDJni},

@ -49,12 +49,12 @@ static_library("browser") {
if (is_android) {
sources += [
"//components/dom_distiller/android/component_jni_registrar.cc",
"//components/dom_distiller/android/component_jni_registrar.h",
"android/content_jni_registrar.cc",
"android/content_jni_registrar.h",
"distillable_page_utils_android.cc",
"distillable_page_utils_android.h",
]
deps += [ "//components/dom_distiller/android:jni_headers" ]
deps += [ "android:jni_headers" ]
}
}

@ -0,0 +1,22 @@
# Copyright 2016 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.
import("//build/config/android/rules.gni")
# GYP: //components/dom_distiller.gypi:dom_distiller_java
android_library("dom_distiller_content_java") {
deps = [
"//base:base_java",
"//components/dom_distiller/core/android:dom_distiller_core_java",
"//content/public/android:content_java",
]
java_files = [ "java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java" ]
}
generate_jni("jni_headers") {
sources = [
"java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java",
]
jni_package = "dom_distiller_content"
}

@ -0,0 +1,34 @@
// Copyright 2016 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.
#include "components/dom_distiller/content/browser/android/content_jni_registrar.h"
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
#include "base/macros.h"
#include "components/dom_distiller/content/browser/distillable_page_utils_android.h"
namespace dom_distiller {
namespace content {
namespace android {
static base::android::RegistrationMethod kDomDistillerRegisteredMethods[] = {
{"DistillablePageUtils",
dom_distiller::android::RegisterDistillablePageUtils},
};
bool RegisterDomDistiller(JNIEnv* env) {
return base::android::RegisterNativeMethods(
env,
kDomDistillerRegisteredMethods,
arraysize(kDomDistillerRegisteredMethods));
}
} // namespace android
} // namespace content
} // namespace dom_distiller

@ -0,0 +1,25 @@
// Copyright 2016 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.
#ifndef COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_ANDROID_CONTENT_JNI_REGISTRAR_H_
#define COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_ANDROID_CONTENT_JNI_REGISTRAR_H_
#include <jni.h>
namespace dom_distiller {
namespace content {
namespace android {
// Register all JNI bindings necessary for the dom_distiller component.
bool RegisterDomDistiller(JNIEnv* env);
} // namespace android
} // namespace content
} // namespace dom_distiller
#endif // COMPONENTS_DOM_DISTILLER_CONTENT_BROWSER_ANDROID_CONTENT_JNI_REGISTRAR_H_

@ -80,6 +80,8 @@ static_library("core") {
if (is_android) {
sources += [
"android/core_jni_registrar.cc",
"android/core_jni_registrar.h",
"dom_distiller_service_android.cc",
"dom_distiller_service_android.h",
]
@ -166,9 +168,9 @@ if (is_android) {
generate_jni("jni_headers") {
sources = [
"../android/java/src/org/chromium/components/dom_distiller/core/DistilledPagePrefs.java",
"../android/java/src/org/chromium/components/dom_distiller/core/DomDistillerService.java",
"../android/java/src/org/chromium/components/dom_distiller/core/DomDistillerUrlUtils.java",
"android/java/src/org/chromium/components/dom_distiller/core/DistilledPagePrefs.java",
"android/java/src/org/chromium/components/dom_distiller/core/DomDistillerService.java",
"android/java/src/org/chromium/components/dom_distiller/core/DomDistillerUrlUtils.java",
]
jni_package = "dom_distiller_core"
}

@ -1,4 +1,4 @@
# Copyright 2014 The Chromium Authors. All rights reserved.
# Copyright 2016 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.
@ -20,16 +20,6 @@ android_library("dom_distiller_core_java") {
]
}
# GYP: //components/dom_distiller.gypi:dom_distiller_java
android_library("dom_distiller_content_java") {
deps = [
":dom_distiller_core_java",
"//base:base_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
java_cpp_template("dom_distiller_core_font_family_javagen") {
package_name = "org/chromium/components/dom_distiller/core"
@ -37,7 +27,7 @@ java_cpp_template("dom_distiller_core_font_family_javagen") {
"java/src/org/chromium/components/dom_distiller/core/FontFamily.template",
]
inputs = [
"../core/font_family_list.h",
"../font_family_list.h",
]
}
@ -48,13 +38,6 @@ java_cpp_template("dom_distiller_core_theme_javagen") {
"java/src/org/chromium/components/dom_distiller/core/Theme.template",
]
inputs = [
"../core/theme_list.h",
"../theme_list.h",
]
}
generate_jni("jni_headers") {
sources = [
"java/src/org/chromium/components/dom_distiller/content/DistillablePageUtils.java",
]
jni_package = "dom_distiller_content"
}

@ -0,0 +1,3 @@
include_rules = [
"+components/dom_distiller",
]

@ -1,28 +1,29 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Copyright 2016 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.
#include "components/dom_distiller/android/component_jni_registrar.h"
#include "components/dom_distiller/core/android/core_jni_registrar.h"
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
#include "base/macros.h"
#include "components/dom_distiller/content/browser/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"
namespace dom_distiller {
namespace core {
namespace android {
static base::android::RegistrationMethod kDomDistillerRegisteredMethods[] = {
{"DistilledPagePrefs", DistilledPagePrefsAndroid::Register},
{"DomDistillerService", DomDistillerServiceAndroid::Register},
{"DistilledPagePrefs",
dom_distiller::android::DistilledPagePrefsAndroid::Register},
{"DomDistillerService",
dom_distiller::android::DomDistillerServiceAndroid::Register},
{"DomDistillerUrlUtils",
dom_distiller::url_utils::android::RegisterUrlUtils},
{"DistillablePageUtils",
dom_distiller::android::RegisterDistillablePageUtils},
};
bool RegisterDomDistiller(JNIEnv* env) {
@ -34,4 +35,6 @@ bool RegisterDomDistiller(JNIEnv* env) {
} // namespace android
} // namespace core
} // namespace dom_distiller

@ -1,14 +1,16 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Copyright 2016 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.
#ifndef COMPONENTS_DOM_DISTILLER_ANDROID_COMPONENT_JNI_REGISTRAR_H_
#define COMPONENTS_DOM_DISTILLER_ANDROID_COMPONENT_JNI_REGISTRAR_H_
#ifndef COMPONENTS_DOM_DISTILLER_CORE_ANDROID_CORE_JNI_REGISTRAR_H_
#define COMPONENTS_DOM_DISTILLER_CORE_ANDROID_CORE_JNI_REGISTRAR_H_
#include <jni.h>
namespace dom_distiller {
namespace core {
namespace android {
// Register all JNI bindings necessary for the dom_distiller component.
@ -16,6 +18,8 @@ bool RegisterDomDistiller(JNIEnv* env);
} // namespace android
} // namespace core
} // namespace dom_distiller
#endif // COMPONENTS_DOM_DISTILLER_ANDROID_COMPONENT_JNI_REGISTRAR_H_
#endif // COMPONENTS_DOM_DISTILLER_CORE_ANDROID_CORE_JNI_REGISTRAR_H_

@ -231,8 +231,8 @@ to the classpath for downstream development. See "additional_entries" below.
<classpathentry kind="lib" path="out/Debug/lib.java/chrome/android/chrome_java.jar"/>
<classpathentry kind="lib" path="out/Debug/lib.java/chrome/android/document_tab_model_info_proto_java.jar"/>
<classpathentry kind="lib" path="out/Debug/lib.java/components/bookmarks/common/android/bookmarks_java.jar"/>
<classpathentry kind="lib" path="out/Debug/lib.java/components/dom_distiller/android/dom_distiller_content_java.jar"/>
<classpathentry kind="lib" path="out/Debug/lib.java/components/dom_distiller/android/dom_distiller_core_java.jar"/>
<classpathentry kind="lib" path="out/Debug/lib.java/components/dom_distiller/content/browser/android/dom_distiller_content_java.jar"/>
<classpathentry kind="lib" path="out/Debug/lib.java/components/dom_distiller/core/android/dom_distiller_core_java.jar"/>
<classpathentry kind="lib" path="out/Debug/lib.java/components/external_video_surface/java.jar"/>
<classpathentry kind="lib" path="out/Debug/lib.java/components/gcm_driver/android/gcm_driver_java.jar"/>
<classpathentry kind="lib" path="out/Debug/lib.java/components/gcm_driver/instance_id/android/instance_id_driver_java.jar"/>