From: csagan5 <32685696+csagan5@users.noreply.github.com>
Date: Sat, 14 Sep 2019 10:20:08 +0200
Subject: Bromite subresource adblocker
Add option to configure the ad blocker filters URL
Disable look-alike, metrics, ablation and navigation throttles
Do not use experiments to enable/disable presets
Always enable ad filtering
Download filters by checking Last-Modified header first
Fix RestoreForeignSessionTab by recreating the tab (issue #681)
Enable AutomaticLazyFrameLoadingToAds and AutomaticLazyFrameLoadingToEmbeds features
License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html
---
chrome/android/BUILD.gn | 1 +
chrome/android/chrome_java_resources.gni | 2 +
chrome/android/chrome_java_sources.gni | 2 +
.../java/res/layout/adblock_editor.xml | 67 +++++
chrome/android/java/res/values/styles.xml | 18 ++
chrome/android/java/res/values/values.xml | 2 +
.../java/res/xml/adblock_preferences.xml | 25 ++
.../android/java/res/xml/main_preferences.xml | 5 +
.../browser/settings/AdBlockEditor.java | 91 ++++++
.../browser/settings/AdBlockPreferences.java | 61 ++++
.../chrome/browser/tabmodel/TabModelImpl.java | 2 +-
chrome/app/generated_resources.grd | 10 +
chrome/browser/after_startup_task_utils.cc | 4 +
chrome/browser/browser_process.h | 6 +
chrome/browser/browser_process_impl.cc | 20 ++
chrome/browser/browser_process_impl.h | 2 +
chrome/browser/chrome_browser_main.cc | 3 +
chrome/browser/flags/BUILD.gn | 3 +
.../flags/android/adblock_native_gateway.cc | 21 ++
.../browser/flags/AdBlockNativeGateway.java | 20 ++
.../net/system_network_context_manager.cc | 3 +
.../sessions/session_restore_android.cc | 6 +-
.../strings/android_chrome_strings.grd | 14 +
chrome/common/pref_names.h | 3 +
.../strings/android/site_settings.grdp | 4 +-
components/component_updater/BUILD.gn | 7 +
.../adblock_updater_service.cc | 268 ++++++++++++++++++
.../adblock_updater_service.h | 98 +++++++
.../download_filters_task.cc | 239 ++++++++++++++++
.../component_updater/download_filters_task.h | 129 +++++++++
...ent_subresource_filter_throttle_manager.cc | 15 +
...tent_subresource_filter_throttle_manager.h | 2 +
.../content/browser/ruleset_service.cc | 42 ++-
.../content/browser/ruleset_service.h | 7 +-
.../content/browser/ruleset_version.h | 4 +
.../unindexed_ruleset_stream_generator.cc | 3 +
.../browser/verified_ruleset_dealer.cc | 4 +
.../browser/subresource_filter_features.cc | 116 +-------
.../core/common/indexed_ruleset.cc | 5 +-
third_party/blink/common/features.cc | 12 +-
40 files changed, 1211 insertions(+), 135 deletions(-)
create mode 100644 chrome/android/java/res/layout/adblock_editor.xml
create mode 100644 chrome/android/java/res/xml/adblock_preferences.xml
create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/settings/AdBlockEditor.java
create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/settings/AdBlockPreferences.java
create mode 100755 chrome/browser/flags/android/adblock_native_gateway.cc
create mode 100755 chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/AdBlockNativeGateway.java
create mode 100644 components/component_updater/adblock_updater_service.cc
create mode 100644 components/component_updater/adblock_updater_service.h
create mode 100644 components/component_updater/download_filters_task.cc
create mode 100644 components/component_updater/download_filters_task.h
diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn
--- a/chrome/android/BUILD.gn
+++ b/chrome/android/BUILD.gn
@@ -304,6 +304,7 @@ if (current_toolchain == default_toolchain) {
"//chrome/android/modules/image_editor/provider:java",
"//chrome/android/modules/stack_unwinder/provider:java",
"//chrome/android/webapk/libs/client:client_java",
+ "//chrome/browser/endpoint_fetcher:java",
"//chrome/android/webapk/libs/common:common_java",
"//chrome/android/webapk/libs/common:splash_java",
"//chrome/android/webapk/libs/runtime_library:webapk_service_aidl_java",
diff --git a/chrome/android/chrome_java_resources.gni b/chrome/android/chrome_java_resources.gni
--- a/chrome/android/chrome_java_resources.gni
+++ b/chrome/android/chrome_java_resources.gni
@@ -448,6 +448,7 @@ chrome_java_resources = [
"java/res/layout/account_chooser_dialog_title.xml",
"java/res/layout/account_divider_preference.xml",
"java/res/layout/account_management_account_row.xml",
+ "java/res/layout/adblock_editor.xml",
"java/res/layout/auto_sign_in_first_run_dialog.xml",
"java/res/layout/autofill_billing_address_dropdown.xml",
"java/res/layout/autofill_card_name_and_number.xml",
@@ -648,6 +649,7 @@ chrome_java_resources = [
"java/res/xml/about_chrome_preferences.xml",
"java/res/xml/account_management_preferences.xml",
"java/res/xml/ad_services_config.xml",
+ "java/res/xml/adblock_preferences.xml",
"java/res/xml/bookmark_widget_info.xml",
"java/res/xml/clear_browsing_data_preferences_tab.xml",
"java/res/xml/contextual_search_preferences.xml",
diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni
--- a/chrome/android/chrome_java_sources.gni
+++ b/chrome/android/chrome_java_sources.gni
@@ -960,6 +960,8 @@ chrome_java_sources = [
"java/src/org/chromium/chrome/browser/permissions/PermissionSettingsBridge.java",
"java/src/org/chromium/chrome/browser/permissions/PermissionUpdateRequester.java",
"java/src/org/chromium/chrome/browser/photo_picker/DecoderServiceImpl.java",
+ "java/src/org/chromium/chrome/browser/settings/AdBlockEditor.java",
+ "java/src/org/chromium/chrome/browser/settings/AdBlockPreferences.java",
"java/src/org/chromium/chrome/browser/policy/PolicyAuditor.java",
"java/src/org/chromium/chrome/browser/policy/PolicyAuditorBridge.java",
"java/src/org/chromium/chrome/browser/printing/TabPrinter.java",
diff --git a/chrome/android/java/res/layout/adblock_editor.xml b/chrome/android/java/res/layout/adblock_editor.xml
new file mode 100644
--- /dev/null
+++ b/chrome/android/java/res/layout/adblock_editor.xml
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/chrome/android/java/res/values/styles.xml b/chrome/android/java/res/values/styles.xml
--- a/chrome/android/java/res/values/styles.xml
+++ b/chrome/android/java/res/values/styles.xml
@@ -232,6 +232,24 @@ found in the LICENSE file.
+
+
+
+