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 Change-Id: I09c0504269c659e0f125dfa982148b705cd6528b --- 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 + .../flags/android/cached_feature_flags.cc | 11 + .../browser/flags/CachedFeatureFlags.java | 10 + .../net/system_network_context_manager.cc | 4 + .../sessions/session_restore_android.cc | 4 +- .../strings/android_chrome_strings.grd | 14 + chrome/common/pref_names.cc | 3 + chrome/common/pref_names.h | 1 + .../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 | 222 +++++++++++++++ .../component_updater/download_filters_task.h | 129 +++++++++ ...ent_subresource_filter_throttle_manager.cc | 11 + .../content/browser/ruleset_service.cc | 33 ++- .../content/browser/ruleset_service.h | 7 +- .../content/browser/ruleset_version.h | 4 + .../browser/verified_ruleset_dealer.cc | 4 + .../browser/subresource_filter_features.cc | 116 +------- .../core/common/indexed_ruleset.cc | 5 +- .../navigation_throttle_runner.cc | 5 - third_party/blink/common/features.cc | 12 +- 39 files changed, 1158 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 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 @@ -253,6 +253,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_sources.gni b/chrome/android/chrome_java_sources.gni --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni @@ -941,6 +941,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/prerender/ChromePrerenderServiceImpl.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 index 0000000000000000000000000000000000000000..aced0dbca5a2be7e2dc03207a757a6c0c1e654e1 --- /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 @@ -224,6 +224,24 @@ found in the LICENSE file. + + + +