diff --git a/build.sh b/build.sh index 577560c9cbead4eef402400cd442fc23874ca5f1..2a9350d3c170bbecba22a5d5ee1bf451660248fc 100755 --- a/build.sh +++ b/build.sh @@ -7,11 +7,13 @@ root_dir=$(dirname "$(readlink -f "$0")") if [ ! -d "$chromium_dir" ]; then chromium_dir=$root_dir fi -chromium_version="117.0.5938.156" +chromium_version="119.0.6045.200" chromium_code=$(echo "$chromium_version" | tr -d '.' | cut -c5-) +chromium_url=https://github.com/chromium/chromium.git clean=0 gsync=0 history=1 +test=0 arch="" usage() { @@ -24,6 +26,7 @@ usage() { echo " -u Show this message" echo " -s Sync source" echo " -h Sync without history" + echo " -t Sign with AOSP test-key" echo exit 1 } @@ -49,6 +52,15 @@ build() { build_args+=' android_default_version_name="'$chromium_version'"' build_args+=' android_default_version_code="'$code'"' + if [ $test -eq 1 ]; then + echo ">> [$(date)] Using AOSP test-key to sign" + keystore_path="${root_dir}/platform.jks" + build_args+=' android_keystore_path="'$keystore_path'"' + build_args+=' android_keystore_name="platform"' + build_args+=' android_keystore_password="platform"' + build_args+=' trichrome_certdigest="c8a2e9bccf597c2fb6dc66bee293fc13f2fc47ec77bc6b2b0d52c11f51192ab8"' + fi + if [ $clean -eq 1 ]; then if [ -d "out/$1" ]; then rm -rf "out/$1" @@ -96,50 +108,63 @@ patch() { bromite_patches_list=$(cat "${root_dir}/build/bromite_patches_list.txt") for file in $bromite_patches_list; do - git am -3 --ignore-whitespace "${root_dir}/build/bromite_patches/$file" + git am -C0 -3 --ignore-whitespace "${root_dir}/build/bromite_patches/$file" done e_patches_list=$(cat "${root_dir}/build/e_patches_list.txt") for file in $e_patches_list; do - git am -3 --ignore-whitespace "${root_dir}/build/e_patches/$file" + git am -C0 -3 --ignore-whitespace "${root_dir}/build/e_patches/$file" done # Rename Chrome to Browser rename + + # domain_substitution from ungoogled-chromium + domain_substitution } rename() { cd $chromium_dir/src - # Translation directories - dirs="components components/strings chrome/browser/ui/android/strings chrome/browser/ui/android/strings/translations" + replacements=("Chrome browser=Browser" "Chrome=Browser" "Bromite=Browser" "Cromite=Browser") - for dir in $dirs; do - grdp_files=$(ls $dir/*.grdp 2> /dev/null | wc -l) - if [ "$grdp_files" != "0" ]; then - sed -i 's/Chrome browser/Browser/g' $dir/*.grd* - sed -i 's/Chrome/Browser/g' $dir/*.grd* - fi - xtb_files=$(ls $dir/*.xtb 2> /dev/null | wc -l) - if [ "$xtb_files" != "0" ]; then - sed -i 's/Chrome browser/Browser/g' $dir/*.xtb - sed -i 's/Chrome/Browser/g' $dir/*.xtb - fi + for replacement in "${replacements[@]}"; do + replaced_string=${replacement%%=*} + replacement_string=${replacement#*=} + + find . -type f -not -name 'foundation_e.grdp' -name '*.grd*' | while read -r filename; do + sed -i "s/\b${replaced_string}\b/${replacement_string}/g" "$filename" + done + find . -type f -name '*.xtb' | while read -r filename; do + sed -i "s/\b${replaced_string}\b/${replacement_string}/g" "$filename" + done done git add . git commit -m "Browser: Replace Chrome with Browser" } +domain_substitution() { + cd "${root_dir}/domain_substitution" + python3 domain_substitution.py apply -r domain_regex.list -f domain_substitution.list $chromium_dir/src + cd $chromium_dir/src + git add . + git commit -m "Browser: Automated domain substitution" +} + sync() { echo ">> [$(date)] Syncing chromium $chromium_version" cd $chromium_dir gclient_config if [ -d "$chromium_dir/src" ]; then cd $chromium_dir/src - git checkout main git fetch origin refs/tags/$chromium_version - git reset --hard FETCH_HEAD + if [ $clean -eq 1 ]; then + git checkout main + git reset --hard FETCH_HEAD + else + git reset --hard $chromium_commit_hash + fi fi if [ $history -eq 1 ]; then gclient sync -D --nohooks -R @@ -151,11 +176,9 @@ sync() { } gclient_config() { - url=https://github.com/chromium/chromium.git - commit_hash=$(git ls-remote --refs $url refs/tags/$chromium_version | awk '{print $1}') cat < "$chromium_dir/.gclient" solutions = [{ - "url": "$url@$commit_hash", + "url": "$chromium_url@$chromium_commit_hash", "managed": False, "name": "src", "custom_deps": {}, @@ -177,13 +200,14 @@ init_repo(){ fi } -while getopts ":a:cur:sh" opt; do +while getopts ":a:cur:sht" opt; do case $opt in a) arch="$OPTARG" ;; c) clean=1 ;; u) usage ;; s) gsync=1 ;; h) history=0 ;; + t) test=1 ;; :) echo "Option -$OPTARG requires an argument" echo @@ -204,6 +228,8 @@ if [ ! -d "$chromium_dir/depot_tools" ]; then fi export PATH="$chromium_dir/depot_tools:$PATH" +chromium_commit_hash=$(git ls-remote --refs $chromium_url refs/tags/$chromium_version | awk '{print $1}') + if [ $clean -eq 1 ]; then echo ">> [$(date)] Cleaning chromium source code" if [ -d "$chromium_dir/src" ]; then diff --git a/build/bromite_patches/00AdblockPlus-add-blocking-in-service-workers.patch b/build/bromite_patches/00AdblockPlus-add-blocking-in-service-workers.patch index fba22ba818820b4f7970d45ddc9bd8d09da88f96..d37667d5d3ba8f43eb30f2aee9170bc3148fc217 100644 --- a/build/bromite_patches/00AdblockPlus-add-blocking-in-service-workers.patch +++ b/build/bromite_patches/00AdblockPlus-add-blocking-in-service-workers.patch @@ -22,7 +22,7 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/browser/adblock/adblock_content_browser_client.cc --- a/chrome/browser/adblock/adblock_content_browser_client.cc +++ b/chrome/browser/adblock/adblock_content_browser_client.cc -@@ -45,6 +45,7 @@ +@@ -43,6 +43,7 @@ #include "content/public/browser/web_contents.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "services/network/public/mojom/websocket.mojom.h" @@ -30,7 +30,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b #include "services/service_manager/public/cpp/binder_registry.h" #include "third_party/blink/public/common/loader/url_loader_throttle.h" -@@ -58,6 +59,29 @@ +@@ -56,6 +57,29 @@ namespace { @@ -60,7 +60,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b bool IsFilteringNeeded(content::RenderFrameHost* frame) { if (frame) { auto* profile = -@@ -65,17 +89,7 @@ bool IsFilteringNeeded(content::RenderFrameHost* frame) { +@@ -63,17 +87,7 @@ bool IsFilteringNeeded(content::RenderFrameHost* frame) { if (profile) { content::RenderFrameHost* embedder = frame->GetOutermostMainFrameOrEmbedder(); const auto& embedder_url = embedder->GetLastCommittedURL(); @@ -79,7 +79,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b } } return false; -@@ -90,6 +104,8 @@ class AdblockContextData : public base::SupportsUserData::Data { +@@ -88,6 +102,8 @@ class AdblockContextData : public base::SupportsUserData::Data { static void StartProxying( Profile* profile, @@ -88,7 +88,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b content::RenderFrameHost* frame, int render_process_id, mojo::PendingReceiver receiver, -@@ -102,8 +118,6 @@ class AdblockContextData : public base::SupportsUserData::Data { +@@ -100,8 +116,6 @@ class AdblockContextData : public base::SupportsUserData::Data { self = new AdblockContextData(); profile->SetUserData(kAdblockContextUserDataKey, base::WrapUnique(self)); } @@ -97,7 +97,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b adblock::AdblockURLLoaderFactoryConfig config{ adblock::SubscriptionServiceFactory::GetForBrowserContext( browser_context), -@@ -115,8 +129,9 @@ class AdblockContextData : public base::SupportsUserData::Data { +@@ -113,8 +127,9 @@ class AdblockContextData : public base::SupportsUserData::Data { browser_context)}; auto proxy = std::make_unique( std::move(config), @@ -108,7 +108,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b std::move(receiver), std::move(target_factory), embedder_support::GetUserAgent(), base::BindOnce(&AdblockContextData::RemoveProxy, -@@ -157,47 +172,50 @@ void AdblockContentBrowserClient::ForceAdblockProxyForTesting() { +@@ -155,47 +170,50 @@ void AdblockContentBrowserClient::ForceAdblockProxyForTesting() { #endif bool AdblockContentBrowserClient::WillInterceptWebSocket( @@ -176,7 +176,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b auto* subscription_service = adblock::SubscriptionServiceFactory::GetForBrowserContext( browser_context); -@@ -205,33 +223,33 @@ void AdblockContentBrowserClient::CreateWebSocketInternal( +@@ -203,33 +221,33 @@ void AdblockContentBrowserClient::CreateWebSocketInternal( adblock::ResourceClassificationRunnerFactory::GetForBrowserContext( browser_context); classification_runner->CheckRequestFilterMatchForWebSocket( @@ -218,7 +218,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b std::move(handshake_client)); return; } -@@ -248,6 +266,72 @@ void AdblockContentBrowserClient::OnWebSocketFilterCheckCompleted( +@@ -246,6 +264,72 @@ void AdblockContentBrowserClient::OnWebSocketFilterCheckCompleted( VLOG(1) << "[eyeo] Web socket blocked for " << url; } @@ -291,7 +291,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b bool AdblockContentBrowserClient::WillCreateURLLoaderFactory( content::BrowserContext* browser_context, content::RenderFrameHost* frame, -@@ -271,24 +355,12 @@ bool AdblockContentBrowserClient::WillCreateURLLoaderFactory( +@@ -269,24 +353,12 @@ bool AdblockContentBrowserClient::WillCreateURLLoaderFactory( navigation_id, ukm_source_id, factory_receiver, header_client, bypass_redirect_checks, disable_secure_dns, factory_override, navigation_response_task_runner); @@ -320,7 +320,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b bool use_test_loader = false; #ifdef EYEO_INTERCEPT_DEBUG_URL -@@ -307,7 +379,7 @@ bool AdblockContentBrowserClient::WillCreateURLLoaderFactory( +@@ -305,7 +377,7 @@ bool AdblockContentBrowserClient::WillCreateURLLoaderFactory( mojo::PendingRemote target_factory_remote; *factory_receiver = target_factory_remote.InitWithNewPipeAndPassReceiver(); AdblockContextData::StartProxying( @@ -401,7 +401,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.h b/chrome/br diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc --- a/chrome/browser/chrome_content_browser_client.cc +++ b/chrome/browser/chrome_content_browser_client.cc -@@ -6252,7 +6252,9 @@ ChromeContentBrowserClient:: +@@ -6330,7 +6330,9 @@ ChromeContentBrowserClient:: } bool ChromeContentBrowserClient::WillInterceptWebSocket( @@ -412,7 +412,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch #if BUILDFLAG(ENABLE_EXTENSIONS) if (!frame) { return false; -@@ -6273,9 +6275,11 @@ bool ChromeContentBrowserClient::WillInterceptWebSocket( +@@ -6351,9 +6353,11 @@ bool ChromeContentBrowserClient::WillInterceptWebSocket( } void ChromeContentBrowserClient::CreateWebSocket( @@ -427,7 +427,7 @@ diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/ch diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h --- a/chrome/browser/chrome_content_browser_client.h +++ b/chrome/browser/chrome_content_browser_client.h -@@ -610,11 +610,15 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { +@@ -624,11 +624,15 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient { CreateURLLoaderHandlerForServiceWorkerNavigationPreload( int frame_tree_node_id, const network::ResourceRequest& resource_request) override; @@ -495,7 +495,7 @@ diff --git a/components/adblock/content/browser/adblock_url_loader_factory.h b/c namespace adblock { -@@ -49,6 +50,7 @@ class AdblockURLLoaderFactory : public network::mojom::URLLoaderFactory { +@@ -57,6 +58,7 @@ class AdblockURLLoaderFactory : public network::mojom::URLLoaderFactory { AdblockURLLoaderFactory( AdblockURLLoaderFactoryConfig config, @@ -503,7 +503,7 @@ diff --git a/components/adblock/content/browser/adblock_url_loader_factory.h b/c content::GlobalRenderFrameHostId host_id, mojo::PendingReceiver receiver, mojo::PendingRemote target_factory, -@@ -78,6 +80,7 @@ class AdblockURLLoaderFactory : public network::mojom::URLLoaderFactory { +@@ -86,6 +88,7 @@ class AdblockURLLoaderFactory : public network::mojom::URLLoaderFactory { void MaybeDestroySelf(); AdblockURLLoaderFactoryConfig config_; @@ -683,7 +683,7 @@ diff --git a/content/browser/websockets/websocket_connector_impl.cc b/content/br diff --git a/content/public/browser/content_browser_client.cc b/content/public/browser/content_browser_client.cc --- a/content/public/browser/content_browser_client.cc +++ b/content/public/browser/content_browser_client.cc -@@ -967,7 +967,7 @@ bool ContentBrowserClient::WillCreateURLLoaderFactory( +@@ -998,7 +998,7 @@ bool ContentBrowserClient::WillCreateURLLoaderFactory( return false; } @@ -692,7 +692,7 @@ diff --git a/content/public/browser/content_browser_client.cc b/content/public/b return false; } -@@ -976,9 +976,11 @@ uint32_t ContentBrowserClient::GetWebSocketOptions(RenderFrameHost* frame) { +@@ -1007,9 +1007,11 @@ uint32_t ContentBrowserClient::GetWebSocketOptions(RenderFrameHost* frame) { } void ContentBrowserClient::CreateWebSocket( @@ -707,7 +707,7 @@ diff --git a/content/public/browser/content_browser_client.cc b/content/public/b diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h --- a/content/public/browser/content_browser_client.h +++ b/content/public/browser/content_browser_client.h -@@ -1746,7 +1746,7 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1791,7 +1791,7 @@ class CONTENT_EXPORT ContentBrowserClient { scoped_refptr navigation_response_task_runner); // Returns true when the embedder wants to intercept a websocket connection. @@ -716,7 +716,7 @@ diff --git a/content/public/browser/content_browser_client.h b/content/public/br // Returns the WebSocket creation options. virtual uint32_t GetWebSocketOptions(RenderFrameHost* frame); -@@ -1768,9 +1768,11 @@ class CONTENT_EXPORT ContentBrowserClient { +@@ -1813,9 +1813,11 @@ class CONTENT_EXPORT ContentBrowserClient { // Always called on the UI thread and only when the Network Service is // enabled. virtual void CreateWebSocket( diff --git a/build/bromite_patches/00Add-cromite-flags-support.patch b/build/bromite_patches/00Add-cromite-flags-support.patch new file mode 100644 index 0000000000000000000000000000000000000000..d79d24667e40667e1db0ee979b660c43c4c36fb8 --- /dev/null +++ b/build/bromite_patches/00Add-cromite-flags-support.patch @@ -0,0 +1,1167 @@ +From: uazo +Date: Sat, 18 Nov 2023 09:41:28 +0000 +Subject: Add cromite flags support + +Add SET_CROMITE_FEATURE_ENABLED*, SET_CROMITE_FEATURE_DISABLED* +and CROMITE_FEATURE macros, logic has been adapted from that found +in brave. +Allows flags to be defined in separate files. +Activates a new cromite tab in chrome://flags with only the flags +added and changed. In android added chrome://flags/cromite +in the setting ui. +Currently in wip + +Need: bromite-build-utils.patch +License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html +--- + base/BUILD.gn | 4 +- + base/feature_list.cc | 56 +++++++ + base/feature_list.h | 84 +++++++++- + build/android/gyp/java_cpp_features.py | 17 ++ + chrome/android/java/res/values/values.xml | 3 + + .../java/res/xml/privacy_preferences.xml | 4 + + chrome/browser/about_flags.cc | 7 + + chrome/browser/browser_features.cc | 1 + + .../flags/android/chrome_feature_list.cc | 1 + + .../flags/android/chrome_feature_list.h | 1 + + chrome/browser/ui/ui_features.cc | 1 + + chrome/common/chrome_features.cc | 1 + + .../content_settings/core/common/features.cc | 1 + + components/flags_ui/flags_state.cc | 21 +++ + components/flags_ui/resources/experiment.html | 7 +- + components/flags_ui/resources/experiment.ts | 16 ++ + components/flags_ui/resources/flags.css | 19 +++ + components/flags_ui/resources/flags.html | 13 ++ + components/flags_ui/resources/flags.ts | 36 ++++- + .../flags_ui/resources/flags_browser_proxy.ts | 5 + + .../core/offline_page_feature.cc | 1 + + .../offline_pages/core/offline_page_feature.h | 1 + + components/permissions/features.cc | 1 + + content/common/features.cc | 1 + + content/public/common/content_features.cc | 1 + + content/public/common/content_features.h | 1 + + cromite_flags/BUILD.gn | 150 ++++++++++++++++++ + .../browser/about_flags_cc/placeholder.txt | 1 + + .../browser_features_cc/placeholder.txt | 1 + + .../chrome_feature_list_cc/placeholder.txt | 1 + + .../chrome_feature_list_h/placeholder.txt | 1 + + .../browser/ui/ui_features_cc/placeholder.txt | 1 + + .../common/chrome_features_cc/placeholder.txt | 1 + + .../common/chrome_features_h/placeholder.txt | 1 + + .../core/common/features_cc/placeholder.txt | 1 + + .../offline_page_feature_cc/placeholder.txt | 1 + + .../offline_page_feature_h/placeholder.txt | 1 + + .../permissions/features_cc/placeholder.txt | 1 + + .../common/features_cc/placeholder.txt | 1 + + .../content_features_cc/placeholder.txt | 1 + + .../common/content_features_h/placeholder.txt | 1 + + .../base/media_switches_cc/placeholder.txt | 1 + + .../base/media_switches_h/placeholder.txt | 1 + + .../net/base/features_cc/placeholder.txt | 1 + + .../net/base/features_h/placeholder.txt | 1 + + .../public/cpp/features_cc/placeholder.txt | 1 + + .../public/cpp/features_h/placeholder.txt | 1 + + .../blink/common/features_cc/placeholder.txt | 1 + + .../blink/common/features_h/placeholder.txt | 1 + + media/base/media_switches.cc | 2 +- + media/base/media_switches.h | 2 +- + net/base/features.cc | 1 + + net/base/features.h | 1 + + services/network/public/cpp/features.cc | 1 + + services/network/public/cpp/features.h | 1 + + third_party/blink/common/features.cc | 1 + + third_party/blink/public/common/features.h | 1 + + 57 files changed, 474 insertions(+), 12 deletions(-) + create mode 100755 cromite_flags/BUILD.gn + create mode 100755 cromite_flags/chrome/browser/about_flags_cc/placeholder.txt + create mode 100755 cromite_flags/chrome/browser/browser_features_cc/placeholder.txt + create mode 100755 cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/placeholder.txt + create mode 100755 cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/placeholder.txt + create mode 100755 cromite_flags/chrome/browser/ui/ui_features_cc/placeholder.txt + create mode 100755 cromite_flags/chrome/common/chrome_features_cc/placeholder.txt + create mode 100755 cromite_flags/chrome/common/chrome_features_h/placeholder.txt + create mode 100755 cromite_flags/components/content_settings/core/common/features_cc/placeholder.txt + create mode 100755 cromite_flags/components/offline_pages/core/offline_page_feature_cc/placeholder.txt + create mode 100755 cromite_flags/components/offline_pages/core/offline_page_feature_h/placeholder.txt + create mode 100755 cromite_flags/components/permissions/features_cc/placeholder.txt + create mode 100755 cromite_flags/content/common/features_cc/placeholder.txt + create mode 100755 cromite_flags/content/public/common/content_features_cc/placeholder.txt + create mode 100755 cromite_flags/content/public/common/content_features_h/placeholder.txt + create mode 100755 cromite_flags/media/base/media_switches_cc/placeholder.txt + create mode 100755 cromite_flags/media/base/media_switches_h/placeholder.txt + create mode 100755 cromite_flags/net/base/features_cc/placeholder.txt + create mode 100755 cromite_flags/net/base/features_h/placeholder.txt + create mode 100755 cromite_flags/services/network/public/cpp/features_cc/placeholder.txt + create mode 100755 cromite_flags/services/network/public/cpp/features_h/placeholder.txt + create mode 100755 cromite_flags/third_party/blink/common/features_cc/placeholder.txt + create mode 100755 cromite_flags/third_party/blink/common/features_h/placeholder.txt + +diff --git a/base/BUILD.gn b/base/BUILD.gn +--- a/base/BUILD.gn ++++ b/base/BUILD.gn +@@ -206,6 +206,8 @@ buildflag_header("message_pump_buildflags") { + # This does not include test code (test support and anything in the test + # directory) which should use source_set as is recommended for GN targets). + component("base") { ++ deps = [ "//cromite_flags", ] ++ + sources = [ + "allocator/allocator_check.cc", + "allocator/allocator_check.h", +@@ -1034,7 +1036,7 @@ component("base") { + "//build/config/compiler:wglobal_constructors", + ] + +- deps = [ ++ deps += [ + ":message_pump_buildflags", + "//base/allocator:buildflags", + "//base/allocator/partition_allocator:raw_ptr", +diff --git a/base/feature_list.cc b/base/feature_list.cc +--- a/base/feature_list.cc ++++ b/base/feature_list.cc +@@ -29,6 +29,33 @@ + #include "base/strings/stringprintf.h" + #include "build/build_config.h" + ++namespace base { ++namespace internal { ++ ++using DefaultStateOverrides = ++ flat_map; ++ ++constexpr size_t kDefaultStateOverridesReserve = 64 * 4; ++ ++DefaultStateOverrides& GetListOfNewFeatureState() { ++ static NoDestructor ++ startup_default_state_overrides([] { ++ DefaultStateOverrides v; ++ v.reserve(kDefaultStateOverridesReserve); ++ return v; ++ }()); ++ return *startup_default_state_overrides; ++} ++ ++FeatureDefaultStateOverrider::FeatureDefaultStateOverrider( ++ const Feature& feature, FeatureState state) { ++ auto& default_state_overrides = GetListOfNewFeatureState(); ++ default_state_overrides.insert({&feature, state}); ++} ++ ++} // namespace internal ++} // namespace base ++ + namespace base { + + namespace { +@@ -436,6 +463,24 @@ bool FeatureList::IsEnabled(const Feature& feature) { + return g_feature_list_instance->IsFeatureEnabled(feature); + } + ++bool FeatureList::IsCromiteChanged(const Feature& feature) { ++ for(auto const& [key, value]: internal::GetListOfNewFeatureState()) { ++ if (key->name == feature.name) { ++ return true; ++ } ++ } ++ return false; ++} ++ ++bool FeatureList::GetCromiteChange(const Feature& feature) { ++ for(auto const& [key, value]: internal::GetListOfNewFeatureState()) { ++ if (key->name == feature.name) { ++ return value == base::FEATURE_ENABLED_BY_DEFAULT; ++ } ++ } ++ NOTREACHED(); ++ return false; ++} + // static + bool FeatureList::IsValidFeatureOrFieldTrialName(StringPiece name) { + return IsStringASCII(name) && name.find_first_of(",<*") == std::string::npos; +@@ -616,6 +661,17 @@ void FeatureList::SetCachingContextForTesting(uint16_t caching_context) { + + void FeatureList::FinalizeInitialization() { + DCHECK(!initialized_); ++ //LOG(INFO) << "---FinalizeInitialization"; ++ for(auto const& [key, value]: internal::GetListOfNewFeatureState()) { ++ // LOG(INFO) << "---key " << key->name ++ // << " " ++ // << (value == base::FEATURE_ENABLED_BY_DEFAULT ? "1" : "0"); ++ RegisterOverride(key->name, ++ value == base::FEATURE_ENABLED_BY_DEFAULT ++ ? OverrideState::OVERRIDE_ENABLE_FEATURE ++ : OverrideState::OVERRIDE_DISABLE_FEATURE, ++ /* field_trial = */ nullptr); ++ } + // Store the field trial list pointer for DCHECKing. + field_trial_list_ = FieldTrialList::GetInstance(); + initialized_ = true; +diff --git a/base/feature_list.h b/base/feature_list.h +--- a/base/feature_list.h ++++ b/base/feature_list.h +@@ -93,8 +93,10 @@ enum FeatureState { + // [1]: + // https://crsrc.org/c/docs/speed/binary_size/android_binary_size_trybot.md#Mutable-Constants + struct BASE_EXPORT LOGICALLY_CONST Feature { +- constexpr Feature(const char* name, FeatureState default_state) +- : name(name), default_state(default_state) { ++ constexpr Feature(const char* name, FeatureState default_state, ++ bool cromite = false, bool is_new_flag = false) ++ : name(name), default_state(default_state), ++ is_cromite(cromite), is_new(is_new_flag) { + #if BUILDFLAG(ENABLE_BANNED_BASE_FEATURE_PREFIX) + if (StringPiece(name).find(BUILDFLAG(BANNED_BASE_FEATURE_PREFIX)) == 0) { + LOG(FATAL) << "Invalid feature name " << name << " starts with " +@@ -120,6 +122,9 @@ struct BASE_EXPORT LOGICALLY_CONST Feature { + // command line switch. + const FeatureState default_state; + ++ const bool is_cromite = false; ++ const bool is_new = false; ++ + private: + friend class FeatureList; + +@@ -395,6 +400,9 @@ class BASE_EXPORT FeatureList { + // instance, which is checked in builds with DCHECKs enabled. + static bool IsEnabled(const Feature& feature); + ++ static bool IsCromiteChanged(const Feature& feature); ++ static bool GetCromiteChange(const Feature& feature); ++ + // Some characters are not allowed to appear in feature names or the + // associated field trial names, as they are used as special characters for + // command-line serialization. This function checks that the strings are ASCII +@@ -616,4 +624,76 @@ class BASE_EXPORT FeatureList { + + } // namespace base + ++namespace base { ++namespace internal { ++ ++// Perform base::Feature duplicates check and fills overriden states into a ++// map that is used at runtime to get an override if available. ++class BASE_EXPORT FeatureDefaultStateOverrider { ++ public: ++ using FeatureOverrideInfo = ++ std::pair, FeatureState>; ++ ++ FeatureDefaultStateOverrider( ++ const Feature& feature, FeatureState state); ++}; ++ ++} // namespace internal ++} // namespace base ++ ++#define CROMITE_FEATURE(feature, name, default_state) \ ++ CONSTINIT const base::Feature feature(name, default_state, true, true) ++ ++#define CROMITE_FEATURE_KEEP_DISABLED(feature, name, default_state) \ ++ CONSTINIT const base::Feature feature(name, base::FEATURE_DISABLED_BY_DEFAULT, true); \ ++ static_assert(default_state == base::FEATURE_DISABLED_BY_DEFAULT, \ ++ "Feature is not disabled by default.") ++ ++#define CROMITE_FEATURE_DISABLED(feature, name, default_state) \ ++ CONSTINIT const base::Feature feature(name, base::FEATURE_DISABLED_BY_DEFAULT, true); \ ++ static_assert(default_state == base::FEATURE_ENABLED_BY_DEFAULT, \ ++ "Feature is not enabled by default.") ++ ++#define CROMITE_FEATURE_KEEP_ENABLED(feature, name, default_state) \ ++ CONSTINIT const base::Feature feature(name, base::FEATURE_ENABLED_BY_DEFAULT, true); \ ++ static_assert(default_state == base::FEATURE_ENABLED_BY_DEFAULT, \ ++ "Feature is not enabled by default.") ++ ++#define CROMITE_FEATURE_ENABLED(feature, name, default_state) \ ++ CONSTINIT const base::Feature feature(name, base::FEATURE_ENABLED_BY_DEFAULT, true); \ ++ static_assert(default_state == base::FEATURE_DISABLED_BY_DEFAULT, \ ++ "Feature is not disabled by default.") ++ ++#define SET_CROMITE_FEATURE_ENABLED(feature) \ ++ _Pragma("clang diagnostic push") \ ++ _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") \ ++ static const ::base::internal::FeatureDefaultStateOverrider \ ++ g_feature_default_state_overrider_ ##feature {feature, base::FEATURE_ENABLED_BY_DEFAULT}; \ ++ _Pragma("clang diagnostic pop") \ ++ static_assert(true, "") /* for a semicolon requirement */ ++ ++#define SET_CROMITE_FEATURE_DISABLED(feature) \ ++ _Pragma("clang diagnostic push") \ ++ _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") \ ++ static const ::base::internal::FeatureDefaultStateOverrider \ ++ g_feature_default_state_overrider_ ##feature {feature, base::FEATURE_DISABLED_BY_DEFAULT}; \ ++ _Pragma("clang diagnostic pop") \ ++ static_assert(true, "") /* for a semicolon requirement */ ++ ++#define SET_CROMITE_FEATURE_ENABLED_W_NAMESPACE(namespace_value, feature) \ ++ _Pragma("clang diagnostic push") \ ++ _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") \ ++ static const ::base::internal::FeatureDefaultStateOverrider \ ++ g_feature_default_state_overrider_ ##feature {namespace_value::feature, base::FEATURE_ENABLED_BY_DEFAULT}; \ ++ _Pragma("clang diagnostic pop") \ ++ static_assert(true, "") /* for a semicolon requirement */ ++ ++#define SET_CROMITE_FEATURE_DISABLED_W_NAMESPACE(namespace_value, feature) \ ++ _Pragma("clang diagnostic push") \ ++ _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") \ ++ static const ::base::internal::FeatureDefaultStateOverrider \ ++ g_feature_default_state_overrider_ ##feature {namespace_value::feature, base::FEATURE_DISABLED_BY_DEFAULT}; \ ++ _Pragma("clang diagnostic pop") \ ++ static_assert(true, "") /* for a semicolon requirement */ ++ + #endif // BASE_FEATURE_LIST_H_ +diff --git a/build/android/gyp/java_cpp_features.py b/build/android/gyp/java_cpp_features.py +--- a/build/android/gyp/java_cpp_features.py ++++ b/build/android/gyp/java_cpp_features.py +@@ -22,10 +22,27 @@ class FeatureParserDelegate(java_cpp_utils.CppConstantParser.Delegate): + # ExtractConstantName() -> 'ConstantName' + # ExtractValue() -> '"StringNameOfTheFeature"' + FEATURE_RE = re.compile(r'BASE_FEATURE\(k([^,]+),') ++ ++ FEATURE_RE1 = re.compile(r'CROMITE_FEATURE\(k([^,]+),') ++ FEATURE_RE2 = re.compile(r'CROMITE_FEATURE_KEEP_DISABLED\(k([^,]+),') ++ FEATURE_RE3 = re.compile(r'CROMITE_FEATURE_DISABLED\(k([^,]+),') ++ FEATURE_RE4 = re.compile(r'CROMITE_FEATURE_KEEP_ENABLED\(k([^,]+),') ++ FEATURE_RE5 = re.compile(r'CROMITE_FEATURE_ENABLED\(k([^,]+),') ++ + VALUE_RE = re.compile(r'\s*("(?:\"|[^"])*")\s*,') + + def ExtractConstantName(self, line): + match = FeatureParserDelegate.FEATURE_RE.match(line) ++ if match is None: ++ match = FeatureParserDelegate.FEATURE_RE1.match(line) ++ if match is None: ++ match = FeatureParserDelegate.FEATURE_RE2.match(line) ++ if match is None: ++ match = FeatureParserDelegate.FEATURE_RE3.match(line) ++ if match is None: ++ match = FeatureParserDelegate.FEATURE_RE4.match(line) ++ if match is None: ++ match = FeatureParserDelegate.FEATURE_RE5.match(line) + return match.group(1) if match else None + + def ExtractValue(self, line): +diff --git a/chrome/android/java/res/values/values.xml b/chrome/android/java/res/values/values.xml +--- a/chrome/android/java/res/values/values.xml ++++ b/chrome/android/java/res/values/values.xml +@@ -42,6 +42,9 @@ found in the LICENSE file. + + 0.95 + ++ Open Cromite flags list ++ chrome://flags/cromite ++ + + 0.5 + 0 +diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml +--- a/chrome/android/java/res/xml/privacy_preferences.xml ++++ b/chrome/android/java/res/xml/privacy_preferences.xml +@@ -99,6 +99,10 @@ found in the LICENSE file. + android:title="@string/tabgrid_use_icons_title" + android:summary="@string/tabgrid_use_icons_summary" + android:defaultValue="false" /> ++ + kAuxiliarySearchMaxTabsCountParam( + "auxiliary_search_max_donation_tab", + 100); + ++#include "cromite_flags/chrome_browser_flags_android_chrome_feature_list_h.inc" + } // namespace android + } // namespace chrome + +diff --git a/chrome/browser/ui/ui_features.cc b/chrome/browser/ui/ui_features.cc +--- a/chrome/browser/ui/ui_features.cc ++++ b/chrome/browser/ui/ui_features.cc +@@ -394,4 +394,5 @@ BASE_FEATURE(kStopLoadingAnimationForHiddenWindow, + "StopLoadingAnimationForHiddenWindow", + base::FEATURE_ENABLED_BY_DEFAULT); + ++#include "cromite_flags/chrome_browser_ui_ui_features_cc.inc" + } // namespace features +diff --git a/chrome/common/chrome_features.cc b/chrome/common/chrome_features.cc +--- a/chrome/common/chrome_features.cc ++++ b/chrome/common/chrome_features.cc +@@ -1664,4 +1664,5 @@ BASE_FEATURE(kSupportsRtcWakeOver24Hours, + base::FEATURE_ENABLED_BY_DEFAULT); + #endif // BUILDFLAG(IS_CHROMEOS_ASH) + ++#include "cromite_flags/chrome_common_chrome_features_cc.inc" + } // namespace features +diff --git a/components/content_settings/core/common/features.cc b/components/content_settings/core/common/features.cc +--- a/components/content_settings/core/common/features.cc ++++ b/components/content_settings/core/common/features.cc +@@ -82,5 +82,6 @@ BASE_FEATURE(kTrackingProtection3pcd, + "TrackingProtection3pcd", + base::FEATURE_DISABLED_BY_DEFAULT); + ++#include "cromite_flags/components_content_settings_core_common_features_cc.inc" + } // namespace features + } // namespace content_settings +diff --git a/components/flags_ui/flags_state.cc b/components/flags_ui/flags_state.cc +--- a/components/flags_ui/flags_state.cc ++++ b/components/flags_ui/flags_state.cc +@@ -668,6 +668,27 @@ void FlagsState::GetFlagFeatureEntries( + bool is_default_value = IsDefaultValue(entry, enabled_entries); + data.Set("is_default", is_default_value); + ++ if (entry.type == FeatureEntry::FEATURE_VALUE ++ || entry.type == FeatureEntry::FEATURE_WITH_PARAMS_VALUE) { ++ DCHECK(entry.feature.feature); ++ if (base::FeatureList::IsCromiteChanged(*entry.feature.feature)) { ++ bool is_enabled = base::FeatureList::GetCromiteChange(*entry.feature.feature); ++ data.Set("is_cromite", true); ++ data.Set("default_value", ++ is_enabled ? "enabled" : "disabled"); ++ } else { ++ bool is_enabled = entry.feature.feature->default_state == base::FEATURE_ENABLED_BY_DEFAULT; ++ data.Set("default_value", is_enabled ++ ? "enabled" : "disabled"); ++ if (is_enabled) ++ data.Set("is_default_value_on", true); ++ } ++ if (entry.feature.feature->is_cromite) ++ data.Set("is_cromite", true); ++ if (entry.feature.feature->is_new) ++ data.Set("is_new", true); ++ } ++ + switch (entry.type) { + case FeatureEntry::SINGLE_VALUE: + case FeatureEntry::SINGLE_DISABLE_VALUE: +diff --git a/components/flags_ui/resources/experiment.html b/components/flags_ui/resources/experiment.html +--- a/components/flags_ui/resources/experiment.html ++++ b/components/flags_ui/resources/experiment.html +@@ -119,6 +119,11 @@ + color: white; + } + ++ .experiment-on select { ++ background: #dddddd; ++ color: var(--link-color); ++ } ++ + .experiment-switched option { + background: white; + color: var(--link-color); +@@ -164,7 +169,6 @@ + .experiment .experiment-actions { + max-width: 100%; + padding-top: 12px; +- text-align: left; /* csschecker-disable-line left-right */ + width: 100%; + } + +@@ -172,7 +176,6 @@ + .body { + overflow: hidden; + text-overflow: ellipsis; +- white-space: nowrap; + width: 100%; + } + +diff --git a/components/flags_ui/resources/experiment.ts b/components/flags_ui/resources/experiment.ts +--- a/components/flags_ui/resources/experiment.ts ++++ b/components/flags_ui/resources/experiment.ts +@@ -60,11 +60,16 @@ function resetHighlights(element: HTMLElement) { + + export class FlagsExperimentElement extends CustomElement { + private feature_: Feature|null = null; ++ private permalink_: boolean = true; + + static override get template() { + return getTemplate(); + } + ++ set permalink(visible: boolean) { ++ this.permalink_ = visible; ++ } ++ + set data(feature: Feature) { + this.feature_ = feature; + +@@ -76,12 +81,18 @@ export class FlagsExperimentElement extends CustomElement { + 'experiment-default', feature.is_default); + experimentDefault.classList.toggle( + 'experiment-switched', !feature.is_default); ++ experimentDefault.classList.toggle( ++ 'cromite', feature.is_cromite && feature.is_new); ++ experimentDefault.classList.toggle( ++ 'experiment-on', !!feature.is_default_value_on); + + const experimentName = this.getRequiredElement('.experiment-name'); + experimentName.id = `${feature.internal_name}_name`; + experimentName.title = + feature.is_default ? '' : loadTimeData.getString('experiment-enabled'); + experimentName.textContent = feature.name; ++ if (feature.is_cromite && feature.is_new) ++ experimentName.textContent += " (Cromite flag)" + + const description = this.getRequiredElement('.description'); + description.textContent = feature.description; +@@ -124,6 +135,7 @@ export class FlagsExperimentElement extends CustomElement { + const permalink = this.getRequiredElement('.permalink'); + permalink.href = `#${feature.internal_name}`; + permalink.textContent = `#${feature.internal_name}`; ++ if (!this.permalink_) permalink.hidden = true; + + const smallScreenCheck = window.matchMedia('(max-width: 480px)'); + // Toggling of experiment description overflow content on smaller screens. +@@ -152,6 +164,10 @@ export class FlagsExperimentElement extends CustomElement { + const optionEl = document.createElement('option'); + optionEl.selected = option.selected; + optionEl.textContent = option.description; ++ if (option.description == "Default" && ++ feature.default_value !== undefined) { ++ optionEl.textContent += " (" + feature.default_value + ")"; ++ } + experimentSelect.appendChild(optionEl); + } + +diff --git a/components/flags_ui/resources/flags.css b/components/flags_ui/resources/flags.css +--- a/components/flags_ui/resources/flags.css ++++ b/components/flags_ui/resources/flags.css +@@ -468,3 +468,22 @@ button.primary:-webkit-any(:active, :hover) { + padding-top: 1.5rem; + } + } ++ ++.cromite #header { ++ display: none; ++} ++.cromite .blurb-container { ++ display: none; ++} ++.cromite #tabs { ++ display: none; ++} ++.cromite #tab-content-available { ++ display: none; ++} ++.cromite #tab-content-unavailable { ++ display: none; ++} ++.cromite #tab-content-cromite { ++ display: block !important; ++} +diff --git a/components/flags_ui/resources/flags.html b/components/flags_ui/resources/flags.html +--- a/components/flags_ui/resources/flags.html ++++ b/components/flags_ui/resources/flags.html +@@ -92,6 +92,11 @@ + aria-selected="false" aria-controls="panel2" + tabindex="-1">$i18n{unavailable} + ++ Cromite + +
+
+
+ ++
++ ++
++ ++
++ ++
+
+
+
+diff --git a/components/flags_ui/resources/flags.ts b/components/flags_ui/resources/flags.ts +--- a/components/flags_ui/resources/flags.ts ++++ b/components/flags_ui/resources/flags.ts +@@ -39,6 +39,10 @@ interface Tab { + } + + const tabs: Tab[] = [ ++ { ++ tabEl: document.body.querySelector('#tab-cromite')!, ++ panelEl: document.body.querySelector('#tab-content-cromite')!, ++ }, + { + tabEl: document.body.querySelector('#tab-available')!, + panelEl: document.body.querySelector('#tab-content-available')!, +@@ -84,18 +88,27 @@ function render(experimentalFeaturesData: ExperimentalFeaturesData) { + const defaultFeatures: Feature[] = []; + const nonDefaultFeatures: Feature[] = []; + ++ if (document.body.classList.contains("cromite")) { ++ experimentalFeaturesData.supportedFeatures = ++ experimentalFeaturesData.supportedFeatures.filter(item => item.is_new); ++ } ++ experimentalFeaturesData.supportedFeatures.sort( ++ (a,b) => (a.internal_name.localeCompare(b.internal_name))); + experimentalFeaturesData.supportedFeatures.forEach( + f => (f.is_default ? defaultFeatures : nonDefaultFeatures).push(f)); + + renderExperiments( +- nonDefaultFeatures, getRequiredElement('non-default-experiments')); ++ nonDefaultFeatures, getRequiredElement('non-default-experiments'), ++ getRequiredElement('non-default-cromite-experiments'), false); + +- renderExperiments(defaultFeatures, getRequiredElement('default-experiments')); ++ renderExperiments(defaultFeatures, getRequiredElement('default-experiments'), ++ getRequiredElement('cromite-experiments'), false); + + // + renderExperiments( + experimentalFeaturesData.unsupportedFeatures, +- getRequiredElement('unavailable-experiments'), true); ++ getRequiredElement('unavailable-experiments'), ++ undefined, true); + // + + showRestartToast(experimentalFeaturesData.needsRestart); +@@ -248,16 +261,22 @@ function resetAllFlags() { + } + + function renderExperiments( +- features: Feature[], container: HTMLElement, unsupported = false) { ++ features: Feature[], container: HTMLElement, cromiteContainer: HTMLElement | undefined, unsupported: boolean) { + const fragment = document.createDocumentFragment(); ++ const fragmentCromite = document.createDocumentFragment(); ++ const show_permalink = !document.body.classList.contains('cromite'); + for (const feature of features) { + const experiment = document.createElement('flags-experiment'); + + experiment.toggleAttribute('unsupported', unsupported); ++ experiment.permalink = show_permalink; + experiment.data = feature; + experiment.id = feature.internal_name; + + const select = experiment.getSelect(); ++ // if (select && feature.is_cromite && !feature.is_new) { ++ // select.disabled = true; ++ // } + if (select) { + experiment.addEventListener('select-change', () => { + showRestartToast(true); +@@ -281,9 +300,14 @@ function renderExperiments( + return false; + }); + } +- fragment.appendChild(experiment); ++ if (feature.is_cromite) ++ fragmentCromite.appendChild(experiment); ++ else ++ fragment.appendChild(experiment); + } + container.replaceChildren(fragment); ++ if (!!cromiteContainer) ++ cromiteContainer.replaceChildren(fragmentCromite); + } + + /** +@@ -507,6 +531,8 @@ function setupRestartButton() { + // + + document.addEventListener('DOMContentLoaded', function() { ++ if (location.pathname == '/cromite') ++ document.body.classList.add('cromite'); + // Get and display the data upon loading. + requestExperimentalFeaturesData(); + // There is no restart button on iOS. +diff --git a/components/flags_ui/resources/flags_browser_proxy.ts b/components/flags_ui/resources/flags_browser_proxy.ts +--- a/components/flags_ui/resources/flags_browser_proxy.ts ++++ b/components/flags_ui/resources/flags_browser_proxy.ts +@@ -16,6 +16,11 @@ export interface Feature { + description: string; + enabled: boolean; + is_default: boolean; ++ is_default_value_on: boolean; ++ default_value: string; ++ is_cromite: boolean; ++ is_new: boolean; ++ permalink: boolean; + supported_platforms: string[]; + origin_list_value?: string; + string_value?: string; +diff --git a/components/offline_pages/core/offline_page_feature.cc b/components/offline_pages/core/offline_page_feature.cc +--- a/components/offline_pages/core/offline_page_feature.cc ++++ b/components/offline_pages/core/offline_page_feature.cc +@@ -82,4 +82,5 @@ bool IsOfflinePagesNetworkStateLikelyUnknown() { + return base::FeatureList::IsEnabled(kOfflinePagesNetworkStateLikelyUnknown); + } + ++#include "cromite_flags/components_offline_pages_core_offline_page_feature_cc.inc" + } // namespace offline_pages +diff --git a/components/offline_pages/core/offline_page_feature.h b/components/offline_pages/core/offline_page_feature.h +--- a/components/offline_pages/core/offline_page_feature.h ++++ b/components/offline_pages/core/offline_page_feature.h +@@ -64,6 +64,7 @@ bool IsOnTheFlyMhtmlHashComputationEnabled(); + // offline pages to avoid showing them even when the device is online. + bool IsOfflinePagesNetworkStateLikelyUnknown(); + ++#include "cromite_flags/components_offline_pages_core_offline_page_feature_h.inc" + } // namespace offline_pages + + #endif // COMPONENTS_OFFLINE_PAGES_CORE_OFFLINE_PAGE_FEATURE_H_ +diff --git a/components/permissions/features.cc b/components/permissions/features.cc +--- a/components/permissions/features.cc ++++ b/components/permissions/features.cc +@@ -171,6 +171,7 @@ BASE_FEATURE(kBlockMidiByDefault, + "BlockMidiByDefault", + base::FEATURE_ENABLED_BY_DEFAULT); + ++#include "cromite_flags/components_permissions_features_cc.inc" + } // namespace features + namespace feature_params { + +diff --git a/content/common/features.cc b/content/common/features.cc +--- a/content/common/features.cc ++++ b/content/common/features.cc +@@ -529,4 +529,5 @@ BASE_FEATURE(kWindowOpenFileSelectFix, + + // Please keep features in alphabetical order. + ++#include "cromite_flags/content_common_features_cc.inc" + } // namespace features +diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc +--- a/content/public/common/content_features.cc ++++ b/content/public/common/content_features.cc +@@ -1321,4 +1321,5 @@ bool IsVideoCaptureServiceEnabledForBrowserProcess() { + VideoCaptureServiceConfiguration::kEnabledForBrowserProcess; + } + ++#include "cromite_flags/content_public_common_content_features_cc.inc" + } // namespace features +diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h +--- a/content/public/common/content_features.h ++++ b/content/public/common/content_features.h +@@ -327,6 +327,7 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kWebRtcPipeWireCapturer); + CONTENT_EXPORT bool IsVideoCaptureServiceEnabledForOutOfProcess(); + CONTENT_EXPORT bool IsVideoCaptureServiceEnabledForBrowserProcess(); + ++#include "cromite_flags/content_public_common_content_features_h.inc" + } // namespace features + + #endif // CONTENT_PUBLIC_COMMON_CONTENT_FEATURES_H_ +diff --git a/cromite_flags/BUILD.gn b/cromite_flags/BUILD.gn +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/BUILD.gn +@@ -0,0 +1,150 @@ ++# This file is part of Bromite. ++ ++# Bromite is free software: you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation, either version 3 of the License, or ++# (at your option) any later version. ++ ++# Bromite is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with Bromite. If not, see . ++ ++# for placeholder.txt: ++# ++# this file is intentionally empty ++# ++ ++cpp_bromite_include("chrome_browser_about_flags_cc") { ++ inputs = [ "//cromite_flags/chrome/browser/about_flags_cc/placeholder.txt" ] ++ output_file = "chrome_browser_about_flags_cc.inc" ++} ++ ++cpp_bromite_include("chrome_common_chrome_features_cc") { ++ inputs = [ "//cromite_flags/chrome/common/chrome_features_cc/placeholder.txt" ] ++ output_file = "chrome_common_chrome_features_cc.inc" ++} ++ ++cpp_bromite_include("content_common_features_cc") { ++ inputs = [ "//cromite_flags/content/common/features_cc/placeholder.txt" ] ++ output_file = "content_common_features_cc.inc" ++} ++ ++cpp_bromite_include("content_public_common_content_features_h") { ++ inputs = [ "//cromite_flags/content/public/common/content_features_h/placeholder.txt" ] ++ output_file = "content_public_common_content_features_h.inc" ++} ++ ++cpp_bromite_include("content_public_common_content_features_cc") { ++ inputs = [ "//cromite_flags/content/public/common/content_features_cc/placeholder.txt" ] ++ output_file = "content_public_common_content_features_cc.inc" ++} ++ ++cpp_bromite_include("third_party_blink_common_features_cc") { ++ inputs = [ "//cromite_flags/third_party/blink/common/features_cc/placeholder.txt" ] ++ output_file = "third_party_blink_common_features_cc.inc" ++} ++ ++cpp_bromite_include("third_party_blink_common_features_h") { ++ inputs = [ "//cromite_flags/third_party/blink/common/features_h/placeholder.txt" ] ++ output_file = "third_party_blink_common_features_h.inc" ++} ++ ++cpp_bromite_include("chrome_browser_flags_android_chrome_feature_list_cc") { ++ inputs = [ "//cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/placeholder.txt" ] ++ output_file = "chrome_browser_flags_android_chrome_feature_list_cc.inc" ++} ++ ++cpp_bromite_include("chrome_browser_flags_android_chrome_feature_list_h") { ++ inputs = [ "//cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/placeholder.txt" ] ++ output_file = "chrome_browser_flags_android_chrome_feature_list_h.inc" ++} ++ ++cpp_bromite_include("chrome_browser_browser_features_cc") { ++ inputs = [ "//cromite_flags/chrome/browser/browser_features_cc/placeholder.txt" ] ++ output_file = "chrome_browser_browser_features_cc.inc" ++} ++ ++cpp_bromite_include("chrome_browser_ui_ui_features_cc") { ++ inputs = [ "//cromite_flags/chrome/browser/ui/ui_features_cc/placeholder.txt" ] ++ output_file = "chrome_browser_ui_ui_features_cc.inc" ++} ++ ++cpp_bromite_include("media_base_media_switches_cc") { ++ inputs = [ "//cromite_flags/media/base/media_switches_cc/placeholder.txt" ] ++ output_file = "media_base_media_switches_cc.inc" ++} ++ ++cpp_bromite_include("media_base_media_switches_h") { ++ inputs = [ "//cromite_flags/media/base/media_switches_h/placeholder.txt" ] ++ output_file = "media_base_media_switches_h.inc" ++} ++ ++cpp_bromite_include("components_content_settings_core_common_features_cc") { ++ inputs = [ "//cromite_flags/components/content_settings/core/common/features_cc/placeholder.txt" ] ++ output_file = "components_content_settings_core_common_features_cc.inc" ++} ++ ++cpp_bromite_include("components_permissions_features_cc") { ++ inputs = [ "//cromite_flags/components/permissions/features_cc/placeholder.txt" ] ++ output_file = "components_permissions_features_cc.inc" ++} ++ ++cpp_bromite_include("components_offline_pages_core_offline_page_feature_cc") { ++ inputs = [ "//cromite_flags/components/offline_pages/core/offline_page_feature_cc/placeholder.txt" ] ++ output_file = "components_offline_pages_core_offline_page_feature_cc.inc" ++} ++ ++cpp_bromite_include("components_offline_pages_core_offline_page_feature_h") { ++ inputs = [ "//cromite_flags/components/offline_pages/core/offline_page_feature_h/placeholder.txt" ] ++ output_file = "components_offline_pages_core_offline_page_feature_h.inc" ++} ++ ++cpp_bromite_include("net_base_features_cc") { ++ inputs = [ "//cromite_flags/net/base/features_cc/placeholder.txt" ] ++ output_file = "net_base_features_cc.inc" ++} ++ ++cpp_bromite_include("net_base_features_h") { ++ inputs = [ "//cromite_flags/net/base/features_h/placeholder.txt" ] ++ output_file = "net_base_features_h.inc" ++} ++ ++cpp_bromite_include("services_network_public_cpp_features_cc") { ++ inputs = [ "//cromite_flags/services/network/public/cpp/features_cc/placeholder.txt" ] ++ output_file = "services_network_public_cpp_features_cc.inc" ++} ++ ++cpp_bromite_include("services_network_public_cpp_features_h") { ++ inputs = [ "//cromite_flags/services/network/public/cpp/features_h/placeholder.txt" ] ++ output_file = "services_network_public_cpp_features_h.inc" ++} ++ ++component("cromite_flags") { ++ deps = [ ++ ":content_common_features_cc", ++ ":content_public_common_content_features_cc", ++ ":content_public_common_content_features_h", ++ ":components_content_settings_core_common_features_cc", ++ ":components_permissions_features_cc", ++ ":components_offline_pages_core_offline_page_feature_cc", ++ ":components_offline_pages_core_offline_page_feature_h", ++ ":media_base_media_switches_cc", ++ ":media_base_media_switches_h", ++ ":net_base_features_cc", ++ ":net_base_features_h", ++ ":chrome_common_chrome_features_cc", ++ ":chrome_browser_about_flags_cc", ++ ":chrome_browser_flags_android_chrome_feature_list_cc", ++ ":chrome_browser_flags_android_chrome_feature_list_h", ++ ":chrome_browser_ui_ui_features_cc", ++ ":chrome_browser_browser_features_cc", ++ ":services_network_public_cpp_features_cc", ++ ":services_network_public_cpp_features_h", ++ ":third_party_blink_common_features_cc", ++ ":third_party_blink_common_features_h", ++ ] ++} +diff --git a/cromite_flags/chrome/browser/about_flags_cc/placeholder.txt b/cromite_flags/chrome/browser/about_flags_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/chrome/browser/browser_features_cc/placeholder.txt b/cromite_flags/chrome/browser/browser_features_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/chrome/browser/browser_features_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/placeholder.txt b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/placeholder.txt b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/chrome/browser/ui/ui_features_cc/placeholder.txt b/cromite_flags/chrome/browser/ui/ui_features_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/chrome/browser/ui/ui_features_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/chrome/common/chrome_features_cc/placeholder.txt b/cromite_flags/chrome/common/chrome_features_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/chrome/common/chrome_features_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/chrome/common/chrome_features_h/placeholder.txt b/cromite_flags/chrome/common/chrome_features_h/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/chrome/common/chrome_features_h/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/components/content_settings/core/common/features_cc/placeholder.txt b/cromite_flags/components/content_settings/core/common/features_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/components/content_settings/core/common/features_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/components/offline_pages/core/offline_page_feature_cc/placeholder.txt b/cromite_flags/components/offline_pages/core/offline_page_feature_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/components/offline_pages/core/offline_page_feature_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/components/offline_pages/core/offline_page_feature_h/placeholder.txt b/cromite_flags/components/offline_pages/core/offline_page_feature_h/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/components/offline_pages/core/offline_page_feature_h/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/components/permissions/features_cc/placeholder.txt b/cromite_flags/components/permissions/features_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/components/permissions/features_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/content/common/features_cc/placeholder.txt b/cromite_flags/content/common/features_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/content/common/features_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/content/public/common/content_features_cc/placeholder.txt b/cromite_flags/content/public/common/content_features_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/content/public/common/content_features_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/content/public/common/content_features_h/placeholder.txt b/cromite_flags/content/public/common/content_features_h/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/content/public/common/content_features_h/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/media/base/media_switches_cc/placeholder.txt b/cromite_flags/media/base/media_switches_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/media/base/media_switches_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/media/base/media_switches_h/placeholder.txt b/cromite_flags/media/base/media_switches_h/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/media/base/media_switches_h/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/net/base/features_cc/placeholder.txt b/cromite_flags/net/base/features_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/net/base/features_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/net/base/features_h/placeholder.txt b/cromite_flags/net/base/features_h/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/net/base/features_h/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/services/network/public/cpp/features_cc/placeholder.txt b/cromite_flags/services/network/public/cpp/features_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/services/network/public/cpp/features_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/services/network/public/cpp/features_h/placeholder.txt b/cromite_flags/services/network/public/cpp/features_h/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/services/network/public/cpp/features_h/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/third_party/blink/common/features_cc/placeholder.txt b/cromite_flags/third_party/blink/common/features_cc/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/third_party/blink/common/features_cc/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/cromite_flags/third_party/blink/common/features_h/placeholder.txt b/cromite_flags/third_party/blink/common/features_h/placeholder.txt +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/third_party/blink/common/features_h/placeholder.txt +@@ -0,0 +1 @@ ++this file is intentionally empty +diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc +--- a/media/base/media_switches.cc ++++ b/media/base/media_switches.cc +@@ -1743,5 +1743,5 @@ uint32_t GetPassthroughAudioFormats() { + return 0; + #endif // BUILDFLAG(ENABLE_PASSTHROUGH_AUDIO_CODECS) + } +- ++#include "cromite_flags/media_base_media_switches_cc.inc" + } // namespace media +diff --git a/media/base/media_switches.h b/media/base/media_switches.h +--- a/media/base/media_switches.h ++++ b/media/base/media_switches.h +@@ -505,5 +505,5 @@ MEDIA_EXPORT bool IsOutOfProcessVideoDecodingEnabled(); + MEDIA_EXPORT uint32_t GetPassthroughAudioFormats(); + + } // namespace media +- ++#include "cromite_flags/media_base_media_switches_h.inc" + #endif // MEDIA_BASE_MEDIA_SWITCHES_H_ +diff --git a/net/base/features.cc b/net/base/features.cc +--- a/net/base/features.cc ++++ b/net/base/features.cc +@@ -469,4 +469,5 @@ BASE_FEATURE(kSpdyHeadersToHttpResponseVerifyCorrectness, + "SpdyHeadersToHttpResponseVerifyCorrectness", + base::FEATURE_DISABLED_BY_DEFAULT); + ++#include "cromite_flags/net_base_features_cc.inc" + } // namespace net::features +diff --git a/net/base/features.h b/net/base/features.h +--- a/net/base/features.h ++++ b/net/base/features.h +@@ -467,6 +467,7 @@ NET_EXPORT BASE_DECLARE_FEATURE(kSpdyHeadersToHttpResponseUseBuilder); + // for two weeks on Dev. + NET_EXPORT BASE_DECLARE_FEATURE(kSpdyHeadersToHttpResponseVerifyCorrectness); + ++#include "cromite_flags/net_base_features_h.inc" + } // namespace net::features + + #endif // NET_BASE_FEATURES_H_ +diff --git a/services/network/public/cpp/features.cc b/services/network/public/cpp/features.cc +--- a/services/network/public/cpp/features.cc ++++ b/services/network/public/cpp/features.cc +@@ -422,4 +422,5 @@ BASE_FEATURE(kVisibilityAwareResourceScheduler, + + BASE_FEATURE(kSharedZstd, "SharedZstd", base::FEATURE_ENABLED_BY_DEFAULT); + ++#include "cromite_flags/services_network_public_cpp_features_cc.inc" + } // namespace network::features +diff --git a/services/network/public/cpp/features.h b/services/network/public/cpp/features.h +--- a/services/network/public/cpp/features.h ++++ b/services/network/public/cpp/features.h +@@ -158,6 +158,7 @@ BASE_DECLARE_FEATURE(kVisibilityAwareResourceScheduler); + COMPONENT_EXPORT(NETWORK_CPP) + BASE_DECLARE_FEATURE(kSharedZstd); + ++#include "cromite_flags/services_network_public_cpp_features_h.inc" + } // namespace features + } // namespace network + +diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc +--- a/third_party/blink/common/features.cc ++++ b/third_party/blink/common/features.cc +@@ -2168,5 +2168,6 @@ bool IsKeepAliveURLLoaderServiceEnabled() { + base::FeatureList::IsEnabled(kFetchLaterAPI); + } + ++#include "cromite_flags/third_party_blink_common_features_cc.inc" + } // namespace features + } // namespace blink +diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h +--- a/third_party/blink/public/common/features.h ++++ b/third_party/blink/public/common/features.h +@@ -1388,6 +1388,7 @@ BLINK_COMMON_EXPORT bool IsKeepAliveURLLoaderServiceEnabled(); + BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE( + kRemoveAuthroizationOnCrossOriginRedirect); + ++#include "cromite_flags/third_party_blink_common_features_h.inc" + } // namespace features + } // namespace blink + +-- +2.25.1 diff --git a/build/bromite_patches/00Disable-Feeback-Collector.patch b/build/bromite_patches/00Disable-Feeback-Collector.patch new file mode 100644 index 0000000000000000000000000000000000000000..e3198574bf138637c953301bc9d3edf960c4b933 --- /dev/null +++ b/build/bromite_patches/00Disable-Feeback-Collector.patch @@ -0,0 +1,55 @@ +From: uazo +Date: Sat, 22 Jul 2023 13:58:40 +0000 +Subject: Disable Feeback Collector + +License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html +--- + .../browser/feedback/FeedbackCollector.java | 27 +++---------------- + 1 file changed, 3 insertions(+), 24 deletions(-) + +diff --git a/chrome/browser/feedback/android/java/src/org/chromium/chrome/browser/feedback/FeedbackCollector.java b/chrome/browser/feedback/android/java/src/org/chromium/chrome/browser/feedback/FeedbackCollector.java +--- a/chrome/browser/feedback/android/java/src/org/chromium/chrome/browser/feedback/FeedbackCollector.java ++++ b/chrome/browser/feedback/android/java/src/org/chromium/chrome/browser/feedback/FeedbackCollector.java +@@ -28,6 +28,7 @@ import org.chromium.components.signin.identitymanager.ConsentLevel; + import org.chromium.components.signin.identitymanager.IdentityManager; + + import java.util.HashMap; ++import java.util.ArrayList; + import java.util.List; + import java.util.Map; + +@@ -64,30 +65,8 @@ public abstract class FeedbackCollector implements Runnable { + // Subclasses must invoke init() at construction time. + protected void init(Activity activity, @Nullable ScreenshotSource screenshotTask, T initParams, + Profile profile) { +- // 1. Build all synchronous and asynchronous sources and determine the currently signed in +- // account. +- mSynchronousSources = buildSynchronousFeedbackSources(activity, initParams); +- mAsynchronousSources = buildAsynchronousFeedbackSources(initParams); +- IdentityManager identityManager = +- IdentityServicesProvider.get().getIdentityManager(profile); +- if (identityManager != null) { +- mAccountInUse = CoreAccountInfo.getEmailFrom( +- identityManager.getPrimaryAccountInfo(ConsentLevel.SIGNIN)); +- } +- +- // Validation check in case a source is added to the wrong list. +- for (FeedbackSource source : mSynchronousSources) { +- assert !(source instanceof AsyncFeedbackSource); +- } +- +- // 2. Set |mScreenshotTask| if not null. +- if (screenshotTask != null) mScreenshotTask = screenshotTask; +- +- // 3. Start all asynchronous sources and the screenshot task. +- for (var source : mAsynchronousSources) { +- source.start(this); +- } +- if (mScreenshotTask != null) mScreenshotTask.capture(this); ++ mSynchronousSources = new ArrayList<>(); ++ mAsynchronousSources = new ArrayList<>(); + + // 4. Kick off a task to timeout the async sources. + ThreadUtils.postOnUiThreadDelayed(this, TIMEOUT_MS); +-- +2.25.1 diff --git a/build/bromite_patches/Enable-ImprovedBookmarks-by-default.patch b/build/bromite_patches/00Enable-ImprovedBookmarks-by-default.patch similarity index 67% rename from build/bromite_patches/Enable-ImprovedBookmarks-by-default.patch rename to build/bromite_patches/00Enable-ImprovedBookmarks-by-default.patch index 3e068a909e407feeb4f448dc75896a604e99b68a..c9fadacf503064f52bfdbbad5bead11f5a147011 100644 --- a/build/bromite_patches/Enable-ImprovedBookmarks-by-default.patch +++ b/build/bromite_patches/00Enable-ImprovedBookmarks-by-default.patch @@ -4,36 +4,29 @@ Subject: Enable ImprovedBookmarks by default License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html --- - chrome/android/java/res/layout/bookmark_search_box_row.xml | 6 +++--- - .../chromium/chrome/browser/bookmarks/BookmarkFeatures.java | 2 +- - .../browser/bookmarks/BookmarkSearchBoxRowViewBinder.java | 2 ++ - .../chromium/chrome/browser/bookmarks/BookmarkUiPrefs.java | 2 +- - .../chromium/chrome/browser/bookmarks/BookmarkUtils.java | 3 ++- - chrome/browser/flags/android/chrome_feature_list.cc | 2 +- - 6 files changed, 10 insertions(+), 7 deletions(-) + chrome/android/java/res/layout/bookmark_search_box_row.xml | 4 ++-- + .../chromium/chrome/browser/bookmarks/BookmarkFeatures.java | 2 +- + .../browser/bookmarks/BookmarkSearchBoxRowViewBinder.java | 2 ++ + .../chromium/chrome/browser/bookmarks/BookmarkUiPrefs.java | 2 +- + .../org/chromium/chrome/browser/bookmarks/BookmarkUtils.java | 3 ++- + .../Enable-ImprovedBookmarks-by-default.inc | 1 + + 6 files changed, 9 insertions(+), 5 deletions(-) + create mode 100644 cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Enable-ImprovedBookmarks-by-default.inc diff --git a/chrome/android/java/res/layout/bookmark_search_box_row.xml b/chrome/android/java/res/layout/bookmark_search_box_row.xml --- a/chrome/android/java/res/layout/bookmark_search_box_row.xml +++ b/chrome/android/java/res/layout/bookmark_search_box_row.xml -@@ -31,9 +31,9 @@ found in the LICENSE file. - android:textAppearance="@style/TextAppearance.TextLarge.Primary" /> +@@ -58,8 +58,8 @@ found in the LICENSE file. - + - -- -\ No newline at end of file -+ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkFeatures.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkFeatures.java --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkFeatures.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkFeatures.java @@ -57,25 +50,25 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/Bookm import androidx.annotation.DrawableRes; import androidx.annotation.StringRes; -@@ -20,6 +21,7 @@ class BookmarkSearchBoxRowViewBinder { - static void bind(PropertyModel model, View view, PropertyKey key) { +@@ -53,6 +54,7 @@ class BookmarkSearchBoxRowViewBinder { + private void bindInternal(PropertyModel model, View view, PropertyKey key) { BookmarkSearchBoxRow row = (BookmarkSearchBoxRow) view; ChipView shoppingChip = view.findViewById(R.id.shopping_filter_chip); + shoppingChip.setVisibility(ViewGroup.GONE); - if (key == BookmarkSearchBoxRowProperties.QUERY_CALLBACK) { - row.setQueryCallback(model.get(BookmarkSearchBoxRowProperties.QUERY_CALLBACK)); - } else if (key == BookmarkSearchBoxRowProperties.SHOPPING_CHIP_VISIBILITY) { + if (key == BookmarkSearchBoxRowProperties.SEARCH_TEXT_CHANGE_CALLBACK) { + Callback callback = + wrapCallback(model, BookmarkSearchBoxRowProperties.SEARCH_TEXT_CHANGE_CALLBACK); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUiPrefs.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUiPrefs.java --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUiPrefs.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUiPrefs.java -@@ -18,7 +18,7 @@ import java.lang.annotation.RetentionPolicy; +@@ -21,7 +21,7 @@ import java.lang.annotation.RetentionPolicy; */ public class BookmarkUiPrefs { private static final @BookmarkRowDisplayPref int INITIAL_BOOKMARK_ROW_DISPLAY_PREF = - BookmarkRowDisplayPref.VISUAL; + BookmarkRowDisplayPref.COMPACT; private static final @BookmarkRowSortOrder int INITIAL_BOOKMARK_ROW_SORT_ORDER = - BookmarkRowSortOrder.REVERSE_CHRONOLOGICAL; + BookmarkRowSortOrder.MANUAL; diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java @@ -97,17 +90,11 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/Bookm showBookmarkManagerOnTablet(context, activity == null ? null : activity.getComponentName(), url, isIncognito); } else { -diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc ---- a/chrome/browser/flags/android/chrome_feature_list.cc -+++ b/chrome/browser/flags/android/chrome_feature_list.cc -@@ -495,7 +495,7 @@ BASE_FEATURE(kAndroidSearchEngineChoiceNotification, - - BASE_FEATURE(kAndroidImprovedBookmarks, - "AndroidImprovedBookmarks", -- base::FEATURE_DISABLED_BY_DEFAULT); -+ base::FEATURE_ENABLED_BY_DEFAULT); - - BASE_FEATURE(kAnimatedImageDragShadow, - "AnimatedImageDragShadow", +diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Enable-ImprovedBookmarks-by-default.inc b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Enable-ImprovedBookmarks-by-default.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Enable-ImprovedBookmarks-by-default.inc +@@ -0,0 +1 @@ ++SET_CROMITE_FEATURE_ENABLED(kAndroidImprovedBookmarks); -- 2.25.1 diff --git a/build/bromite_patches/00Eyeo-Adblock-Remove-Privacy-Issues.patch b/build/bromite_patches/00Eyeo-Adblock-Remove-Privacy-Issues.patch index ae26bf099a22fcd2ed845547c811a3ac149a30f0..a54e13303e4dd418a987000c9502e80a7b2a7c70 100644 --- a/build/bromite_patches/00Eyeo-Adblock-Remove-Privacy-Issues.patch +++ b/build/bromite_patches/00Eyeo-Adblock-Remove-Privacy-Issues.patch @@ -8,10 +8,9 @@ suit Bromite logic .../android/java/res/xml/main_preferences.xml | 19 +- chrome/browser/BUILD.gn | 2 - .../adblock/adblock_content_browser_client.cc | 26 +- - chrome/browser/android/adblock/adblock_jni.cc | 50 +- - .../adblock_private/adblock_private_api.cc | 66 +- + .../adblock_private/adblock_private_api.cc | 74 +- .../api/adblock_private/adblock_private_api.h | 49 + - .../eyeo_filtering_private_api.cc | 20 +- + .../eyeo_filtering_private_api.cc | 25 +- ...hrome_browser_main_extra_parts_profiles.cc | 2 - chrome/browser/resources/settings/BUILD.gn | 2 + .../settings/adblock_page/adblock_page.html | 207 + @@ -24,15 +23,17 @@ suit Bromite logic chrome/browser/resources/settings/settings.ts | 1 + .../settings/settings_menu/settings_menu.html | 5 + chrome/browser/ui/tab_helpers.cc | 6 +- + .../adblock_internals_page_handler_impl.cc | 20 +- .../extensions/api/_permission_features.json | 8 - .../common/extensions/api/adblock_private.idl | 8 + chrome/test/BUILD.gn | 5 - - components/adblock/android/BUILD.gn | 4 +- + components/adblock/android/BUILD.gn | 3 +- + components/adblock/android/adblock_jni.cc | 53 +- .../adblock/android/adblock_strings.grd | 54 +- .../java/res/layout/adblock_custom_item.xml | 14 +- .../layout/adblock_filter_lists_list_item.xml | 15 + ...ences.xml => eyeo_adblock_preferences.xml} | 39 +- - .../components/adblock/AdblockController.java | 56 +- + .../components/adblock/AdblockController.java | 51 +- .../AdblockAllowedDomainsFragment.java | 7 +- .../AdblockCustomFilterListsFragment.java | 32 +- .../AdblockCustomFiltersFragment.java | 7 +- @@ -44,18 +45,17 @@ suit Bromite logic .../browser/adblock_webcontents_observer.cc | 25 +- .../browser/adblock_webcontents_observer.h | 5 +- .../content_security_policy_injector_impl.cc | 1 + + .../content/browser/element_hider_impl.cc | 2 +- .../subscription_service_factory_base.cc | 11 +- .../subscription_service_factory_base.h | 1 + components/adblock/core/BUILD.gn | 39 - - .../activeping_telemetry_topic_provider.cc | 243 -- - .../activeping_telemetry_topic_provider.h | 84 - - components/adblock/core/adblock_controller.h | 8 + - .../adblock/core/adblock_controller_impl.cc | 58 +- - .../adblock/core/adblock_controller_impl.h | 7 + + .../activeping_telemetry_topic_provider.cc | 285 -- + .../activeping_telemetry_topic_provider.h | 87 - + .../adblock/core/adblock_controller_impl.cc | 10 +- components/adblock/core/adblock_switches.cc | 1 - components/adblock/core/adblock_switches.h | 1 - - .../adblock/core/adblock_telemetry_service.cc | 244 -- - .../adblock/core/adblock_telemetry_service.h | 107 - + .../adblock/core/adblock_telemetry_service.cc | 258 -- + .../adblock/core/adblock_telemetry_service.h | 120 - components/adblock/core/common/BUILD.gn | 8 - .../adblock/core/common/adblock_constants.cc | 2 - .../adblock/core/common/adblock_constants.h | 1 - @@ -88,9 +88,9 @@ suit Bromite logic .../subscription_persistent_metadata_impl.cc | 7 + .../subscription_persistent_metadata_impl.h | 1 + .../subscription_persistent_storage_impl.cc | 11 +- - .../core/subscription/subscription_service.h | 3 + - .../subscription/subscription_service_impl.cc | 23 +- - .../subscription/subscription_service_impl.h | 3 + + .../core/subscription/subscription_service.h | 9 + + .../subscription/subscription_service_impl.cc | 78 +- + .../subscription/subscription_service_impl.h | 9 + .../subscription/subscription_updater_impl.cc | 8 +- .../subscription_validator_impl.cc | 4 +- .../browser/bromite_content_settings/ads.inc | 3 + @@ -100,14 +100,15 @@ suit Bromite logic components/resources/adblocking/BUILD.gn | 30 +- .../adblocking/elemhide_for_selector.jst | 2 +- .../resources/adblocking/elemhideemu.jst | 2 + + .../snippets/dist/isolated-first-xpath3.jst | 62 + + .../dist/isolated-first-xpath3.source.jst | 3696 +++++++++++++++++ .../snippets/dist/isolated-first.jst | 65 + - .../snippets/dist/isolated-first.source.jst | 3624 +++++++++++++++++ + .../snippets/dist/isolated-first.source.jst | 3624 ++++++++++++++++ .../blink/renderer/core/css/style_engine.cc | 8 + .../blink/renderer/core/css/style_engine.h | 1 + - .../renderer/core/exported/web_document.cc | 13 +- - tools/gritsettings/resource_ids.spec | 9 +- + .../renderer/core/exported/web_document.cc | 15 +- .../definitions/adblock_private.d.ts | 14 + - 102 files changed, 5079 insertions(+), 1083 deletions(-) + 103 files changed, 8856 insertions(+), 1165 deletions(-) create mode 100644 chrome/browser/resources/settings/adblock_page/adblock_page.html create mode 100644 chrome/browser/resources/settings/adblock_page/adblock_page.ts rename components/adblock/android/java/res/xml/{adblock_preferences.xml => eyeo_adblock_preferences.xml} (56%) @@ -117,6 +118,8 @@ suit Bromite logic delete mode 100644 components/adblock/core/adblock_telemetry_service.h create mode 100644 components/adblock/core/converter/parser/test/test_rules.txt create mode 100644 components/content_settings/core/browser/bromite_content_settings/ads.inc + create mode 100644 components/resources/adblocking/snippets/dist/isolated-first-xpath3.jst + create mode 100644 components/resources/adblocking/snippets/dist/isolated-first-xpath3.source.jst create mode 100755 components/resources/adblocking/snippets/dist/isolated-first.jst create mode 100755 components/resources/adblocking/snippets/dist/isolated-first.source.jst @@ -176,7 +179,7 @@ diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/browser/adblock/adblock_content_browser_client.cc --- a/chrome/browser/adblock/adblock_content_browser_client.cc +++ b/chrome/browser/adblock/adblock_content_browser_client.cc -@@ -25,6 +25,8 @@ +@@ -24,6 +24,8 @@ #include "chrome/browser/adblock/resource_classification_runner_factory.h" #include "chrome/browser/adblock/sitekey_storage_factory.h" #include "chrome/browser/adblock/subscription_service_factory.h" @@ -185,7 +188,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser_navigator_params.h" #include "components/adblock/content/browser/adblock_url_loader_factory.h" -@@ -61,6 +63,13 @@ bool IsFilteringNeeded(content::RenderFrameHost* frame) { +@@ -59,6 +61,13 @@ bool IsFilteringNeeded(content::RenderFrameHost* frame) { auto* profile = Profile::FromBrowserContext(frame->GetProcess()->GetBrowserContext()); if (profile) { @@ -199,7 +202,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b // Filtering may be needed if there's at least one enabled // FilteringConfiguration. return base::ranges::any_of( -@@ -104,23 +113,6 @@ class AdblockContextData : public base::SupportsUserData::Data { +@@ -102,23 +111,6 @@ class AdblockContextData : public base::SupportsUserData::Data { adblock::SitekeyStorageFactory::GetForBrowserContext(browser_context), adblock::ContentSecurityPolicyInjectorFactory::GetForBrowserContext( browser_context)}; @@ -213,7 +216,7 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b - embedder_support::GetUserAgent(), - base::BindOnce(&AdblockContextData::RemoveProxy, - self->weak_factory_.GetWeakPtr()), -- adblock::AdblockControllerFactory::GetForBrowserContext( +- adblock::SubscriptionServiceFactory::GetForBrowserContext( - Profile::FromBrowserContext( - frame->GetProcess()->GetBrowserContext()))); - self->proxies_.emplace(std::move(proxy)); @@ -223,111 +226,20 @@ diff --git a/chrome/browser/adblock/adblock_content_browser_client.cc b/chrome/b auto proxy = std::make_unique( std::move(config), content::GlobalRenderFrameHostId(render_process_id, -diff --git a/chrome/browser/android/adblock/adblock_jni.cc b/chrome/browser/android/adblock/adblock_jni.cc ---- a/chrome/browser/android/adblock/adblock_jni.cc -+++ b/chrome/browser/android/adblock/adblock_jni.cc -@@ -24,6 +24,7 @@ - #include "base/android/jni_array.h" - #include "base/android/jni_string.h" - #include "base/android/jni_weak_ref.h" -+#include "base/time/time_to_iso8601.h" - #include "base/logging.h" - #include "chrome/browser/adblock/adblock_controller_factory.h" - #include "chrome/browser/android/adblock/adblock_jni_factory.h" -@@ -71,6 +72,10 @@ ScopedJavaLocalRef ToJava(JNIEnv* env, - const std::string& url, - const std::string& title, - const std::string& version, -+ adblock::Subscription::InstallationState state, -+ const std::string& installation_time, -+ long download_success_count, -+ long download_error_count, - const std::vector& languages) { - ScopedJavaLocalRef url_param( - env, env->NewObject(url_class.obj(), url_constructor, -@@ -79,12 +84,19 @@ ScopedJavaLocalRef ToJava(JNIEnv* env, - return Java_Subscription_Constructor(env, url_param, - ConvertUTF8ToJavaString(env, title), - ConvertUTF8ToJavaString(env, version), -+ ConvertUTF8ToJavaString(env, Subscription::SubscriptionInstallationStateToString(state)), -+ ConvertUTF8ToJavaString(env, installation_time), -+ download_success_count, -+ download_error_count, - ToJavaArrayOfStrings(env, languages)); - } - - std::vector> CSubscriptionsToJObjects( - JNIEnv* env, - const std::vector>& subscriptions) { -+ auto* controller = adblock::GetController(); -+ raw_ptr metadata = -+ controller->GetMetadata(); - ScopedJavaLocalRef url_class = GetClass(env, "java/net/URL"); - jmethodID url_constructor = MethodID::Get( - env, url_class.obj(), "", "(Ljava/lang/String;)V"); -@@ -93,7 +105,11 @@ std::vector> CSubscriptionsToJObjects( - for (auto& sub : subscriptions) { - jobjects.push_back(ToJava( - env, url_class, url_constructor, sub->GetSourceUrl().spec(), -- sub->GetTitle(), sub->GetCurrentVersion(), std::vector{})); -+ sub->GetTitle(), sub->GetCurrentVersion(), -+ sub->GetInstallationState(), base::TimeToISO8601(sub->GetInstallationTime()), -+ metadata ? metadata->GetDownloadSuccessCount(sub->GetSourceUrl()) : 0, -+ metadata ? metadata->GetDownloadErrorCount(sub->GetSourceUrl()) : 0, -+ std::vector{})); - } - return jobjects; - } -@@ -113,6 +129,9 @@ std::vector> CSubscriptionsToJObjects( - if (sub.url.is_valid()) { - jobjects.push_back(ToJava(env, url_class, url_constructor, - sub.url.spec(), sub.title, "", -+ adblock::Subscription::InstallationState::Unknown, -+ /*installation_time*/ "", -+ /*download_success_count*/ 0, /*download_error_count*/ 0, - sub.languages)); - } - } -@@ -167,6 +186,35 @@ static void JNI_AdblockController_Bind( - adblock::GetJNI()->Bind(weak_controller_ref); - } - -+static void -+JNI_AdblockController_StartUpdate(JNIEnv* env) { -+ adblock::GetController()->StartUpdate(); -+} -+ -+static base::android::ScopedJavaLocalRef -+JNI_AdblockController_GetCustomSubscriptions(JNIEnv* env) { -+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); -+ if (!adblock::GetController()) { -+ return ToJavaArrayOfObjects(env, -+ std::vector>{}); -+ } -+ -+ return ToJavaArrayOfObjects( -+ env, adblock::CSubscriptionsToJObjects( -+ env, adblock::GetController()->GetCustomSubscriptions())); -+} -+ -+static jboolean JNI_AdblockController_IsPrivilegedFiltersEnabled( -+ JNIEnv* env) { -+ return adblock::GetController()->IsPrivilegedFiltersEnabled() ? JNI_TRUE : JNI_FALSE; -+} -+ -+static void JNI_AdblockController_SetPrivilegedFiltersEnabled( -+ JNIEnv* env, -+ jboolean j_enabled) { -+ adblock::GetController()->SetPrivilegedFiltersEnabled(j_enabled == JNI_TRUE); -+} -+ - static base::android::ScopedJavaLocalRef - JNI_AdblockController_GetInstalledSubscriptions(JNIEnv* env) { - DCHECK_CURRENTLY_ON(content::BrowserThread::UI); diff --git a/chrome/browser/extensions/api/adblock_private/adblock_private_api.cc b/chrome/browser/extensions/api/adblock_private/adblock_private_api.cc --- a/chrome/browser/extensions/api/adblock_private/adblock_private_api.cc +++ b/chrome/browser/extensions/api/adblock_private/adblock_private_api.cc -@@ -75,26 +75,12 @@ std::vector CopySessionsStats( +@@ -18,7 +18,8 @@ + #include "base/containers/flat_map.h" + #include "base/logging.h" + #include "base/no_destructor.h" +-#include "base/time/time_to_iso8601.h" ++#include "base/i18n/time_formatting.h" ++#include "base/strings/utf_string_conversions.h" + #include "base/values.h" + #include "chrome/browser/adblock/resource_classification_runner_factory.h" + #include "chrome/browser/adblock/session_stats_factory.h" +@@ -77,26 +78,12 @@ std::vector CopySessionsStats( return result; } @@ -349,22 +261,23 @@ diff --git a/chrome/browser/extensions/api/adblock_private/adblock_private_api.c -} - std::vector CopySubscriptions( -+ raw_ptr controller, ++ raw_ptr subscription_service, const std::vector> current_subscriptions) { + raw_ptr metadata = -+ controller->GetMetadata(); ++ subscription_service->GetMetadata(); std::vector result; for (auto& sub : current_subscriptions) { api::adblock_private::Subscription js_sub; -@@ -102,9 +88,13 @@ std::vector CopySubscriptions( +@@ -104,9 +91,13 @@ std::vector CopySubscriptions( js_sub.title = sub->GetTitle(); js_sub.current_version = sub->GetCurrentVersion(); js_sub.installation_state = - SubscriptionInstallationStateToString(sub->GetInstallationState()); + adblock::Subscription::SubscriptionInstallationStateToString(sub->GetInstallationState()); js_sub.last_installation_time = - base::TimeToISO8601(sub->GetInstallationTime()); +- base::TimeToISO8601(sub->GetInstallationTime()); ++ base::UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(sub->GetInstallationTime())); + if (metadata) { + js_sub.download_success_count = metadata->GetDownloadSuccessCount(sub->GetSourceUrl()); + js_sub.download_error_count = metadata->GetDownloadErrorCount(sub->GetSourceUrl()); @@ -372,7 +285,7 @@ diff --git a/chrome/browser/extensions/api/adblock_private/adblock_private_api.c result.emplace_back(std::move(js_sub)); } return result; -@@ -345,6 +335,44 @@ void AdblockPrivateAPI::OnListenerAdded( +@@ -347,6 +338,47 @@ void AdblockPrivateAPI::OnListenerAdded( namespace api { @@ -381,9 +294,10 @@ diff --git a/chrome/browser/extensions/api/adblock_private/adblock_private_api.c +AdblockPrivateStartUpdateFunction::~AdblockPrivateStartUpdateFunction() {} + +ExtensionFunction::ResponseAction AdblockPrivateStartUpdateFunction::Run() { -+ auto* controller = adblock::AdblockControllerFactory::GetForBrowserContext( -+ browser_context()); -+ controller->StartUpdate(); ++ auto* subscription_service = ++ adblock::SubscriptionServiceFactory::GetForBrowserContext( ++ browser_context()); ++ subscription_service->StartUpdate(); + return RespondNow(NoArguments()); +} + @@ -396,9 +310,10 @@ diff --git a/chrome/browser/extensions/api/adblock_private/adblock_private_api.c + api::adblock_private::SetEnabled::Params::Create(args()); + EXTENSION_FUNCTION_VALIDATE(params); + -+ auto* controller = adblock::AdblockControllerFactory::GetForBrowserContext( -+ browser_context()); -+ controller->SetPrivilegedFiltersEnabled(params->enabled); ++ auto* subscription_service = ++ adblock::SubscriptionServiceFactory::GetForBrowserContext( ++ browser_context()); ++ subscription_service->SetPrivilegedFiltersEnabled(params->enabled); + return RespondNow(NoArguments()); +} + @@ -407,25 +322,26 @@ diff --git a/chrome/browser/extensions/api/adblock_private/adblock_private_api.c +AdblockPrivateIsPrivilegedFiltersEnabledFunction::~AdblockPrivateIsPrivilegedFiltersEnabledFunction() {} + +ExtensionFunction::ResponseAction AdblockPrivateIsPrivilegedFiltersEnabledFunction::Run() { -+ auto* controller = adblock::AdblockControllerFactory::GetForBrowserContext( -+ browser_context()); ++ auto* subscription_service = ++ adblock::SubscriptionServiceFactory::GetForBrowserContext( ++ browser_context()); + return RespondNow( + ArgumentList(api::adblock_private::IsEnabled::Results::Create( -+ controller->IsPrivilegedFiltersEnabled()))); ++ subscription_service->IsPrivilegedFiltersEnabled()))); +} + AdblockPrivateSetEnabledFunction::AdblockPrivateSetEnabledFunction() {} AdblockPrivateSetEnabledFunction::~AdblockPrivateSetEnabledFunction() {} -@@ -486,7 +514,7 @@ AdblockPrivateGetInstalledSubscriptionsFunction::Run() { - browser_context()); +@@ -514,7 +546,7 @@ AdblockPrivateGetInstalledSubscriptionsFunction::Run() { + << "adblock_private expects \"adblock\" configuration"; return RespondNow(ArgumentList( api::adblock_private::GetInstalledSubscriptions::Results::Create( -- CopySubscriptions(controller->GetInstalledSubscriptions())))); -+ CopySubscriptions(controller, controller->GetInstalledSubscriptions())))); +- CopySubscriptions(subscription_service->GetCurrentSubscriptions( ++ CopySubscriptions(subscription_service, subscription_service->GetCurrentSubscriptions( + subscription_service->GetAdblockFilteringConfiguration()))))); } - AdblockPrivateAddAllowedDomainFunction:: diff --git a/chrome/browser/extensions/api/adblock_private/adblock_private_api.h b/chrome/browser/extensions/api/adblock_private/adblock_private_api.h --- a/chrome/browser/extensions/api/adblock_private/adblock_private_api.h +++ b/chrome/browser/extensions/api/adblock_private/adblock_private_api.h @@ -488,7 +404,17 @@ diff --git a/chrome/browser/extensions/api/adblock_private/adblock_private_api.h diff --git a/chrome/browser/extensions/api/eyeo_filtering_private/eyeo_filtering_private_api.cc b/chrome/browser/extensions/api/eyeo_filtering_private/eyeo_filtering_private_api.cc --- a/chrome/browser/extensions/api/eyeo_filtering_private/eyeo_filtering_private_api.cc +++ b/chrome/browser/extensions/api/eyeo_filtering_private/eyeo_filtering_private_api.cc -@@ -29,6 +29,7 @@ +@@ -18,7 +18,8 @@ + #include "base/containers/flat_map.h" + #include "base/logging.h" + #include "base/no_destructor.h" +-#include "base/time/time_to_iso8601.h" ++#include "base/i18n/time_formatting.h" ++#include "base/strings/utf_string_conversions.h" + #include "base/values.h" + #include "chrome/browser/adblock/resource_classification_runner_factory.h" + #include "chrome/browser/adblock/session_stats_factory.h" +@@ -29,6 +30,7 @@ #include "components/adblock/content/browser/resource_classification_runner.h" #include "components/adblock/core/common/adblock_utils.h" #include "components/adblock/core/common/content_type.h" @@ -496,7 +422,7 @@ diff --git a/chrome/browser/extensions/api/eyeo_filtering_private/eyeo_filtering #include "components/adblock/core/configuration/filtering_configuration.h" #include "components/adblock/core/configuration/persistent_filtering_configuration.h" #include "components/adblock/core/session_stats.h" -@@ -94,23 +95,6 @@ std::vector CopySessionsStats( +@@ -94,23 +96,6 @@ std::vector CopySessionsStats( return result; } @@ -520,15 +446,18 @@ diff --git a/chrome/browser/extensions/api/eyeo_filtering_private/eyeo_filtering std::vector CopySubscriptions( const std::vector> current_subscriptions) { -@@ -121,7 +105,7 @@ std::vector CopySubscriptions( +@@ -121,9 +106,9 @@ std::vector CopySubscriptions( js_sub.title = sub->GetTitle(); js_sub.current_version = sub->GetCurrentVersion(); js_sub.installation_state = - SubscriptionInstallationStateToString(sub->GetInstallationState()); + adblock::Subscription::SubscriptionInstallationStateToString(sub->GetInstallationState()); js_sub.last_installation_time = - base::TimeToISO8601(sub->GetInstallationTime()); +- base::TimeToISO8601(sub->GetInstallationTime()); ++ base::UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(sub->GetInstallationTime())); result.emplace_back(std::move(js_sub)); + } + return result; diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc --- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc +++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc @@ -540,7 +469,7 @@ diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc #include "chrome/browser/adblock/content_security_policy_injector_factory.h" #include "chrome/browser/adblock/element_hider_factory.h" #include "chrome/browser/adblock/resource_classification_runner_factory.h" -@@ -721,7 +720,6 @@ void ChromeBrowserMainExtraPartsProfiles:: +@@ -756,7 +755,6 @@ void ChromeBrowserMainExtraPartsProfiles:: ExitTypeServiceFactory::GetInstance(); #endif adblock::AdblockControllerFactory::GetInstance(); @@ -551,7 +480,7 @@ diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn --- a/chrome/browser/resources/settings/BUILD.gn +++ b/chrome/browser/resources/settings/BUILD.gn -@@ -72,6 +72,7 @@ build_webui("build") { +@@ -74,6 +74,7 @@ build_webui("build") { web_component_files = [ "a11y_page/a11y_page.ts", "about_page/about_page.ts", @@ -559,7 +488,7 @@ diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resourc "appearance_page/appearance_fonts_page.ts", "appearance_page/appearance_page.ts", "appearance_page/home_url_input.ts", -@@ -365,6 +366,7 @@ build_webui("build") { +@@ -372,6 +373,7 @@ build_webui("build") { ts_composite = true ts_definitions = [ "//tools/typescript/definitions/autofill_private.d.ts", @@ -1096,8 +1025,8 @@ diff --git a/chrome/browser/resources/settings/basic_page/basic_page.ts b/chrome import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js'; +import '../adblock_page/adblock_page.js'; import '../appearance_page/appearance_page.js'; + import '../privacy_page/preloading_page.js'; import '../privacy_page/privacy_guide/privacy_guide_promo.js'; - import '../privacy_page/privacy_page.js'; diff --git a/chrome/browser/resources/settings/page_visibility.ts b/chrome/browser/resources/settings/page_visibility.ts --- a/chrome/browser/resources/settings/page_visibility.ts +++ b/chrome/browser/resources/settings/page_visibility.ts @@ -1112,7 +1041,7 @@ diff --git a/chrome/browser/resources/settings/page_visibility.ts b/chrome/brows diff --git a/chrome/browser/resources/settings/route.ts b/chrome/browser/resources/settings/route.ts --- a/chrome/browser/resources/settings/route.ts +++ b/chrome/browser/resources/settings/route.ts -@@ -178,6 +178,10 @@ function createBrowserSettingsRoutes(): SettingsRoutes { +@@ -187,6 +187,10 @@ function createBrowserSettingsRoutes(): SettingsRoutes { r.FONTS = r.APPEARANCE.createChild('/fonts'); } @@ -1148,7 +1077,7 @@ diff --git a/chrome/browser/resources/settings/settings.ts b/chrome/browser/reso diff --git a/chrome/browser/resources/settings/settings_menu/settings_menu.html b/chrome/browser/resources/settings/settings_menu/settings_menu.html --- a/chrome/browser/resources/settings/settings_menu/settings_menu.html +++ b/chrome/browser/resources/settings/settings_menu/settings_menu.html -@@ -134,6 +134,11 @@ +@@ -140,6 +140,11 @@ $i18n{a11yPageTitle} @@ -1163,7 +1092,7 @@ diff --git a/chrome/browser/resources/settings/settings_menu/settings_menu.html diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc --- a/chrome/browser/ui/tab_helpers.cc +++ b/chrome/browser/ui/tab_helpers.cc -@@ -21,6 +21,7 @@ +@@ -20,6 +20,7 @@ #include "chrome/browser/adblock/element_hider_factory.h" #include "chrome/browser/adblock/sitekey_storage_factory.h" #include "chrome/browser/adblock/subscription_service_factory.h" @@ -1171,16 +1100,16 @@ diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc #include "chrome/browser/bookmarks/bookmark_model_factory.h" #include "chrome/browser/breadcrumbs/breadcrumb_manager_tab_helper.h" #include "chrome/browser/browser_process.h" -@@ -349,6 +350,8 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) { +@@ -350,6 +351,8 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) { + } } - #endif + adblock::AdblockControllerFactory::GetForBrowserContext( + web_contents->GetBrowserContext()); AdblockWebContentObserver::CreateForWebContents( web_contents, adblock::SubscriptionServiceFactory::GetForBrowserContext( -@@ -357,7 +360,8 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) { +@@ -358,7 +361,8 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) { web_contents->GetBrowserContext()), adblock::SitekeyStorageFactory::GetForBrowserContext( web_contents->GetBrowserContext()), @@ -1190,10 +1119,61 @@ diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc autofill::ChromeAutofillClient::CreateForWebContents(web_contents); if (breadcrumbs::IsEnabled()) BreadcrumbManagerTabHelper::CreateForWebContents(web_contents); +diff --git a/chrome/browser/ui/webui/adblock_internals/adblock_internals_page_handler_impl.cc b/chrome/browser/ui/webui/adblock_internals/adblock_internals_page_handler_impl.cc +--- a/chrome/browser/ui/webui/adblock_internals/adblock_internals_page_handler_impl.cc ++++ b/chrome/browser/ui/webui/adblock_internals/adblock_internals_page_handler_impl.cc +@@ -17,11 +17,10 @@ + + #include "chrome/browser/ui/webui/adblock_internals/adblock_internals_page_handler_impl.h" + +-#include "base/time/time_to_iso8601.h" +-#include "chrome/browser/adblock/adblock_telemetry_service_factory.h" ++#include "base/i18n/time_formatting.h" ++#include "base/strings/utf_string_conversions.h" + #include "chrome/browser/adblock/session_stats_factory.h" + #include "chrome/browser/adblock/subscription_service_factory.h" +-#include "components/adblock/core/adblock_telemetry_service.h" + #include "components/adblock/core/session_stats.h" + #include "components/adblock/core/subscription/subscription_config.h" + #include "components/adblock/core/subscription/subscription_service.h" +@@ -53,6 +52,13 @@ std::string DebugLine(std::string name, int value, int level) { + return DebugLine(name, std::to_string(value), level); + } + ++std::string FormatInstallationTime(base::Time time) { ++ if (time.is_null()) { ++ return "Never"; ++ } ++ return base::UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(time)); ++} ++ + } // namespace + + AdblockInternalsPageHandlerImpl::AdblockInternalsPageHandlerImpl( +@@ -90,17 +96,13 @@ void AdblockInternalsPageHandlerImpl::GetDebugInfo( + content += DebugLine("Title", it->GetTitle(), 2); + content += DebugLine("Version", it->GetCurrentVersion(), 2); + content += DebugLine("Last update", +- base::TimeToISO8601(it->GetInstallationTime()), 2); ++ FormatInstallationTime(it->GetInstallationTime()), 2); + content += DebugLine("Total allowed", allowed[url], 2); + content += DebugLine("Total blocked", blocked[url], 2); + } + } + +- auto* telemetry_service = +- adblock::AdblockTelemetryServiceFactory::GetForProfile(profile_); +- telemetry_service->GetTopicProvidersDebugInfo(base::BindOnce( +- &AdblockInternalsPageHandlerImpl::OnTelemetryServiceInfoArrived, +- std::move(callback), std::move(content))); ++ std::move(callback).Run(std::move(content)); + } + + void AdblockInternalsPageHandlerImpl::OnTelemetryServiceInfoArrived( diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/common/extensions/api/_permission_features.json --- a/chrome/common/extensions/api/_permission_features.json +++ b/chrome/common/extensions/api/_permission_features.json -@@ -50,10 +50,6 @@ +@@ -60,10 +60,6 @@ "5107DE9024C329EEA9C9A72D94C16723790C6422" // Apps Developer Tool Dev. ] }, @@ -1204,7 +1184,7 @@ diff --git a/chrome/common/extensions/api/_permission_features.json b/chrome/com "autofillPrivate": { "channel": "trunk", "extension_types": ["extension", "platform_app"], -@@ -341,10 +337,6 @@ +@@ -351,10 +347,6 @@ "extension", "legacy_packaged_app", "hosted_app", "platform_app" ] }, @@ -1243,7 +1223,7 @@ diff --git a/chrome/common/extensions/api/adblock_private.idl b/chrome/common/ex diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn --- a/chrome/test/BUILD.gn +++ b/chrome/test/BUILD.gn -@@ -27,7 +27,6 @@ import("//chrome/test/base/js2gtest.gni") +@@ -28,7 +28,6 @@ import("//chrome/test/base/js2gtest.gni") import("//chrome/test/include_js_tests.gni") import("//chrome/version.gni") import("//chromeos/ash/components/assistant/assistant.gni") @@ -1251,7 +1231,7 @@ diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn import("//components/captive_portal/core/features.gni") import("//components/enterprise/buildflags/buildflags.gni") import("//components/feed/features.gni") -@@ -2670,10 +2669,6 @@ if (!is_android) { +@@ -2754,10 +2753,6 @@ if (!is_android) { sources += [ "../browser/chrome_for_testing/chrome_for_testing_info_bar_browsertest.cc" ] } @@ -1265,16 +1245,15 @@ diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn diff --git a/components/adblock/android/BUILD.gn b/components/adblock/android/BUILD.gn --- a/components/adblock/android/BUILD.gn +++ b/components/adblock/android/BUILD.gn -@@ -53,7 +53,7 @@ android_library("adblock_java") { - "//third_party/androidx:androidx_preference_preference_java", - ] - -- annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] -+ srcjar_deps = [ ":jni_headers" ] - resources_package = "org.chromium.components.adblock" - } +@@ -14,6 +14,7 @@ + import("//build/config/android/rules.gni") + import("//build/config/locales.gni") + import("//tools/grit/grit_rule.gni") ++import("//third_party/jni_zero/jni_zero.gni") -@@ -91,7 +91,7 @@ android_resources("java_resources") { + source_set("java_bindings") { + sources = [ +@@ -120,7 +121,7 @@ android_resources("java_ui_resources") { "java/res/layout/adblock_custom_item_settings.xml", "java/res/layout/adblock_filter_lists_list_item.xml", "java/res/xml/adblock_more_options.xml", @@ -1283,6 +1262,110 @@ diff --git a/components/adblock/android/BUILD.gn b/components/adblock/android/BU ] deps = [ ":adblock_strings_grd" ] +diff --git a/components/adblock/android/adblock_jni.cc b/components/adblock/android/adblock_jni.cc +--- a/components/adblock/android/adblock_jni.cc ++++ b/components/adblock/android/adblock_jni.cc +@@ -25,6 +25,8 @@ + #include "base/android/jni_array.h" + #include "base/android/jni_string.h" + #include "base/android/jni_weak_ref.h" ++#include "base/i18n/time_formatting.h" ++#include "base/strings/utf_string_conversions.h" + #include "base/logging.h" + #include "components/adblock/android/java_bindings_getters.h" + #include "components/adblock/android/jni_headers/AdblockController_jni.h" +@@ -54,6 +56,10 @@ ScopedJavaLocalRef ToJava(JNIEnv* env, + const std::string& url, + const std::string& title, + const std::string& version, ++ adblock::Subscription::InstallationState state, ++ const std::string& installation_time, ++ long download_success_count, ++ long download_error_count, + const std::vector& languages) { + ScopedJavaLocalRef url_param( + env, env->NewObject(url_class.obj(), url_constructor, +@@ -62,12 +68,19 @@ ScopedJavaLocalRef ToJava(JNIEnv* env, + return Java_Subscription_Constructor(env, url_param, + ConvertUTF8ToJavaString(env, title), + ConvertUTF8ToJavaString(env, version), ++ ConvertUTF8ToJavaString(env, Subscription::SubscriptionInstallationStateToString(state)), ++ ConvertUTF8ToJavaString(env, installation_time), ++ download_success_count, ++ download_error_count, + ToJavaArrayOfStrings(env, languages)); + } + + std::vector> CSubscriptionsToJObjects( + JNIEnv* env, + const std::vector>& subscriptions) { ++ auto* subscription_service = adblock::GetSubscriptionService(); ++ raw_ptr metadata = ++ subscription_service->GetMetadata(); + ScopedJavaLocalRef url_class = GetClass(env, "java/net/URL"); + jmethodID url_constructor = MethodID::Get( + env, url_class.obj(), "", "(Ljava/lang/String;)V"); +@@ -76,7 +89,11 @@ std::vector> CSubscriptionsToJObjects( + for (auto& sub : subscriptions) { + jobjects.push_back(ToJava( + env, url_class, url_constructor, sub->GetSourceUrl().spec(), +- sub->GetTitle(), sub->GetCurrentVersion(), std::vector{})); ++ sub->GetTitle(), sub->GetCurrentVersion(), ++ sub->GetInstallationState(), base::UTF16ToUTF8(base::TimeFormatFriendlyDateAndTime(sub->GetInstallationTime())), ++ metadata ? metadata->GetDownloadSuccessCount(sub->GetSourceUrl()) : 0, ++ metadata ? metadata->GetDownloadErrorCount(sub->GetSourceUrl()) : 0, ++ std::vector{})); + } + return jobjects; + } +@@ -96,6 +113,9 @@ std::vector> CSubscriptionsToJObjects( + if (sub.url.is_valid()) { + jobjects.push_back(ToJava(env, url_class, url_constructor, + sub.url.spec(), sub.title, "", ++ adblock::Subscription::InstallationState::Unknown, ++ /*installation_time*/ "", ++ /*download_success_count*/ 0, /*download_error_count*/ 0, + sub.languages)); + } + } +@@ -139,6 +159,37 @@ void AdblockJNI::OnSubscriptionInstalled(const GURL& url) { + + } // namespace adblock + ++static void ++JNI_AdblockController_StartUpdate(JNIEnv* env) { ++ adblock::GetSubscriptionService()->StartUpdate(); ++} ++ ++static base::android::ScopedJavaLocalRef ++JNI_AdblockController_GetCustomSubscriptions(JNIEnv* env) { ++ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); ++ auto* subscription_service = adblock::GetSubscriptionService(); ++ if (!subscription_service) { ++ return ToJavaArrayOfObjects(env, ++ std::vector>{}); ++ } ++ ++ return ToJavaArrayOfObjects( ++ env, adblock::CSubscriptionsToJObjects( ++ env, subscription_service->GetCustomSubscriptions( ++ subscription_service->GetAdblockFilteringConfiguration()))); ++} ++ ++static jboolean JNI_AdblockController_IsPrivilegedFiltersEnabled( ++ JNIEnv* env) { ++ return adblock::GetSubscriptionService()->IsPrivilegedFiltersEnabled() ? JNI_TRUE : JNI_FALSE; ++} ++ ++static void JNI_AdblockController_SetPrivilegedFiltersEnabled( ++ JNIEnv* env, ++ jboolean j_enabled) { ++ adblock::GetSubscriptionService()->SetPrivilegedFiltersEnabled(j_enabled == JNI_TRUE); ++} ++ + static void JNI_AdblockController_Bind( + JNIEnv* env, + const base::android::JavaParamRef& caller) { diff --git a/components/adblock/android/adblock_strings.grd b/components/adblock/android/adblock_strings.grd --- a/components/adblock/android/adblock_strings.grd +++ b/components/adblock/android/adblock_strings.grd @@ -1487,7 +1570,7 @@ rename to components/adblock/android/java/res/xml/eyeo_adblock_preferences.xml diff --git a/components/adblock/android/java/src/org/chromium/components/adblock/AdblockController.java b/components/adblock/android/java/src/org/chromium/components/adblock/AdblockController.java --- a/components/adblock/android/java/src/org/chromium/components/adblock/AdblockController.java +++ b/components/adblock/android/java/src/org/chromium/components/adblock/AdblockController.java -@@ -85,6 +85,10 @@ public final class AdblockController extends FilteringConfiguration { +@@ -73,6 +73,10 @@ public final class AdblockController extends FilteringConfiguration { private String mTitle; private String mVersion = ""; private String[] mLanguages = {}; @@ -1498,7 +1581,7 @@ diff --git a/components/adblock/android/java/src/org/chromium/components/adblock public Subscription(final URL url, final String title, final String version) { this.mUrl = url; -@@ -94,11 +98,30 @@ public final class AdblockController extends FilteringConfiguration { +@@ -82,11 +86,30 @@ public final class AdblockController extends FilteringConfiguration { @CalledByNative("Subscription") public Subscription( @@ -1530,7 +1613,7 @@ diff --git a/components/adblock/android/java/src/org/chromium/components/adblock } public String title() { -@@ -129,6 +152,7 @@ public final class AdblockController extends FilteringConfiguration { +@@ -117,6 +140,7 @@ public final class AdblockController extends FilteringConfiguration { @UiThread public void setAcceptableAdsEnabled(boolean enabled) { @@ -1538,19 +1621,7 @@ diff --git a/components/adblock/android/java/src/org/chromium/components/adblock if (enabled) addFilterList(mAcceptableAds); else -@@ -164,7 +188,10 @@ public final class AdblockController extends FilteringConfiguration { - if (title != null && !title.isEmpty()) { - recommendedSubscriptions.set(i, - new Subscription(recommendedSubscriptions.get(i).url(), title, -- "" /*version*/, recommendedSubscriptions.get(i).languages())); -+ "" /*version*/, -+ "" /*state*/, "" /*installation_time*/, -+ 0 /*download_success_count*/, 0 /*download_error_count*/, -+ recommendedSubscriptions.get(i).languages())); - break; - } - } -@@ -182,6 +209,27 @@ public final class AdblockController extends FilteringConfiguration { +@@ -144,6 +168,27 @@ public final class AdblockController extends FilteringConfiguration { removeFilterList(url); } @@ -1578,7 +1649,7 @@ diff --git a/components/adblock/android/java/src/org/chromium/components/adblock @UiThread public List getInstalledSubscriptions() { return (List) (List) Arrays.asList( -@@ -251,6 +299,10 @@ public final class AdblockController extends FilteringConfiguration { +@@ -196,6 +241,10 @@ public final class AdblockController extends FilteringConfiguration { @NativeMethods interface Natives { @@ -1636,7 +1707,7 @@ diff --git a/components/adblock/android/java/src/org/chromium/components/adblock - final List installed = - AdblockController.getInstance().getInstalledSubscriptions(); - final List recommended = -- AdblockController.getInstance().getRecommendedSubscriptions(getActivity()); +- AdblockController.getInstance().getRecommendedSubscriptions(); - final List customStrings = new ArrayList(); - for (final AdblockController.Subscription subscription : installed) { - if (recommended.contains(subscription)) { @@ -1782,15 +1853,15 @@ diff --git a/components/adblock/android/java/src/org/chromium/components/adblock diff --git a/components/adblock/android/java/src/org/chromium/components/adblock/settings/AdblockSettingsFragment.java b/components/adblock/android/java/src/org/chromium/components/adblock/settings/AdblockSettingsFragment.java --- a/components/adblock/android/java/src/org/chromium/components/adblock/settings/AdblockSettingsFragment.java +++ b/components/adblock/android/java/src/org/chromium/components/adblock/settings/AdblockSettingsFragment.java -@@ -16,6 +16,7 @@ import android.os.Bundle; - import android.util.Log; - import android.view.MotionEvent; - import android.view.View; +@@ -13,6 +13,7 @@ + package org.chromium.components.adblock.settings; + + import android.os.Bundle; +import android.widget.Toast; import androidx.preference.Preference; import androidx.preference.PreferenceFragmentCompat; -@@ -34,7 +35,19 @@ public class AdblockSettingsFragment +@@ -32,7 +33,19 @@ public class AdblockSettingsFragment private Preference mFilterLists; private Preference mAllowedDomains; private Preference mMoreOptions; @@ -1811,7 +1882,7 @@ diff --git a/components/adblock/android/java/src/org/chromium/components/adblock private static final String SETTINGS_ENABLED_KEY = "fragment_adblock_settings_enabled_key"; private static final String SETTINGS_FILTER_LISTS_KEY = "fragment_adblock_settings_filter_lists_key"; -@@ -51,6 +64,16 @@ public class AdblockSettingsFragment +@@ -49,9 +62,20 @@ public class AdblockSettingsFragment private long mOnOffTogleTimestamp; private void bindPreferences() { @@ -1828,19 +1899,21 @@ diff --git a/components/adblock/android/java/src/org/chromium/components/adblock mAdblockEnabled = (ChromeSwitchPreference) findPreference(SETTINGS_ENABLED_KEY); mFilterLists = findPreference(SETTINGS_FILTER_LISTS_KEY); mAcceptableAdsEnabled = (ChromeSwitchPreference) findPreference(SETTINGS_AA_ENABLED_KEY); -@@ -59,14 +82,28 @@ public class AdblockSettingsFragment ++ mAcceptableAdsEnabled.setVisible(false); + mAllowedDomains = findPreference(SETTINGS_ALLOWED_DOMAINS_KEY); + mMoreOptions = findPreference(SETTINGS_MORE_OPTIONS_KEY); + } +@@ -62,14 +86,25 @@ public class AdblockSettingsFragment } private void applyAdblockEnabled(boolean enabledValue) { +- mFilterLists.setEnabled(enabledValue); +- mAcceptableAdsEnabled.setEnabled(enabledValue); + mStartUpdate.setEnabled(enabledValue); + mPrivilegedFilters.setEnabled(enabledValue); - mFilterLists.setEnabled(enabledValue); - mAcceptableAdsEnabled.setEnabled(enabledValue); -+ mAcceptableAdsEnabled.setVisible(false); mAllowedDomains.setEnabled(enabledValue); mMoreOptions.setEnabled(enabledValue); -- mMoreOptions.setVisible(AdblockController.getInstance().areMoreOptionsEnabled()); -+ mMoreOptions.setVisible(false); + mMoreOptions.setVisible(areMoreOptionsEnabled()); } private void synchronizePreferences() { @@ -1858,7 +1931,7 @@ diff --git a/components/adblock/android/java/src/org/chromium/components/adblock boolean enabled = AdblockController.getInstance().isEnabled(); mAdblockEnabled.setChecked(enabled); mAdblockEnabled.setOnPreferenceChangeListener(this); -@@ -103,7 +140,7 @@ public class AdblockSettingsFragment +@@ -107,7 +142,7 @@ public class AdblockSettingsFragment @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { @@ -1867,7 +1940,7 @@ diff --git a/components/adblock/android/java/src/org/chromium/components/adblock bindPreferences(); synchronizePreferences(); } -@@ -122,6 +159,8 @@ public class AdblockSettingsFragment +@@ -126,6 +161,8 @@ public class AdblockSettingsFragment maybeEnableMoreOptions(); applyAdblockEnabled((Boolean) newValue); @@ -1957,9 +2030,9 @@ diff --git a/components/adblock/content/browser/adblock_webcontents_observer.cc + void TraceHandleLoadComplete( - content::RenderFrameHost* frame_host, + intptr_t rfh_trace_id, @@ -66,18 +68,32 @@ void TraceHandleLoadComplete( - TRACE_ID_LOCAL(frame_host)); + TRACE_ID_LOCAL(rfh_trace_id)); } +bool IsFilteringNeeded(content::RenderFrameHost* frame, HostContentSettingsMap* settings_map) { @@ -2042,6 +2115,18 @@ diff --git a/components/adblock/content/browser/content_security_policy_injector for (const auto& collection : subscription_collections) { const auto injection = collection->GetCspInjections(request_url, frame_hierarchy_chain); +diff --git a/components/adblock/content/browser/element_hider_impl.cc b/components/adblock/content/browser/element_hider_impl.cc +--- a/components/adblock/content/browser/element_hider_impl.cc ++++ b/components/adblock/content/browser/element_hider_impl.cc +@@ -208,7 +208,7 @@ void InsertUserCSSAndApplyElemHidingEmuJS( + if (!frame_host) { + // Render frame host was destroyed before element hiding could be applied. + // This is not a bug, just legitimate a race condition. +- std::move(on_finished).Run(std::move(input)); ++ std::move(on_finished).Run(ElementHider::ElemhideInjectionData{}); + return; + } + auto* info = ElementHiderInfo::GetOrCreateForCurrentDocument(frame_host); diff --git a/components/adblock/content/browser/subscription_service_factory_base.cc b/components/adblock/content/browser/subscription_service_factory_base.cc --- a/components/adblock/content/browser/subscription_service_factory_base.cc +++ b/components/adblock/content/browser/subscription_service_factory_base.cc @@ -2081,7 +2166,7 @@ diff --git a/components/adblock/content/browser/subscription_service_factory_bas } base::DeleteFile(path); return result; -@@ -202,10 +204,11 @@ SubscriptionServiceFactoryBase::ConvertCustomFilters( +@@ -201,10 +203,11 @@ SubscriptionServiceFactoryBase::ConvertCustomFilters( void SubscriptionServiceFactoryBase::ConvertFilterListFile( const GURL& subscription_url, const base::FilePath& path, @@ -2185,9 +2270,8 @@ diff --git a/components/adblock/core/activeping_telemetry_topic_provider.cc b/co deleted file mode 100644 --- a/components/adblock/core/activeping_telemetry_topic_provider.cc +++ /dev/null -@@ -1,243 +0,0 @@ --/* -- * This file is part of eyeo Chromium SDK, +@@ -1,285 +0,0 @@ +-/* This file is part of eyeo Chromium SDK, - * Copyright (C) 2006-present eyeo GmbH - * - * eyeo Chromium SDK is free software: you can redistribute it and/or modify @@ -2209,8 +2293,10 @@ deleted file mode 100644 -#include "base/json/json_writer.h" -#include "base/system/sys_info.h" -#include "base/time/time.h" +-#include "base/time/time_to_iso8601.h" -#include "base/uuid.h" -#include "components/adblock/core/common/adblock_prefs.h" +-#include "components/adblock/core/subscription/subscription_config.h" - -namespace adblock { -namespace { @@ -2258,12 +2344,12 @@ deleted file mode 100644 -ActivepingTelemetryTopicProvider::ActivepingTelemetryTopicProvider( - utils::AppInfo app_info, - PrefService* pref_service, -- AdblockController* adblock_controller, +- SubscriptionService* subscription_service, - const GURL& base_url, - const std::string& auth_token) - : app_info_(std::move(app_info)), - pref_service_(pref_service), -- adblock_controller_(adblock_controller), +- subscription_service_(subscription_service), - base_url_(base_url), - auth_token_(auth_token) {} - @@ -2304,35 +2390,13 @@ deleted file mode 100644 - return auth_token_; -} - --void ActivepingTelemetryTopicProvider::GetPayload(PayloadCallback callback) { -- base::Value::Dict payload; -- payload.Set("addon_name", "eyeo-chromium-sdk"); -- payload.Set("addon_version", "2.0.0"); -- payload.Set("application", app_info_.name); -- payload.Set("application_version", app_info_.version); -- payload.Set("aa_active", adblock_controller_->IsAcceptableAdsEnabled()); -- payload.Set("platform", base::SysInfo::OperatingSystemName()); -- payload.Set("platform_version", base::SysInfo::OperatingSystemVersion()); -- // Server requires the following parameters to either have a correct, -- // non-empty value, or not be present at all. We shall not send empty strings. -- AppendStringIfPresent(pref_service_, common::prefs::kTelemetryLastPingTag, -- "last_ping_tag", payload); -- AppendStringIfPresent(pref_service_, common::prefs::kTelemetryFirstPingTime, -- "first_ping", payload); -- AppendStringIfPresent(pref_service_, common::prefs::kTelemetryLastPingTime, -- "last_ping", payload); -- AppendStringIfPresent(pref_service_, -- common::prefs::kTelemetryPreviousLastPingTime, -- "previous_last_ping", payload); -- -- base::Value::Dict root; -- root.Set("payload", std::move(payload)); +-void ActivepingTelemetryTopicProvider::GetPayload( +- PayloadCallback callback) const { - std::string serialized; - // The only way JSONWriter::Write() can return fail is then the Value - // contains lists or dicts that are too deep (200 levels). We just built the - // payload and root objects here, they should be really shallow. -- CHECK(base::JSONWriter::Write(root, &serialized)); -- VLOG(1) << "[eyeo] Telemetry ping payload: " << serialized; +- CHECK(base::JSONWriter::Write(GetPayloadInternal(), &serialized)); - std::move(callback).Run(std::move(serialized)); -} - @@ -2390,6 +2454,35 @@ deleted file mode 100644 - UpdatePrefs(*ping_response_time); -} - +-void ActivepingTelemetryTopicProvider::FetchDebugInfo( +- DebugInfoCallback callback) const { +- base::Value::Dict debug_info; +- debug_info.Set("endpoint_url", GetEndpointURL().spec()); +- debug_info.Set("payload", GetPayloadInternal()); +- debug_info.Set("first_ping", +- pref_service_->GetString( +- adblock::common::prefs::kTelemetryFirstPingTime)); +- debug_info.Set("time_of_next_request", +- base::TimeToISO8601(GetTimeOfNextRequest())); +- debug_info.Set( +- "last_ping", +- pref_service_->GetString(adblock::common::prefs::kTelemetryLastPingTime)); +- debug_info.Set("previous_last_ping", +- pref_service_->GetString( +- adblock::common::prefs::kTelemetryPreviousLastPingTime)); +- debug_info.Set("next_ping", +- base::TimeToISO8601(pref_service_->GetTime( +- adblock::common::prefs::kTelemetryNextPingTime))); +- +- std::string serialized; +- // The only way JSONWriter::Write() can return fail is then the Value +- // contains lists or dicts that are too deep (200 levels). We just built the +- // payload and root objects here, they should be really shallow. +- CHECK(base::JSONWriter::WriteWithOptions( +- debug_info, base::JsonOptions::OPTIONS_PRETTY_PRINT, &serialized)); +- std::move(callback).Run(std::move(serialized)); +-} +- -void ActivepingTelemetryTopicProvider::ScheduleNextPing(base::TimeDelta delay) { - pref_service_->SetTime(common::prefs::kTelemetryNextPingTime, - base::Time::Now() + delay); @@ -2416,26 +2509,60 @@ deleted file mode 100644 - tag.AsLowercaseString()); -} - --// static --void ActivepingTelemetryTopicProvider::SetHttpPortForTesting( -- int http_port_for_testing) { -- g_http_port_for_testing = http_port_for_testing; --} -- --// static --void ActivepingTelemetryTopicProvider::SetIntervalsForTesting( -- base::TimeDelta time_delta) { -- g_time_delta_for_testing = time_delta; --} -- --} // namespace adblock -diff --git a/components/adblock/core/activeping_telemetry_topic_provider.h b/components/adblock/core/activeping_telemetry_topic_provider.h -deleted file mode 100644 ---- a/components/adblock/core/activeping_telemetry_topic_provider.h -+++ /dev/null -@@ -1,84 +0,0 @@ --/* -- * This file is part of eyeo Chromium SDK, +-base::Value ActivepingTelemetryTopicProvider::GetPayloadInternal() const { +- base::Value::Dict payload; +- bool aa_enabled = false; +- auto* adblock_configuration = +- subscription_service_->GetAdblockFilteringConfiguration(); +- if (adblock_configuration) { +- aa_enabled = base::ranges::any_of( +- adblock_configuration->GetFilterLists(), +- [&](const auto& url) { return url == AcceptableAdsUrl(); }); +- } +- payload.Set("addon_name", "eyeo-chromium-sdk"); +- payload.Set("addon_version", "2.0.0"); +- payload.Set("application", app_info_.name); +- payload.Set("application_version", app_info_.version); +- payload.Set("aa_active", aa_enabled); +- payload.Set("platform", base::SysInfo::OperatingSystemName()); +- payload.Set("platform_version", base::SysInfo::OperatingSystemVersion()); +- // Server requires the following parameters to either have a correct, +- // non-empty value, or not be present at all. We shall not send empty strings. +- AppendStringIfPresent(pref_service_, common::prefs::kTelemetryLastPingTag, +- "last_ping_tag", payload); +- AppendStringIfPresent(pref_service_, common::prefs::kTelemetryFirstPingTime, +- "first_ping", payload); +- AppendStringIfPresent(pref_service_, common::prefs::kTelemetryLastPingTime, +- "last_ping", payload); +- AppendStringIfPresent(pref_service_, +- common::prefs::kTelemetryPreviousLastPingTime, +- "previous_last_ping", payload); +- +- base::Value::Dict root; +- root.Set("payload", std::move(payload)); +- return base::Value(std::move(root)); +-} +- +-// static +-void ActivepingTelemetryTopicProvider::SetHttpPortForTesting( +- int http_port_for_testing) { +- g_http_port_for_testing = http_port_for_testing; +-} +- +-// static +-void ActivepingTelemetryTopicProvider::SetIntervalsForTesting( +- base::TimeDelta time_delta) { +- g_time_delta_for_testing = time_delta; +-} +- +-} // namespace adblock +diff --git a/components/adblock/core/activeping_telemetry_topic_provider.h b/components/adblock/core/activeping_telemetry_topic_provider.h +deleted file mode 100644 +--- a/components/adblock/core/activeping_telemetry_topic_provider.h ++++ /dev/null +@@ -1,87 +0,0 @@ +-/* +- * This file is part of eyeo Chromium SDK, - * Copyright (C) 2006-present eyeo GmbH - * - * eyeo Chromium SDK is free software: you can redistribute it and/or modify @@ -2456,9 +2583,9 @@ deleted file mode 100644 - -#include "base/memory/raw_ptr.h" -#include "base/time/time.h" --#include "components/adblock/core/adblock_controller.h" -#include "components/adblock/core/adblock_telemetry_service.h" -#include "components/adblock/core/common/adblock_utils.h" +-#include "components/adblock/core/subscription/subscription_service.h" -#include "components/prefs/pref_service.h" - -namespace adblock { @@ -2477,7 +2604,7 @@ deleted file mode 100644 - public: - ActivepingTelemetryTopicProvider(utils::AppInfo app_info, - PrefService* pref_service, -- AdblockController* adblock_controller, +- SubscriptionService* subscription_service, - const GURL& base_url, - const std::string& auth_token); - ~ActivepingTelemetryTopicProvider() final; @@ -2487,7 +2614,7 @@ deleted file mode 100644 - - GURL GetEndpointURL() const final; - std::string GetAuthToken() const final; -- void GetPayload(PayloadCallback callback) final; +- void GetPayload(PayloadCallback callback) const final; - - // Normally 12 hours since last ping, 1 hour in case of retries. - base::Time GetTimeOfNextRequest() const final; @@ -2496,6 +2623,8 @@ deleted file mode 100644 - // from |response_content|. - void ParseResponse(std::unique_ptr response_content) final; - +- void FetchDebugInfo(DebugInfoCallback callback) const final; +- - // Sets the port used by the embedded http server required for browser tests. - // Must be called before the first call to DefaultBaseUrl(). - static void SetHttpPortForTesting(int http_port_for_testing); @@ -2507,10 +2636,11 @@ deleted file mode 100644 - private: - void ScheduleNextPing(base::TimeDelta delay); - void UpdatePrefs(const std::string& ping_response_time); +- base::Value GetPayloadInternal() const; - - const utils::AppInfo app_info_; - raw_ptr pref_service_; -- raw_ptr adblock_controller_; +- raw_ptr subscription_service_; - const GURL base_url_; - const std::string auth_token_; -}; @@ -2518,55 +2648,10 @@ deleted file mode 100644 -} // namespace adblock - -#endif // COMPONENTS_ADBLOCK_CORE_ACTIVEPING_TELEMETRY_TOPIC_PROVIDER_H_ -diff --git a/components/adblock/core/adblock_controller.h b/components/adblock/core/adblock_controller.h ---- a/components/adblock/core/adblock_controller.h -+++ b/components/adblock/core/adblock_controller.h -@@ -24,6 +24,7 @@ - #include "base/observer_list.h" - #include "components/adblock/core/subscription/installed_subscription.h" - #include "components/adblock/core/subscription/subscription_config.h" -+#include "components/adblock/core/subscription/subscription_persistent_metadata.h" - #include "components/keyed_service/core/keyed_service.h" - - class GURL; -@@ -43,10 +44,17 @@ class AdblockController : public KeyedService { - virtual void SetAcceptableAdsEnabled(bool enabled) = 0; - virtual bool IsAcceptableAdsEnabled() const = 0; - -+ virtual void StartUpdate() = 0; -+ virtual raw_ptr GetMetadata() = 0; -+ virtual void SetPrivilegedFiltersEnabled(bool enabled) = 0; -+ virtual bool IsPrivilegedFiltersEnabled() = 0; -+ - virtual void InstallSubscription(const GURL& url) = 0; - virtual void UninstallSubscription(const GURL& url) = 0; - virtual std::vector> GetInstalledSubscriptions() - const = 0; -+ virtual std::vector> GetCustomSubscriptions() -+ const = 0; - - virtual void AddAllowedDomain(const std::string& domain) = 0; - virtual void RemoveAllowedDomain(const std::string& domain) = 0; diff --git a/components/adblock/core/adblock_controller_impl.cc b/components/adblock/core/adblock_controller_impl.cc --- a/components/adblock/core/adblock_controller_impl.cc +++ b/components/adblock/core/adblock_controller_impl.cc -@@ -73,6 +73,15 @@ absl::optional MigrateBoolFromPrefs(PrefService* pref_service, - return absl::nullopt; - } - -+bool IsKnownSubscription( -+ const std::vector& known_subscriptions, -+ const GURL& url) { -+ return base::ranges::any_of(known_subscriptions, -+ [&](const auto& known_subscription) { -+ return known_subscription.url == url; -+ }); -+} -+ - } // namespace - - AdblockControllerImpl::AdblockControllerImpl( -@@ -103,6 +112,7 @@ bool AdblockControllerImpl::IsAdblockEnabled() const { +@@ -103,6 +103,7 @@ bool AdblockControllerImpl::IsAdblockEnabled() const { } void AdblockControllerImpl::SetAcceptableAdsEnabled(bool enabled) { @@ -2574,62 +2659,15 @@ diff --git a/components/adblock/core/adblock_controller_impl.cc b/components/adb if (enabled) { InstallSubscription(AcceptableAdsUrl()); } else { -@@ -116,7 +126,33 @@ bool AdblockControllerImpl::IsAcceptableAdsEnabled() const { - [&](const auto& url) { return url == AcceptableAdsUrl(); }); +@@ -117,6 +118,7 @@ bool AdblockControllerImpl::IsAcceptableAdsEnabled() const { } -+void AdblockControllerImpl::StartUpdate() { -+ subscription_service_->StartUpdate(); -+} -+ -+raw_ptr AdblockControllerImpl::GetMetadata() { -+ return subscription_service_->GetMetadataFor(adblock_filtering_configuration_); -+} -+ -+bool AdblockControllerImpl::IsPrivilegedFiltersEnabled() { -+ return adblock_filtering_configuration_->IsPrivilegedFiltersEnabled(); -+} -+ -+void AdblockControllerImpl::SetPrivilegedFiltersEnabled(bool enabled) { -+ adblock_filtering_configuration_->SetPrivilegedFiltersEnabled(enabled); -+ for (const auto& cur : known_subscriptions_) { -+ if (config::AllowPrivilegedFilters(cur.url)) { -+ if (enabled) -+ InstallSubscription(cur.url); -+ else -+ UninstallSubscription(cur.url); -+ } -+ } -+ StartUpdate(); -+} -+ void AdblockControllerImpl::InstallSubscription(const GURL& url) { + if (url == AcceptableAdsUrl()) return; adblock_filtering_configuration_->AddFilterList(url); } -@@ -129,6 +165,20 @@ AdblockControllerImpl::GetInstalledSubscriptions() const { - return GetSubscriptionsThatMatchConfiguration(); - } - -+std::vector> -+AdblockControllerImpl::GetCustomSubscriptions() const { -+ auto selected = GetInstalledSubscriptions(); -+ std::vector known = GetKnownSubscriptions(); -+ selected.erase(base::ranges::remove_if(selected, -+ [&](const auto& subscription) { -+ return IsKnownSubscription( -+ known, -+ subscription->GetSourceUrl()); -+ }), -+ selected.end()); -+ return selected; -+} -+ - void AdblockControllerImpl::AddAllowedDomain(const std::string& domain) { - adblock_filtering_configuration_->AddAllowedDomain(domain); - } -@@ -165,10 +215,8 @@ void AdblockControllerImpl::RunFirstRunLogic(PrefService* pref_service) { +@@ -165,10 +167,8 @@ void AdblockControllerImpl::RunFirstRunLogic(PrefService* pref_service) { common::prefs::kInstallFirstStartSubscriptions)) { // On first run, install additional subscriptions. for (const auto& cur : known_subscriptions_) { @@ -2642,7 +2680,7 @@ diff --git a/components/adblock/core/adblock_controller_impl.cc b/components/adb // Do not install Acceptable Ads on first run because a command line // switch forbids it. Mostly used for testing. continue; -@@ -236,7 +284,7 @@ void AdblockControllerImpl::InstallLanguageBasedRecommendedSubscriptions() { +@@ -236,7 +236,7 @@ void AdblockControllerImpl::InstallLanguageBasedRecommendedSubscriptions() { SubscriptionFirstRunBehavior::SubscribeIfLocaleMatch && std::find(subscription.languages.begin(), subscription.languages.end(), language_) != subscription.languages.end()) { @@ -2651,27 +2689,6 @@ diff --git a/components/adblock/core/adblock_controller_impl.cc b/components/adb << language_ << "\": " << subscription.title; language_specific_subscription_installed = true; InstallSubscription(subscription.url); -diff --git a/components/adblock/core/adblock_controller_impl.h b/components/adblock/core/adblock_controller_impl.h ---- a/components/adblock/core/adblock_controller_impl.h -+++ b/components/adblock/core/adblock_controller_impl.h -@@ -58,10 +58,17 @@ class AdblockControllerImpl : public AdblockController { - void SetAcceptableAdsEnabled(bool enabled) override; - bool IsAcceptableAdsEnabled() const override; - -+ void StartUpdate() override; -+ raw_ptr GetMetadata() override; -+ void SetPrivilegedFiltersEnabled(bool enabled) override; -+ bool IsPrivilegedFiltersEnabled() override; -+ - void InstallSubscription(const GURL& url) override; - void UninstallSubscription(const GURL& url) override; - std::vector> GetInstalledSubscriptions() - const override; -+ std::vector> GetCustomSubscriptions() -+ const override; - - void AddAllowedDomain(const std::string& domain) override; - void RemoveAllowedDomain(const std::string& domain) override; diff --git a/components/adblock/core/adblock_switches.cc b/components/adblock/core/adblock_switches.cc --- a/components/adblock/core/adblock_switches.cc +++ b/components/adblock/core/adblock_switches.cc @@ -2698,7 +2715,7 @@ diff --git a/components/adblock/core/adblock_telemetry_service.cc b/components/a deleted file mode 100644 --- a/components/adblock/core/adblock_telemetry_service.cc +++ /dev/null -@@ -1,244 +0,0 @@ +@@ -1,258 +0,0 @@ -/* - * This file is part of eyeo Chromium SDK, - * Copyright (C) 2006-present eyeo GmbH @@ -2720,6 +2737,7 @@ deleted file mode 100644 - -#include - +-#include "base/barrier_callback.h" -#include "base/functional/bind.h" -#include "base/memory/weak_ptr.h" -#include "base/strings/string_number_conversions.h" @@ -2816,6 +2834,10 @@ deleted file mode 100644 - url_loader_.reset(); - } - +- const std::unique_ptr& GetTopicProvider() const { +- return topic_provider_; +- } +- - private: - bool IsRequestInFlight() { - return url_loader_ != nullptr || weak_ptr_factory_.HasWeakPtrs(); @@ -2910,6 +2932,15 @@ deleted file mode 100644 - OnEnabledStateChangedInternal(); -} - +-void AdblockTelemetryService::GetTopicProvidersDebugInfo( +- TopicProvidersDebugInfoCallback service_callback) const { +- const auto barrier_callback = base::BarrierCallback( +- ongoing_conversations_.size(), std::move(service_callback)); +- for (const auto& conversation : ongoing_conversations_) { +- conversation->GetTopicProvider()->FetchDebugInfo(barrier_callback); +- } +-} +- -void AdblockTelemetryService::OnEnabledStateChangedInternal() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - if (adblock_filtering_configuration_->IsEnabled() && !timer_.IsRunning()) { @@ -2947,7 +2978,7 @@ diff --git a/components/adblock/core/adblock_telemetry_service.h b/components/ad deleted file mode 100644 --- a/components/adblock/core/adblock_telemetry_service.h +++ /dev/null -@@ -1,107 +0,0 @@ +@@ -1,120 +0,0 @@ -/* - * This file is part of eyeo Chromium SDK, - * Copyright (C) 2006-present eyeo GmbH @@ -2972,6 +3003,7 @@ deleted file mode 100644 -#include -#include - +-#include "base/functional/callback_forward.h" -#include "base/memory/raw_ptr.h" -#include "base/sequence_checker.h" -#include "base/time/time.h" @@ -2999,6 +3031,7 @@ deleted file mode 100644 - class TopicProvider { - public: - using PayloadCallback = base::OnceCallback; +- using DebugInfoCallback = base::OnceCallback; - virtual ~TopicProvider() = default; - // Endpoint URL on the Telemetry server onto which requests should be sent. - virtual GURL GetEndpointURL() const = 0; @@ -3006,7 +3039,7 @@ deleted file mode 100644 - virtual std::string GetAuthToken() const = 0; - // Data uploaded with the request, should be valid for the schema - // present on the server. Async to allow querying asynchronous data sources. -- virtual void GetPayload(PayloadCallback callback) = 0; +- virtual void GetPayload(PayloadCallback callback) const = 0; - // Returns the desired time when AdblockTelemetryService should make the - // next network request. - virtual base::Time GetTimeOfNextRequest() const = 0; @@ -3015,6 +3048,10 @@ deleted file mode 100644 - // response errors via GetTimeToNextRequest(). - virtual void ParseResponse( - std::unique_ptr response_content) = 0; +- // Gets debugging info to be logged on chrome://adblock-internals. Do not +- // put any secrets here (tokens, api keys). Asynchronous to allow reusing +- // the async logic of GetPayload, if needed. +- virtual void FetchDebugInfo(DebugInfoCallback callback) const = 0; - }; - AdblockTelemetryService( - FilteringConfiguration* filtering_configuration, @@ -3022,6 +3059,8 @@ deleted file mode 100644 - base::TimeDelta initial_delay, - base::TimeDelta check_interval); - ~AdblockTelemetryService() override; +- using TopicProvidersDebugInfoCallback = +- base::OnceCallback)>; - - // Add all required topic providers before calling Start(). - void AddTopicProvider(std::unique_ptr topic_provider); @@ -3037,6 +3076,11 @@ deleted file mode 100644 - // FilteringConfiguration::Observer - void OnEnabledStateChanged(FilteringConfiguration* config) override; - +- // Collects debug information from all topic providers. Runs |callback| once +- // all topic providers have provided their info. +- void GetTopicProvidersDebugInfo( +- TopicProvidersDebugInfoCallback callback) const; +- - private: - void OnEnabledStateChangedInternal(); - void RunPeriodicCheck(); @@ -3232,7 +3276,7 @@ diff --git a/components/adblock/core/configuration/filtering_configuration.h b/c + // Adding an existing filter list, or removing a non-existing filter list, are // NOPs and do not notify observers. - virtual void AddFilterList(GURL url) = 0; + virtual void AddFilterList(const GURL& url) = 0; diff --git a/components/adblock/core/configuration/persistent_filtering_configuration.cc b/components/adblock/core/configuration/persistent_filtering_configuration.cc --- a/components/adblock/core/configuration/persistent_filtering_configuration.cc +++ b/components/adblock/core/configuration/persistent_filtering_configuration.cc @@ -3277,8 +3321,8 @@ diff --git a/components/adblock/core/configuration/persistent_filtering_configur + void SetPrivilegedFiltersEnabled(bool enabled) final; + bool IsPrivilegedFiltersEnabled() final; + - void AddFilterList(GURL url) final; - void RemoveFilterList(GURL url) final; + void AddFilterList(const GURL& url) final; + void RemoveFilterList(const GURL& url) final; std::vector GetFilterLists() const final; diff --git a/components/adblock/core/converter/flatbuffer_converter.cc b/components/adblock/core/converter/flatbuffer_converter.cc --- a/components/adblock/core/converter/flatbuffer_converter.cc @@ -3884,7 +3928,7 @@ diff --git a/components/adblock/core/subscription/subscription_collection_impl.c diff --git a/components/adblock/core/subscription/subscription_config.cc b/components/adblock/core/subscription/subscription_config.cc --- a/components/adblock/core/subscription/subscription_config.cc +++ b/components/adblock/core/subscription/subscription_config.cc -@@ -221,17 +221,17 @@ const std::vector& config::GetKnownSubscriptions() { +@@ -239,17 +239,17 @@ const std::vector& config::GetKnownSubscriptions() { SubscriptionFirstRunBehavior::SubscribeIfLocaleMatch, SubscriptionPrivilegedFilterStatus::Forbidden}, {AcceptableAdsUrl(), @@ -3907,7 +3951,7 @@ diff --git a/components/adblock/core/subscription/subscription_config.cc b/compo {GURL(GetHost() + "i_dont_care_about_cookies.txt"), "I don't care about cookies", {}, -@@ -262,13 +262,13 @@ const std::vector& config::GetKnownSubscriptions() { +@@ -280,13 +280,13 @@ const std::vector& config::GetKnownSubscriptions() { {}, SubscriptionUiVisibility::Invisible, SubscriptionFirstRunBehavior::Ignore, @@ -3923,7 +3967,7 @@ diff --git a/components/adblock/core/subscription/subscription_config.cc b/compo // You can customize subscriptions available on first run and in settings // here. Items are displayed in settings in order declared here. See -@@ -297,7 +297,7 @@ bool config::AllowPrivilegedFilters(const GURL& url) { +@@ -315,7 +315,7 @@ bool config::AllowPrivilegedFilters(const GURL& url) { for (const auto& cur : GetKnownSubscriptions()) { if (cur.url == url) { return cur.privileged_status == @@ -3932,7 +3976,7 @@ diff --git a/components/adblock/core/subscription/subscription_config.cc b/compo } } -@@ -307,9 +307,7 @@ bool config::AllowPrivilegedFilters(const GURL& url) { +@@ -325,9 +325,7 @@ bool config::AllowPrivilegedFilters(const GURL& url) { const std::vector& config::GetPreloadedSubscriptionConfiguration() { static const std::vector preloaded_subscriptions = @@ -4153,23 +4197,103 @@ diff --git a/components/adblock/core/subscription/subscription_persistent_storag diff --git a/components/adblock/core/subscription/subscription_service.h b/components/adblock/core/subscription/subscription_service.h --- a/components/adblock/core/subscription/subscription_service.h +++ b/components/adblock/core/subscription/subscription_service.h -@@ -77,6 +77,9 @@ class SubscriptionService : public KeyedService { - // concurrently, and future changes to the installed subscriptions will not - // impact it. - virtual Snapshot GetCurrentSnapshot() const = 0; +@@ -38,6 +38,15 @@ namespace adblock { + // FilteringConfigurations. + class SubscriptionService : public KeyedService { + public: + virtual void StartUpdate() = 0; ++ virtual raw_ptr GetMetadata() = 0; + virtual raw_ptr GetMetadataFor( + raw_ptr configuration) = 0; - - virtual void AddObserver(SubscriptionObserver*) = 0; - virtual void RemoveObserver(SubscriptionObserver*) = 0; ++ virtual void SetPrivilegedFiltersEnabled(bool enabled) = 0; ++ virtual bool IsPrivilegedFiltersEnabled() = 0; ++ virtual std::vector> GetCustomSubscriptions( ++ FilteringConfiguration* configuration) const = 0; ++ + using Snapshot = std::vector>; + class SubscriptionObserver : public base::CheckedObserver { + public: diff --git a/components/adblock/core/subscription/subscription_service_impl.cc b/components/adblock/core/subscription/subscription_service_impl.cc --- a/components/adblock/core/subscription/subscription_service_impl.cc +++ b/components/adblock/core/subscription/subscription_service_impl.cc -@@ -133,6 +133,18 @@ void SubscriptionServiceImpl::UninstallFilteringConfiguration( +@@ -36,9 +36,23 @@ + #include "components/adblock/core/subscription/filtering_configuration_maintainer.h" + #include "components/adblock/core/subscription/subscription_collection.h" + #include "components/adblock/core/subscription/subscription_service.h" ++#include "components/adblock/core/subscription/subscription_config.h" + + namespace adblock { + ++namespace { ++ ++bool IsKnownSubscription( ++ const std::vector& known_subscriptions, ++ const GURL& url) { ++ return base::ranges::any_of(known_subscriptions, ++ [&](const auto& known_subscription) { ++ return known_subscription.url == url; ++ }); ++} ++ ++} ++ + class EmptySubscription : public Subscription { + public: + EmptySubscription(const GURL& url) : url_(url) {} +@@ -133,6 +147,68 @@ void SubscriptionServiceImpl::UninstallFilteringConfiguration( maintainers_.erase(it); } ++void SubscriptionServiceImpl::StartUpdate() { ++ for (auto& entry : maintainers_) { ++ if (!entry.second) { ++ continue; // Configuration is disabled ++ } ++ entry.second->StartUpdate(); ++ } ++} ++ ++bool SubscriptionServiceImpl::IsPrivilegedFiltersEnabled() { ++ auto* adblock_filtering_configuration = GetAdblockFilteringConfiguration(); ++ return adblock_filtering_configuration->IsPrivilegedFiltersEnabled(); ++} ++ ++void SubscriptionServiceImpl::SetPrivilegedFiltersEnabled(bool enabled) { ++ auto* adblock_filtering_configuration = GetAdblockFilteringConfiguration(); ++ adblock_filtering_configuration->SetPrivilegedFiltersEnabled(enabled); ++ auto known_subscriptions = adblock::config::GetKnownSubscriptions(); ++ for (const auto& cur : known_subscriptions) { ++ if (config::AllowPrivilegedFilters(cur.url)) { ++ if (enabled) ++ adblock_filtering_configuration->AddFilterList(cur.url); ++ else ++ adblock_filtering_configuration->RemoveFilterList(cur.url); ++ } ++ } ++ StartUpdate(); ++} ++ ++std::vector> ++SubscriptionServiceImpl::GetCustomSubscriptions( ++ FilteringConfiguration* configuration) const { ++ std::vector> selected = ++ GetCurrentSubscriptions(configuration); ++ ++ auto known_subscriptions = adblock::config::GetKnownSubscriptions(); ++ selected.erase(base::ranges::remove_if(selected, ++ [&](const auto& subscription) { ++ return IsKnownSubscription( ++ known_subscriptions, ++ subscription->GetSourceUrl()); ++ }), ++ selected.end()); ++ return selected; ++} ++ ++raw_ptr SubscriptionServiceImpl::GetMetadata() { ++ return GetMetadataFor(GetAdblockFilteringConfiguration()); ++} ++ +raw_ptr SubscriptionServiceImpl::GetMetadataFor( + raw_ptr configuration) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); @@ -4179,205 +4303,3964 @@ diff --git a/components/adblock/core/subscription/subscription_service_impl.cc b + if (it != maintainers_.end() && it->second) { + return it->second->GetMetadata(); + } -+ return nullptr; -+} ++ return nullptr; ++} ++ + std::vector + SubscriptionServiceImpl::GetInstalledFilteringConfigurations() { + std::vector result; +@@ -178,7 +254,7 @@ void SubscriptionServiceImpl::OnEnabledStateChanged( + }); + DCHECK(it != maintainers_.end()) << "Received OnEnabledStateChanged from " + "unregistered FilteringConfiguration"; +- VLOG(1) << "[eyeo] FilteringConfiguration " << config->GetName() ++ LOG(INFO) << "[eyeo] FilteringConfiguration " << config->GetName() + << (config->IsEnabled() ? " enabled" : " disabled"); + if (config->IsEnabled()) { + // Enable the configuration by creating a new +diff --git a/components/adblock/core/subscription/subscription_service_impl.h b/components/adblock/core/subscription/subscription_service_impl.h +--- a/components/adblock/core/subscription/subscription_service_impl.h ++++ b/components/adblock/core/subscription/subscription_service_impl.h +@@ -43,6 +43,15 @@ namespace adblock { + class SubscriptionServiceImpl final : public SubscriptionService, + public FilteringConfiguration::Observer { + public: ++ void StartUpdate() override; ++ raw_ptr GetMetadata() override; ++ raw_ptr GetMetadataFor( ++ raw_ptr configuration) final; ++ void SetPrivilegedFiltersEnabled(bool enabled) override; ++ bool IsPrivilegedFiltersEnabled() override; ++ std::vector> GetCustomSubscriptions( ++ FilteringConfiguration* configuration) const override; ++ + // Used to notify this about updates to installed subscriptions. + using SubscriptionUpdatedCallback = + base::RepeatingCallback; +diff --git a/components/adblock/core/subscription/subscription_updater_impl.cc b/components/adblock/core/subscription/subscription_updater_impl.cc +--- a/components/adblock/core/subscription/subscription_updater_impl.cc ++++ b/components/adblock/core/subscription/subscription_updater_impl.cc +@@ -38,7 +38,7 @@ void SubscriptionUpdaterImpl::StartSchedule( + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + DCHECK(!timer_.IsRunning()); + run_update_check_ = std::move(run_update_check); +- VLOG(1) << "[eyeo] Starting update schedule, first check scheduled for " ++ LOG(INFO) << "[eyeo] Starting update schedule, first check scheduled for " + << base::Time::Now() + initial_delay_; + timer_.Start(FROM_HERE, initial_delay_, + base::BindOnce(&SubscriptionUpdaterImpl::RunUpdateCheck, +@@ -47,14 +47,14 @@ void SubscriptionUpdaterImpl::StartSchedule( + + void SubscriptionUpdaterImpl::StopSchedule() { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); +- VLOG(1) << "[eyeo] Stopping update schedule"; ++ LOG(INFO) << "[eyeo] Stopping update schedule"; + timer_.Stop(); + } + + void SubscriptionUpdaterImpl::RunUpdateCheck() { +- VLOG(1) << "[eyeo] Running subscription update check"; ++ LOG(INFO) << "[eyeo] Running subscription update check"; + run_update_check_.Run(); +- VLOG(1) ++ LOG(INFO) + << "[eyeo] Subscription update check completed, next one scheduled for " + << base::Time::Now() + check_interval_; + timer_.Start(FROM_HERE, check_interval_, +diff --git a/components/adblock/core/subscription/subscription_validator_impl.cc b/components/adblock/core/subscription/subscription_validator_impl.cc +--- a/components/adblock/core/subscription/subscription_validator_impl.cc ++++ b/components/adblock/core/subscription/subscription_validator_impl.cc +@@ -64,11 +64,11 @@ bool IsSignatureValidInternal( + const auto* expected_hash = initial_subscription_signatures.FindString( + path.BaseName().AsUTF8Unsafe()); + if (!expected_hash) { +- DLOG(WARNING) << "[eyeo] " << path << " has no matching signature in prefs"; ++ LOG(WARNING) << "[eyeo] " << path.BaseName().AsUTF8Unsafe() << " has no matching signature in prefs"; + return false; + } + if (*expected_hash != ComputeSubscriptionHash(data)) { +- DLOG(WARNING) << "[eyeo] " << path << " has invalid signature in prefs"; ++ LOG(WARNING) << "[eyeo] " << path.BaseName().AsUTF8Unsafe() << " has invalid signature in prefs"; + return false; + } + return true; +diff --git a/components/content_settings/core/browser/bromite_content_settings/ads.inc b/components/content_settings/core/browser/bromite_content_settings/ads.inc +new file mode 100644 +--- /dev/null ++++ b/components/content_settings/core/browser/bromite_content_settings/ads.inc +@@ -0,0 +1,3 @@ ++ content_settings::WebsiteSettingsRegistry::GetInstance() ++ ->GetMutable(ContentSettingsType::ADS) ++ ->set_show_into_info_page(); +diff --git a/components/resources/BUILD.gn b/components/resources/BUILD.gn +--- a/components/resources/BUILD.gn ++++ b/components/resources/BUILD.gn +@@ -76,7 +76,6 @@ grit("components_resources") { + + deps += [ + "//components/resources/adblocking:copy_snippets_lib", +- "//components/resources/adblocking:make_all_preloaded_subscriptions", + ] + } + +diff --git a/components/resources/adblock_resources.grdp b/components/resources/adblock_resources.grdp +--- a/components/resources/adblock_resources.grdp ++++ b/components/resources/adblock_resources.grdp +@@ -21,7 +21,4 @@ + + + +- +- +- + +diff --git a/components/resources/adblocking/.gitignore b/components/resources/adblocking/.gitignore +--- a/components/resources/adblocking/.gitignore ++++ b/components/resources/adblocking/.gitignore +@@ -1 +1 @@ +-snippets ++#snippets +diff --git a/components/resources/adblocking/BUILD.gn b/components/resources/adblocking/BUILD.gn +--- a/components/resources/adblocking/BUILD.gn ++++ b/components/resources/adblocking/BUILD.gn +@@ -18,7 +18,7 @@ import("//build/compiled_action.gni") + + # Converts text-format filter lists into flatbuffers using a standalone + # converter tool. +-template("make_preloaded_subscription") { ++template("make_preloaded_subscription_NO") { + compiled_action(target_name) { + tool = "//components/adblock/core/converter:adblock_flatbuffer_converter" + inputs = [ invoker.input ] +@@ -31,34 +31,6 @@ template("make_preloaded_subscription") { + } + } + +-# Note, url is *not* used to download the list during build time, only to +-# identify the subscription. Consider it metadata. +-make_preloaded_subscription("make_easylist") { +- input = "//components/resources/adblocking/easylist.txt.gz" +- url = "https://easylist-downloads.adblockplus.org/easylist.txt" +- output = "${target_gen_dir}/easylist.fb" +-} +- +-make_preloaded_subscription("make_exceptionrules") { +- input = "//components/resources/adblocking/exceptionrules.txt.gz" +- url = "https://easylist-downloads.adblockplus.org/exceptionrules.txt" +- output = "${target_gen_dir}/exceptionrules.fb" +-} +- +-make_preloaded_subscription("make_anticv") { +- input = "//components/resources/adblocking/anticv.txt.gz" +- url = "https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt" +- output = "${target_gen_dir}/anticv.fb" +-} +- +-group("make_all_preloaded_subscriptions") { +- deps = [ +- ":make_anticv", +- ":make_easylist", +- ":make_exceptionrules", +- ] +-} +- + action("prepare_snippets_deps") { + script = "//tools/eyeo/snippets_deps.py" + inputs = ["//components/resources/adblocking/snippets/dist"] +diff --git a/components/resources/adblocking/elemhide_for_selector.jst b/components/resources/adblocking/elemhide_for_selector.jst +--- a/components/resources/adblocking/elemhide_for_selector.jst ++++ b/components/resources/adblocking/elemhide_for_selector.jst +@@ -43,7 +43,7 @@ if (typeof(elemhideForSelector) !== typeof(Function)) + } + else + { +- console.debug("Nothing found for selector " + selector + ", retrying elemhide in 100 millis"); ++ //console.debug("Nothing found for selector " + selector + ", retrying elemhide in 100 millis"); + setTimeout(elemhideForSelector, 100, url, selector, attempt + 1); + } + } +diff --git a/components/resources/adblocking/elemhideemu.jst b/components/resources/adblocking/elemhideemu.jst +--- a/components/resources/adblocking/elemhideemu.jst ++++ b/components/resources/adblocking/elemhideemu.jst +@@ -1,3 +1,4 @@ ++(function() { + /* + * This file is part of eyeo Chromium SDK, + * Copyright (C) 2006-present eyeo GmbH +@@ -1434,3 +1435,4 @@ let elemHideEmulation = new ElemHideEmulation( + ); + + elemHideEmulation.apply(elemHidingEmulatedPatterns); ++})() +diff --git a/components/resources/adblocking/snippets/dist/isolated-first-xpath3.jst b/components/resources/adblocking/snippets/dist/isolated-first-xpath3.jst +new file mode 100644 +--- /dev/null ++++ b/components/resources/adblocking/snippets/dist/isolated-first-xpath3.jst +@@ -0,0 +1,62 @@ ++(e, ...t) => { ++/*! ++ * This file is part of eyeo's Anti-Circumvention Snippets module (@eyeo/snippets), ++ * Copyright (C) 2006-present eyeo GmbH ++ * ++ * @eyeo/snippets is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 3 as ++ * published by the Free Software Foundation. ++ * ++ * @eyeo/snippets is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with @eyeo/snippets. If not, see . ++ */ ++ ((environment, ...filters) => { ++const e=Proxy,{apply:t,bind:n,call:o}=Function,r=o.bind(t),i=o.bind(n),s=o.bind(o),a={get:(e,t)=>i(o,e[t])},c=t=>new e(t,a),l={get:(e,t)=>i(e[t],e)},u=t=>new e(t,l),{assign:d,defineProperties:h,freeze:f,getOwnPropertyDescriptor:p,getOwnPropertyDescriptors:w,getPrototypeOf:m}=u(Object),{hasOwnProperty:g}=c({}),{species:b}=Symbol,y={get(e,t){const n=e[t];class o extends n{}const r=w(n.prototype);delete r.constructor,f(h(o.prototype,r));const i=w(n);return delete i.length,delete i.prototype,i[b]={value:o},f(h(o,i))}},v=t=>new e(t,y),S="undefined"!=typeof environment?environment:{};"undefined"==typeof globalThis&&(window.globalThis=window);const{apply:k,ownKeys:E}=u(Reflect),x="world"in S,M=x&&"ISOLATED"===S.world,C=x&&"MAIN"===S.world,T="object"==typeof chrome&&!!chrome.runtime,W="object"==typeof browser&&!!browser.runtime,L=!C&&(M||T||W),O=e=>L?e:P(e,R(e)),{create:P,defineProperties:D,defineProperty:N,freeze:A,getOwnPropertyDescriptor:I,getOwnPropertyDescriptors:R}=u(Object),V=u(globalThis),$=L?globalThis:v(globalThis),{Map:H,RegExp:_,Set:j,WeakMap:X,WeakSet:F}=$,q=(e,t,n=null)=>{const o=E(t);for(const r of E(e)){if(o.includes(r))continue;const i=I(e,r);if(n&&"value"in i){const{value:e}=i;"function"==typeof e&&(i.value=n(e))}N(t,r,i)}},B=e=>{const t=$[e];class n extends t{}const{toString:o,valueOf:r}=t.prototype;D(n.prototype,{toString:{value:o},valueOf:{value:r}});const i=e.toLowerCase(),s=e=>function(){const t=k(e,this,arguments);return typeof t===i?new n(t):t};return q(t,n,s),q(t.prototype,n.prototype,s),n},z=A({frozen:new X,hidden:new F,iframePropertiesToAbort:{read:new j,write:new j},abortedIframes:new X}),U=new _("^[A-Z]");var G=new Proxy(new H([["chrome",L&&(T&&chrome||W&&browser)||void 0],["isExtensionContext",L],["variables",z],["console",O(console)],["document",globalThis.document],["performance",O(performance)],["JSON",O(JSON)],["Map",H],["Math",O(Math)],["Number",L?Number:B("Number")],["RegExp",_],["Set",j],["String",L?String:B("String")],["WeakMap",X],["WeakSet",F],["MouseEvent",MouseEvent]]),{get(e,t){if(e.has(t))return e.get(t);let n=globalThis[t];return"function"==typeof n&&(n=(U.test(t)?$:V)[t]),e.set(t,n),n},has:(e,t)=>e.has(t)});const J={WeakSet:WeakSet,WeakMap:WeakMap,WeakValue:class{has(){return!1}set(){}}},{apply:Q}=Reflect;const{Map:Y,WeakMap:K,WeakSet:Z,setTimeout:ee}=G;let te=!0,ne=e=>{e.clear(),te=!te};var oe=function(e){const{WeakSet:t,WeakMap:n,WeakValue:o}=this||J,r=new t,i=new n,s=new o;return function(t){if(r.has(t))return t;if(i.has(t))return i.get(t);if(s.has(t))return s.get(t);const n=Q(e,this,arguments);return r.add(n),n!==t&&("object"==typeof t&&t?i:s).set(t,n),n}}.bind({WeakMap:K,WeakSet:Z,WeakValue:class extends Y{set(e,t){return te&&(te=!te,ee(ne,0,this)),super.set(e,t)}}});const{concat:re,includes:ie,join:se,reduce:ae,unshift:ce}=c([]),le=v(globalThis),{Map:ue,WeakMap:de}=le,he=new ue,fe=t=>{const n=(e=>{const t=[];let n=e;for(;n;){if(he.has(n))ce(t,he.get(n));else{const e=w(n);he.set(n,e),ce(t,e)}n=m(n)}return ce(t,{}),r(d,null,t)})("function"==typeof t?t.prototype:t),o={get(e,t){if(t in n){const{value:o,get:r}=n[t];if(r)return s(r,e);if("function"==typeof o)return i(o,e)}return e[t]},set(e,t,o){if(t in n){const{set:r}=n[t];if(r)return s(r,e,o),!0}return e[t]=o,!0}};return t=>new e(t,o)},{isExtensionContext:pe,Array:we,Number:me,String:ge,Object:be}=G,{isArray:ye}=we,{getOwnPropertyDescriptor:ve,setPrototypeOf:Se}=be,{toString:ke}=be.prototype,{slice:Ee}=ge.prototype,{get:xe}=ve(Node.prototype,"nodeType"),Me=pe?{}:{Attr:fe(Attr),CanvasRenderingContext2D:fe(CanvasRenderingContext2D),CSSStyleDeclaration:fe(CSSStyleDeclaration),Document:fe(Document),Element:fe(Element),HTMLCanvasElement:fe(HTMLCanvasElement),HTMLElement:fe(HTMLElement),HTMLImageElement:fe(HTMLImageElement),HTMLScriptElement:fe(HTMLScriptElement),MutationRecord:fe(MutationRecord),Node:fe(Node),ShadowRoot:fe(ShadowRoot),get CSS2Properties(){return Me.CSSStyleDeclaration}},Ce=(e,t)=>{if("Element"!==t&&t in Me)return Me[t](e);if(ye(e))return Se(e,we.prototype);const n=(e=>s(Ee,s(ke,e),8,-1))(e);if(n in Me)return Me[n](e);if(n in G)return Se(e,G[n].prototype);if("nodeType"in e)switch(s(xe,e)){case 1:if(!(t in Me))throw new Error("unknown hint "+t);return Me[t](e);case 2:return Me.Attr(e);case 3:return Me.Node(e);case 9:return Me.Document(e)}throw new Error("unknown brand "+n)};var Te=pe?e=>e===window||e===globalThis?G:e:oe(((e,t="Element")=>{if(e===window||e===globalThis)return G;switch(typeof e){case"object":return e&&Ce(e,t);case"string":return new ge(e);case"number":return new me(e);default:throw new Error("unsupported value")}}));let{document:We,getComputedStyle:Le,isExtensionContext:Oe,variables:Pe,Array:De,MutationObserver:Ne,Object:Ae,XPathEvaluator:Ie,XPathExpression:Re,XPathResult:Ve}=Te(window),{querySelectorAll:$e}=We,He=$e&&i($e,We);const{assign:_e,setPrototypeOf:je}=Ae;class Xe extends Re{evaluate(...e){return je(r(super.evaluate,this,e),Ve.prototype)}}class Fe extends Ie{createExpression(...e){return je(r(super.createExpression,this,e),Xe.prototype)}}function qe(e){if(Pe.hidden.has(e))return;!function(e){Oe&&"function"==typeof checkElement&&checkElement(e)}(e),Pe.hidden.add(e);let{style:t}=Te(e),n=Te(t,"CSSStyleDeclaration"),o=Te([]),{debugCSSProperties:r}=S;for(let[e,t]of r||[["display","none"]])n.setProperty(e,t,"important"),o.push([e,n.getPropertyValue(e)]);new Ne((()=>{for(let[e,t]of o){let o=n.getPropertyValue(e),r=n.getPropertyPriority(e);o==t&&"important"==r||n.setProperty(e,t,"important")}})).observe(e,{attributes:!0,attributeFilter:["style"]})}function Be(e){let t=e;if(t.startsWith("xpath(")&&t.endsWith(")")){let e=t.slice(6,-1),n=(new Fe).createExpression(e,null),o=Ve.ORDERED_NODE_SNAPSHOT_TYPE;return e=>{if(!e)return;let t=n.evaluate(We,o,null),{snapshotLength:r}=t;for(let n=0;nHe(e).forEach(t)}function ze(e,t,n,o){let r;null==n&&(n=t);const i=()=>{for(const i of He(n)){const n=Te(i).closest(t);n&&e(i,n)&&(r(),qe(n),"function"==typeof o&&o(n))}};return _e(new Ne(i),{race(e){r=e,this.observe(We,{childList:!0,characterData:!0,subtree:!0}),i()}})}function Ue(e,t,n){let o=Te(t,"CSSStyleDeclaration");if("none"==o.getPropertyValue("display"))return!1;let r=o.getPropertyValue("visibility");if("hidden"==r||"collapse"==r)return!1;if(!n||e==n)return!0;let i=Te(e).parentElement;return!i||Ue(i,Le(i),n)}function Ge(e){let t=Le(e),{cssText:n}=t;if(n)return n;for(let e of t)n+=`${e}: ${t[e]}; `;return Te(n).trim()}let{Math:Je,RegExp:Qe}=Te(window);function Ye(e){let{length:t}=e;if(t>1&&"/"===e[0]){let n="/"===e[t-1];if(n||t>2&&Te(e).endsWith("/i")){let t=[Te(e).slice(1,n?-1:-2)];return n||t.push("i"),new Qe(...t)}}return new Qe(Te(e).replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))}let Ke=!1;function Ze(){return Ke}const{console:et}=Te(window),tt=()=>{};function nt(...e){Ze()&&Te(e).unshift("%c DEBUG","font-weight: bold"),et.log(...e)}function ot(e){return i(Ze()?nt:tt,null,e)}let{Array:rt,Error:it,Map:st,parseInt:at}=Te(window),ct=null,lt=null;function ut(e,t){if(null===ct)return tt;let n=ct,{participants:o}=n;return o.set(r,t),r;function r(){if(n.winners<1)return;if(ot("race")(`${e} won the race`),n===ct)lt.push(r);else if(o.delete(r),--n.winners<1){for(let e of o.values())e();o.clear()}}}const dt={get(e,t){const n=e;for(;!g(e,t);)e=m(e);const{get:o,set:i}=p(e,t);return function(){return arguments.length?r(i,n,arguments):s(o,n)}}};var ht;function ft(e,t,n){var o,r;n?"load"===n?(e("Waiting until window.load"),window.onload=()=>{e("Window.load fired."),t()}):"loading"===n||"interactive"===n||"complete"===n?(e("Waiting document state until :",n),document.onreadystatechange=()=>{e("Document state changed:",document.readyState),document.readyState===n&&t()}):(e("Waiting until ",n," event is triggered on document"),(o=document,r=n,new Promise((e=>{const t=()=>{o.removeEventListener(r,t),e()};o.addEventListener(r,t)}))).then((()=>{e(n," is triggered on document, starting the snippet"),t()})).catch((t=>{e("There was an error while waiting for the event.",t)}))):t()}Te(window),ht=window,new e(ht,dt),Te(/^\d+$/);let{MutationObserver:pt,WeakSet:wt,getComputedStyle:mt}=Te(window);let{clearTimeout:gt,fetch:bt,getComputedStyle:yt,setTimeout:vt,Map:St,MutationObserver:kt,Uint8Array:Et}=Te(window);let xt=new St;function Mt(e,{as:t="arrayBuffer",cleanup:n=6e4}={}){let o=t+":"+e,r=xt.get(o)||{remove:()=>xt.delete(o),result:null,timer:0};return gt(r.timer),r.timer=vt(r.remove,n),r.result||(r.result=bt(e).then((e=>e[t]())).catch(r.remove),xt.set(o,r)),r.result}function Ct(e){return e.reduce(((e,t)=>e+function(e,t=2){let n=Te(e).toString(16);return n.length{const n=e.length+1,o=t.length+1,r=[[0]];let i=0,s=0;for(;++i"{mark(){},end(){}}"};function zt(e,t=10){return Bt}let{MutationObserver:Ut,WeakSet:Gt}=Te(window);const{ELEMENT_NODE:Jt}=Node;let{MutationObserver:Qt,WeakSet:Yt}=Te(window);const{ELEMENT_NODE:Kt}=Node;let{parseInt:Zt,setTimeout:en,Error:tn,MouseEvent:nn,MutationObserver:on,WeakSet:rn}=Te(window);let{parseInt:sn,setTimeout:an,Error:cn,MouseEvent:ln,MutationObserver:un,WeakSet:dn}=Te(window);const hn=["auxclick","click","dblclick","gotpointercapture","lostpointercapture","mouseenter","mousedown","mouseleave","mousemove","mouseout","mouseover","mouseup","pointerdown","pointerenter","pointermove","pointerover","pointerout","pointerup","pointercancel","pointerleave"];const fn={log:nt,race:function(e,t="1"){switch(e){case"start":ct={winners:at(t,10)||1,participants:new st},lt=new rt;break;case"end":case"finish":case"stop":ct=null;for(let e of lt)e();lt=null;break;default:throw new it(`Invalid action: ${e}`)}},debug:function(){Ke=!0},"hide-if-matches-xpath":function(e,t){const{mark:n,end:o}=zt(),r=ot("hide-if-matches-xpath"),i=t=>{const i=Be(`xpath(${e})`),s=new Gt,a=()=>{n(),i((t=>{if(s.has(t))return!1;s.add(t),l(),Te(t).nodeType===Jt?qe(t):Te(t).textContent="",r("Matched: ",t," for selector: ",e)})),o()},c=new Ut(a),l=ut("hide-if-matches-xpath",(()=>c.disconnect()));c.observe(t,{characterData:!0,childList:!0,subtree:!0}),a()};if(t){let e,n=0;const o=Be(`xpath(${t})`),r=()=>{o((e=>{i(e),n++})),n>0&&e.disconnect()};e=new Ut(r),e.observe(document,{characterData:!0,childList:!0,subtree:!0}),r()}else i(document)},"hide-if-matches-computed-xpath":function(e,t,n,o){const{mark:r,end:i}=zt(),s=ot("hide-if-matches-computed-xpath");if(!t||!e)return void s("No query or searchQuery provided.");const a=t=>{const n=(t=>e.replace("{{}}",t))(t);s("Starting hiding elements that match query: ",n);const o=Be(`xpath(${n})`),a=new Yt,c=()=>{r(),o((t=>{if(a.has(t))return!1;a.add(t),u(),Te(t).nodeType===Kt?qe(t):Te(t).textContent="",s("Matched: ",t," for selector: ",e)})),i()},l=new Qt(c),u=ut("hide-if-matches-computed-xpath",(()=>l.disconnect()));l.observe(document,{characterData:!0,childList:!0,subtree:!0}),c()},c=Ye(n);ft(s,(()=>{if(t){s("Started searching for: ",t);const e=new Yt;let n;const o=Be(`xpath(${t})`),r=()=>{o((t=>{if(e.has(t))return!1;if(e.add(t),s("Found node: ",t),t.innerHTML){s("Searching in: ",t.innerHTML);const e=t.innerHTML.match(c);if(e&&e.length){let t="";t=e[1]?e[1]:e[0],s("Matched search query: ",t),a(t)}}}))};n=new Qt(r),n.observe(document,{characterData:!0,childList:!0,subtree:!0}),r()}}),o)},"hide-if-contains":function(e,t="*",n=null){const o=ot("hide-if-contains");let r=Ye(e);const i=ze((e=>r.test(Te(e).textContent)),t,n,(e=>{o("Matched: ",e," for selector: ",t,n)}));i.race(ut("hide-if-contains",(()=>{i.disconnect()})))},"hide-if-contains-similar-text":function(e,t,n=null,o=0,r=0){const i=new Ot,s=ot("hide-if-contains-similar-text"),a=Te(e),{length:c}=a,l=c+Tt(o)||0,u=Te([...a]).sort(),d=Tt(r)||1/0;null==n&&(n=t),s("Looking for similar text: "+a);const h=()=>{for(const e of He(n)){if(i.has(e))continue;i.add(e);const{innerText:n}=Te(e),r=Pt(d,n.length-l+1);for(let i=0;if.disconnect()));f.observe(document,{childList:!0,characterData:!0,subtree:!0}),h()},"hide-if-contains-visible-text":function(e,t,n=null,...o){let r=Te([]);const i=new At([["-snippet-box-margin","2"],["-disable-bg-color-check","false"],["-check-is-contained","false"]]);for(let e of o){e=Te(e);let t=e.indexOf(":");if(t<0)continue;let n=e.slice(0,t).trim().toString(),o=e.slice(t+1).trim().toString();n&&o&&(i.has(n)?i.set(n,o):r.push([n,o]))}let s=Te([["opacity","0"],["font-size","0px"],["color","rgba(0, 0, 0, 0)"]]),a=new At(s.concat(r));function c(e,t,{bgColorCheck:n=!0}={}){t||(t=Nt(e)),t=Te(t);for(const[e,n]of a){if(Ye(n).test(t.getPropertyValue(e)))return!1}let o=t.getPropertyValue("color");return!n||t.getPropertyValue("background-color")!=o}function l(e,t,{bgColorCheck:n=!0}={}){let o=Nt(e,t);if(!Ue(e,o)||!c(e,o,{bgColorCheck:n}))return"";let{content:r}=Te(o);if(r&&"none"!==r){let t=Te([]);return r=Te(r).trim().replace(/(["'])(?:(?=(\\?))\2.)*?\1/g,(e=>""+(t.push(Te(e).slice(1,-1))-1))),r=r.replace(/\s*attr\(\s*([^\s,)]+)[^)]*?\)\s*/g,((t,n)=>Te(e).getAttribute(n)||"")),r.replace(/\x01(\d+)/g,((e,n)=>t[n]))}return""}function u(e,t,{boxMargin:n=2}={}){const o=Te(e).getBoundingClientRect(),r=Te(t).getBoundingClientRect(),i=r.left-n,s=r.right+n,a=r.top-n,c=r.bottom+n;return i<=o.left&&o.left<=s&&a<=o.top&&o.top<=c&&a<=o.bottom&&o.bottom<=c&&i<=o.right&&o.right<=s}function d(e,t,n,o,r,{boxMargin:i=2,bgColorCheck:s,checkIsContained:a}={}){let h=!n;if(h&&(n=Nt(e)),!Ue(e,n,h&&t))return"";o||"hidden"!==Te(n).getPropertyValue("overflow-x")&&"hidden"!==Te(n).getPropertyValue("overflow-y")||(o=e);let f=l(e,":before",{bgColorCheck:s});for(let t of Te(e).childNodes)switch(Te(t).nodeType){case Vt:f+=d(t,e,Nt(t),o,r,{boxMargin:i,bgColorCheck:s,checkIsContained:a});break;case $t:if(o)u(e,o,{boxMargin:i})&&c(e,n,{bgColorCheck:s})&&(f+=Te(t).nodeValue);else if(c(e,n,{bgColorCheck:s})){if(a&&!u(e,r,{boxMargin:i}))continue;f+=Te(t).nodeValue}}return f+l(e,":after",{bgColorCheck:s})}const h=i.get("-snippet-box-margin"),f=Rt(h)||0,p=!("true"===i.get("-disable-bg-color-check")),w="true"===i.get("-check-is-contained");let m=Ye(e),g=new It;const b=ze(((e,t)=>{if(g.has(e))return!1;g.add(e);let n=d(e,t,null,null,e,{boxMargin:f,bgColorCheck:p,checkIsContained:w}),o=m.test(n);return Ze()&&n.length&&nt(o,m,n),o}),t,n);b.race(ut("hide-if-contains-visible-text",(()=>{b.disconnect()})))},"hide-if-contains-and-matches-style":function(e,t="*",n=null,o=null,r=null,i,s=null,a=null){const c=ot("hide-if-contains-and-matches-style"),l=new wt;null==n&&(n=t);const u=Ye(e),d=o?Ye(o):null,h=r?Ye(r):null,f=()=>{const e=()=>{if(!(s&&window.innerWidtha))for(const e of He(n))if(!l.has(e)&&u.test(Te(e).textContent))if(!h||h.test(Ge(e))){const n=Te(e).closest(t);if(!n)continue;!d||d.test(Ge(n))?(r(),qe(n),l.add(e),c("Matched: ",n,"which contains: ",e," for params: ",...arguments)):c("In this element the searchStyle matched but style didn't:\n",n,mt(n),...arguments)}else c("In this element the searchStyle didn't match:\n",e,mt(e),...arguments)},o=new pt(e),r=ut("hide-if-contains-and-matches-style",(()=>o.disconnect()));o.observe(document,{childList:!0,characterData:!0,subtree:!0}),e()};ft(c,f,i)},"hide-if-has-and-matches-style":function(e,t="*",n=null,o=null,r=null,i=null,s=null,a=null){const c=ot("hide-if-has-and-matches-style"),l=new _t;null==n&&(n=t);const u=o?Ye(o):null,d=r?Ye(r):null,h=()=>{const o=()=>{if(!(s&&window.innerWidtha))for(const o of He(n))if(!l.has(o))if(!Te(o).querySelector(e)||d&&!d.test(Ge(o)))c("In this element the searchStyle didn't match:\n",o,jt(o),...arguments);else{const e=Te(o).closest(t);!e||u&&!u.test(Ge(e))?c("In this element the searchStyle matched but style didn't:\n",e,jt(e),...arguments):(i(),qe(e),l.add(o),c("Matched: ",e,"which contains: ",o," for params: ",...arguments))}},r=new Ht(o),i=ut("hide-if-has-and-matches-style",(()=>r.disconnect()));r.observe(document,{childList:!0,subtree:!0}),o()};ft(c,h,i)},"hide-if-labelled-by":function(e,t,n=null){let o=null==n,r=Ye(e),i=new qt,s=()=>{for(let e of He(t)){let t=o?e:Te(e).closest(n);if(!t||!Ue(e,Xt(e),t))continue;let s=Te(e).getAttribute("aria-labelledby"),a=()=>{i.has(t)||r.test(Te(e).getAttribute("aria-label")||"")&&(c(),i.add(t),qe(t))};if(s)for(let e of Te(s).split(/\s+/)){let n=Te(document).getElementById(e);n?!i.has(n)&&r.test(n.innerText)&&(c(),i.add(n),qe(t)):a()}else a()}},a=new Ft(s),c=ut("hide-if-labelled-by",(()=>a.disconnect()));a.observe(document,{characterData:!0,childList:!0,subtree:!0}),s()},"hide-if-contains-image":function(e,t,n){null==n&&(n=t);let o=Ye(e);const r=ot("hide-if-contains-image");let i=()=>{for(let e of He(n)){let n=yt(e),i=Te(n["background-image"]).match(/^url\("(.*)"\)$/);i&&Mt(i[1]).then((n=>{if(o.test(Ct(new Et(n)))){let n=Te(e).closest(t);n&&(a(),qe(n),r("Matched: ",n," for:",...arguments))}}))}},s=new kt(i),a=ut("hide-if-contains-image",(()=>s.disconnect()));s.observe(document,{childList:!0,subtree:!0}),i()},"simulate-event-poc":function(e,t,n="0"){if(!e)throw new tn("[simulate-event snippet]: No event type provided.");if(!t)throw new tn("[simulate-event snippet]: No selector provided.");let o=Be(t),r=Zt(n,10),i=new rn;function s(){o((t=>{i.has(t)||(i.add(t),en((()=>{Te(t).dispatchEvent(new nn(e,{bubbles:!0,cancelable:!0}))}),r))}))}new on(s).observe(document,{childList:!0,subtree:!0}),s()},"simulate-mouse-event":function(...e){const t=ot("simulate-mouse-event");if(e.length<1)throw new cn("[simulate-mouse-event snippet]: No selector provided.");e.length>7&&(e=e.slice(0,7));const n=Te([]);function o(){return n.forEach((e=>{if(!e.found){(function(e){let t=e;if(t.startsWith("xpath(")&&t.endsWith(")")){let t=Be(e);return()=>{let e=Te([]);return t((t=>e.push(t))),e}}return()=>De.from(He(e))})(e.selector)().length>0&&(e.found=!0)}})),n.every((e=>e.found))}function r(e,n,o){e&&n&&("click"===n&&e.click?(e.click(),t("Clicked on this node:\n",e,"\nwith a delay of",o,"ms")):(e.dispatchEvent(new ln(n,{bubbles:!0,cancelable:!0})),t("A",n,"event was dispatched with a delay of",o,"ms on this node:\n",e)))}Te(e).forEach((e=>{const o=function(e){if(!e)return null;const n={selector:"",continue:!1,trigger:!1,event:"click",delay:"500",clicked:!1,found:!1},o=e.split("$");let r=[];o.length>=2&&(r=o[1].toLowerCase().split(",")),[n.selector]=o;for(const e of r)if("trigger"===e)n.trigger=!0;else if("continue"===e)n.continue=!0;else if(e.startsWith("event")){const t=e.toLowerCase().split("=");t[1]?n.event=t[1]:n.event="click"}else if(e.startsWith("delay")){const t=e.toLowerCase().split("=");t[1]?n.delay=t[1]:n.delay="500"}return hn.includes(n.event)||t(n.event," might be misspelled, check for typos.\n","These are the supported events:",hn),n}(e);n.push(o)}));let i=!1;const[s]=n.slice(-1);s.trigger=!0;let a=new dn;function c(){if(i||(i=o()),i)for(const e of n){const t=Be(e.selector),n=sn(e.delay,10);e.trigger&&t((t=>{a.has(t)||(a.add(t),e.continue?setInterval((()=>{r(t,e.event,e.delay)}),n):an((()=>{r(t,e.event,e.delay)}),n))}))}}new un(c).observe(document,{childList:!0,subtree:!0}),c()}};let{MutationObserver:pn}=Te(window);const{ELEMENT_NODE:wn}=Node;fn["hide-if-matches-xpath3"]=function(e,t){let{mark:n,end:o}=zt();function r(){return fontoxpath.evaluateXPathToNodes(e,document,null,null,{language:fontoxpath.evaluateXPath.XQUERY_3_1_LANGUAGE})}let i=ot("hide-if-matches-xpath3");const s=t=>{const s=new WeakSet,a=()=>{n();const t=r();for(const n of Te(t)){if(s.has(n))return!1;s.add(n),l(),Te(n).nodeType===wn?qe(n):Te(n).textContent="",i("Matched: ",n," for selector: ",e)}o()},c=new pn(a),l=ut("hide-if-matches-xpath3",(()=>c.disconnect()));c.observe(t,{characterData:!0,childList:!0,subtree:!0}),a()};if(t){let e,t=0;const n=r(),o=()=>{for(const e of Te(n))s(e),t++;t>0&&e.disconnect()};e=new pn(o),e.observe(document,{characterData:!0,childList:!0,subtree:!0}),o()}else s(document)}; ++const snippets=fn; ++let context; ++for (const [name, ...args] of filters) { ++if (snippets.hasOwnProperty(name)) { ++try { context = snippets[name].apply(context, args); } ++catch (error) { console.error(error); } ++} ++} ++context = void 0; ++})(e, ...t); ++ ++const callback = (environment, ...filters) => { ++const e=Proxy,{apply:t,bind:r,call:n}=Function,o=n.bind(t),i=n.bind(r),s=n.bind(n),a={get:(e,t)=>i(n,e[t])},l=t=>new e(t,a),c=(t,r)=>new e(t,{apply:(e,t,n)=>o(r,t,n)}),u={get:(e,t)=>i(e[t],e)},f=t=>new e(t,u),{assign:p,defineProperties:d,freeze:h,getOwnPropertyDescriptor:w,getOwnPropertyDescriptors:g,getPrototypeOf:y}=f(Object),{hasOwnProperty:m}=l({}),{species:b}=Symbol,v={get(e,t){const r=e[t];class n extends r{}const o=g(r.prototype);delete o.constructor,h(d(n.prototype,o));const i=g(r);return delete i.length,delete i.prototype,i[b]={value:n},h(d(n,i))}},E=t=>new e(t,v),S="undefined"!=typeof environment?environment:{};"undefined"==typeof globalThis&&(window.globalThis=window);const{apply:M,ownKeys:T}=f(Reflect),x="world"in S,O=x&&"ISOLATED"===S.world,P=x&&"MAIN"===S.world,j="object"==typeof chrome&&!!chrome.runtime,N="object"==typeof browser&&!!browser.runtime,L=!P&&(O||j||N),k=e=>L?e:C(e,H(e)),{create:C,defineProperties:A,defineProperty:W,freeze:$,getOwnPropertyDescriptor:D,getOwnPropertyDescriptors:H}=f(Object),z=f(globalThis),R=L?globalThis:E(globalThis),{Map:F,RegExp:I,Set:J,WeakMap:V,WeakSet:B}=R,U=(e,t,r=null)=>{const n=T(t);for(const o of T(e)){if(n.includes(o))continue;const i=D(e,o);if(r&&"value"in i){const{value:e}=i;"function"==typeof e&&(i.value=r(e))}W(t,o,i)}},_=e=>{const t=R[e];class r extends t{}const{toString:n,valueOf:o}=t.prototype;A(r.prototype,{toString:{value:n},valueOf:{value:o}});const i=e.toLowerCase(),s=e=>function(){const t=M(e,this,arguments);return typeof t===i?new r(t):t};return U(t,r,s),U(t.prototype,r.prototype,s),r},X=$({frozen:new V,hidden:new B,iframePropertiesToAbort:{read:new J,write:new J},abortedIframes:new V}),q=new I("^[A-Z]");var G=new Proxy(new F([["chrome",L&&(j&&chrome||N&&browser)||void 0],["isExtensionContext",L],["variables",X],["console",k(console)],["document",globalThis.document],["performance",k(performance)],["JSON",k(JSON)],["Map",F],["Math",k(Math)],["Number",L?Number:_("Number")],["RegExp",I],["Set",J],["String",L?String:_("String")],["WeakMap",V],["WeakSet",B],["MouseEvent",MouseEvent]]),{get(e,t){if(e.has(t))return e.get(t);let r=globalThis[t];return"function"==typeof r&&(r=(q.test(t)?R:z)[t]),e.set(t,r),r},has:(e,t)=>e.has(t)});const K={WeakSet:WeakSet,WeakMap:WeakMap,WeakValue:class{has(){return!1}set(){}}},{apply:Y}=Reflect;const{Map:Z,WeakMap:Q,WeakSet:ee,setTimeout:te}=G;let re=!0,ne=e=>{e.clear(),re=!re};var oe=function(e){const{WeakSet:t,WeakMap:r,WeakValue:n}=this||K,o=new t,i=new r,s=new n;return function(t){if(o.has(t))return t;if(i.has(t))return i.get(t);if(s.has(t))return s.get(t);const r=Y(e,this,arguments);return o.add(r),r!==t&&("object"==typeof t&&t?i:s).set(t,r),r}}.bind({WeakMap:Q,WeakSet:ee,WeakValue:class extends Z{set(e,t){return re&&(re=!re,te(ne,0,this)),super.set(e,t)}}});const{concat:ie,includes:se,join:ae,reduce:le,unshift:ce}=l([]),ue=E(globalThis),{Map:fe,WeakMap:pe}=ue,de=new fe,he=t=>{const r=(e=>{const t=[];let r=e;for(;r;){if(de.has(r))ce(t,de.get(r));else{const e=g(r);de.set(r,e),ce(t,e)}r=y(r)}return ce(t,{}),o(p,null,t)})("function"==typeof t?t.prototype:t),n={get(e,t){if(t in r){const{value:n,get:o}=r[t];if(o)return s(o,e);if("function"==typeof n)return i(n,e)}return e[t]},set(e,t,n){if(t in r){const{set:o}=r[t];if(o)return s(o,e,n),!0}return e[t]=n,!0}};return t=>new e(t,n)},{isExtensionContext:we,Array:ge,Number:ye,String:me,Object:be}=G,{isArray:ve}=ge,{getOwnPropertyDescriptor:Ee,setPrototypeOf:Se}=be,{toString:Me}=be.prototype,{slice:Te}=me.prototype,{get:xe}=Ee(Node.prototype,"nodeType"),Oe=we?{}:{Attr:he(Attr),CanvasRenderingContext2D:he(CanvasRenderingContext2D),CSSStyleDeclaration:he(CSSStyleDeclaration),Document:he(Document),Element:he(Element),HTMLCanvasElement:he(HTMLCanvasElement),HTMLElement:he(HTMLElement),HTMLImageElement:he(HTMLImageElement),HTMLScriptElement:he(HTMLScriptElement),MutationRecord:he(MutationRecord),Node:he(Node),ShadowRoot:he(ShadowRoot),get CSS2Properties(){return Oe.CSSStyleDeclaration}},Pe=(e,t)=>{if("Element"!==t&&t in Oe)return Oe[t](e);if(ve(e))return Se(e,ge.prototype);const r=(e=>s(Te,s(Me,e),8,-1))(e);if(r in Oe)return Oe[r](e);if(r in G)return Se(e,G[r].prototype);if("nodeType"in e)switch(s(xe,e)){case 1:if(!(t in Oe))throw new Error("unknown hint "+t);return Oe[t](e);case 2:return Oe.Attr(e);case 3:return Oe.Node(e);case 9:return Oe.Document(e)}throw new Error("unknown brand "+r)};var je=we?e=>e===window||e===globalThis?G:e:oe(((e,t="Element")=>{if(e===window||e===globalThis)return G;switch(typeof e){case"object":return e&&Pe(e,t);case"string":return new me(e);case"number":return new ye(e);default:throw new Error("unsupported value")}}));const Ne={get(e,t){const r=e;for(;!m(e,t);)e=y(e);const{get:n,set:i}=w(e,t);return function(){return arguments.length?o(i,r,arguments):s(n,r)}}},Le=t=>new e(t,Ne);let ke=!1;function Ce(){return ke}const{console:Ae}=je(window),We=()=>{};function $e(...e){Ce()&&je(e).unshift("%c DEBUG","font-weight: bold"),Ae.log(...e)}function De(e){return i(Ce()?$e:We,null,e)}let{Math:He,RegExp:ze}=je(window);function Re(e){let{length:t}=e;if(t>1&&"/"===e[0]){let r="/"===e[t-1];if(r||t>2&&je(e).endsWith("/i")){let t=[je(e).slice(1,r?-1:-2)];return r||t.push("i"),new ze(...t)}}return new ze(je(e).replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"))}function Fe(){return je(He.floor(2116316160*He.random()+60466176)).toString(36)}let{parseFloat:Ie,variables:Je,Array:Ve,Error:Be,Map:Ue,Object:_e,ReferenceError:Xe,Set:qe,WeakMap:Ge}=je(window),{onerror:Ke}=Le(window),Ye=Node.prototype,Ze=Element.prototype,Qe=null;function et(e,t,r,n=!0){let o=je(t),i=o.indexOf(".");if(-1==i){let o=_e.getOwnPropertyDescriptor(e,t);if(o&&!o.configurable)return;let i=_e.assign({},r,{configurable:n});if(!o&&!i.get&&i.set){let r=e[t];i.get=()=>r}return void _e.defineProperty(e,t,i)}let s=o.slice(0,i).toString();t=o.slice(i+1).toString();let a=e[s];!a||"object"!=typeof a&&"function"!=typeof a||et(a,t,r);let l=_e.getOwnPropertyDescriptor(e,s);if(l&&!l.configurable)return;Qe||(Qe=new Ge),Qe.has(e)||Qe.set(e,new Ue);let c=Qe.get(e);if(c.has(s))return void c.get(s).set(t,r);let u=new Ue([[t,r]]);c.set(s,u),_e.defineProperty(e,s,{get:()=>a,set(e){if(a=e,a&&("object"==typeof a||"function"==typeof a))for(let[e,t]of u)et(a,e,t)},configurable:n})}function tt(e){let t=Ke();Ke(((...r)=>{let n=r.length&&r[0];return!("string"!=typeof n||!je(n).includes(e))||("function"==typeof t?o(t,this,r):void 0)}))}function rt(e,t,r,n=!0){let o=De(e);if(!r)return void o("no property to abort on read");let i=Fe();o(`aborting on ${r} access`),et(t,r,{get:function(){throw o(`${r} access aborted`),new Xe(i)},set(){}},n),tt(i)}function nt(e,t,r,n=!0){let o=De(e);if(!r)return void o("no property to abort on write");let i=Fe();o(`aborting when setting ${r}`),et(t,r,{set:function(){throw o(`setting ${r} aborted`),new Xe(i)}},n),tt(i)}function ot(e,t=!1,r=!1){let n=Je.abortedIframes,i=Je.iframePropertiesToAbort;for(let o of Ve.from(window.frames))if(n.has(o))for(let i of e)t&&n.get(o).read.add(i),r&&n.get(o).write.add(i);for(let n of e)t&&i.read.add(n),r&&i.write.add(n);function a(){for(let e of Ve.from(window.frames)){n.has(e)||n.set(e,{read:new qe(i.read),write:new qe(i.write)});let t=n.get(e).read;if(t.size>0){let r=Ve.from(t);t.clear();for(let t of r)rt("abort-on-iframe-property-read",e,t)}let r=n.get(e).write;if(r.size>0){let t=Ve.from(r);r.clear();for(let r of t)nt("abort-on-iframe-property-write",e,r)}}}a(),n.has(document)||(n.set(document,!0),function(e){let t;function r(e,t){for(let r of t){et(e,r,n(e,r))}}function n(t,r){let n=t[r];return{get:()=>function(...t){let r;return r=o(n,this,t),e&&e(),r}}}function i(t,r){let n=_e.getOwnPropertyDescriptor(t,r),{set:o}=n||{};return{set(t){let r;return r=s(o,this,t),e&&e(),r}}}r(Ye,["appendChild","insertBefore","replaceChild"]),r(Ze,["append","prepend","replaceWith","after","before","insertAdjacentElement","insertAdjacentHTML"]),t=i(Ze,"innerHTML"),et(Ze,"innerHTML",t),t=i(Ze,"outerHTML"),et(Ze,"outerHTML",t)}(a))}let{Object:it}=window;function st(e,t){if(!(e instanceof it))return;let r=e,n=je(t).split(".");if(0===n.length)return;for(let e=0;e{};case"trueFunc":return()=>!0;case"falseFunc":return()=>!1;case"emptyArray":return[];case"emptyObj":return{};case"undefined":return;case"":return e;default:if(at.test(e))return Ie(e);throw new Be(`[override-property-read snippet]: Value "${e}" is not valid.`)}}let{HTMLScriptElement:ct,Object:ut,ReferenceError:ft}=je(window),pt=ut.getPrototypeOf(ct);let{Error:dt}=je(window),{cookie:ht}=Le(document);let{document:wt,getComputedStyle:gt,isExtensionContext:yt,variables:mt,Array:bt,MutationObserver:vt,Object:Et,XPathEvaluator:St,XPathExpression:Mt,XPathResult:Tt}=je(window),{querySelectorAll:xt}=wt,Ot=xt&&i(xt,wt);const{assign:Pt,setPrototypeOf:jt}=Et;class Nt extends Mt{evaluate(...e){return jt(o(super.evaluate,this,e),Tt.prototype)}}class Lt extends St{createExpression(...e){return jt(o(super.createExpression,this,e),Nt.prototype)}}function kt(e){if(mt.hidden.has(e))return;!function(e){yt&&"function"==typeof checkElement&&checkElement(e)}(e),mt.hidden.add(e);let{style:t}=je(e),r=je(t,"CSSStyleDeclaration"),n=je([]),{debugCSSProperties:o}=S;for(let[e,t]of o||[["display","none"]])r.setProperty(e,t,"important"),n.push([e,r.getPropertyValue(e)]);new vt((()=>{for(let[e,t]of n){let n=r.getPropertyValue(e),o=r.getPropertyPriority(e);n==t&&"important"==o||r.setProperty(e,t,"important")}})).observe(e,{attributes:!0,attributeFilter:["style"]})}function Ct(e){let t=e;if(t.startsWith("xpath(")&&t.endsWith(")")){let t=function(e){let t=e;if(t.startsWith("xpath(")&&t.endsWith(")")){let e=t.slice(6,-1),r=(new Lt).createExpression(e,null),n=Tt.ORDERED_NODE_SNAPSHOT_TYPE;return e=>{if(!e)return;let t=r.evaluate(wt,n,null),{snapshotLength:o}=t;for(let r=0;rOt(e).forEach(t)}(e);return()=>{let e=je([]);return t((t=>e.push(t))),e}}return()=>bt.from(Ot(e))}let{ELEMENT_NODE:At,TEXT_NODE:Wt,prototype:$t}=Node,{prototype:Dt}=Element,{prototype:Ht}=HTMLElement,{console:zt,variables:Rt,DOMParser:Ft,Error:It,MutationObserver:Jt,Object:Vt,ReferenceError:Bt}=je(window),{getOwnPropertyDescriptor:Ut}=Vt;function _t(e,t){return We}je(window);const{Map:Xt,MutationObserver:qt,Object:Gt,Set:Kt,WeakSet:Yt}=je(window);let Zt=Element.prototype,{attachShadow:Qt}=Zt,er=new Yt,tr=new Xt,rr=null;const{Error:nr,JSON:or,Map:ir,Object:sr}=je(window);let ar=null;let{Error:lr,JSON:cr,Map:ur,Object:fr}=je(window),pr=null;let{Error:dr}=je(window);let{Error:hr,Map:wr,Object:gr,console:yr}=je(window),{toString:mr}=Function.prototype,br=EventTarget.prototype,{addEventListener:vr}=br,Er=null;let Sr,{URL:Mr,fetch:Tr}=je(window),{delete:xr,has:Or}=l(URLSearchParams.prototype);const Pr={"abort-current-inline-script":function(e,t=null){const r=De("abort-current-inline-script"),n=t?Re(t):null,o=Fe(),i=je(document).currentScript;let a=window;const l=je(e).split("."),c=je(l).pop();for(let e of je(l))if(a=a[e],!a||"object"!=typeof a&&"function"!=typeof a)return void r(l," is not found");const{get:u,set:f}=ut.getOwnPropertyDescriptor(a,c)||{};let p=a[c];void 0===p&&r("The property",c,"doesn't exist yet. Check typos.");const d=()=>{const e=je(document).currentScript;if(e instanceof pt&&""==je(e,"HTMLScriptElement").src&&e!=i&&(!n||n.test(je(e).textContent)))throw r(l," is aborted \n",e),new ft(o)};et(a,c,{get(){return d(),u?s(u,this):p},set(e){d(),f?s(f,this,e):p=e}}),tt(o)},"abort-on-iframe-property-read":function(...e){ot(e,!0,!1)},"abort-on-iframe-property-write":function(...e){ot(e,!1,!0)},"abort-on-property-read":function(e,t){rt("abort-on-property-read",window,e,!("false"===t))},"abort-on-property-write":function(e,t){nt("abort-on-property-write",window,e,!("false"===t))},"cookie-remover":function(e){if(!e)throw new dt("[cookie-remover snippet]: No cookie to remove.");let t=De("cookie-remover"),r=Re(e);if(je(/^http|^about/).test(location.protocol)){t("Parsing cookies for matches");for(const e of je(je(ht()).split(";").filter((e=>r.test(je(e).split("=")[0]))))){let r=je(location.hostname),n=je(e).split("=")[0],o="expires=Thu, 01 Jan 1970 00:00:00 GMT",i="path=/",s="domain="+r.slice(r.indexOf(".")+1);ht(`${je(n).trim()}=;${o};${i};${s}`),t(`Set expiration date on ${n}`)}}else t("Snippet only works for http or https and about.")},debug:function(){ke=!0},"freeze-element":function(e,t="",...r){let n,i,a=!1,l=!1,c=je(r).filter((e=>!h(e))),u=je(r).filter((e=>h(e))).map(Re),f=Fe(),p=Ct(e);!function(){let r=je(t).split("+");1===r.length&&""===r[0]&&(r=[]);for(let t of r)switch(t){case"subtree":a=!0;break;case"abort":l=!0;break;default:throw new It("[freeze] Unknown option passed to the snippet. [selector]: "+e+" [option]: "+t)}}();let d={selector:e,shouldAbort:l,rid:f,exceptionSelectors:c,regexExceptions:u,changeId:0};function h(e){return e.length>=2&&"/"==e[0]&&"/"==e[e.length-1]}function w(){i=p(),g(i,!1)}function g(e,t=!0){for(let r of e)Rt.frozen.has(r)||(Rt.frozen.set(r,d),!t&&a&&new Jt((e=>{for(let t of je(e))g(je(t,"MutationRecord").addedNodes)})).observe(r,{childList:!0,subtree:!0}),a&&je(r).nodeType===At&&g(je(r).childNodes))}function y(e,...t){$e(`[freeze][${e}] `,...t)}function m(e,t,r,n){let o=n.selector,i=n.changeId,s="string"==typeof e,a=n.shouldAbort?"aborting":"watching";switch(zt.groupCollapsed(`[freeze][${i}] ${a}: ${o}`),r){case"appendChild":case"append":case"prepend":case"insertBefore":case"replaceChild":case"insertAdjacentElement":case"insertAdjacentHTML":case"insertAdjacentText":case"innerHTML":case"outerHTML":y(i,s?"text: ":"node: ",e),y(i,"added to node: ",t);break;case"replaceWith":case"after":case"before":y(i,s?"text: ":"node: ",e),y(i,"added to node: ",je(t).parentNode);break;case"textContent":case"innerText":case"nodeValue":y(i,"content of node: ",t),y(i,"changed to: ",e)}y(i,`using the function "${r}"`),zt.groupEnd(),n.changeId++}function b(e,t){if(t)for(let r of t)if(r.test(e))return!0;return!1}function v(e){throw new Bt(e)}function E(e,t,r,n){let o=new Ft,{body:i}=je(o.parseFromString(e,"text/html")),s=S(je(i).childNodes,t,r,n);return je(s).map((e=>{switch(je(e).nodeType){case At:return je(e).outerHTML;case Wt:return je(e).textContent;default:return""}})).join("")}function S(e,t,r,n){let o=je([]);for(let i of e)M(i,t,r,n)&&o.push(i);return o}function M(e,t,r,n){let o=n.shouldAbort,i=n.regexExceptions,s=n.exceptionSelectors,a=n.rid;if("string"==typeof e){let s=e;return!!b(s,i)||(Ce()&&m(s,t,r,n),o&&v(a),Ce())}let l=e;switch(je(l).nodeType){case At:return!!function(e,t){if(t){let r=je(e);for(let e of t)if(r.matches(e))return!0}return!1}(l,s)||(o&&(Ce()&&m(l,t,r,n),v(a)),!!Ce()&&(kt(l),m(l,t,r,n),!0));case Wt:return!!b(je(l).textContent,i)||(Ce()&&m(l,t,r,n),o&&v(a),!1);default:return!0}}function T(e,t,r,n){let i=Ut(e,t)||{},a=i.get&&s(i.get,e)||i.value;if(a)return{get:()=>function(...e){if(r(this)){let r=n(this);if(r){let n=e[0];if(!M(n,this,t,r))return n}}return o(a,this,e)}}}function x(e,t,r,n){let i=Ut(e,t)||{},a=i.get&&s(i.get,e)||i.value;if(a)return{get:()=>function(...e){if(!r(this))return o(a,this,e);let i=n(this);if(!i)return o(a,this,e);let s=S(e,this,t,i);return s.length>0?o(a,this,s):void 0}}}function O(e,t,r,n){let i=Ut(e,t)||{},a=i.get&&s(i.get,e)||i.value;if(a)return{get:()=>function(...e){let[i,l]=e,c="afterbegin"===i||"beforeend"===i;if(r(this,c)){let e=n(this,c);if(e){let r,n=c?this:je(this).parentNode;switch(t){case"insertAdjacentElement":if(!M(l,n,t,e))return l;break;case"insertAdjacentHTML":return r=E(l,n,t,e),r?s(a,this,i,r):void 0;case"insertAdjacentText":if(!M(l,n,t,e))return}}}return o(a,this,e)}}}function P(e,t,r,n){let o=Ut(e,t)||{},{set:i}=o;if(i)return{set(e){if(!r(this))return s(i,this,e);let o=n(this);if(!o)return s(i,this,e);let a=E(e,this,t,o);return a?s(i,this,a):void 0}}}function j(e,t,r,n){let o=Ut(e,t)||{},{set:i}=o;if(i)return{set(e){if(!r(this))return s(i,this,e);let o=n(this);return o?M(e,this,t,o)?s(i,this,e):void 0:s(i,this,e)}}}Rt.frozen.has(document)||(Rt.frozen.set(document,!0),function(){let e;function t(e){return e&&Rt.frozen.has(e)}function r(e){try{return e&&(Rt.frozen.has(e)||Rt.frozen.has(je(e).parentNode))}catch(e){return!1}}function n(e,t){try{return e&&(Rt.frozen.has(e)&&t||Rt.frozen.has(je(e).parentNode)&&!t)}catch(e){return!1}}function o(e){return Rt.frozen.get(e)}function i(e){try{if(Rt.frozen.has(e))return Rt.frozen.get(e);let t=je(e).parentNode;return Rt.frozen.get(t)}catch(e){}}function s(e,t){try{if(Rt.frozen.has(e)&&t)return Rt.frozen.get(e);let r=je(e).parentNode;return Rt.frozen.get(r)}catch(e){}}e=T($t,"appendChild",t,o),et($t,"appendChild",e),e=T($t,"insertBefore",t,o),et($t,"insertBefore",e),e=T($t,"replaceChild",t,o),et($t,"replaceChild",e),e=x(Dt,"append",t,o),et(Dt,"append",e),e=x(Dt,"prepend",t,o),et(Dt,"prepend",e),e=x(Dt,"replaceWith",r,i),et(Dt,"replaceWith",e),e=x(Dt,"after",r,i),et(Dt,"after",e),e=x(Dt,"before",r,i),et(Dt,"before",e),e=O(Dt,"insertAdjacentElement",n,s),et(Dt,"insertAdjacentElement",e),e=O(Dt,"insertAdjacentHTML",n,s),et(Dt,"insertAdjacentHTML",e),e=O(Dt,"insertAdjacentText",n,s),et(Dt,"insertAdjacentText",e),e=P(Dt,"innerHTML",t,o),et(Dt,"innerHTML",e),e=P(Dt,"outerHTML",r,i),et(Dt,"outerHTML",e),e=j($t,"textContent",t,o),et($t,"textContent",e),e=j(Ht,"innerText",t,o),et(Ht,"innerText",e),e=j($t,"nodeValue",t,o),et($t,"nodeValue",e)}()),n=new Jt(w),n.observe(document,{childList:!0,subtree:!0}),w()},"hide-if-shadow-contains":function(e,t="*"){let r=`${e}\\${t}`;tr.has(r)||tr.set(r,[Re(e),t,_t()]);const n=De("hide-if-shadow-contain");rr||(rr=new qt((e=>{let t=new Kt;for(let{target:r}of je(e)){let e=je(r).parentNode;for(;e;)[r,e]=[e,je(r).parentNode];if(!er.has(r)&&!t.has(r)){t.add(r);for(let[e,t,o]of tr.values())if(e.test(je(r).textContent)){let e=je(r.host).closest(t);e&&(o(),je(r).appendChild(document.createElement("style")).textContent=":host {display: none !important}",kt(e),er.add(r),n("Hiding: ",e," for params: ",...arguments))}}}})),Gt.defineProperty(Zt,"attachShadow",{value:c(Qt,(function(){let e=o(Qt,this,arguments);return n("attachShadow is called for: ",e),rr.observe(e,{childList:!0,characterData:!0,subtree:!0}),e}))}))},"json-override":function(e,t,r="",n=""){if(!e)throw new nr("[json-override snippet]: Missing paths to override.");if(void 0===t)throw new nr("[json-override snippet]: No value to override with.");if(!ar){let e=De("json-override"),{parse:t}=or;ar=new ir,sr.defineProperty(window.JSON,"parse",{value:c(t,(function(r){let n=o(t,this,arguments);for(let{prune:t,needle:o,filter:i,value:s}of ar.values())if(!i||i.test(r)){if(je(o).some((e=>!st(n,e))))return n;for(let r of t){let t=st(n,r);void 0!==t&&(e(`Found ${r} replaced it with ${s}`),t[0][t[1]]=lt(s))}}return n}))}),e("Wrapped JSON.parse for override")}ar.set(e,{prune:je(e).split(/ +/),needle:r.length?je(r).split(/ +/):[],filter:n?Re(n):null,value:t})},"json-prune":function(e,t=""){if(!e)throw new lr("Missing paths to prune");if(!pr){let e=De("json-prune"),{parse:t}=cr;pr=new ur,fr.defineProperty(window.JSON,"parse",{value:c(t,(function(){let r=o(t,this,arguments);for(let{prune:t,needle:n}of pr.values()){if(je(n).some((e=>!st(r,e))))return r;for(let n of t){let t=st(r,n);void 0!==t&&(e(`Found ${n} and deleted`),delete t[0][t[1]])}}return r}))}),e("Wrapped JSON.parse for prune")}pr.set(e,{prune:je(e).split(/ +/),needle:t.length?je(t).split(/ +/):[]})},"override-property-read":function(e,t){if(!e)throw new dr("[override-property-read snippet]: No property to override.");if(void 0===t)throw new dr("[override-property-read snippet]: No value to override with.");let r=De("override-property-read"),n=lt(t);r(`Overriding ${e}.`),et(window,e,{get:()=>(r(`${e} override done.`),n),set(){}})},"prevent-listener":function(e,t,r){if(!e)throw new hr("[prevent-listener snippet]: No event type.");if(!Er){Er=new wr;let e=De("[prevent]");gr.defineProperty(br,"addEventListener",{value:c(vr,(function(t,r){for(let{evt:n,handlers:o,selectors:i}of Er.values()){if(!n.test(t))continue;let a=this instanceof Element;for(let l=0;lc.test(s(mr,"function"==typeof r?r:r.handleEvent));if((!c||f())&&(!u||a&&je(this).matches(u)))return void(Ce()&&(yr.groupCollapsed("DEBUG [prevent] was successful"),e(`type: ${t} matching ${n}`),e("handler:",r),c&&e(`matching ${c}`),u&&e("on element: ",this,` matching ${u}`),e("was prevented from being added"),yr.groupEnd()))}}return o(vr,this,arguments)}))}),e("Wrapped addEventListener")}Er.has(e)||Er.set(e,{evt:Re(e),handlers:[],selectors:[]});let{handlers:n,selectors:i}=Er.get(e);n.push(t?Re(t):null),i.push(r)},"strip-fetch-query-parameter":function(e,t=null){const r=De("strip-fetch-query-parameter");Sr||(Sr=new Map,window.fetch=c(Tr,((...e)=>{let[t]=e;if("string"==typeof t){let n=new Mr(t);for(let[o,i]of Sr)i&&!i.test(t)||Or(n.searchParams,o)&&(r(`${o} has been stripped from url ${t}`),xr(n.searchParams,o),e[0]=n.href)}return o(Tr,self,e)}))),Sr.set(e,t&&Re(t))},trace:function(...e){o($e,null,e)}}; ++const snippets=Pr; ++let context; ++for (const [name, ...args] of filters) { ++if (snippets.hasOwnProperty(name)) { ++try { context = snippets[name].apply(context, args); } ++catch (error) { console.error(error); } ++} ++} ++context = void 0; ++}; ++const graph = new Map([["abort-current-inline-script",null],["abort-on-iframe-property-read",null],["abort-on-iframe-property-write",null],["abort-on-property-read",null],["abort-on-property-write",null],["cookie-remover",null],["debug",null],["freeze-element",null],["hide-if-shadow-contains",null],["json-override",null],["json-prune",null],["override-property-read",null],["prevent-listener",null],["strip-fetch-query-parameter",null],["trace",null]]); ++callback.get = snippet => graph.get(snippet); ++callback.has = snippet => graph.has(snippet); ++ ++ if (t.every(([name]) => !callback.has(name))) return; ++ const append = () => { ++ URL.revokeObjectURL( ++ Object.assign( ++ document.documentElement.appendChild(document.createElement("script")), ++ {async: false, src: URL.createObjectURL(new Blob([ ++ "(" + callback + ")(..." + JSON.stringify([e, ...t]) + ")" ++ ]))} ++ ).src ++ ); ++ }; ++ try { append(); } ++ catch (_) { ++ document.addEventListener("readystatechange", append, {once:true}); ++ } ++} +\ No newline at end of file +diff --git a/components/resources/adblocking/snippets/dist/isolated-first-xpath3.source.jst b/components/resources/adblocking/snippets/dist/isolated-first-xpath3.source.jst +new file mode 100644 +--- /dev/null ++++ b/components/resources/adblocking/snippets/dist/isolated-first-xpath3.source.jst +@@ -0,0 +1,3696 @@ ++(e, ...t) => { ++/*! ++ * snippets v0.8.1 (https://gitlab.com/eyeo/anti-cv/snippets/-/tree/5f54b58f039a604088d65991f2829a9a081832f6/dist) ++ * This file is part of eyeo's Anti-Circumvention Snippets module (@eyeo/snippets), ++ * Copyright (C) 2006-present eyeo GmbH ++ * ++ * @eyeo/snippets is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 3 as ++ * published by the Free Software Foundation. ++ * ++ * @eyeo/snippets is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with @eyeo/snippets. If not, see . ++ */ ++ ((environment, ...filters) => { ++ /*! ++ * This file is part of eyeo's Anti-Circumvention Snippets module (@eyeo/snippets), ++ * Copyright (C) 2006-present eyeo GmbH ++ * ++ * @eyeo/snippets is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 3 as ++ * published by the Free Software Foundation. ++ * ++ * @eyeo/snippets is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with @eyeo/snippets. If not, see . ++ */ ++ const $$1 = Proxy; ++ ++ const {apply: a, bind: b, call: c} = Function; ++ const apply$2 = c.bind(a); ++ const bind = c.bind(b); ++ const call = c.bind(c); ++ ++ const callerHandler = { ++ get(target, name) { ++ return bind(c, target[name]); ++ } ++ }; ++ ++ const caller = target => new $$1(target, callerHandler); ++ ++ const handler$2 = { ++ get(target, name) { ++ return bind(target[name], target); ++ } ++ }; ++ ++ const bound = target => new $$1(target, handler$2); ++ ++ const { ++ assign: assign$1, ++ defineProperties: defineProperties$1, ++ freeze: freeze$1, ++ getOwnPropertyDescriptor: getOwnPropertyDescriptor$2, ++ getOwnPropertyDescriptors: getOwnPropertyDescriptors$1, ++ getPrototypeOf ++ } = bound(Object); ++ ++ const {hasOwnProperty} = caller({}); ++ ++ const {species} = Symbol; ++ ++ const handler$1 = { ++ get(target, name) { ++ const Native = target[name]; ++ class Secure extends Native {} ++ ++ const proto = getOwnPropertyDescriptors$1(Native.prototype); ++ delete proto.constructor; ++ freeze$1(defineProperties$1(Secure.prototype, proto)); ++ ++ const statics = getOwnPropertyDescriptors$1(Native); ++ delete statics.length; ++ delete statics.prototype; ++ statics[species] = {value: Secure}; ++ return freeze$1(defineProperties$1(Secure, statics)); ++ } ++ }; ++ ++ const secure = target => new $$1(target, handler$1); ++ ++ const libEnvironment = typeof environment !== "undefined" ? environment : ++ {}; ++ ++ if (typeof globalThis === "undefined") ++ window.globalThis = window; ++ ++ const {apply: apply$1, ownKeys} = bound(Reflect); ++ ++ const worldEnvDefined = "world" in libEnvironment; ++ const isIsolatedWorld = worldEnvDefined && libEnvironment.world === "ISOLATED"; ++ const isMainWorld = worldEnvDefined && libEnvironment.world === "MAIN"; ++ const isChrome = typeof chrome === "object" && !!chrome.runtime; ++ const isOtherThanChrome = typeof browser === "object" && !!browser.runtime; ++ const isExtensionContext$2 = !isMainWorld && ++ (isIsolatedWorld || isChrome || isOtherThanChrome); ++ const copyIfExtension = value => isExtensionContext$2 ? ++ value : ++ create(value, getOwnPropertyDescriptors(value)); ++ ++ const { ++ create, ++ defineProperties, ++ defineProperty, ++ freeze, ++ getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, ++ getOwnPropertyDescriptors ++ } = bound(Object); ++ ++ const invokes = bound(globalThis); ++ const classes = isExtensionContext$2 ? globalThis : secure(globalThis); ++ const {Map: Map$5, RegExp: RegExp$1, Set, WeakMap: WeakMap$3, WeakSet: WeakSet$b} = classes; ++ ++ const augment = (source, target, method = null) => { ++ const known = ownKeys(target); ++ for (const key of ownKeys(source)) { ++ if (known.includes(key)) ++ continue; ++ ++ const descriptor = getOwnPropertyDescriptor$1(source, key); ++ if (method && "value" in descriptor) { ++ const {value} = descriptor; ++ if (typeof value === "function") ++ descriptor.value = method(value); ++ } ++ defineProperty(target, key, descriptor); ++ } ++ }; ++ ++ const primitive = name => { ++ const Super = classes[name]; ++ class Class extends Super {} ++ const {toString, valueOf} = Super.prototype; ++ defineProperties(Class.prototype, { ++ toString: {value: toString}, ++ valueOf: {value: valueOf} ++ }); ++ const type = name.toLowerCase(); ++ const method = callback => function() { ++ const result = apply$1(callback, this, arguments); ++ return typeof result === type ? new Class(result) : result; ++ }; ++ augment(Super, Class, method); ++ augment(Super.prototype, Class.prototype, method); ++ return Class; ++ }; ++ ++ const variables$1 = freeze({ ++ frozen: new WeakMap$3(), ++ hidden: new WeakSet$b(), ++ iframePropertiesToAbort: { ++ read: new Set(), ++ write: new Set() ++ }, ++ abortedIframes: new WeakMap$3() ++ }); ++ ++ const startsCapitalized = new RegExp$1("^[A-Z]"); ++ ++ var env = new Proxy(new Map$5([ ++ ++ ["chrome", ( ++ isExtensionContext$2 && ( ++ (isChrome && chrome) || ++ (isOtherThanChrome && browser) ++ ) ++ ) || void 0], ++ ["isExtensionContext", isExtensionContext$2], ++ ["variables", variables$1], ++ ++ ["console", copyIfExtension(console)], ++ ["document", globalThis.document], ++ ["performance", copyIfExtension(performance)], ++ ["JSON", copyIfExtension(JSON)], ++ ["Map", Map$5], ++ ["Math", copyIfExtension(Math)], ++ ["Number", isExtensionContext$2 ? Number : primitive("Number")], ++ ["RegExp", RegExp$1], ++ ["Set", Set], ++ ["String", isExtensionContext$2 ? String : primitive("String")], ++ ["WeakMap", WeakMap$3], ++ ["WeakSet", WeakSet$b], ++ ++ ["MouseEvent", MouseEvent] ++ ]), { ++ get(map, key) { ++ if (map.has(key)) ++ return map.get(key); ++ ++ let value = globalThis[key]; ++ if (typeof value === "function") ++ value = (startsCapitalized.test(key) ? classes : invokes)[key]; ++ ++ map.set(key, value); ++ return value; ++ }, ++ has(map, key) { ++ return map.has(key); ++ } ++ }); ++ ++ class WeakValue { ++ has() { return false; } ++ set() {} ++ } ++ ++ const helpers = {WeakSet, WeakMap, WeakValue}; ++ const {apply} = Reflect; ++ ++ function transformOnce (callback) { const {WeakSet, WeakMap, WeakValue} = (this || helpers); ++ const ws = new WeakSet; ++ const wm = new WeakMap; ++ const wv = new WeakValue; ++ return function (any) { ++ if (ws.has(any)) ++ return any; ++ ++ if (wm.has(any)) ++ return wm.get(any); ++ ++ if (wv.has(any)) ++ return wv.get(any); ++ ++ const value = apply(callback, this, arguments); ++ ws.add(value); ++ if (value !== any) ++ (typeof any === 'object' && any ? wm : wv).set(any, value); ++ return value; ++ }; ++ } ++ ++ const {Map: Map$4, WeakMap: WeakMap$2, WeakSet: WeakSet$a, setTimeout: setTimeout$3} = env; ++ ++ let cleanup = true; ++ let cleanUpCallback = map => { ++ map.clear(); ++ cleanup = !cleanup; ++ }; ++ ++ var transformer = transformOnce.bind({ ++ WeakMap: WeakMap$2, ++ WeakSet: WeakSet$a, ++ ++ WeakValue: class extends Map$4 { ++ set(key, value) { ++ if (cleanup) { ++ cleanup = !cleanup; ++ setTimeout$3(cleanUpCallback, 0, this); ++ } ++ return super.set(key, value); ++ } ++ } ++ }); ++ ++ const {concat, includes, join, reduce, unshift} = caller([]); ++ ++ const globals = secure(globalThis); ++ ++ const { ++ Map: Map$3, ++ WeakMap: WeakMap$1 ++ } = globals; ++ ++ const map = new Map$3; ++ const descriptors = target => { ++ const chain = []; ++ let current = target; ++ while (current) { ++ if (map.has(current)) ++ unshift(chain, map.get(current)); ++ else { ++ const descriptors = getOwnPropertyDescriptors$1(current); ++ map.set(current, descriptors); ++ unshift(chain, descriptors); ++ } ++ current = getPrototypeOf(current); ++ } ++ unshift(chain, {}); ++ return apply$2(assign$1, null, chain); ++ }; ++ ++ const chain = source => { ++ const target = typeof source === 'function' ? source.prototype : source; ++ const chained = descriptors(target); ++ const handler = { ++ get(target, key) { ++ if (key in chained) { ++ const {value, get} = chained[key]; ++ if (get) ++ return call(get, target); ++ if (typeof value === 'function') ++ return bind(value, target); ++ } ++ return target[key]; ++ }, ++ set(target, key, value) { ++ if (key in chained) { ++ const {set} = chained[key]; ++ if (set) { ++ call(set, target, value); ++ return true; ++ } ++ } ++ target[key] = value; ++ return true; ++ } ++ }; ++ return target => new $$1(target, handler); ++ }; ++ ++ const { ++ isExtensionContext: isExtensionContext$1, ++ Array: Array$2, ++ Number: Number$1, ++ String: String$1, ++ Object: Object$2 ++ } = env; ++ ++ const {isArray} = Array$2; ++ const {getOwnPropertyDescriptor, setPrototypeOf: setPrototypeOf$1} = Object$2; ++ ++ const {toString} = Object$2.prototype; ++ const {slice} = String$1.prototype; ++ const getBrand = value => call(slice, call(toString, value), 8, -1); ++ ++ const {get: nodeType} = getOwnPropertyDescriptor(Node.prototype, "nodeType"); ++ ++ const chained = isExtensionContext$1 ? {} : { ++ Attr: chain(Attr), ++ CanvasRenderingContext2D: chain(CanvasRenderingContext2D), ++ CSSStyleDeclaration: chain(CSSStyleDeclaration), ++ Document: chain(Document), ++ Element: chain(Element), ++ HTMLCanvasElement: chain(HTMLCanvasElement), ++ HTMLElement: chain(HTMLElement), ++ HTMLImageElement: chain(HTMLImageElement), ++ HTMLScriptElement: chain(HTMLScriptElement), ++ MutationRecord: chain(MutationRecord), ++ Node: chain(Node), ++ ShadowRoot: chain(ShadowRoot), ++ ++ get CSS2Properties() { ++ return chained.CSSStyleDeclaration; ++ } ++ }; ++ ++ const upgrade = (value, hint) => { ++ if (hint !== "Element" && hint in chained) ++ return chained[hint](value); ++ ++ if (isArray(value)) ++ return setPrototypeOf$1(value, Array$2.prototype); ++ ++ const brand = getBrand(value); ++ if (brand in chained) ++ return chained[brand](value); ++ ++ if (brand in env) ++ return setPrototypeOf$1(value, env[brand].prototype); ++ ++ if ("nodeType" in value) { ++ switch (call(nodeType, value)) { ++ case 1: ++ if (!(hint in chained)) ++ throw new Error("unknown hint " + hint); ++ return chained[hint](value); ++ case 2: ++ return chained.Attr(value); ++ case 3: ++ return chained.Node(value); ++ case 9: ++ return chained.Document(value); ++ } ++ } ++ ++ throw new Error("unknown brand " + brand); ++ }; ++ ++ var $ = isExtensionContext$1 ? ++ value => (value === window || value === globalThis ? env : value) : ++ transformer((value, hint = "Element") => { ++ if (value === window || value === globalThis) ++ return env; ++ ++ switch (typeof value) { ++ case "object": ++ return value && upgrade(value, hint); ++ ++ case "string": ++ return new String$1(value); ++ ++ case "number": ++ return new Number$1(value); ++ ++ default: ++ throw new Error("unsupported value"); ++ } ++ }); ++ ++ let { ++ document: document$1, ++ getComputedStyle: getComputedStyle$5, ++ isExtensionContext, ++ variables, ++ Array: Array$1, ++ MutationObserver: MutationObserver$a, ++ Object: Object$1, ++ XPathEvaluator, ++ XPathExpression, ++ XPathResult ++ } = $(window); ++ ++ let {querySelectorAll} = document$1; ++ let $$ = querySelectorAll && bind(querySelectorAll, document$1); ++ ++ const {assign, setPrototypeOf} = Object$1; ++ ++ class $XPathExpression extends XPathExpression { ++ evaluate(...args) { ++ return setPrototypeOf( ++ apply$2(super.evaluate, this, args), ++ XPathResult.prototype ++ ); ++ } ++ } ++ ++ class $XPathEvaluator extends XPathEvaluator { ++ createExpression(...args) { ++ return setPrototypeOf( ++ apply$2(super.createExpression, this, args), ++ $XPathExpression.prototype ++ ); ++ } ++ } ++ ++ function hideElement(element) { ++ if (variables.hidden.has(element)) ++ return; ++ ++ notifyElementHidden(element); ++ ++ variables.hidden.add(element); ++ ++ let {style} = $(element); ++ let $style = $(style, "CSSStyleDeclaration"); ++ let properties = $([]); ++ let {debugCSSProperties} = libEnvironment; ++ ++ for (let [key, value] of (debugCSSProperties || [["display", "none"]])) { ++ $style.setProperty(key, value, "important"); ++ properties.push([key, $style.getPropertyValue(key)]); ++ } ++ ++ new MutationObserver$a(() => { ++ for (let [key, value] of properties) { ++ let propertyValue = $style.getPropertyValue(key); ++ let propertyPriority = $style.getPropertyPriority(key); ++ if (propertyValue != value || propertyPriority != "important") ++ $style.setProperty(key, value, "important"); ++ } ++ }).observe(element, {attributes: true, ++ attributeFilter: ["style"]}); ++ } ++ ++ function notifyElementHidden(element) { ++ if (isExtensionContext && typeof checkElement === "function") ++ checkElement(element); ++ } ++ ++ function initQueryAndApply(selector) { ++ let $selector = selector; ++ if ($selector.startsWith("xpath(") && ++ $selector.endsWith(")")) { ++ let xpathQuery = $selector.slice(6, -1); ++ let evaluator = new $XPathEvaluator(); ++ let expression = evaluator.createExpression(xpathQuery, null); ++ ++ let flag = XPathResult.ORDERED_NODE_SNAPSHOT_TYPE; ++ ++ return cb => { ++ if (!cb) ++ return; ++ let result = expression.evaluate(document$1, flag, null); ++ let {snapshotLength} = result; ++ for (let i = 0; i < snapshotLength; i++) ++ cb(result.snapshotItem(i)); ++ }; ++ } ++ return cb => $$(selector).forEach(cb); ++ } ++ ++ function initQueryAll(selector) { ++ let $selector = selector; ++ if ($selector.startsWith("xpath(") && ++ $selector.endsWith(")")) { ++ let queryAndApply = initQueryAndApply(selector); ++ return () => { ++ let elements = $([]); ++ queryAndApply(e => elements.push(e)); ++ return elements; ++ }; ++ } ++ return () => Array$1.from($$(selector)); ++ } ++ ++ function hideIfMatches(match, selector, searchSelector, onHideCallback) { ++ if (searchSelector == null) ++ searchSelector = selector; ++ ++ let won; ++ const callback = () => { ++ for (const element of $$(searchSelector)) { ++ const closest = $(element).closest(selector); ++ if (closest && match(element, closest)) { ++ won(); ++ hideElement(closest); ++ if (typeof onHideCallback === "function") ++ onHideCallback(closest); ++ } ++ } ++ }; ++ return assign( ++ new MutationObserver$a(callback), ++ { ++ race(win) { ++ won = win; ++ this.observe(document$1, {childList: true, ++ characterData: true, ++ subtree: true}); ++ callback(); ++ } ++ } ++ ); ++ } ++ ++ function isVisible(element, style, closest) { ++ let $style = $(style, "CSSStyleDeclaration"); ++ if ($style.getPropertyValue("display") == "none") ++ return false; ++ ++ let visibility = $style.getPropertyValue("visibility"); ++ if (visibility == "hidden" || visibility == "collapse") ++ return false; ++ ++ if (!closest || element == closest) ++ return true; ++ ++ let parent = $(element).parentElement; ++ if (!parent) ++ return true; ++ ++ return isVisible(parent, getComputedStyle$5(parent), closest); ++ } ++ ++ function getComputedCSSText(element) { ++ let style = getComputedStyle$5(element); ++ let {cssText} = style; ++ ++ if (cssText) ++ return cssText; ++ ++ for (let property of style) ++ cssText += `${property}: ${style[property]}; `; ++ ++ return $(cssText).trim(); ++ } ++ ++ let {Math: Math$2, RegExp} = $(window); ++ ++ function regexEscape(string) { ++ return $(string).replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"); ++ } ++ ++ function toRegExp(pattern) { ++ let {length} = pattern; ++ ++ if (length > 1 && pattern[0] === "/") { ++ let isCaseSensitive = pattern[length - 1] === "/"; ++ ++ if (isCaseSensitive || (length > 2 && $(pattern).endsWith("/i"))) { ++ let args = [$(pattern).slice(1, isCaseSensitive ? -1 : -2)]; ++ if (!isCaseSensitive) ++ args.push("i"); ++ ++ return new RegExp(...args); ++ } ++ } ++ ++ return new RegExp(regexEscape(pattern)); ++ } ++ ++ let debugging = false; ++ ++ function debug() { ++ return debugging; ++ } ++ ++ function setDebug() { ++ debugging = true; ++ } ++ ++ const {console: console$1} = $(window); ++ ++ const noop = () => {}; ++ ++ function log(...args) { ++ if (debug()) ++ $(args).unshift("%c DEBUG", "font-weight: bold"); ++ ++ console$1.log(...args); ++ } ++ ++ function getDebugger(name) { ++ return bind(debug() ? log : noop, null, name); ++ } ++ ++ let {Array, Error: Error$3, Map: Map$2, parseInt: parseInt$2} = $(window); ++ ++ let stack = null; ++ let won = null; ++ ++ function race(action, winners = "1") { ++ switch (action) { ++ case "start": ++ stack = { ++ winners: parseInt$2(winners, 10) || 1, ++ participants: new Map$2() ++ }; ++ won = new Array(); ++ break; ++ case "end": ++ case "finish": ++ case "stop": ++ stack = null; ++ for (let win of won) ++ win(); ++ won = null; ++ break; ++ default: ++ throw new Error$3(`Invalid action: ${action}`); ++ } ++ } ++ ++ function raceWinner(name, lose) { ++ ++ if (stack === null) ++ return noop; ++ ++ let current = stack; ++ let {participants} = current; ++ participants.set(win, lose); ++ ++ return win; ++ ++ function win() { ++ ++ if (current.winners < 1) ++ return; ++ ++ let debugLog = getDebugger("race"); ++ debugLog(`${name} won the race`); ++ ++ if (current === stack) { ++ won.push(win); ++ } ++ else { ++ participants.delete(win); ++ if (--current.winners < 1) { ++ for (let looser of participants.values()) ++ looser(); ++ ++ participants.clear(); ++ } ++ } ++ } ++ } ++ ++ function hideIfContains(search, selector = "*", searchSelector = null) { ++ const debugLog = getDebugger("hide-if-contains"); ++ const onHideCallback = node => { ++ debugLog("Matched: ", node, " for selector: ", selector, searchSelector); ++ }; ++ let re = toRegExp(search); ++ ++ const mo = hideIfMatches(element => re.test($(element).textContent), ++ selector, ++ searchSelector, ++ onHideCallback); ++ mo.race(raceWinner( ++ "hide-if-contains", ++ () => { ++ mo.disconnect(); ++ } ++ )); ++ } ++ ++ const handler = { ++ get(target, name) { ++ const context = target; ++ while (!hasOwnProperty(target, name)) ++ target = getPrototypeOf(target); ++ const {get, set} = getOwnPropertyDescriptor$2(target, name); ++ return function () { ++ return arguments.length ? ++ apply$2(set, context, arguments) : ++ call(get, context); ++ }; ++ } ++ }; ++ ++ const accessor = target => new $$1(target, handler); ++ ++ $(window); ++ ++ accessor(window); ++ ++ $(/^\d+$/); ++ ++ function getPromiseFromEvent(item, event) { ++ return new Promise( ++ resolve => { ++ const listener = () => { ++ item.removeEventListener(event, listener); ++ resolve(); ++ }; ++ item.addEventListener(event, listener); ++ } ++ ); ++ } ++ ++ function waitUntilEvent( ++ debugLog, ++ mainLogic, ++ waitUntil) { ++ if (waitUntil) { ++ ++ if (waitUntil === "load") { ++ debugLog("Waiting until window.load"); ++ ++ window.onload = () => { ++ debugLog("Window.load fired."); ++ mainLogic(); ++ }; ++ } ++ ++ else if (waitUntil === "loading" || ++ waitUntil === "interactive" || ++ waitUntil === "complete") { ++ debugLog("Waiting document state until :", waitUntil); ++ ++ document.onreadystatechange = () => { ++ debugLog("Document state changed:", document.readyState); ++ if (document.readyState === waitUntil) ++ mainLogic(); ++ }; ++ } ++ ++ else { ++ debugLog("Waiting until ", waitUntil, " event is triggered on document"); ++ getPromiseFromEvent(document, waitUntil).then(() => { ++ debugLog(waitUntil, " is triggered on document, starting the snippet"); ++ mainLogic(); ++ }).catch(err => { ++ debugLog("There was an error while waiting for the event.", err); ++ }); ++ } ++ } ++ else { ++ ++ mainLogic(); ++ } ++ } ++ ++ let {MutationObserver: MutationObserver$9, WeakSet: WeakSet$9, getComputedStyle: getComputedStyle$4} = $(window); ++ ++ function hideIfContainsAndMatchesStyle(search, ++ selector = "*", ++ searchSelector = null, ++ style = null, ++ searchStyle = null, ++ waitUntil, ++ windowWidthMin = null, ++ windowWidthMax = null ++ ) { ++ const debugLog = getDebugger("hide-if-contains-and-matches-style"); ++ const hiddenMap = new WeakSet$9(); ++ if (searchSelector == null) ++ searchSelector = selector; ++ ++ const searchRegExp = toRegExp(search); ++ ++ const styleRegExp = style ? toRegExp(style) : null; ++ const searchStyleRegExp = searchStyle ? toRegExp(searchStyle) : null; ++ const mainLogic = () => { ++ const callback = () => { ++ if ((windowWidthMin && window.innerWidth < windowWidthMin) || ++ (windowWidthMax && window.innerWidth > windowWidthMax) ++ ) ++ return; ++ for (const element of $$(searchSelector)) { ++ if (hiddenMap.has(element)) ++ continue; ++ if (searchRegExp.test($(element).textContent)) { ++ if (!searchStyleRegExp || ++ searchStyleRegExp.test(getComputedCSSText(element))) { ++ const closest = $(element).closest(selector); ++ if (!closest) ++ continue; ++ if (!styleRegExp || styleRegExp.test(getComputedCSSText(closest))) { ++ win(); ++ hideElement(closest); ++ hiddenMap.add(element); ++ debugLog("Matched: ", ++ closest, ++ "which contains: ", ++ element, ++ " for params: ", ++ ...arguments); ++ } ++ else { ++ debugLog( ++ "In this element the searchStyle matched but style didn't:\n", ++ closest, ++ getComputedStyle$4(closest), ++ ...arguments); ++ } ++ } ++ else { ++ debugLog( ++ "In this element the searchStyle didn't match:\n", ++ element, ++ getComputedStyle$4(element), ++ ...arguments); ++ } ++ } ++ } ++ }; ++ ++ const mo = new MutationObserver$9(callback); ++ const win = raceWinner( ++ "hide-if-contains-and-matches-style", ++ () => mo.disconnect() ++ ); ++ mo.observe(document, {childList: true, characterData: true, subtree: true}); ++ callback(); ++ }; ++ waitUntilEvent(debugLog, mainLogic, waitUntil); ++ } ++ ++ let { ++ clearTimeout, ++ fetch, ++ getComputedStyle: getComputedStyle$3, ++ setTimeout: setTimeout$2, ++ Map: Map$1, ++ MutationObserver: MutationObserver$8, ++ Uint8Array ++ } = $(window); ++ ++ function hideIfContainsImage(search, selector, searchSelector) { ++ if (searchSelector == null) ++ searchSelector = selector; ++ ++ let searchRegExp = toRegExp(search); ++ ++ const debugLog = getDebugger("hide-if-contains-image"); ++ ++ let callback = () => { ++ for (let element of $$(searchSelector)) { ++ let style = getComputedStyle$3(element); ++ let match = $(style["background-image"]).match(/^url\("(.*)"\)$/); ++ if (match) { ++ fetchContent(match[1]).then(content => { ++ if (searchRegExp.test(uint8ArrayToHex(new Uint8Array(content)))) { ++ let closest = $(element).closest(selector); ++ if (closest) { ++ win(); ++ hideElement(closest); ++ debugLog("Matched: ", closest, " for:", ...arguments); ++ } ++ } ++ }); ++ } ++ } ++ }; ++ ++ let mo = new MutationObserver$8(callback); ++ let win = raceWinner( ++ "hide-if-contains-image", ++ () => mo.disconnect() ++ ); ++ mo.observe(document, {childList: true, subtree: true}); ++ callback(); ++ } ++ ++ let fetchContentMap = new Map$1(); ++ ++ function fetchContent(url, {as = "arrayBuffer", cleanup = 60000} = {}) { ++ ++ let uid = as + ":" + url; ++ let details = fetchContentMap.get(uid) || { ++ remove: () => fetchContentMap.delete(uid), ++ result: null, ++ timer: 0 ++ }; ++ clearTimeout(details.timer); ++ details.timer = setTimeout$2(details.remove, cleanup); ++ if (!details.result) { ++ details.result = fetch(url).then(res => res[as]()).catch(details.remove); ++ fetchContentMap.set(uid, details); ++ } ++ return details.result; ++ } ++ ++ function toHex(number, length = 2) { ++ let hex = $(number).toString(16); ++ ++ if (hex.length < length) ++ hex = $("0").repeat(length - hex.length) + hex; ++ ++ return hex; ++ } ++ ++ function uint8ArrayToHex(uint8Array) { ++ return uint8Array.reduce((hex, byte) => hex + toHex(byte), ""); ++ } ++ ++ const {parseFloat: parseFloat$1, Math: Math$1, MutationObserver: MutationObserver$7, WeakSet: WeakSet$8} = $(window); ++ const {min} = Math$1; ++ ++ const ld = (a, b) => { ++ const len1 = a.length + 1; ++ const len2 = b.length + 1; ++ const d = [[0]]; ++ let i = 0; ++ let I = 0; ++ ++ while (++i < len2) ++ d[0][i] = i; ++ ++ i = 0; ++ while (++i < len1) { ++ const c = a[I]; ++ let j = 0; ++ let J = 0; ++ d[i] = [i]; ++ while (++j < len2) { ++ d[i][j] = min(d[I][j] + 1, d[i][J] + 1, d[I][J] + (c != b[J])); ++ ++J; ++ } ++ ++I; ++ } ++ return d[len1 - 1][len2 - 1]; ++ }; ++ ++ function hideIfContainsSimilarText( ++ search, selector, ++ searchSelector = null, ++ ignoreChars = 0, ++ maxSearches = 0 ++ ) { ++ const visitedNodes = new WeakSet$8(); ++ const debugLog = getDebugger("hide-if-contains-similar-text"); ++ const $search = $(search); ++ const {length} = $search; ++ const chars = length + parseFloat$1(ignoreChars) || 0; ++ const find = $([...$search]).sort(); ++ const guard = parseFloat$1(maxSearches) || Infinity; ++ ++ if (searchSelector == null) ++ searchSelector = selector; ++ ++ debugLog("Looking for similar text: " + $search); ++ ++ const callback = () => { ++ for (const element of $$(searchSelector)) { ++ if (visitedNodes.has(element)) ++ continue; ++ ++ visitedNodes.add(element); ++ const {innerText} = $(element); ++ const loop = min(guard, innerText.length - chars + 1); ++ for (let i = 0; i < loop; i++) { ++ const str = $(innerText).substr(i, chars); ++ const distance = ld(find, $([...str]).sort()) - ignoreChars; ++ if (distance <= 0) { ++ const closest = $(element).closest(selector); ++ debugLog("Found similar text: " + $search, closest); ++ if (closest) { ++ win(); ++ hideElement(closest); ++ break; ++ } ++ } ++ } ++ } ++ }; ++ ++ let mo = new MutationObserver$7(callback); ++ let win = raceWinner( ++ "hide-if-contains-similar-text", ++ () => mo.disconnect() ++ ); ++ mo.observe(document, {childList: true, characterData: true, subtree: true}); ++ callback(); ++ } ++ ++ let {getComputedStyle: getComputedStyle$2, Map, WeakSet: WeakSet$7, parseFloat} = $(window); ++ ++ const {ELEMENT_NODE: ELEMENT_NODE$3, TEXT_NODE} = Node; ++ ++ function hideIfContainsVisibleText(search, selector, ++ searchSelector = null, ++ ...attributes) { ++ let entries = $([]); ++ const optionalParameters = new Map([ ++ ["-snippet-box-margin", "2"], ++ ["-disable-bg-color-check", "false"], ++ ["-check-is-contained", "false"] ++ ]); ++ ++ for (let attr of attributes) { ++ attr = $(attr); ++ let markerIndex = attr.indexOf(":"); ++ if (markerIndex < 0) ++ continue; ++ ++ let key = attr.slice(0, markerIndex).trim().toString(); ++ let value = attr.slice(markerIndex + 1).trim().toString(); ++ ++ if (key && value) { ++ if (optionalParameters.has(key)) ++ optionalParameters.set(key, value); ++ else ++ entries.push([key, value]); ++ } ++ } ++ ++ let defaultEntries = $([ ++ ["opacity", "0"], ++ ["font-size", "0px"], ++ ++ ["color", "rgba(0, 0, 0, 0)"] ++ ]); ++ ++ let attributesMap = new Map(defaultEntries.concat(entries)); ++ ++ function isTextVisible(element, style, {bgColorCheck = true} = {}) { ++ if (!style) ++ style = getComputedStyle$2(element); ++ ++ style = $(style); ++ ++ for (const [key, value] of attributesMap) { ++ let valueAsRegex = toRegExp(value); ++ if (valueAsRegex.test(style.getPropertyValue(key))) ++ return false; ++ } ++ ++ let color = style.getPropertyValue("color"); ++ if (bgColorCheck && style.getPropertyValue("background-color") == color) ++ return false; ++ ++ return true; ++ } ++ ++ function getPseudoContent(element, pseudo, {bgColorCheck = true} = {}) { ++ let style = getComputedStyle$2(element, pseudo); ++ if (!isVisible(element, style) || ++ !isTextVisible(element, style, {bgColorCheck})) ++ return ""; ++ ++ let {content} = $(style); ++ if (content && content !== "none") { ++ let strings = $([]); ++ ++ content = $(content).trim().replace( ++ /(["'])(?:(?=(\\?))\2.)*?\1/g, ++ value => `\x01${strings.push($(value).slice(1, -1)) - 1}` ++ ); ++ ++ content = content.replace( ++ /\s*attr\(\s*([^\s,)]+)[^)]*?\)\s*/g, ++ (_, name) => $(element).getAttribute(name) || "" ++ ); ++ ++ return content.replace( ++ /\x01(\d+)/g, ++ (_, index) => strings[index]); ++ } ++ return ""; ++ } ++ ++ function isContained(childNode, parentNode, {boxMargin = 2} = {}) { ++ const child = $(childNode).getBoundingClientRect(); ++ const parent = $(parentNode).getBoundingClientRect(); ++ const stretchedParent = { ++ left: parent.left - boxMargin, ++ right: parent.right + boxMargin, ++ top: parent.top - boxMargin, ++ bottom: parent.bottom + boxMargin ++ }; ++ return ( ++ (stretchedParent.left <= child.left && ++ child.left <= stretchedParent.right && ++ stretchedParent.top <= child.top && ++ child.top <= stretchedParent.bottom) && ++ (stretchedParent.top <= child.bottom && ++ child.bottom <= stretchedParent.bottom && ++ stretchedParent.left <= child.right && ++ child.right <= stretchedParent.right) ++ ); ++ } ++ ++ function getVisibleContent(element, ++ closest, ++ style, ++ parentOverflowNode, ++ originalElement, ++ { ++ boxMargin = 2, ++ bgColorCheck, ++ checkIsContained ++ } = {}) { ++ let checkClosest = !style; ++ if (checkClosest) ++ style = getComputedStyle$2(element); ++ ++ if (!isVisible(element, style, checkClosest && closest)) ++ return ""; ++ ++ if (!parentOverflowNode && ++ ( ++ $(style).getPropertyValue("overflow-x") === "hidden" || ++ $(style).getPropertyValue("overflow-y") === "hidden" ++ ) ++ ) ++ parentOverflowNode = element; ++ ++ let text = getPseudoContent(element, ":before", {bgColorCheck}); ++ for (let node of $(element).childNodes) { ++ switch ($(node).nodeType) { ++ case ELEMENT_NODE$3: ++ text += getVisibleContent(node, ++ element, ++ getComputedStyle$2(node), ++ parentOverflowNode, ++ originalElement, ++ { ++ boxMargin, ++ bgColorCheck, ++ checkIsContained ++ } ++ ); ++ break; ++ case TEXT_NODE: ++ ++ if (parentOverflowNode) { ++ if (isContained(element, parentOverflowNode, {boxMargin}) && ++ isTextVisible(element, style, {bgColorCheck})) ++ text += $(node).nodeValue; ++ } ++ else if (isTextVisible(element, style, {bgColorCheck})) { ++ if (checkIsContained && ++ !isContained(element, originalElement, {boxMargin})) ++ continue; ++ text += $(node).nodeValue; ++ } ++ break; ++ } ++ } ++ return text + getPseudoContent(element, ":after", {bgColorCheck}); ++ } ++ const boxMarginStr = optionalParameters.get("-snippet-box-margin"); ++ const boxMargin = parseFloat(boxMarginStr) || 0; ++ ++ const bgColorCheckStr = optionalParameters.get("-disable-bg-color-check"); ++ const bgColorCheck = !(bgColorCheckStr === "true"); ++ ++ const checkIsContainedStr = optionalParameters.get("-check-is-contained"); ++ const checkIsContained = (checkIsContainedStr === "true"); ++ ++ let re = toRegExp(search); ++ let seen = new WeakSet$7(); ++ ++ const mo = hideIfMatches( ++ (element, closest) => { ++ if (seen.has(element)) ++ return false; ++ ++ seen.add(element); ++ let text = getVisibleContent(element, closest, null, null, element, { ++ boxMargin, ++ bgColorCheck, ++ checkIsContained ++ } ++ ); ++ let result = re.test(text); ++ if (debug() && text.length) ++ log(result, re, text); ++ return result; ++ }, ++ selector, ++ searchSelector ++ ); ++ mo.race(raceWinner( ++ "hide-if-contains-visible-text", ++ () => { ++ mo.disconnect(); ++ } ++ )); ++ } ++ ++ let {MutationObserver: MutationObserver$6, WeakSet: WeakSet$6, getComputedStyle: getComputedStyle$1} = $(window); ++ ++ function hideIfHasAndMatchesStyle(search, ++ selector = "*", ++ searchSelector = null, ++ style = null, ++ searchStyle = null, ++ waitUntil = null, ++ windowWidthMin = null, ++ windowWidthMax = null ++ ) { ++ const debugLog = getDebugger("hide-if-has-and-matches-style"); ++ const hiddenMap = new WeakSet$6(); ++ if (searchSelector == null) ++ searchSelector = selector; ++ ++ const styleRegExp = style ? toRegExp(style) : null; ++ const searchStyleRegExp = searchStyle ? toRegExp(searchStyle) : null; ++ const mainLogic = () => { ++ const callback = () => { ++ if ((windowWidthMin && window.innerWidth < windowWidthMin) || ++ (windowWidthMax && window.innerWidth > windowWidthMax) ++ ) ++ return; ++ for (const element of $$(searchSelector)) { ++ if (hiddenMap.has(element)) ++ continue; ++ if ($(element).querySelector(search) && ++ (!searchStyleRegExp || ++ searchStyleRegExp.test(getComputedCSSText(element)))) { ++ const closest = $(element).closest(selector); ++ if (closest && (!styleRegExp || ++ styleRegExp.test(getComputedCSSText(closest)))) { ++ win(); ++ hideElement(closest); ++ hiddenMap.add(element); ++ debugLog("Matched: ", ++ closest, ++ "which contains: ", ++ element, ++ " for params: ", ++ ...arguments); ++ } ++ else { ++ debugLog( ++ "In this element the searchStyle matched but style didn't:\n", ++ closest, ++ getComputedStyle$1(closest), ++ ...arguments); ++ } ++ } ++ else { ++ debugLog( ++ "In this element the searchStyle didn't match:\n", ++ element, ++ getComputedStyle$1(element), ++ ...arguments); ++ } ++ } ++ }; ++ ++ const mo = new MutationObserver$6(callback); ++ const win = raceWinner( ++ "hide-if-has-and-matches-style", ++ () => mo.disconnect() ++ ); ++ mo.observe(document, {childList: true, subtree: true}); ++ callback(); ++ }; ++ waitUntilEvent(debugLog, mainLogic, waitUntil); ++ } ++ ++ let {getComputedStyle, MutationObserver: MutationObserver$5, WeakSet: WeakSet$5} = $(window); ++ ++ function hideIfLabelledBy(search, selector, searchSelector = null) { ++ let sameSelector = searchSelector == null; ++ ++ let searchRegExp = toRegExp(search); ++ ++ let matched = new WeakSet$5(); ++ ++ let callback = () => { ++ for (let node of $$(selector)) { ++ let closest = sameSelector ? ++ node : ++ $(node).closest(searchSelector); ++ if (!closest || !isVisible(node, getComputedStyle(node), closest)) ++ continue; ++ ++ let attr = $(node).getAttribute("aria-labelledby"); ++ let fallback = () => { ++ if (matched.has(closest)) ++ return; ++ ++ if (searchRegExp.test( ++ $(node).getAttribute("aria-label") || "" ++ )) { ++ win(); ++ matched.add(closest); ++ hideElement(closest); ++ } ++ }; ++ ++ if (attr) { ++ for (let label of $(attr).split(/\s+/)) { ++ let target = $(document).getElementById(label); ++ if (target) { ++ if (!matched.has(target) && searchRegExp.test(target.innerText)) { ++ win(); ++ matched.add(target); ++ hideElement(closest); ++ } ++ } ++ else { ++ fallback(); ++ } ++ } ++ } ++ else { ++ fallback(); ++ } ++ } ++ }; ++ ++ let mo = new MutationObserver$5(callback); ++ let win = raceWinner( ++ "hide-if-labelled-by", ++ () => mo.disconnect() ++ ); ++ mo.observe(document, {characterData: true, childList: true, subtree: true}); ++ callback(); ++ } ++ ++ $(window); ++ ++ const noopProfile = { ++ mark() {}, ++ end() {}, ++ toString() { ++ return "{mark(){},end(){}}"; ++ } ++ }; ++ ++ function profile(id, rate = 10) { ++ return noopProfile; ++ } ++ ++ let {MutationObserver: MutationObserver$4, WeakSet: WeakSet$4} = $(window); ++ ++ const {ELEMENT_NODE: ELEMENT_NODE$2} = Node; ++ ++ function hideIfMatchesXPath(query, scopeQuery) { ++ const {mark, end} = profile(); ++ const debugLog = getDebugger("hide-if-matches-xpath"); ++ ++ const startHidingMutationObserver = scopeNode => { ++ const queryAndApply = initQueryAndApply(`xpath(${query})`); ++ const seenMap = new WeakSet$4(); ++ const callback = () => { ++ mark(); ++ queryAndApply(node => { ++ if (seenMap.has(node)) ++ return false; ++ seenMap.add(node); ++ win(); ++ if ($(node).nodeType === ELEMENT_NODE$2) ++ hideElement(node); ++ else ++ $(node).textContent = ""; ++ debugLog("Matched: ", node, " for selector: ", query); ++ }); ++ end(); ++ }; ++ const mo = new MutationObserver$4(callback); ++ const win = raceWinner( ++ "hide-if-matches-xpath", ++ () => mo.disconnect() ++ ); ++ mo.observe( ++ scopeNode, {characterData: true, childList: true, subtree: true}); ++ callback(); ++ }; ++ ++ if (scopeQuery) { ++ ++ let count = 0; ++ let scopeMutationObserver; ++ const scopeQueryAndApply = initQueryAndApply(`xpath(${scopeQuery})`); ++ const findMutationScopeNodes = () => { ++ scopeQueryAndApply(scopeNode => { ++ ++ startHidingMutationObserver(scopeNode); ++ count++; ++ }); ++ if (count > 0) ++ scopeMutationObserver.disconnect(); ++ }; ++ scopeMutationObserver = new MutationObserver$4(findMutationScopeNodes); ++ scopeMutationObserver.observe( ++ document, {characterData: true, childList: true, subtree: true} ++ ); ++ findMutationScopeNodes(); ++ } ++ else { ++ ++ startHidingMutationObserver(document); ++ } ++ } ++ ++ let {MutationObserver: MutationObserver$3, WeakSet: WeakSet$3} = $(window); ++ ++ const {ELEMENT_NODE: ELEMENT_NODE$1} = Node; ++ ++ function hideIfMatchesComputedXPath(query, searchQuery, searchRegex, ++ waitUntil) { ++ const {mark, end} = profile(); ++ const debugLog = getDebugger("hide-if-matches-computed-xpath"); ++ ++ if (!searchQuery || !query) { ++ debugLog("No query or searchQuery provided."); ++ return; ++ } ++ ++ const computeQuery = foundText => query.replace("{{}}", foundText); ++ ++ const startHidingMutationObserver = foundText => { ++ const computedQuery = computeQuery(foundText); ++ debugLog("Starting hiding elements that match query: ", computedQuery); ++ const queryAndApply = initQueryAndApply(`xpath(${computedQuery})`); ++ const seenMap = new WeakSet$3(); ++ const callback = () => { ++ mark(); ++ queryAndApply(node => { ++ if (seenMap.has(node)) ++ return false; ++ seenMap.add(node); ++ win(); ++ if ($(node).nodeType === ELEMENT_NODE$1) ++ hideElement(node); ++ else ++ $(node).textContent = ""; ++ debugLog("Matched: ", node, " for selector: ", query); ++ }); ++ end(); ++ }; ++ const mo = new MutationObserver$3(callback); ++ const win = raceWinner( ++ "hide-if-matches-computed-xpath", ++ () => mo.disconnect() ++ ); ++ mo.observe( ++ document, {characterData: true, childList: true, subtree: true}); ++ callback(); ++ }; ++ ++ const re = toRegExp(searchRegex); ++ ++ const mainLogic = () => { ++ if (searchQuery) { ++ debugLog("Started searching for: ", searchQuery); ++ const seenMap = new WeakSet$3(); ++ let searchMO; ++ const searchQueryAndApply = initQueryAndApply(`xpath(${searchQuery})`); ++ const findMutationSearchNodes = () => { ++ searchQueryAndApply(searchNode => { ++ if (seenMap.has(searchNode)) ++ return false; ++ seenMap.add(searchNode); ++ debugLog("Found node: ", searchNode); ++ if (searchNode.innerHTML) { ++ debugLog("Searching in: ", searchNode.innerHTML); ++ const foundTextArr = searchNode.innerHTML.match(re); ++ if (foundTextArr && foundTextArr.length) { ++ let foundText = ""; ++ ++ foundTextArr[1] ? foundText = foundTextArr[1] : ++ foundText = foundTextArr[0]; ++ debugLog("Matched search query: ", foundText); ++ startHidingMutationObserver(foundText); ++ } ++ } ++ }); ++ }; ++ ++ searchMO = new MutationObserver$3(findMutationSearchNodes); ++ searchMO.observe( ++ document, {characterData: true, childList: true, subtree: true} ++ ); ++ findMutationSearchNodes(); ++ } ++ }; ++ ++ waitUntilEvent(debugLog, mainLogic, waitUntil); ++ } ++ ++ let { ++ parseInt: parseInt$1, ++ setTimeout: setTimeout$1, ++ Error: Error$2, ++ MouseEvent: MouseEvent$2, ++ MutationObserver: MutationObserver$2, ++ WeakSet: WeakSet$2 ++ } = $(window); ++ ++ function simulateEvent(event, selector, delay = "0") { ++ if (!event) ++ throw new Error$2("[simulate-event snippet]: No event type provided."); ++ if (!selector) ++ throw new Error$2("[simulate-event snippet]: No selector provided."); ++ ++ let queryAndApply = initQueryAndApply(selector); ++ let delayInMiliseconds = parseInt$1(delay, 10); ++ let dispatchedNodes = new WeakSet$2(); ++ ++ let observer = new MutationObserver$2(findNodesAndDispatchEvents); ++ observer.observe(document, {childList: true, subtree: true}); ++ findNodesAndDispatchEvents(); ++ ++ function findNodesAndDispatchEvents() { ++ queryAndApply(node => { ++ if (!dispatchedNodes.has(node)) { ++ dispatchedNodes.add(node); ++ setTimeout$1(() => { ++ $(node).dispatchEvent( ++ new MouseEvent$2(event, {bubbles: true, cancelable: true}) ++ ); ++ }, delayInMiliseconds); ++ } ++ }); ++ } ++ } ++ ++ let { ++ parseInt, ++ setTimeout, ++ Error: Error$1, ++ MouseEvent: MouseEvent$1, ++ MutationObserver: MutationObserver$1, ++ WeakSet: WeakSet$1 ++ } = $(window); ++ ++ const VALID_TYPES = ["auxclick", "click", "dblclick", "gotpointercapture", ++ "lostpointercapture", "mouseenter", "mousedown", ++ "mouseleave", "mousemove", "mouseout", "mouseover", ++ "mouseup", "pointerdown", "pointerenter", ++ "pointermove", "pointerover", "pointerout", ++ "pointerup", "pointercancel", "pointerleave"]; ++ ++ function simulateMouseEvent(...selectors) { ++ const debugLog = getDebugger("simulate-mouse-event"); ++ const MAX_ARGS = 7; ++ if (selectors.length < 1) ++ throw new Error$1("[simulate-mouse-event snippet]: No selector provided."); ++ if (selectors.length > MAX_ARGS) { ++ ++ selectors = selectors.slice(0, MAX_ARGS); ++ } ++ function parseArg(theRule) { ++ if (!theRule) ++ return null; ++ ++ const result = { ++ selector: "", ++ continue: false, ++ trigger: false, ++ event: "click", ++ delay: "500", ++ clicked: false, ++ found: false ++ }; ++ const textArr = theRule.split("$"); ++ let options = []; ++ if (textArr.length >= 2) ++ options = textArr[1].toLowerCase().split(","); ++ ++ [result.selector] = textArr; ++ ++ for (const option of options) { ++ if (option === "trigger") { ++ result.trigger = true; ++ } ++ else if (option === "continue") { ++ result.continue = true; ++ } ++ else if (option.startsWith("event")) { ++ const event = option.toLowerCase().split("="); ++ event[1] ? result.event = event[1] : result.event = "click"; ++ } ++ else if (option.startsWith("delay")) { ++ const delay = option.toLowerCase().split("="); ++ delay[1] ? result.delay = delay[1] : result.delay = "500"; ++ } ++ } ++ if (!VALID_TYPES.includes(result.event)) { ++ debugLog(result.event, ++ " might be misspelled, check for typos.\n", ++ "These are the supported events:", ++ VALID_TYPES); ++ } ++ return result; ++ } ++ ++ const parsedArgs = $([]); ++ ++ $(selectors).forEach(rule => { ++ const parsedRule = parseArg(rule); ++ parsedArgs.push(parsedRule); ++ }); ++ ++ function checkIfAllSelectorsFound() { ++ parsedArgs.forEach(arg => { ++ if (!arg.found) { ++ const queryAll = initQueryAll(arg.selector); ++ const elems = queryAll(); ++ if (elems.length > 0) ++ arg.found = true; ++ } ++ }); ++ return parsedArgs.every(arg => arg.found); ++ } ++ ++ function triggerEvent(node, event, delay) { ++ ++ if (!node || !event) ++ return; ++ ++ if (event === "click" && node.click) { ++ node.click(); ++ debugLog( ++ "Clicked on this node:\n", node, "\nwith a delay of", delay, "ms" ++ ); ++ } ++ else { ++ node.dispatchEvent( ++ new MouseEvent$1(event, {bubbles: true, cancelable: true}) ++ ); ++ debugLog( ++ "A", ++ event, ++ "event was dispatched with a delay of", ++ delay, ++ "ms on this node:\n", ++ node ++ ); ++ } ++ } ++ let allFound = false; ++ ++ const [last] = parsedArgs.slice(-1); ++ last.trigger = true; ++ ++ let dispatchedNodes = new WeakSet$1(); ++ ++ let observer = new MutationObserver$1(findNodesAndDispatchEvents); ++ observer.observe(document, {childList: true, subtree: true}); ++ findNodesAndDispatchEvents(); ++ ++ function findNodesAndDispatchEvents() { ++ ++ if (!allFound) ++ allFound = checkIfAllSelectorsFound(); ++ if (allFound) { ++ for (const parsedRule of parsedArgs) { ++ const queryAndApply = initQueryAndApply(parsedRule.selector); ++ const delayInMiliseconds = parseInt(parsedRule.delay, 10); ++ if (parsedRule.trigger) { ++ queryAndApply(node => { ++ if (!dispatchedNodes.has(node)) { ++ dispatchedNodes.add(node); ++ if (parsedRule.continue) { ++ setInterval(() => { ++ triggerEvent(node, parsedRule.event, parsedRule.delay); ++ }, delayInMiliseconds); ++ } ++ else { ++ setTimeout(() => { ++ triggerEvent(node, parsedRule.event, parsedRule.delay); ++ }, delayInMiliseconds); ++ } ++ } ++ }); ++ } ++ } ++ } ++ } ++ } ++ ++ const snippets = { ++ log, ++ race, ++ "debug": setDebug, ++ "hide-if-matches-xpath": hideIfMatchesXPath, ++ "hide-if-matches-computed-xpath": hideIfMatchesComputedXPath, ++ "hide-if-contains": hideIfContains, ++ "hide-if-contains-similar-text": hideIfContainsSimilarText, ++ "hide-if-contains-visible-text": hideIfContainsVisibleText, ++ "hide-if-contains-and-matches-style": hideIfContainsAndMatchesStyle, ++ "hide-if-has-and-matches-style": hideIfHasAndMatchesStyle, ++ "hide-if-labelled-by": hideIfLabelledBy, ++ "hide-if-contains-image": hideIfContainsImage, ++ "simulate-event-poc": simulateEvent, ++ "simulate-mouse-event": simulateMouseEvent ++ }; ++ ++ let {MutationObserver} = $(window); ++ ++ const {ELEMENT_NODE} = Node; ++ ++ function hideIfMatchesXPath3(query, scopeQuery) { ++ let {mark, end} = profile(); ++ ++ function queryNodes() { ++ return fontoxpath.evaluateXPathToNodes(query, document, null, null, { ++ language: fontoxpath.evaluateXPath.XQUERY_3_1_LANGUAGE ++ }); ++ } ++ ++ let debugLog = getDebugger("hide-if-matches-xpath3"); ++ ++ const startHidingMutationObserver = scopeNode => { ++ const seenMap = new WeakSet(); ++ const callback = () => { ++ mark(); ++ ++ const nodes = queryNodes(); ++ for (const node of $(nodes)) { ++ if (seenMap.has(node)) ++ return false; ++ seenMap.add(node); ++ win(); ++ if ($(node).nodeType === ELEMENT_NODE) ++ hideElement(node); ++ else ++ $(node).textContent = ""; ++ debugLog("Matched: ", node, " for selector: ", query); ++ } ++ end(); ++ }; ++ ++ const mo = new MutationObserver(callback); ++ const win = raceWinner( ++ "hide-if-matches-xpath3", ++ () => mo.disconnect() ++ ); ++ mo.observe( ++ scopeNode, {characterData: true, childList: true, subtree: true}); ++ callback(); ++ }; ++ ++ if (scopeQuery) { ++ ++ let count = 0; ++ let scopeMutationObserver; ++ const scopeNodes = queryNodes(); ++ const findMutationScopeNodes = () => { ++ for (const scopeNode of $(scopeNodes)) { ++ ++ startHidingMutationObserver(scopeNode); ++ count++; ++ } ++ if (count > 0) ++ scopeMutationObserver.disconnect(); ++ }; ++ ++ scopeMutationObserver = new MutationObserver(findMutationScopeNodes); ++ scopeMutationObserver.observe( ++ document, {characterData: true, childList: true, subtree: true} ++ ); ++ findMutationScopeNodes(); ++ } ++ else { ++ ++ startHidingMutationObserver(document); ++ } ++ } ++ ++ snippets["hide-if-matches-xpath3"] = hideIfMatchesXPath3; ++ let context; ++ for (const [name, ...args] of filters) { ++ if (snippets.hasOwnProperty(name)) { ++ try { context = snippets[name].apply(context, args); } ++ catch (error) { console.error(error); } ++ } ++ } ++ context = void 0; ++})(e, ...t); ++ ++const callback = (environment, ...filters) => { ++ /*! ++ * This file is part of eyeo's Anti-Circumvention Snippets module (@eyeo/snippets), ++ * Copyright (C) 2006-present eyeo GmbH ++ * ++ * @eyeo/snippets is free software: you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 3 as ++ * published by the Free Software Foundation. ++ * ++ * @eyeo/snippets is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with @eyeo/snippets. If not, see . ++ */ ++ const $$1 = Proxy; ++ ++ const {apply: a, bind: b, call: c} = Function; ++ const apply$2 = c.bind(a); ++ const bind = c.bind(b); ++ const call = c.bind(c); ++ ++ const callerHandler = { ++ get(target, name) { ++ return bind(c, target[name]); ++ } ++ }; ++ ++ const caller = target => new $$1(target, callerHandler); ++ ++ const proxy = (source, target) => new $$1(source, { ++ apply: (_, self, args) => apply$2(target, self, args) ++ }); ++ ++ const handler$2 = { ++ get(target, name) { ++ return bind(target[name], target); ++ } ++ }; ++ ++ const bound = target => new $$1(target, handler$2); ++ ++ const { ++ assign: assign$1, ++ defineProperties: defineProperties$1, ++ freeze: freeze$1, ++ getOwnPropertyDescriptor: getOwnPropertyDescriptor$3, ++ getOwnPropertyDescriptors: getOwnPropertyDescriptors$1, ++ getPrototypeOf ++ } = bound(Object); ++ ++ const {hasOwnProperty} = caller({}); ++ ++ const {species} = Symbol; ++ ++ const handler$1 = { ++ get(target, name) { ++ const Native = target[name]; ++ class Secure extends Native {} ++ ++ const proto = getOwnPropertyDescriptors$1(Native.prototype); ++ delete proto.constructor; ++ freeze$1(defineProperties$1(Secure.prototype, proto)); ++ ++ const statics = getOwnPropertyDescriptors$1(Native); ++ delete statics.length; ++ delete statics.prototype; ++ statics[species] = {value: Secure}; ++ return freeze$1(defineProperties$1(Secure, statics)); ++ } ++ }; ++ ++ const secure = target => new $$1(target, handler$1); ++ ++ const libEnvironment = typeof environment !== "undefined" ? environment : ++ {}; ++ ++ if (typeof globalThis === "undefined") ++ window.globalThis = window; ++ ++ const {apply: apply$1, ownKeys} = bound(Reflect); ++ ++ const worldEnvDefined = "world" in libEnvironment; ++ const isIsolatedWorld = worldEnvDefined && libEnvironment.world === "ISOLATED"; ++ const isMainWorld = worldEnvDefined && libEnvironment.world === "MAIN"; ++ const isChrome = typeof chrome === "object" && !!chrome.runtime; ++ const isOtherThanChrome = typeof browser === "object" && !!browser.runtime; ++ const isExtensionContext$2 = !isMainWorld && ++ (isIsolatedWorld || isChrome || isOtherThanChrome); ++ const copyIfExtension = value => isExtensionContext$2 ? ++ value : ++ create(value, getOwnPropertyDescriptors(value)); ++ ++ const { ++ create, ++ defineProperties, ++ defineProperty, ++ freeze, ++ getOwnPropertyDescriptor: getOwnPropertyDescriptor$2, ++ getOwnPropertyDescriptors ++ } = bound(Object); ++ ++ const invokes = bound(globalThis); ++ const classes = isExtensionContext$2 ? globalThis : secure(globalThis); ++ const {Map: Map$8, RegExp: RegExp$1, Set: Set$2, WeakMap: WeakMap$4, WeakSet: WeakSet$3} = classes; ++ ++ const augment = (source, target, method = null) => { ++ const known = ownKeys(target); ++ for (const key of ownKeys(source)) { ++ if (known.includes(key)) ++ continue; ++ ++ const descriptor = getOwnPropertyDescriptor$2(source, key); ++ if (method && "value" in descriptor) { ++ const {value} = descriptor; ++ if (typeof value === "function") ++ descriptor.value = method(value); ++ } ++ defineProperty(target, key, descriptor); ++ } ++ }; ++ ++ const primitive = name => { ++ const Super = classes[name]; ++ class Class extends Super {} ++ const {toString, valueOf} = Super.prototype; ++ defineProperties(Class.prototype, { ++ toString: {value: toString}, ++ valueOf: {value: valueOf} ++ }); ++ const type = name.toLowerCase(); ++ const method = callback => function() { ++ const result = apply$1(callback, this, arguments); ++ return typeof result === type ? new Class(result) : result; ++ }; ++ augment(Super, Class, method); ++ augment(Super.prototype, Class.prototype, method); ++ return Class; ++ }; ++ ++ const variables$3 = freeze({ ++ frozen: new WeakMap$4(), ++ hidden: new WeakSet$3(), ++ iframePropertiesToAbort: { ++ read: new Set$2(), ++ write: new Set$2() ++ }, ++ abortedIframes: new WeakMap$4() ++ }); ++ ++ const startsCapitalized = new RegExp$1("^[A-Z]"); ++ ++ var env = new Proxy(new Map$8([ ++ ++ ["chrome", ( ++ isExtensionContext$2 && ( ++ (isChrome && chrome) || ++ (isOtherThanChrome && browser) ++ ) ++ ) || void 0], ++ ["isExtensionContext", isExtensionContext$2], ++ ["variables", variables$3], ++ ++ ["console", copyIfExtension(console)], ++ ["document", globalThis.document], ++ ["performance", copyIfExtension(performance)], ++ ["JSON", copyIfExtension(JSON)], ++ ["Map", Map$8], ++ ["Math", copyIfExtension(Math)], ++ ["Number", isExtensionContext$2 ? Number : primitive("Number")], ++ ["RegExp", RegExp$1], ++ ["Set", Set$2], ++ ["String", isExtensionContext$2 ? String : primitive("String")], ++ ["WeakMap", WeakMap$4], ++ ["WeakSet", WeakSet$3], ++ ++ ["MouseEvent", MouseEvent] ++ ]), { ++ get(map, key) { ++ if (map.has(key)) ++ return map.get(key); ++ ++ let value = globalThis[key]; ++ if (typeof value === "function") ++ value = (startsCapitalized.test(key) ? classes : invokes)[key]; ++ ++ map.set(key, value); ++ return value; ++ }, ++ has(map, key) { ++ return map.has(key); ++ } ++ }); ++ ++ class WeakValue { ++ has() { return false; } ++ set() {} ++ } ++ ++ const helpers = {WeakSet, WeakMap, WeakValue}; ++ const {apply} = Reflect; ++ ++ function transformOnce (callback) { const {WeakSet, WeakMap, WeakValue} = (this || helpers); ++ const ws = new WeakSet; ++ const wm = new WeakMap; ++ const wv = new WeakValue; ++ return function (any) { ++ if (ws.has(any)) ++ return any; ++ ++ if (wm.has(any)) ++ return wm.get(any); ++ ++ if (wv.has(any)) ++ return wv.get(any); ++ ++ const value = apply(callback, this, arguments); ++ ws.add(value); ++ if (value !== any) ++ (typeof any === 'object' && any ? wm : wv).set(any, value); ++ return value; ++ }; ++ } ++ ++ const {Map: Map$7, WeakMap: WeakMap$3, WeakSet: WeakSet$2, setTimeout} = env; ++ ++ let cleanup = true; ++ let cleanUpCallback = map => { ++ map.clear(); ++ cleanup = !cleanup; ++ }; ++ ++ var transformer = transformOnce.bind({ ++ WeakMap: WeakMap$3, ++ WeakSet: WeakSet$2, ++ ++ WeakValue: class extends Map$7 { ++ set(key, value) { ++ if (cleanup) { ++ cleanup = !cleanup; ++ setTimeout(cleanUpCallback, 0, this); ++ } ++ return super.set(key, value); ++ } ++ } ++ }); ++ ++ const {concat, includes, join, reduce, unshift} = caller([]); ++ ++ const globals = secure(globalThis); ++ ++ const { ++ Map: Map$6, ++ WeakMap: WeakMap$2 ++ } = globals; ++ ++ const map = new Map$6; ++ const descriptors = target => { ++ const chain = []; ++ let current = target; ++ while (current) { ++ if (map.has(current)) ++ unshift(chain, map.get(current)); ++ else { ++ const descriptors = getOwnPropertyDescriptors$1(current); ++ map.set(current, descriptors); ++ unshift(chain, descriptors); ++ } ++ current = getPrototypeOf(current); ++ } ++ unshift(chain, {}); ++ return apply$2(assign$1, null, chain); ++ }; ++ ++ const chain = source => { ++ const target = typeof source === 'function' ? source.prototype : source; ++ const chained = descriptors(target); ++ const handler = { ++ get(target, key) { ++ if (key in chained) { ++ const {value, get} = chained[key]; ++ if (get) ++ return call(get, target); ++ if (typeof value === 'function') ++ return bind(value, target); ++ } ++ return target[key]; ++ }, ++ set(target, key, value) { ++ if (key in chained) { ++ const {set} = chained[key]; ++ if (set) { ++ call(set, target, value); ++ return true; ++ } ++ } ++ target[key] = value; ++ return true; ++ } ++ }; ++ return target => new $$1(target, handler); ++ }; ++ ++ const { ++ isExtensionContext: isExtensionContext$1, ++ Array: Array$2, ++ Number: Number$1, ++ String: String$1, ++ Object: Object$9 ++ } = env; ++ ++ const {isArray} = Array$2; ++ const {getOwnPropertyDescriptor: getOwnPropertyDescriptor$1, setPrototypeOf: setPrototypeOf$1} = Object$9; ++ ++ const {toString: toString$1} = Object$9.prototype; ++ const {slice} = String$1.prototype; ++ const getBrand = value => call(slice, call(toString$1, value), 8, -1); ++ ++ const {get: nodeType} = getOwnPropertyDescriptor$1(Node.prototype, "nodeType"); ++ ++ const chained = isExtensionContext$1 ? {} : { ++ Attr: chain(Attr), ++ CanvasRenderingContext2D: chain(CanvasRenderingContext2D), ++ CSSStyleDeclaration: chain(CSSStyleDeclaration), ++ Document: chain(Document), ++ Element: chain(Element), ++ HTMLCanvasElement: chain(HTMLCanvasElement), ++ HTMLElement: chain(HTMLElement), ++ HTMLImageElement: chain(HTMLImageElement), ++ HTMLScriptElement: chain(HTMLScriptElement), ++ MutationRecord: chain(MutationRecord), ++ Node: chain(Node), ++ ShadowRoot: chain(ShadowRoot), ++ ++ get CSS2Properties() { ++ return chained.CSSStyleDeclaration; ++ } ++ }; ++ ++ const upgrade = (value, hint) => { ++ if (hint !== "Element" && hint in chained) ++ return chained[hint](value); ++ ++ if (isArray(value)) ++ return setPrototypeOf$1(value, Array$2.prototype); ++ ++ const brand = getBrand(value); ++ if (brand in chained) ++ return chained[brand](value); ++ ++ if (brand in env) ++ return setPrototypeOf$1(value, env[brand].prototype); ++ ++ if ("nodeType" in value) { ++ switch (call(nodeType, value)) { ++ case 1: ++ if (!(hint in chained)) ++ throw new Error("unknown hint " + hint); ++ return chained[hint](value); ++ case 2: ++ return chained.Attr(value); ++ case 3: ++ return chained.Node(value); ++ case 9: ++ return chained.Document(value); ++ } ++ } ++ ++ throw new Error("unknown brand " + brand); ++ }; ++ ++ var $ = isExtensionContext$1 ? ++ value => (value === window || value === globalThis ? env : value) : ++ transformer((value, hint = "Element") => { ++ if (value === window || value === globalThis) ++ return env; ++ ++ switch (typeof value) { ++ case "object": ++ return value && upgrade(value, hint); ++ ++ case "string": ++ return new String$1(value); ++ ++ case "number": ++ return new Number$1(value); ++ ++ default: ++ throw new Error("unsupported value"); ++ } ++ }); ++ ++ const handler = { ++ get(target, name) { ++ const context = target; ++ while (!hasOwnProperty(target, name)) ++ target = getPrototypeOf(target); ++ const {get, set} = getOwnPropertyDescriptor$3(target, name); ++ return function () { ++ return arguments.length ? ++ apply$2(set, context, arguments) : ++ call(get, context); ++ }; ++ } ++ }; ++ ++ const accessor = target => new $$1(target, handler); ++ ++ let debugging = false; ++ ++ function debug() { ++ return debugging; ++ } ++ ++ function setDebug() { ++ debugging = true; ++ } ++ ++ const {console: console$3} = $(window); ++ ++ const noop = () => {}; ++ ++ function log(...args) { ++ if (debug()) ++ $(args).unshift("%c DEBUG", "font-weight: bold"); ++ ++ console$3.log(...args); ++ } ++ ++ function getDebugger(name) { ++ return bind(debug() ? log : noop, null, name); ++ } ++ ++ let {Math: Math$1, RegExp} = $(window); ++ ++ function regexEscape(string) { ++ return $(string).replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&"); ++ } ++ ++ function toRegExp(pattern) { ++ let {length} = pattern; ++ ++ if (length > 1 && pattern[0] === "/") { ++ let isCaseSensitive = pattern[length - 1] === "/"; ++ ++ if (isCaseSensitive || (length > 2 && $(pattern).endsWith("/i"))) { ++ let args = [$(pattern).slice(1, isCaseSensitive ? -1 : -2)]; ++ if (!isCaseSensitive) ++ args.push("i"); ++ ++ return new RegExp(...args); ++ } ++ } ++ ++ return new RegExp(regexEscape(pattern)); ++ } ++ ++ function randomId() { ++ ++ return $(Math$1.floor(Math$1.random() * 2116316160 + 60466176)).toString(36); ++ } ++ ++ let { ++ parseFloat, ++ variables: variables$2, ++ Array: Array$1, ++ Error: Error$7, ++ Map: Map$5, ++ Object: Object$8, ++ ReferenceError: ReferenceError$2, ++ Set: Set$1, ++ WeakMap: WeakMap$1 ++ } = $(window); ++ ++ let {onerror} = accessor(window); ++ ++ let NodeProto$1 = Node.prototype; ++ let ElementProto$2 = Element.prototype; ++ ++ let propertyAccessors = null; ++ ++ function wrapPropertyAccess(object, property, descriptor, ++ setConfigurable = true) { ++ let $property = $(property); ++ let dotIndex = $property.indexOf("."); ++ if (dotIndex == -1) { ++ ++ let currentDescriptor = Object$8.getOwnPropertyDescriptor(object, property); ++ if (currentDescriptor && !currentDescriptor.configurable) ++ return; ++ ++ let newDescriptor = Object$8.assign({}, descriptor, { ++ configurable: setConfigurable ++ }); ++ ++ if (!currentDescriptor && !newDescriptor.get && newDescriptor.set) { ++ let propertyValue = object[property]; ++ newDescriptor.get = () => propertyValue; ++ } ++ ++ Object$8.defineProperty(object, property, newDescriptor); ++ return; ++ } ++ ++ let name = $property.slice(0, dotIndex).toString(); ++ property = $property.slice(dotIndex + 1).toString(); ++ let value = object[name]; ++ if (value && (typeof value == "object" || typeof value == "function")) ++ wrapPropertyAccess(value, property, descriptor); ++ ++ let currentDescriptor = Object$8.getOwnPropertyDescriptor(object, name); ++ if (currentDescriptor && !currentDescriptor.configurable) ++ return; ++ ++ if (!propertyAccessors) ++ propertyAccessors = new WeakMap$1(); ++ ++ if (!propertyAccessors.has(object)) ++ propertyAccessors.set(object, new Map$5()); ++ ++ let properties = propertyAccessors.get(object); ++ if (properties.has(name)) { ++ properties.get(name).set(property, descriptor); ++ return; ++ } ++ ++ let toBeWrapped = new Map$5([[property, descriptor]]); ++ properties.set(name, toBeWrapped); ++ Object$8.defineProperty(object, name, { ++ get: () => value, ++ set(newValue) { ++ value = newValue; ++ if (value && (typeof value == "object" || typeof value == "function")) { ++ ++ for (let [prop, desc] of toBeWrapped) ++ wrapPropertyAccess(value, prop, desc); ++ } ++ }, ++ configurable: setConfigurable ++ }); ++ } ++ ++ function overrideOnError(magic) { ++ let prev = onerror(); ++ onerror((...args) => { ++ let message = args.length && args[0]; ++ if (typeof message == "string" && $(message).includes(magic)) ++ return true; ++ if (typeof prev == "function") ++ return apply$2(prev, this, args); ++ }); ++ } ++ ++ function abortOnRead(loggingPrefix, context, property, ++ setConfigurable = true) { ++ let debugLog = getDebugger(loggingPrefix); ++ ++ if (!property) { ++ debugLog("no property to abort on read"); ++ return; ++ } ++ ++ let rid = randomId(); ++ ++ function abort() { ++ debugLog(`${property} access aborted`); ++ throw new ReferenceError$2(rid); ++ } ++ ++ debugLog(`aborting on ${property} access`); ++ ++ wrapPropertyAccess(context, ++ property, ++ {get: abort, set() {}}, ++ setConfigurable); ++ overrideOnError(rid); ++ } ++ ++ function abortOnWrite(loggingPrefix, context, property, ++ setConfigurable = true) { ++ let debugLog = getDebugger(loggingPrefix); ++ ++ if (!property) { ++ debugLog("no property to abort on write"); ++ return; ++ } ++ ++ let rid = randomId(); ++ ++ function abort() { ++ debugLog(`setting ${property} aborted`); ++ throw new ReferenceError$2(rid); ++ } ++ ++ debugLog(`aborting when setting ${property}`); ++ ++ wrapPropertyAccess(context, property, {set: abort}, setConfigurable); ++ overrideOnError(rid); ++ } ++ ++ function abortOnIframe( ++ properties, ++ abortRead = false, ++ abortWrite = false ++ ) { ++ let abortedIframes = variables$2.abortedIframes; ++ let iframePropertiesToAbort = variables$2.iframePropertiesToAbort; ++ ++ for (let frame of Array$1.from(window.frames)) { ++ if (abortedIframes.has(frame)) { ++ for (let property of properties) { ++ if (abortRead) ++ abortedIframes.get(frame).read.add(property); ++ if (abortWrite) ++ abortedIframes.get(frame).write.add(property); ++ } ++ } ++ } ++ ++ for (let property of properties) { ++ if (abortRead) ++ iframePropertiesToAbort.read.add(property); ++ if (abortWrite) ++ iframePropertiesToAbort.write.add(property); ++ } ++ ++ queryAndProxyIframe(); ++ if (!abortedIframes.has(document)) { ++ abortedIframes.set(document, true); ++ addHooksOnDomAdditions(queryAndProxyIframe); ++ } ++ ++ function queryAndProxyIframe() { ++ for (let frame of Array$1.from(window.frames)) { ++ ++ if (!abortedIframes.has(frame)) { ++ abortedIframes.set(frame, { ++ read: new Set$1(iframePropertiesToAbort.read), ++ write: new Set$1(iframePropertiesToAbort.write) ++ }); ++ } ++ ++ let readProps = abortedIframes.get(frame).read; ++ if (readProps.size > 0) { ++ let props = Array$1.from(readProps); ++ readProps.clear(); ++ for (let property of props) ++ abortOnRead("abort-on-iframe-property-read", frame, property); ++ } ++ ++ let writeProps = abortedIframes.get(frame).write; ++ if (writeProps.size > 0) { ++ let props = Array$1.from(writeProps); ++ writeProps.clear(); ++ for (let property of props) ++ abortOnWrite("abort-on-iframe-property-write", frame, property); ++ } ++ } ++ } ++ } ++ ++ function addHooksOnDomAdditions(endCallback) { ++ let descriptor; ++ ++ wrapAccess(NodeProto$1, ["appendChild", "insertBefore", "replaceChild"]); ++ wrapAccess(ElementProto$2, ["append", "prepend", "replaceWith", "after", ++ "before", "insertAdjacentElement", ++ "insertAdjacentHTML"]); ++ ++ descriptor = getInnerHTMLDescriptor(ElementProto$2, "innerHTML"); ++ wrapPropertyAccess(ElementProto$2, "innerHTML", descriptor); ++ ++ descriptor = getInnerHTMLDescriptor(ElementProto$2, "outerHTML"); ++ wrapPropertyAccess(ElementProto$2, "outerHTML", descriptor); ++ ++ function wrapAccess(prototype, names) { ++ for (let name of names) { ++ let desc = getAppendChildDescriptor(prototype, name); ++ wrapPropertyAccess(prototype, name, desc); ++ } ++ } ++ ++ function getAppendChildDescriptor(target, property) { ++ let currentValue = target[property]; ++ return { ++ get() { ++ return function(...args) { ++ let result; ++ result = apply$2(currentValue, this, args); ++ endCallback && endCallback(); ++ return result; ++ }; ++ } ++ }; ++ } ++ ++ function getInnerHTMLDescriptor(target, property) { ++ let desc = Object$8.getOwnPropertyDescriptor(target, property); ++ let {set: prevSetter} = desc || {}; ++ return { ++ set(val) { ++ let result; ++ result = call(prevSetter, this, val); ++ endCallback && endCallback(); ++ return result; ++ } ++ }; ++ } ++ } ++ ++ let {Object: NativeObject} = window; ++ function findOwner(root, path) { ++ if (!(root instanceof NativeObject)) ++ return; ++ ++ let object = root; ++ let chain = $(path).split("."); ++ ++ if (chain.length === 0) ++ return; ++ ++ for (let i = 0; i < chain.length - 1; i++) { ++ let prop = chain[i]; ++ ++ if (!hasOwnProperty(object, prop)) ++ return; ++ ++ object = object[prop]; ++ ++ if (!(object instanceof NativeObject)) ++ return; ++ } ++ ++ let prop = chain[chain.length - 1]; ++ ++ if (hasOwnProperty(object, prop)) ++ return [object, prop]; ++ } ++ ++ const decimals = $(/^\d+$/); ++ ++ function overrideValue(value) { ++ switch (value) { ++ case "false": ++ return false; ++ case "true": ++ return true; ++ case "null": ++ return null; ++ case "noopFunc": ++ return () => {}; ++ case "trueFunc": ++ return () => true; ++ case "falseFunc": ++ return () => false; ++ case "emptyArray": ++ return []; ++ case "emptyObj": ++ return {}; ++ case "undefined": ++ return void 0; ++ case "": ++ return value; ++ default: ++ if (decimals.test(value)) ++ return parseFloat(value); ++ ++ throw new Error$7("[override-property-read snippet]: " + ++ `Value "${value}" is not valid.`); ++ } ++ } ++ ++ let {HTMLScriptElement: HTMLScriptElement$1, Object: Object$7, ReferenceError: ReferenceError$1} = $(window); ++ let Script = Object$7.getPrototypeOf(HTMLScriptElement$1); ++ ++ function abortCurrentInlineScript(api, search = null) { ++ const debugLog = getDebugger("abort-current-inline-script"); ++ const re = search ? toRegExp(search) : null; ++ ++ const rid = randomId(); ++ const us = $(document).currentScript; ++ ++ let object = window; ++ const path = $(api).split("."); ++ const name = $(path).pop(); ++ ++ for (let node of $(path)) { ++ object = object[node]; ++ if ( ++ !object || !(typeof object == "object" || typeof object == "function")) { ++ debugLog(path, " is not found"); ++ return; ++ } ++ } ++ ++ const {get: prevGetter, set: prevSetter} = ++ Object$7.getOwnPropertyDescriptor(object, name) || {}; ++ ++ let currentValue = object[name]; ++ if (typeof currentValue === "undefined") ++ debugLog("The property", name, "doesn't exist yet. Check typos."); ++ ++ const abort = () => { ++ const element = $(document).currentScript; ++ if (element instanceof Script && ++ $(element, "HTMLScriptElement").src == "" && ++ element != us && ++ (!re || re.test($(element).textContent))) { ++ debugLog(path, " is aborted \n", element); ++ throw new ReferenceError$1(rid); ++ } ++ }; ++ ++ const descriptor = { ++ get() { ++ abort(); ++ ++ if (prevGetter) ++ return call(prevGetter, this); ++ ++ return currentValue; ++ }, ++ set(value) { ++ abort(); ++ ++ if (prevSetter) ++ call(prevSetter, this, value); ++ else ++ currentValue = value; ++ } ++ }; ++ ++ wrapPropertyAccess(object, name, descriptor); ++ ++ overrideOnError(rid); ++ } ++ ++ function abortOnIframePropertyRead(...properties) { ++ abortOnIframe(properties, true, false); ++ } ++ ++ function abortOnIframePropertyWrite(...properties) { ++ abortOnIframe(properties, false, true); ++ } ++ ++ function abortOnPropertyRead(property, setConfigurable) { ++ const configurableFlag = !(setConfigurable === "false"); ++ abortOnRead("abort-on-property-read", window, property, configurableFlag); ++ } ++ ++ function abortOnPropertyWrite(property, setConfigurable) { ++ const configurableFlag = !(setConfigurable === "false"); ++ abortOnWrite("abort-on-property-write", window, property, configurableFlag); ++ } ++ ++ let {Error: Error$6} = $(window); ++ let {cookie: documentCookies} = accessor(document); ++ ++ function cookieRemover(cookie) { ++ if (!cookie) ++ throw new Error$6("[cookie-remover snippet]: No cookie to remove."); ++ ++ let debugLog = getDebugger("cookie-remover"); ++ let re = toRegExp(cookie); ++ ++ if (!$(/^http|^about/).test(location.protocol)) { ++ debugLog("Snippet only works for http or https and about."); ++ return; ++ } ++ ++ debugLog("Parsing cookies for matches"); ++ ++ for (const pair of $(getCookieMatches())) { ++ let $hostname = $(location.hostname); ++ let name = $(pair).split("=")[0]; ++ let expires = "expires=Thu, 01 Jan 1970 00:00:00 GMT"; ++ let path = "path=/"; ++ let domain = "domain=" + $hostname.slice($hostname.indexOf(".") + 1); ++ ++ documentCookies(`${$(name).trim()}=;${expires};${path};${domain}`); ++ ++ debugLog(`Set expiration date on ${name}`); ++ } ++ ++ function getCookieMatches() { ++ const arr = $(documentCookies()).split(";"); ++ return arr.filter(str => re.test($(str).split("=")[0])); ++ } ++ } ++ ++ let { ++ document: document$1, ++ getComputedStyle, ++ isExtensionContext, ++ variables: variables$1, ++ Array, ++ MutationObserver: MutationObserver$2, ++ Object: Object$6, ++ XPathEvaluator, ++ XPathExpression, ++ XPathResult ++ } = $(window); ++ ++ let {querySelectorAll} = document$1; ++ let $$ = querySelectorAll && bind(querySelectorAll, document$1); ++ ++ const {assign, setPrototypeOf} = Object$6; ++ ++ class $XPathExpression extends XPathExpression { ++ evaluate(...args) { ++ return setPrototypeOf( ++ apply$2(super.evaluate, this, args), ++ XPathResult.prototype ++ ); ++ } ++ } ++ ++ class $XPathEvaluator extends XPathEvaluator { ++ createExpression(...args) { ++ return setPrototypeOf( ++ apply$2(super.createExpression, this, args), ++ $XPathExpression.prototype ++ ); ++ } ++ } ++ ++ function hideElement(element) { ++ if (variables$1.hidden.has(element)) ++ return; ++ ++ notifyElementHidden(element); ++ ++ variables$1.hidden.add(element); ++ ++ let {style} = $(element); ++ let $style = $(style, "CSSStyleDeclaration"); ++ let properties = $([]); ++ let {debugCSSProperties} = libEnvironment; ++ ++ for (let [key, value] of (debugCSSProperties || [["display", "none"]])) { ++ $style.setProperty(key, value, "important"); ++ properties.push([key, $style.getPropertyValue(key)]); ++ } ++ ++ new MutationObserver$2(() => { ++ for (let [key, value] of properties) { ++ let propertyValue = $style.getPropertyValue(key); ++ let propertyPriority = $style.getPropertyPriority(key); ++ if (propertyValue != value || propertyPriority != "important") ++ $style.setProperty(key, value, "important"); ++ } ++ }).observe(element, {attributes: true, ++ attributeFilter: ["style"]}); ++ } ++ ++ function notifyElementHidden(element) { ++ if (isExtensionContext && typeof checkElement === "function") ++ checkElement(element); ++ } ++ ++ function initQueryAndApply(selector) { ++ let $selector = selector; ++ if ($selector.startsWith("xpath(") && ++ $selector.endsWith(")")) { ++ let xpathQuery = $selector.slice(6, -1); ++ let evaluator = new $XPathEvaluator(); ++ let expression = evaluator.createExpression(xpathQuery, null); ++ ++ let flag = XPathResult.ORDERED_NODE_SNAPSHOT_TYPE; ++ ++ return cb => { ++ if (!cb) ++ return; ++ let result = expression.evaluate(document$1, flag, null); ++ let {snapshotLength} = result; ++ for (let i = 0; i < snapshotLength; i++) ++ cb(result.snapshotItem(i)); ++ }; ++ } ++ return cb => $$(selector).forEach(cb); ++ } ++ ++ function initQueryAll(selector) { ++ let $selector = selector; ++ if ($selector.startsWith("xpath(") && ++ $selector.endsWith(")")) { ++ let queryAndApply = initQueryAndApply(selector); ++ return () => { ++ let elements = $([]); ++ queryAndApply(e => elements.push(e)); ++ return elements; ++ }; ++ } ++ return () => Array.from($$(selector)); ++ } ++ ++ let {ELEMENT_NODE, TEXT_NODE, prototype: NodeProto} = Node; ++ let {prototype: ElementProto$1} = Element; ++ let {prototype: HTMLElementProto} = HTMLElement; ++ ++ let { ++ console: console$2, ++ variables, ++ DOMParser, ++ Error: Error$5, ++ MutationObserver: MutationObserver$1, ++ Object: Object$5, ++ ReferenceError ++ } = $(window); ++ ++ let {getOwnPropertyDescriptor} = Object$5; ++ ++ function freezeElement(selector, options = "", ...exceptions) { ++ let observer; ++ let subtree = false; ++ let shouldAbort = false; ++ let exceptionSelectors = $(exceptions).filter(e => !isRegex(e)); ++ let regexExceptions = $(exceptions).filter(e => isRegex(e)).map(toRegExp); ++ let rid = randomId(); ++ let targetNodes; ++ let queryAll = initQueryAll(selector); ++ ++ checkOptions(); ++ let data = { ++ selector, ++ shouldAbort, ++ rid, ++ exceptionSelectors, ++ regexExceptions, ++ changeId: 0 ++ }; ++ if (!variables.frozen.has(document)) { ++ variables.frozen.set(document, true); ++ proxyNativeProperties(); ++ } ++ observer = new MutationObserver$1(searchAndAttach); ++ observer.observe(document, {childList: true, subtree: true}); ++ searchAndAttach(); ++ ++ function isRegex(s) { ++ return s.length >= 2 && s[0] == "/" && s[s.length - 1] == "/"; ++ } ++ ++ function checkOptions() { ++ let optionsChunks = $(options).split("+"); ++ if (optionsChunks.length === 1 && optionsChunks[0] === "") ++ optionsChunks = []; ++ for (let chunk of optionsChunks) { ++ switch (chunk) { ++ case "subtree": ++ subtree = true; ++ break; ++ case "abort": ++ shouldAbort = true; ++ break; ++ default: ++ throw new Error$5("[freeze] Unknown option passed to the snippet." + ++ " [selector]: " + selector + ++ " [option]: " + chunk); ++ } ++ } ++ } ++ ++ function proxyNativeProperties() { ++ let descriptor; ++ ++ descriptor = getAppendChildDescriptor( ++ NodeProto, "appendChild", isFrozen, getSnippetData ++ ); ++ wrapPropertyAccess(NodeProto, "appendChild", descriptor); ++ ++ descriptor = getAppendChildDescriptor( ++ NodeProto, "insertBefore", isFrozen, getSnippetData ++ ); ++ wrapPropertyAccess(NodeProto, "insertBefore", descriptor); ++ ++ descriptor = getAppendChildDescriptor( ++ NodeProto, "replaceChild", isFrozen, getSnippetData ++ ); ++ wrapPropertyAccess(NodeProto, "replaceChild", descriptor); ++ ++ descriptor = getAppendDescriptor( ++ ElementProto$1, "append", isFrozen, getSnippetData ++ ); ++ wrapPropertyAccess(ElementProto$1, "append", descriptor); ++ ++ descriptor = getAppendDescriptor( ++ ElementProto$1, "prepend", isFrozen, getSnippetData ++ ); ++ wrapPropertyAccess(ElementProto$1, "prepend", descriptor); ++ ++ descriptor = getAppendDescriptor( ++ ElementProto$1, ++ "replaceWith", ++ isFrozenOrHasFrozenParent, ++ getSnippetDataFromNodeOrParent ++ ); ++ wrapPropertyAccess(ElementProto$1, "replaceWith", descriptor); ++ ++ descriptor = getAppendDescriptor( ++ ElementProto$1, ++ "after", ++ isFrozenOrHasFrozenParent, ++ getSnippetDataFromNodeOrParent ++ ); ++ wrapPropertyAccess(ElementProto$1, "after", descriptor); ++ ++ descriptor = getAppendDescriptor( ++ ElementProto$1, ++ "before", ++ isFrozenOrHasFrozenParent, ++ getSnippetDataFromNodeOrParent ++ ); ++ wrapPropertyAccess(ElementProto$1, "before", descriptor); ++ ++ descriptor = getInsertAdjacentDescriptor( ++ ElementProto$1, ++ "insertAdjacentElement", ++ isFrozenAndInsideTarget, ++ getSnippetDataBasedOnTarget ++ ); ++ wrapPropertyAccess(ElementProto$1, "insertAdjacentElement", descriptor); ++ ++ descriptor = getInsertAdjacentDescriptor( ++ ElementProto$1, ++ "insertAdjacentHTML", ++ isFrozenAndInsideTarget, ++ getSnippetDataBasedOnTarget ++ ); ++ wrapPropertyAccess(ElementProto$1, "insertAdjacentHTML", descriptor); ++ ++ descriptor = getInsertAdjacentDescriptor( ++ ElementProto$1, ++ "insertAdjacentText", ++ isFrozenAndInsideTarget, ++ getSnippetDataBasedOnTarget ++ ); ++ wrapPropertyAccess(ElementProto$1, "insertAdjacentText", descriptor); ++ ++ descriptor = getInnerHTMLDescriptor( ++ ElementProto$1, "innerHTML", isFrozen, getSnippetData ++ ); ++ wrapPropertyAccess(ElementProto$1, "innerHTML", descriptor); ++ ++ descriptor = getInnerHTMLDescriptor( ++ ElementProto$1, ++ "outerHTML", ++ isFrozenOrHasFrozenParent, ++ getSnippetDataFromNodeOrParent ++ ); ++ wrapPropertyAccess(ElementProto$1, "outerHTML", descriptor); ++ ++ descriptor = getTextContentDescriptor( ++ NodeProto, "textContent", isFrozen, getSnippetData ++ ); ++ wrapPropertyAccess(NodeProto, "textContent", descriptor); ++ ++ descriptor = getTextContentDescriptor( ++ HTMLElementProto, "innerText", isFrozen, getSnippetData ++ ); ++ wrapPropertyAccess(HTMLElementProto, "innerText", descriptor); ++ ++ descriptor = getTextContentDescriptor( ++ NodeProto, "nodeValue", isFrozen, getSnippetData ++ ); ++ wrapPropertyAccess(NodeProto, "nodeValue", descriptor); ++ ++ function isFrozen(node) { ++ return node && variables.frozen.has(node); ++ } ++ ++ function isFrozenOrHasFrozenParent(node) { ++ try { ++ return node && ++ (variables.frozen.has(node) || ++ variables.frozen.has($(node).parentNode)); ++ } ++ catch (error) { ++ return false; ++ } ++ } ++ ++ function isFrozenAndInsideTarget(node, isInsideTarget) { ++ try { ++ return node && ++ (variables.frozen.has(node) && isInsideTarget || ++ variables.frozen.has($(node).parentNode) && ++ !isInsideTarget); ++ } ++ catch (error) { ++ return false; ++ } ++ } ++ ++ function getSnippetData(node) { ++ return variables.frozen.get(node); ++ } ++ ++ function getSnippetDataFromNodeOrParent(node) { ++ try { ++ if (variables.frozen.has(node)) ++ return variables.frozen.get(node); ++ let parent = $(node).parentNode; ++ return variables.frozen.get(parent); ++ } ++ catch (error) {} ++ } ++ ++ function getSnippetDataBasedOnTarget(node, isInsideTarget) { ++ try { ++ if (variables.frozen.has(node) && isInsideTarget) ++ return variables.frozen.get(node); ++ let parent = $(node).parentNode; ++ return variables.frozen.get(parent); ++ } ++ catch (error) {} ++ } ++ } ++ ++ function searchAndAttach() { ++ targetNodes = queryAll(); ++ markNodes(targetNodes, false); ++ } ++ ++ function markNodes(nodes, isChild = true) { ++ for (let node of nodes) { ++ if (!variables.frozen.has(node)) { ++ variables.frozen.set(node, data); ++ if (!isChild && subtree) { ++ new MutationObserver$1(mutationsList => { ++ for (let mutation of $(mutationsList)) ++ markNodes($(mutation, "MutationRecord").addedNodes); ++ }).observe(node, {childList: true, subtree: true}); ++ } ++ if (subtree && $(node).nodeType === ELEMENT_NODE) ++ markNodes($(node).childNodes); ++ } ++ } ++ } ++ ++ function logPrefixed(id, ...args) { ++ log(`[freeze][${id}] `, ...args); ++ } ++ ++ function logChange(nodeOrDOMString, target, property, snippetData) { ++ let targetSelector = snippetData.selector; ++ let chgId = snippetData.changeId; ++ let isDOMString = typeof nodeOrDOMString == "string"; ++ let action = snippetData.shouldAbort ? "aborting" : "watching"; ++ console$2.groupCollapsed(`[freeze][${chgId}] ${action}: ${targetSelector}`); ++ switch (property) { ++ case "appendChild": ++ case "append": ++ case "prepend": ++ case "insertBefore": ++ case "replaceChild": ++ case "insertAdjacentElement": ++ case "insertAdjacentHTML": ++ case "insertAdjacentText": ++ case "innerHTML": ++ case "outerHTML": ++ logPrefixed(chgId, ++ isDOMString ? "text: " : "node: ", ++ nodeOrDOMString); ++ logPrefixed(chgId, "added to node: ", target); ++ break; ++ case "replaceWith": ++ case "after": ++ case "before": ++ logPrefixed(chgId, ++ isDOMString ? "text: " : "node: ", ++ nodeOrDOMString); ++ logPrefixed(chgId, "added to node: ", $(target).parentNode); ++ break; ++ case "textContent": ++ case "innerText": ++ case "nodeValue": ++ logPrefixed(chgId, "content of node: ", target); ++ logPrefixed(chgId, "changed to: ", nodeOrDOMString); ++ break; ++ } ++ logPrefixed(chgId, `using the function "${property}"`); ++ console$2.groupEnd(); ++ snippetData.changeId++; ++ } ++ ++ function isExceptionNode(element, expSelectors) { ++ if (expSelectors) { ++ let $element = $(element); ++ for (let exception of expSelectors) { ++ if ($element.matches(exception)) ++ return true; ++ } ++ } ++ return false; ++ } ++ ++ function isExceptionText(string, regExceptions) { ++ if (regExceptions) { ++ for (let exception of regExceptions) { ++ if (exception.test(string)) ++ return true; ++ } ++ } ++ return false; ++ } ++ ++ function abort(id) { ++ throw new ReferenceError(id); ++ } ++ ++ function checkHTML(htmlText, parent, property, snippetData) { ++ let domparser = new DOMParser(); ++ let {body} = $(domparser.parseFromString(htmlText, "text/html")); ++ let nodes = $(body).childNodes; ++ let accepted = checkMultiple(nodes, parent, property, snippetData); ++ let content = $(accepted).map(node => { ++ switch ($(node).nodeType) { ++ case ELEMENT_NODE: ++ return $(node).outerHTML; ++ case TEXT_NODE: ++ return $(node).textContent; ++ default: ++ return ""; ++ } ++ }); ++ return content.join(""); ++ } ++ ++ function checkMultiple(nodesOrDOMStrings, parent, property, snippetData) { ++ let accepted = $([]); ++ for (let nodeOrDOMString of nodesOrDOMStrings) { ++ if (checkShouldInsert(nodeOrDOMString, parent, property, snippetData)) ++ accepted.push(nodeOrDOMString); ++ } ++ return accepted; ++ } ++ ++ function checkShouldInsert(nodeOrDOMString, parent, property, snippetData) { ++ let aborting = snippetData.shouldAbort; ++ let regExceptions = snippetData.regexExceptions; ++ let expSelectors = snippetData.exceptionSelectors; ++ let id = snippetData.rid; ++ if (typeof nodeOrDOMString == "string") { ++ let domString = nodeOrDOMString; ++ if (isExceptionText(domString, regExceptions)) ++ return true; ++ if (debug()) ++ logChange(domString, parent, property, snippetData); ++ if (aborting) ++ abort(id); ++ return debug(); ++ } ++ ++ let node = nodeOrDOMString; ++ switch ($(node).nodeType) { ++ case ELEMENT_NODE: ++ if (isExceptionNode(node, expSelectors)) ++ return true; ++ if (aborting) { ++ if (debug()) ++ logChange(node, parent, property, snippetData); ++ abort(id); ++ } ++ if (debug()) { ++ hideElement(node); ++ logChange(node, parent, property, snippetData); ++ return true; ++ } ++ return false; ++ case TEXT_NODE: ++ if (isExceptionText($(node).textContent, regExceptions)) ++ return true; ++ if (debug()) ++ logChange(node, parent, property, snippetData); ++ if (aborting) ++ abort(id); ++ return false; ++ default: ++ return true; ++ } ++ } ++ ++ function getAppendChildDescriptor(target, property, shouldValidate, ++ getSnippetData) { ++ let desc = getOwnPropertyDescriptor(target, property) || {}; ++ let origin = desc.get && call(desc.get, target) || desc.value; ++ if (!origin) ++ return; ++ ++ return { ++ get() { ++ return function(...args) { ++ if (shouldValidate(this)) { ++ let snippetData = getSnippetData(this); ++ if (snippetData) { ++ let incomingNode = args[0]; ++ if (!checkShouldInsert(incomingNode, this, property, snippetData)) ++ return incomingNode; ++ } ++ } ++ return apply$2(origin, this, args); ++ }; ++ } ++ }; ++ } ++ ++ function getAppendDescriptor( ++ target, property, shouldValidate, getSnippetData ++ ) { ++ let desc = getOwnPropertyDescriptor(target, property) || {}; ++ let origin = desc.get && call(desc.get, target) || desc.value; ++ if (!origin) ++ return; ++ return { ++ get() { ++ return function(...nodesOrDOMStrings) { ++ if (!shouldValidate(this)) ++ return apply$2(origin, this, nodesOrDOMStrings); ++ ++ let snippetData = getSnippetData(this); ++ if (!snippetData) ++ return apply$2(origin, this, nodesOrDOMStrings); ++ ++ let accepted = checkMultiple( ++ nodesOrDOMStrings, this, property, snippetData ++ ); ++ if (accepted.length > 0) ++ return apply$2(origin, this, accepted); ++ }; ++ } ++ }; ++ } ++ ++ function getInsertAdjacentDescriptor( ++ target, property, shouldValidate, getSnippetData ++ ) { ++ let desc = getOwnPropertyDescriptor(target, property) || {}; ++ let origin = desc.get && call(desc.get, target) || desc.value; ++ if (!origin) ++ return; ++ ++ return { ++ get() { ++ return function(...args) { ++ let [position, value] = args; ++ let isInsideTarget = ++ position === "afterbegin" || position === "beforeend"; ++ if (shouldValidate(this, isInsideTarget)) { ++ let snippetData = getSnippetData(this, isInsideTarget); ++ if (snippetData) { ++ let parent = isInsideTarget ? ++ this : ++ $(this).parentNode; ++ let finalValue; ++ switch (property) { ++ case "insertAdjacentElement": ++ if (!checkShouldInsert(value, parent, property, snippetData)) ++ return value; ++ break; ++ ++ case "insertAdjacentHTML": ++ finalValue = checkHTML(value, parent, property, snippetData); ++ if (finalValue) ++ return call(origin, this, position, finalValue); ++ ++ return; ++ ++ case "insertAdjacentText": ++ if (!checkShouldInsert(value, parent, property, snippetData)) ++ return; ++ break; ++ } ++ } ++ } ++ return apply$2(origin, this, args); ++ }; ++ } ++ }; ++ } ++ ++ function getInnerHTMLDescriptor( ++ target, property, shouldValidate, getSnippetData ++ ) { ++ let desc = getOwnPropertyDescriptor(target, property) || {}; ++ let {set: prevSetter} = desc; ++ if (!prevSetter) ++ return; ++ ++ return { ++ set(htmlText) { ++ if (!shouldValidate(this)) ++ return call(prevSetter, this, htmlText); ++ ++ let snippetData = getSnippetData(this); ++ if (!snippetData) ++ return call(prevSetter, this, htmlText); ++ let finalValue = checkHTML(htmlText, this, property, snippetData); ++ if (finalValue) ++ return call(prevSetter, this, finalValue); ++ } ++ }; ++ } ++ ++ function getTextContentDescriptor( ++ target, property, shouldValidate, getSnippetData ++ ) { ++ let desc = getOwnPropertyDescriptor(target, property) || {}; ++ let {set: prevSetter} = desc; ++ if (!prevSetter) ++ return; ++ ++ return { ++ set(domString) { ++ if (!shouldValidate(this)) ++ return call(prevSetter, this, domString); ++ ++ let snippetData = getSnippetData(this); ++ if (!snippetData) ++ return call(prevSetter, this, domString); ++ if (checkShouldInsert(domString, this, property, snippetData)) ++ return call(prevSetter, this, domString); ++ } ++ }; ++ } ++ } ++ ++ $(window); ++ ++ function raceWinner(name, lose) { ++ ++ return noop; ++ } ++ ++ const {Map: Map$4, MutationObserver, Object: Object$4, Set, WeakSet: WeakSet$1} = $(window); ++ ++ let ElementProto = Element.prototype; ++ let {attachShadow} = ElementProto; ++ ++ let hiddenShadowRoots = new WeakSet$1(); ++ let searches = new Map$4(); ++ let observer = null; ++ ++ function hideIfShadowContains(search, selector = "*") { ++ ++ let key = `${search}\\${selector}`; ++ if (!searches.has(key)) { ++ searches.set(key, [toRegExp(search), selector, raceWinner() ++ ]); ++ } ++ ++ const debugLog = getDebugger("hide-if-shadow-contain"); ++ ++ if (!observer) { ++ observer = new MutationObserver(records => { ++ let visited = new Set(); ++ for (let {target} of $(records)) { ++ ++ let parent = $(target).parentNode; ++ while (parent) ++ [target, parent] = [parent, $(target).parentNode]; ++ ++ if (hiddenShadowRoots.has(target)) ++ continue; ++ ++ if (visited.has(target)) ++ continue; ++ ++ visited.add(target); ++ for (let [re, selfOrParent, win] of searches.values()) { ++ if (re.test($(target).textContent)) { ++ let closest = $(target.host).closest(selfOrParent); ++ if (closest) { ++ win(); ++ ++ $(target).appendChild( ++ document.createElement("style") ++ ).textContent = ":host {display: none !important}"; ++ ++ hideElement(closest); ++ ++ hiddenShadowRoots.add(target); ++ debugLog("Hiding: ", closest, " for params: ", ...arguments); ++ } ++ } ++ } ++ } ++ }); ++ ++ Object$4.defineProperty(ElementProto, "attachShadow", { ++ ++ value: proxy(attachShadow, function() { ++ ++ let root = apply$2(attachShadow, this, arguments); ++ debugLog("attachShadow is called for: ", root); ++ ++ observer.observe(root, { ++ childList: true, ++ characterData: true, ++ subtree: true ++ }); ++ ++ return root; ++ }) ++ }); ++ } ++ } ++ ++ const {Error: Error$4, JSON: JSON$2, Map: Map$3, Object: Object$3} = $(window); ++ ++ let paths$1 = null; ++ ++ function jsonOverride(rawOverridePaths, value, ++ rawNeedlePaths = "", filter = "") { ++ if (!rawOverridePaths) ++ throw new Error$4("[json-override snippet]: Missing paths to override."); ++ ++ if (typeof value == "undefined") ++ throw new Error$4("[json-override snippet]: No value to override with."); ++ ++ if (!paths$1) { ++ let debugLog = getDebugger("json-override"); ++ ++ let {parse} = JSON$2; ++ paths$1 = new Map$3(); ++ ++ Object$3.defineProperty(window.JSON, "parse", { ++ value: proxy(parse, function(str) { ++ let result = apply$2(parse, this, arguments); ++ ++ for (let {prune, needle, filter: flt, value: val} of paths$1.values()) { ++ if (flt && !flt.test(str)) ++ continue; ++ ++ if ($(needle).some(path => !findOwner(result, path))) ++ return result; ++ ++ for (let path of prune) { ++ let details = findOwner(result, path); ++ if (typeof details != "undefined") { ++ debugLog(`Found ${path} replaced it with ${val}`); ++ details[0][details[1]] = overrideValue(val); ++ } ++ } ++ } ++ ++ return result; ++ }) ++ }); ++ debugLog("Wrapped JSON.parse for override"); ++ } ++ ++ paths$1.set(rawOverridePaths, { ++ prune: $(rawOverridePaths).split(/ +/), ++ needle: rawNeedlePaths.length ? $(rawNeedlePaths).split(/ +/) : [], ++ filter: filter ? toRegExp(filter) : null, ++ value ++ }); ++ } ++ ++ let {Error: Error$3, JSON: JSON$1, Map: Map$2, Object: Object$2} = $(window); ++ ++ let paths = null; ++ ++ function jsonPrune(rawPrunePaths, rawNeedlePaths = "") { ++ if (!rawPrunePaths) ++ throw new Error$3("Missing paths to prune"); ++ ++ if (!paths) { ++ let debugLog = getDebugger("json-prune"); ++ ++ let {parse} = JSON$1; ++ paths = new Map$2(); ++ ++ Object$2.defineProperty(window.JSON, "parse", { ++ value: proxy(parse, function() { ++ let result = apply$2(parse, this, arguments); ++ ++ for (let {prune, needle} of paths.values()) { ++ if ($(needle).some(path => !findOwner(result, path))) ++ return result; ++ ++ for (let path of prune) { ++ let details = findOwner(result, path); ++ if (typeof details != "undefined") { ++ debugLog(`Found ${path} and deleted`); ++ delete details[0][details[1]]; ++ } ++ } ++ } ++ ++ return result; ++ }) ++ }); ++ debugLog("Wrapped JSON.parse for prune"); ++ } ++ ++ paths.set(rawPrunePaths, { ++ prune: $(rawPrunePaths).split(/ +/), ++ needle: rawNeedlePaths.length ? $(rawNeedlePaths).split(/ +/) : [] ++ }); ++ } ++ ++ let {Error: Error$2} = $(window); ++ ++ function overridePropertyRead(property, value) { ++ if (!property) { ++ throw new Error$2("[override-property-read snippet]: " + ++ "No property to override."); ++ } ++ if (typeof value === "undefined") { ++ throw new Error$2("[override-property-read snippet]: " + ++ "No value to override with."); ++ } ++ ++ let debugLog = getDebugger("override-property-read"); ++ ++ let cValue = overrideValue(value); ++ ++ let newGetter = () => { ++ debugLog(`${property} override done.`); ++ return cValue; ++ }; ++ ++ debugLog(`Overriding ${property}.`); ++ ++ wrapPropertyAccess(window, property, {get: newGetter, set() {}}); ++ } ++ ++ let {Error: Error$1, Map: Map$1, Object: Object$1, console: console$1} = $(window); ++ ++ let {toString} = Function.prototype; ++ let EventTargetProto = EventTarget.prototype; ++ let {addEventListener} = EventTargetProto; ++ ++ let events = null; ++ ++ function preventListener(event, eventHandler, selector) { ++ if (!event) ++ throw new Error$1("[prevent-listener snippet]: No event type."); ++ ++ if (!events) { ++ events = new Map$1(); ++ ++ let debugLog = getDebugger("[prevent]"); ++ ++ Object$1.defineProperty(EventTargetProto, "addEventListener", { ++ value: proxy(addEventListener, function(type, listener) { ++ for (let {evt, handlers, selectors} of events.values()) { ++ ++ if (!evt.test(type)) ++ continue; ++ ++ let isElement = this instanceof Element; ++ ++ for (let i = 0; i < handlers.length; i++) { ++ let handler = handlers[i]; ++ let sel = selectors[i]; ++ ++ let handlerMatch = () => handler.test( ++ call( ++ toString, ++ typeof listener === "function" ? ++ listener : listener.handleEvent ++ ) ++ ); ++ ++ if ( ++ (handler && !handlerMatch()) || ++ (sel && !(isElement && $(this).matches(sel))) ++ ) ++ continue; ++ ++ if (debug()) { ++ console$1.groupCollapsed("DEBUG [prevent] was successful"); ++ debugLog(`type: ${type} matching ${evt}`); ++ debugLog("handler:", listener); ++ if (handler) ++ debugLog(`matching ${handler}`); ++ if (sel) ++ debugLog("on element: ", this, ` matching ${sel}`); ++ debugLog("was prevented from being added"); ++ console$1.groupEnd(); ++ } ++ return; ++ } ++ } ++ return apply$2(addEventListener, this, arguments); ++ }) ++ }); ++ ++ debugLog("Wrapped addEventListener"); ++ } ++ ++ if (!events.has(event)) ++ events.set(event, {evt: toRegExp(event), handlers: [], selectors: []}); ++ ++ let {handlers, selectors} = events.get(event); ++ ++ handlers.push(eventHandler ? toRegExp(eventHandler) : null); ++ selectors.push(selector); ++ } ++ ++ let {URL, fetch} = $(window); ++ ++ let {delete: deleteParam, has: hasParam} = caller(URLSearchParams.prototype); ++ ++ let parameters; ++ ++ function stripFetchQueryParameter(name, urlPattern = null) { ++ const debugLog = getDebugger("strip-fetch-query-parameter"); ++ ++ if (!parameters) { ++ parameters = new Map(); ++ window.fetch = proxy(fetch, (...args) => { ++ let [source] = args; ++ if (typeof source === "string") { ++ let url = new URL(source); ++ for (let [key, reg] of parameters) { ++ if (!reg || reg.test(source)) { ++ if (hasParam(url.searchParams, key)) { ++ debugLog(`${key} has been stripped from url ${source}`); ++ deleteParam(url.searchParams, key); ++ args[0] = url.href; ++ } ++ } ++ } ++ } ++ return apply$2(fetch, self, args); ++ }); ++ } ++ parameters.set(name, urlPattern && toRegExp(urlPattern)); ++ } + - std::vector - SubscriptionServiceImpl::GetInstalledFilteringConfigurations() { - std::vector result; -@@ -163,6 +175,15 @@ SubscriptionService::Snapshot SubscriptionServiceImpl::GetCurrentSnapshot() - return snapshot; - } - -+void SubscriptionServiceImpl::StartUpdate() { -+ for (auto& entry : maintainers_) { -+ if (!entry.second) { -+ continue; // Configuration is disabled ++ function trace(...args) { ++ ++ apply$2(log, null, args); ++ } ++ ++ const snippets = { ++ "abort-current-inline-script": abortCurrentInlineScript, ++ "abort-on-iframe-property-read": abortOnIframePropertyRead, ++ "abort-on-iframe-property-write": abortOnIframePropertyWrite, ++ "abort-on-property-read": abortOnPropertyRead, ++ "abort-on-property-write": abortOnPropertyWrite, ++ "cookie-remover": cookieRemover, ++ "debug": setDebug, ++ "freeze-element": freezeElement, ++ "hide-if-shadow-contains": hideIfShadowContains, ++ "json-override": jsonOverride, ++ "json-prune": jsonPrune, ++ "override-property-read": overridePropertyRead, ++ "prevent-listener": preventListener, ++ "strip-fetch-query-parameter": stripFetchQueryParameter, ++ "trace": trace ++ }; ++ let context; ++ for (const [name, ...args] of filters) { ++ if (snippets.hasOwnProperty(name)) { ++ try { context = snippets[name].apply(context, args); } ++ catch (error) { console.error(error); } + } -+ entry.second->StartUpdate(); + } -+} ++ context = void 0; ++}; ++const graph = new Map([["abort-current-inline-script",null],["abort-on-iframe-property-read",null],["abort-on-iframe-property-write",null],["abort-on-property-read",null],["abort-on-property-write",null],["cookie-remover",null],["debug",null],["freeze-element",null],["hide-if-shadow-contains",null],["json-override",null],["json-prune",null],["override-property-read",null],["prevent-listener",null],["strip-fetch-query-parameter",null],["trace",null]]); ++callback.get = snippet => graph.get(snippet); ++callback.has = snippet => graph.has(snippet); + - void SubscriptionServiceImpl::AddObserver(SubscriptionObserver* o) { - observers_.AddObserver(o); - } -@@ -178,7 +199,7 @@ void SubscriptionServiceImpl::OnEnabledStateChanged( - }); - DCHECK(it != maintainers_.end()) << "Received OnEnabledStateChanged from " - "unregistered FilteringConfiguration"; -- VLOG(1) << "[eyeo] FilteringConfiguration " << config->GetName() -+ LOG(INFO) << "[eyeo] FilteringConfiguration " << config->GetName() - << (config->IsEnabled() ? " enabled" : " disabled"); - if (config->IsEnabled()) { - // Enable the configuration by creating a new -diff --git a/components/adblock/core/subscription/subscription_service_impl.h b/components/adblock/core/subscription/subscription_service_impl.h ---- a/components/adblock/core/subscription/subscription_service_impl.h -+++ b/components/adblock/core/subscription/subscription_service_impl.h -@@ -70,6 +70,9 @@ class SubscriptionServiceImpl final : public SubscriptionService, - final; - FilteringConfiguration* GetAdblockFilteringConfiguration() const final; - Snapshot GetCurrentSnapshot() const final; -+ void StartUpdate() final; -+ raw_ptr GetMetadataFor( -+ raw_ptr configuration) final; - void AddObserver(SubscriptionObserver*) final; - void RemoveObserver(SubscriptionObserver*) final; - -diff --git a/components/adblock/core/subscription/subscription_updater_impl.cc b/components/adblock/core/subscription/subscription_updater_impl.cc ---- a/components/adblock/core/subscription/subscription_updater_impl.cc -+++ b/components/adblock/core/subscription/subscription_updater_impl.cc -@@ -38,7 +38,7 @@ void SubscriptionUpdaterImpl::StartSchedule( - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); - DCHECK(!timer_.IsRunning()); - run_update_check_ = std::move(run_update_check); -- VLOG(1) << "[eyeo] Starting update schedule, first check scheduled for " -+ LOG(INFO) << "[eyeo] Starting update schedule, first check scheduled for " - << base::Time::Now() + initial_delay_; - timer_.Start(FROM_HERE, initial_delay_, - base::BindOnce(&SubscriptionUpdaterImpl::RunUpdateCheck, -@@ -47,14 +47,14 @@ void SubscriptionUpdaterImpl::StartSchedule( - - void SubscriptionUpdaterImpl::StopSchedule() { - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); -- VLOG(1) << "[eyeo] Stopping update schedule"; -+ LOG(INFO) << "[eyeo] Stopping update schedule"; - timer_.Stop(); - } - - void SubscriptionUpdaterImpl::RunUpdateCheck() { -- VLOG(1) << "[eyeo] Running subscription update check"; -+ LOG(INFO) << "[eyeo] Running subscription update check"; - run_update_check_.Run(); -- VLOG(1) -+ LOG(INFO) - << "[eyeo] Subscription update check completed, next one scheduled for " - << base::Time::Now() + check_interval_; - timer_.Start(FROM_HERE, check_interval_, -diff --git a/components/adblock/core/subscription/subscription_validator_impl.cc b/components/adblock/core/subscription/subscription_validator_impl.cc ---- a/components/adblock/core/subscription/subscription_validator_impl.cc -+++ b/components/adblock/core/subscription/subscription_validator_impl.cc -@@ -64,11 +64,11 @@ bool IsSignatureValidInternal( - const auto* expected_hash = initial_subscription_signatures.FindString( - path.BaseName().AsUTF8Unsafe()); - if (!expected_hash) { -- DLOG(WARNING) << "[eyeo] " << path << " has no matching signature in prefs"; -+ LOG(WARNING) << "[eyeo] " << path.BaseName().AsUTF8Unsafe() << " has no matching signature in prefs"; - return false; - } - if (*expected_hash != ComputeSubscriptionHash(data)) { -- DLOG(WARNING) << "[eyeo] " << path << " has invalid signature in prefs"; -+ LOG(WARNING) << "[eyeo] " << path.BaseName().AsUTF8Unsafe() << " has invalid signature in prefs"; - return false; - } - return true; -diff --git a/components/content_settings/core/browser/bromite_content_settings/ads.inc b/components/content_settings/core/browser/bromite_content_settings/ads.inc -new file mode 100644 ---- /dev/null -+++ b/components/content_settings/core/browser/bromite_content_settings/ads.inc -@@ -0,0 +1,3 @@ -+ content_settings::WebsiteSettingsRegistry::GetInstance() -+ ->GetMutable(ContentSettingsType::ADS) -+ ->set_show_into_info_page(); -diff --git a/components/resources/BUILD.gn b/components/resources/BUILD.gn ---- a/components/resources/BUILD.gn -+++ b/components/resources/BUILD.gn -@@ -79,7 +79,6 @@ grit("components_resources") { - - deps += [ - "//components/resources/adblocking:copy_snippets_lib", -- "//components/resources/adblocking:make_all_preloaded_subscriptions", - ] - } - -diff --git a/components/resources/adblock_resources.grdp b/components/resources/adblock_resources.grdp ---- a/components/resources/adblock_resources.grdp -+++ b/components/resources/adblock_resources.grdp -@@ -20,7 +20,4 @@ - - - -- -- -- - -diff --git a/components/resources/adblocking/.gitignore b/components/resources/adblocking/.gitignore ---- a/components/resources/adblocking/.gitignore -+++ b/components/resources/adblocking/.gitignore -@@ -1 +1 @@ --snippets -+#snippets -diff --git a/components/resources/adblocking/BUILD.gn b/components/resources/adblocking/BUILD.gn ---- a/components/resources/adblocking/BUILD.gn -+++ b/components/resources/adblocking/BUILD.gn -@@ -18,7 +18,7 @@ import("//build/compiled_action.gni") - - # Converts text-format filter lists into flatbuffers using a standalone - # converter tool. --template("make_preloaded_subscription") { -+template("make_preloaded_subscription_NO") { - compiled_action(target_name) { - tool = "//components/adblock/core/converter:adblock_flatbuffer_converter" - inputs = [ invoker.input ] -@@ -31,34 +31,6 @@ template("make_preloaded_subscription") { - } - } - --# Note, url is *not* used to download the list during build time, only to --# identify the subscription. Consider it metadata. --make_preloaded_subscription("make_easylist") { -- input = "//components/resources/adblocking/easylist.txt.gz" -- url = "https://easylist-downloads.adblockplus.org/easylist.txt" -- output = "${target_gen_dir}/easylist.fb" --} -- --make_preloaded_subscription("make_exceptionrules") { -- input = "//components/resources/adblocking/exceptionrules.txt.gz" -- url = "https://easylist-downloads.adblockplus.org/exceptionrules.txt" -- output = "${target_gen_dir}/exceptionrules.fb" --} -- --make_preloaded_subscription("make_anticv") { -- input = "//components/resources/adblocking/anticv.txt.gz" -- url = "https://easylist-downloads.adblockplus.org/abp-filters-anti-cv.txt" -- output = "${target_gen_dir}/anticv.fb" --} -- --group("make_all_preloaded_subscriptions") { -- deps = [ -- ":make_anticv", -- ":make_easylist", -- ":make_exceptionrules", -- ] --} -- - copy("copy_snippets_lib") { - if (is_debug) { - sources = [ "//components/resources/adblocking/snippets/dist/isolated-first.source.jst" ] -diff --git a/components/resources/adblocking/elemhide_for_selector.jst b/components/resources/adblocking/elemhide_for_selector.jst ---- a/components/resources/adblocking/elemhide_for_selector.jst -+++ b/components/resources/adblocking/elemhide_for_selector.jst -@@ -43,7 +43,7 @@ if (typeof(elemhideForSelector) !== typeof(Function)) - } - else - { -- console.debug("Nothing found for selector " + selector + ", retrying elemhide in 100 millis"); -+ //console.debug("Nothing found for selector " + selector + ", retrying elemhide in 100 millis"); - setTimeout(elemhideForSelector, 100, url, selector, attempt + 1); - } - } -diff --git a/components/resources/adblocking/elemhideemu.jst b/components/resources/adblocking/elemhideemu.jst ---- a/components/resources/adblocking/elemhideemu.jst -+++ b/components/resources/adblocking/elemhideemu.jst -@@ -1,3 +1,4 @@ -+(function() { - /* - * This file is part of eyeo Chromium SDK, - * Copyright (C) 2006-present eyeo GmbH -@@ -1434,3 +1435,4 @@ let elemHideEmulation = new ElemHideEmulation( - ); - - elemHideEmulation.apply(elemHidingEmulatedPatterns); -+})() ++ if (t.every(([name]) => !callback.has(name))) return; ++ const append = () => { ++ URL.revokeObjectURL( ++ Object.assign( ++ document.documentElement.appendChild(document.createElement("script")), ++ {async: false, src: URL.createObjectURL(new Blob([ ++ "(" + callback + ")(..." + JSON.stringify([e, ...t]) + ")" ++ ]))} ++ ).src ++ ); ++ }; ++ try { append(); } ++ catch (_) { ++ document.addEventListener("readystatechange", append, {once:true}); ++ } ++} diff --git a/components/resources/adblocking/snippets/dist/isolated-first.jst b/components/resources/adblocking/snippets/dist/isolated-first.jst new file mode 100755 --- /dev/null @@ -4455,7 +8338,7 @@ new file mode 100755 @@ -0,0 +1,3624 @@ +(e, ...t) => { +/*! -+ * snippets v0.7.0 ++ * snippets v0.7.0 (https://gitlab.com/eyeo/anti-cv/snippets/-/tree/5f54b58f039a604088d65991f2829a9a081832f6/dist) + * https://gitlab.com/eyeo/snippets/-/commit/d7c80795567d9f9c44a6ebaa789baceab85f31f9 + * + * This file is part of eyeo's Anti-Circumvention Snippets module (@eyeo/snippets), @@ -8098,7 +11981,7 @@ diff --git a/third_party/blink/renderer/core/css/style_engine.cc b/third_party/b diff --git a/third_party/blink/renderer/core/css/style_engine.h b/third_party/blink/renderer/core/css/style_engine.h --- a/third_party/blink/renderer/core/css/style_engine.h +++ b/third_party/blink/renderer/core/css/style_engine.h -@@ -242,6 +242,7 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected, +@@ -243,6 +243,7 @@ class CORE_EXPORT StyleEngine final : public GarbageCollected, const ComputedStyle* embedder_style) const; void ViewportStyleSettingChanged(); @@ -8126,6 +12009,15 @@ diff --git a/third_party/blink/renderer/core/exported/web_document.cc b/third_pa auto* parsed_sheet = MakeGarbageCollected( MakeGarbageCollected(*document)); parsed_sheet->ParseString(source_code); +@@ -283,7 +293,7 @@ WebStyleSheetKey WebDocument::InsertAbpElemhideStylesheet( + if (IsValidAbpRule(parsed_sheet->RuleAt(n))) + ++n; + else { +- parsed_sheet->SetMutable(); ++ parsed_sheet->StartMutation(); + parsed_sheet->WrapperDeleteRule(n); + LOG(WARNING) << "[eyeo] Broken rule"; + } @@ -295,9 +305,6 @@ WebStyleSheetKey WebDocument::InsertAbpElemhideStylesheet( {SchedulingPolicy::DisableBackForwardCache()}); } @@ -8136,32 +12028,6 @@ diff --git a/third_party/blink/renderer/core/exported/web_document.cc b/third_pa document->GetStyleEngine().InjectSheet(injection_key, parsed_sheet, origin); return injection_key; } -diff --git a/tools/gritsettings/resource_ids.spec b/tools/gritsettings/resource_ids.spec ---- a/tools/gritsettings/resource_ids.spec -+++ b/tools/gritsettings/resource_ids.spec -@@ -639,10 +639,6 @@ - "META": {"sizes": {"includes": [20]}}, - "includes": [4960], - }, -- "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/adblock_internals/resources.grd": { -- "META": {"sizes": {"includes": [10],}}, -- "includes": [4720], -- }, - # END chrome/ WebUI resources section - - # START chrome/ miscellaneous section. -@@ -1205,6 +1201,11 @@ - "includes": [7440], - }, - -+ "<(SHARED_INTERMEDIATE_DIR)/chrome/browser/resources/adblock_internals/resources.grd": { -+ "META": {"sizes": {"includes": [10],}}, -+ "includes": [8000], -+ }, -+ - # END "everything else" section. - # Everything but chrome/, components/, content/, and ios/ - diff --git a/tools/typescript/definitions/adblock_private.d.ts b/tools/typescript/definitions/adblock_private.d.ts --- a/tools/typescript/definitions/adblock_private.d.ts +++ b/tools/typescript/definitions/adblock_private.d.ts diff --git a/build/bromite_patches/00Fix-eyeo-Browser-Ad-filtering-patches.patch b/build/bromite_patches/00Fix-eyeo-Browser-Ad-filtering-patches.patch deleted file mode 100644 index 2348b2ced3e6d64c79a5c84eba00a197d214b3ab..0000000000000000000000000000000000000000 --- a/build/bromite_patches/00Fix-eyeo-Browser-Ad-filtering-patches.patch +++ /dev/null @@ -1,146 +0,0 @@ -From: uazo -Date: Wed, 6 Sep 2023 15:25:18 +0000 -Subject: Fix eyeo Browser Ad filtering patches - ---- - chrome/browser/BUILD.gn | 4 ---- - chrome/browser/client_hints/client_hints_browsertest.cc | 7 +------ - chrome/browser/extensions/BUILD.gn | 4 ---- - chrome/browser/preferences/BUILD.gn | 4 ---- - chrome/browser/ui/BUILD.gn | 6 ------ - chrome/browser/ui/tab_helpers.cc | 4 ---- - extensions/common/mojom/api_permission_id.mojom | 3 --- - 7 files changed, 1 insertion(+), 31 deletions(-) - -diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn ---- a/chrome/browser/BUILD.gn -+++ b/chrome/browser/BUILD.gn -@@ -2085,12 +2085,8 @@ static_library("browser") { - "//chrome/common/notifications", - "//chrome/installer/util:with_no_strings", - "//chrome/services/speech/buildflags", --<<<<<<< HEAD --======= -- "//chromeos/components/kiosk", - "//components/adblock/content:browser", - "//components/adblock/core/converter", -->>>>>>> 9402d5c48c0e8... Squashed commits - "//components/assist_ranker", - "//components/autofill/content/browser", - "//components/autofill/core/browser", -diff --git a/chrome/browser/client_hints/client_hints_browsertest.cc b/chrome/browser/client_hints/client_hints_browsertest.cc ---- a/chrome/browser/client_hints/client_hints_browsertest.cc -+++ b/chrome/browser/client_hints/client_hints_browsertest.cc -@@ -652,17 +652,12 @@ class ClientHintsBrowserTest : public policy::PolicyTest { - // Force-enable the ClientHintsFormFactor feature, so that the header is - // represented in the various header counts. - feature_list->InitializeFromCommandLine( --<<<<<<< HEAD -- "UserAgentClientHint,CriticalClientHint,AcceptCHFrame," -- "ClientHintsFormFactor", -- ""); --======= - "UserAgentClientHint,CriticalClientHint,AcceptCHFrame", -+ "ClientHintsFormFactor", - // Disabling AdblockPlus because the async implementation of - // AdblockURLLoaderThrottle::WillStartRequest confuses - // ThirdPartyURLLoaderInterceptor. - "AdblockPlus"); -->>>>>>> 9402d5c48c0e8... Squashed commits - return feature_list; - } - -diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn ---- a/chrome/browser/extensions/BUILD.gn -+++ b/chrome/browser/extensions/BUILD.gn -@@ -821,11 +821,7 @@ static_library("extensions") { - "//chrome/browser/safe_browsing:metrics_collector", - "//chrome/browser/ui/tabs:tab_enums", - "//chrome/browser/web_applications", --<<<<<<< HEAD --======= -- "//chromeos/components/kiosk", - "//components/adblock/content:browser", -->>>>>>> 9402d5c48c0e8... Squashed commits - "//components/cbor:cbor", - "//components/commerce/core:pref_names", - "//components/device_reauth", -diff --git a/chrome/browser/preferences/BUILD.gn b/chrome/browser/preferences/BUILD.gn ---- a/chrome/browser/preferences/BUILD.gn -+++ b/chrome/browser/preferences/BUILD.gn -@@ -38,12 +38,8 @@ android_library("java") { - # TODO(chouinard,estade): Consider breaking this target up into a different target for each pref file. - java_cpp_strings("java_pref_names_srcjar") { - sources = [ --<<<<<<< HEAD - "//chrome/common/pref_names.h", --======= -- "//chrome/common/pref_names.cc", - "//components/adblock/core/common/adblock_prefs.cc", -->>>>>>> 9402d5c48c0e8... Squashed commits - "//components/autofill/core/common/autofill_prefs.cc", - "//components/commerce/core/pref_names.cc", - "//components/dom_distiller/core/pref_names.cc", -diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn ---- a/chrome/browser/ui/BUILD.gn -+++ b/chrome/browser/ui/BUILD.gn -@@ -447,11 +447,8 @@ static_library("ui") { - "//chrome/browser/storage_access_api", - "//chrome/browser/ui/side_panel:side_panel_enums", - "//chrome/browser/ui/webui:configs", --<<<<<<< HEAD - "//chrome/browser/ui/webui/location_internals:mojo_bindings", --======= - "//chrome/browser/ui/webui/adblock_internals:mojo_bindings", -->>>>>>> 9402d5c48c0e8... Squashed commits - "//chrome/browser/ui/webui/omnibox:mojo_bindings", - "//chrome/browser/ui/webui/segmentation_internals:mojo_bindings", - "//chrome/browser/ui/webui/suggest_internals:mojo_bindings", -@@ -467,11 +464,8 @@ static_library("ui") { - "//components/about_ui", - "//components/access_code_cast/common:metrics", - "//components/account_id", --<<<<<<< HEAD - "//components/autofill/content/browser", --======= - "//components/adblock/content:browser", -->>>>>>> 9402d5c48c0e8... Squashed commits - "//components/autofill/content/browser:risk_proto", - "//components/autofill/core/browser", - "//components/blocked_content", -diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc ---- a/chrome/browser/ui/tab_helpers.cc -+++ b/chrome/browser/ui/tab_helpers.cc -@@ -17,14 +17,10 @@ - #include "base/trace_event/trace_event.h" - #include "build/build_config.h" - #include "build/chromeos_buildflags.h" --<<<<<<< HEAD - #include "chrome/browser/3pcd/heuristics/opener_heuristic_tab_helper.h" --======= --#include "chrome/browser/3pcd_heuristics/opener_heuristic_tab_helper.h" - #include "chrome/browser/adblock/element_hider_factory.h" - #include "chrome/browser/adblock/sitekey_storage_factory.h" - #include "chrome/browser/adblock/subscription_service_factory.h" -->>>>>>> 9402d5c48c0e8... Squashed commits - #include "chrome/browser/bookmarks/bookmark_model_factory.h" - #include "chrome/browser/breadcrumbs/breadcrumb_manager_tab_helper.h" - #include "chrome/browser/browser_process.h" -diff --git a/extensions/common/mojom/api_permission_id.mojom b/extensions/common/mojom/api_permission_id.mojom ---- a/extensions/common/mojom/api_permission_id.mojom -+++ b/extensions/common/mojom/api_permission_id.mojom -@@ -278,12 +278,9 @@ enum APIPermissionID { - kSmartCardProviderPrivate = 247, - kChromeOSEvents = 248, - kChromeOSAttachedDeviceInfo = 249, --<<<<<<< HEAD - kReadingList = 250, --======= - kAdblockPrivate = 999, - kEyeoFilteringPrivate = 1000, -->>>>>>> 9402d5c48c0e8... Squashed commits - - // Add new entries at the end of the enum and be sure to update the - // "ExtensionPermission3" enum in tools/metrics/histograms/enums.xml --- -2.25.1 diff --git a/build/bromite_patches/Restore-LastTabStandingTracker.patch b/build/bromite_patches/00Restore-LastTabStandingTracker.patch similarity index 95% rename from build/bromite_patches/Restore-LastTabStandingTracker.patch rename to build/bromite_patches/00Restore-LastTabStandingTracker.patch index 682f32f0c5b45b304dc889f3647c501b69f68434..05daf670a6e6357718e6cbcddfeb17137bebe306 100644 --- a/build/bromite_patches/Restore-LastTabStandingTracker.patch +++ b/build/bromite_patches/00Restore-LastTabStandingTracker.patch @@ -1,7 +1,6 @@ -From 989b1ee180d09cb9a4e80c8b9278a9cfb4969505 Mon Sep 17 00:00:00 2001 From: uazo Date: Tue, 30 May 2023 15:13:31 +0000 -Subject: [PATCH 163/192] Restore LastTabStandingTracker +Subject: Restore LastTabStandingTracker License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html --- @@ -26,10 +25,9 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html create mode 100644 chrome/browser/permissions/last_tab_standing_tracker_tab_helper.h diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index c8e2f5b9d070d..8f29675b1d2dc 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -1882,6 +1882,16 @@ static_library("browser") { +@@ -1970,6 +1970,16 @@ static_library("browser") { ] } @@ -47,7 +45,6 @@ index c8e2f5b9d070d..8f29675b1d2dc 100644 sources += [ "importer/profile_writer.cc", diff --git a/chrome/browser/content_settings/host_content_settings_map_factory.cc b/chrome/browser/content_settings/host_content_settings_map_factory.cc -index 241d70c4052eb..6d9ed813f4eff 100644 --- a/chrome/browser/content_settings/host_content_settings_map_factory.cc +++ b/chrome/browser/content_settings/host_content_settings_map_factory.cc @@ -11,6 +11,7 @@ @@ -68,7 +65,6 @@ index 241d70c4052eb..6d9ed813f4eff 100644 #endif diff --git a/chrome/browser/permissions/last_tab_standing_tracker.cc b/chrome/browser/permissions/last_tab_standing_tracker.cc new file mode 100644 -index 0000000000000..5df1981731e0e --- /dev/null +++ b/chrome/browser/permissions/last_tab_standing_tracker.cc @@ -0,0 +1,59 @@ @@ -133,7 +129,6 @@ index 0000000000000..5df1981731e0e +} diff --git a/chrome/browser/permissions/last_tab_standing_tracker.h b/chrome/browser/permissions/last_tab_standing_tracker.h new file mode 100644 -index 0000000000000..fedb9d1973a7a --- /dev/null +++ b/chrome/browser/permissions/last_tab_standing_tracker.h @@ -0,0 +1,40 @@ @@ -179,7 +174,6 @@ index 0000000000000..fedb9d1973a7a +#endif // CHROME_BROWSER_PERMISSIONS_LAST_TAB_STANDING_TRACKER_H_ diff --git a/chrome/browser/permissions/last_tab_standing_tracker_factory.cc b/chrome/browser/permissions/last_tab_standing_tracker_factory.cc new file mode 100644 -index 0000000000000..f09a613ac1533 --- /dev/null +++ b/chrome/browser/permissions/last_tab_standing_tracker_factory.cc @@ -0,0 +1,35 @@ @@ -220,7 +214,6 @@ index 0000000000000..f09a613ac1533 +} diff --git a/chrome/browser/permissions/last_tab_standing_tracker_factory.h b/chrome/browser/permissions/last_tab_standing_tracker_factory.h new file mode 100644 -index 0000000000000..2ed3800733bd8 --- /dev/null +++ b/chrome/browser/permissions/last_tab_standing_tracker_factory.h @@ -0,0 +1,40 @@ @@ -266,7 +259,6 @@ index 0000000000000..2ed3800733bd8 +#endif // CHROME_BROWSER_PERMISSIONS_LAST_TAB_STANDING_TRACKER_FACTORY_H_ diff --git a/chrome/browser/permissions/last_tab_standing_tracker_observer.h b/chrome/browser/permissions/last_tab_standing_tracker_observer.h new file mode 100644 -index 0000000000000..6a9eaa33c09c2 --- /dev/null +++ b/chrome/browser/permissions/last_tab_standing_tracker_observer.h @@ -0,0 +1,24 @@ @@ -296,7 +288,6 @@ index 0000000000000..6a9eaa33c09c2 +#endif // CHROME_BROWSER_PERMISSIONS_LAST_TAB_STANDING_TRACKER_OBSERVER_H_ diff --git a/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.cc b/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.cc new file mode 100644 -index 0000000000000..6754421adca37 --- /dev/null +++ b/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.cc @@ -0,0 +1,42 @@ @@ -344,7 +335,6 @@ index 0000000000000..6754421adca37 +WEB_CONTENTS_USER_DATA_KEY_IMPL(LastTabStandingTrackerTabHelper); diff --git a/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.h b/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.h new file mode 100644 -index 0000000000000..f77adf075f8de --- /dev/null +++ b/chrome/browser/permissions/last_tab_standing_tracker_tab_helper.h @@ -0,0 +1,37 @@ @@ -386,10 +376,9 @@ index 0000000000000..f77adf075f8de + +#endif // CHROME_BROWSER_PERMISSIONS_LAST_TAB_STANDING_TRACKER_TAB_HELPER_H_ diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc -index 1ac481691bef9..5b87cf061b444 100644 --- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc +++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc -@@ -106,6 +106,7 @@ +@@ -123,6 +123,7 @@ #include "chrome/browser/password_manager/password_reuse_manager_factory.h" #include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/permissions/adaptive_quiet_notification_permission_ui_enabler.h" @@ -397,7 +386,7 @@ index 1ac481691bef9..5b87cf061b444 100644 #include "chrome/browser/permissions/notifications_engagement_service_factory.h" #include "chrome/browser/permissions/one_time_permissions_tracker_factory.h" #include "chrome/browser/permissions/origin_keyed_permission_action_service_factory.h" -@@ -839,6 +840,7 @@ void ChromeBrowserMainExtraPartsProfiles:: +@@ -921,6 +922,7 @@ void ChromeBrowserMainExtraPartsProfiles:: #if BUILDFLAG(BUILD_WITH_TFLITE_LIB) OnDeviceTailModelServiceFactory::GetInstance(); #endif @@ -406,10 +395,9 @@ index 1ac481691bef9..5b87cf061b444 100644 OneGoogleBarServiceFactory::GetInstance(); if (base::FeatureList::IsEnabled(permissions::features::kOneTimePermission)) { diff --git a/chrome/browser/ui/tab_helpers.cc b/chrome/browser/ui/tab_helpers.cc -index 1ec9817a39d4a..445dac8992d8d 100644 --- a/chrome/browser/ui/tab_helpers.cc +++ b/chrome/browser/ui/tab_helpers.cc -@@ -55,6 +55,7 @@ +@@ -63,6 +63,7 @@ #include "chrome/browser/page_load_metrics/page_load_metrics_initialize.h" #include "chrome/browser/password_manager/chrome_password_manager_client.h" #include "chrome/browser/performance_manager/public/user_tuning/user_performance_tuning_manager.h" @@ -417,7 +405,7 @@ index 1ec9817a39d4a..445dac8992d8d 100644 #include "chrome/browser/permissions/one_time_permissions_tracker_helper.h" #include "chrome/browser/predictors/loading_predictor_factory.h" #include "chrome/browser/predictors/loading_predictor_tab_helper.h" -@@ -374,6 +375,7 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) { +@@ -396,6 +397,7 @@ void TabHelpers::AttachTabHelpers(WebContents* web_contents) { HistoryClustersTabHelper::CreateForWebContents(web_contents); HttpsOnlyModeTabHelper::CreateForWebContents(web_contents); webapps::InstallableManager::CreateForWebContents(web_contents); @@ -425,6 +413,5 @@ index 1ec9817a39d4a..445dac8992d8d 100644 login_detection::LoginDetectionTabHelper::MaybeCreateForWebContents( web_contents); if (MediaEngagementService::IsEnabled()) --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/AImageReader-CFI-crash-mitigations.patch b/build/bromite_patches/AImageReader-CFI-crash-mitigations.patch index c7397602ad6cdf7c3d2ab1bd69f5a8c435e4c69e..e6688de6894bacdee0c4654b1a50448636c4260a 100644 --- a/build/bromite_patches/AImageReader-CFI-crash-mitigations.patch +++ b/build/bromite_patches/AImageReader-CFI-crash-mitigations.patch @@ -1,7 +1,6 @@ -From 4f01cc05c38f2abb1fbbc71c679d03f02a06324f Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Tue, 5 May 2020 07:22:20 +0200 -Subject: [PATCH 106/192] AImageReader CFI crash mitigations +Subject: AImageReader CFI crash mitigations Revert "gpu/android: Remove setup for disabling AImageReader." This reverts commit dcd5a39518246eb999f1cc63bf1ec95d93fd5b2f. @@ -21,22 +20,23 @@ See discussions at: License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - base/android/android_image_reader_compat.cc | 8 +++++++- - base/android/android_image_reader_compat.h | 4 ++++ - chrome/browser/flag-metadata.json | 6 +++--- - gpu/config/gpu_driver_bug_list.json | 16 ++++++++++++++++ - gpu/config/gpu_finch_features.cc | 5 +++++ - gpu/config/gpu_finch_features.h | 1 + - gpu/config/gpu_util.cc | 8 ++++++++ - gpu/config/gpu_workaround_list.txt | 1 + - gpu/ipc/service/gpu_init.cc | 7 +++++++ - gpu/ipc/service/stream_texture_android.cc | 11 ++++++++++- - media/base/media_switches.cc | 5 +++++ - media/base/media_switches.h | 1 + - 12 files changed, 68 insertions(+), 5 deletions(-) + base/android/android_image_reader_compat.cc | 8 +++++++- + base/android/android_image_reader_compat.h | 4 ++++ + chrome/browser/flag-metadata.json | 6 +++--- + .../AImageReader-CFI-crash-mitigations.inc | 4 ++++ + .../AImageReader-CFI-crash-mitigations.inc | 1 + + gpu/config/gpu_driver_bug_list.json | 16 ++++++++++++++++ + gpu/config/gpu_finch_features.cc | 5 +++++ + gpu/config/gpu_finch_features.h | 1 + + gpu/config/gpu_util.cc | 8 ++++++++ + gpu/config/gpu_workaround_list.txt | 1 + + gpu/ipc/service/gpu_init.cc | 7 +++++++ + gpu/ipc/service/stream_texture_android.cc | 11 ++++++++++- + 12 files changed, 67 insertions(+), 5 deletions(-) + create mode 100644 cromite_flags/media/base/media_switches_cc/AImageReader-CFI-crash-mitigations.inc + create mode 100644 cromite_flags/media/base/media_switches_h/AImageReader-CFI-crash-mitigations.inc diff --git a/base/android/android_image_reader_compat.cc b/base/android/android_image_reader_compat.cc -index d26f7e8a19517..a20f33f114b91 100644 --- a/base/android/android_image_reader_compat.cc +++ b/base/android/android_image_reader_compat.cc @@ -23,6 +23,8 @@ @@ -63,7 +63,6 @@ index d26f7e8a19517..a20f33f114b91 100644 AndroidImageReader::AndroidImageReader() : is_supported_(LoadFunctions()) {} diff --git a/base/android/android_image_reader_compat.h b/base/android/android_image_reader_compat.h -index bef2ae103235c..b44886946d565 100644 --- a/base/android/android_image_reader_compat.h +++ b/base/android/android_image_reader_compat.h @@ -24,6 +24,9 @@ class BASE_EXPORT AndroidImageReader { @@ -85,10 +84,9 @@ index bef2ae103235c..b44886946d565 100644 AndroidImageReader(); diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json -index fded6daa7c8e2..a6d5da2c7c3a6 100644 --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json -@@ -2928,9 +2928,9 @@ +@@ -3028,9 +3028,9 @@ "expiry_milestone": 125 }, { @@ -101,11 +99,25 @@ index fded6daa7c8e2..a6d5da2c7c3a6 100644 }, { "name": "enable-immersive-fullscreen-toolbar", +diff --git a/cromite_flags/media/base/media_switches_cc/AImageReader-CFI-crash-mitigations.inc b/cromite_flags/media/base/media_switches_cc/AImageReader-CFI-crash-mitigations.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/media/base/media_switches_cc/AImageReader-CFI-crash-mitigations.inc +@@ -0,0 +1,4 @@ ++// Enables the Android Image Reader path for Video decoding(for AVDA and MCVD) ++CROMITE_FEATURE(kAImageReaderVideoOutput, ++ "AImageReaderVideoOutput", ++ base::FEATURE_ENABLED_BY_DEFAULT); +diff --git a/cromite_flags/media/base/media_switches_h/AImageReader-CFI-crash-mitigations.inc b/cromite_flags/media/base/media_switches_h/AImageReader-CFI-crash-mitigations.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/media/base/media_switches_h/AImageReader-CFI-crash-mitigations.inc +@@ -0,0 +1 @@ ++MEDIA_EXPORT BASE_DECLARE_FEATURE(kAImageReaderVideoOutput); diff --git a/gpu/config/gpu_driver_bug_list.json b/gpu/config/gpu_driver_bug_list.json -index 71a4f139d781f..7144b22e13688 100644 --- a/gpu/config/gpu_driver_bug_list.json +++ b/gpu/config/gpu_driver_bug_list.json -@@ -3688,6 +3688,22 @@ +@@ -3212,6 +3212,22 @@ "no_downscaled_overlay_promotion" ] }, @@ -129,35 +141,32 @@ index 71a4f139d781f..7144b22e13688 100644 "id": 381, "cr_bugs": [ diff --git a/gpu/config/gpu_finch_features.cc b/gpu/config/gpu_finch_features.cc -index f0138acdeae0c..76c2d34ed046a 100644 --- a/gpu/config/gpu_finch_features.cc +++ b/gpu/config/gpu_finch_features.cc -@@ -65,6 +65,11 @@ BASE_FEATURE(kUseGles2ForOopR, - #endif +@@ -71,6 +71,11 @@ BASE_FEATURE(kUseGles2ForOopR, ); -+ + #if BUILDFLAG(IS_ANDROID) +// Use android AImageReader when playing videos with MediaPlayer. -+const base::Feature kAImageReaderMediaPlayer{"AImageReaderMediaPlayer", -+ base::FEATURE_ENABLED_BY_DEFAULT}; ++CROMITE_FEATURE(kAImageReaderMediaPlayer, ++ "AImageReaderMediaPlayer", ++ base::FEATURE_ENABLED_BY_DEFAULT); + - #if BUILDFLAG(IS_ANDROID) // Use android SurfaceControl API for managing display compositor's buffer queue // and using overlays on Android. Also used by webview to disable surface + // SurfaceControl. diff --git a/gpu/config/gpu_finch_features.h b/gpu/config/gpu_finch_features.h -index c77113dda67c4..662e100792a16 100644 --- a/gpu/config/gpu_finch_features.h +++ b/gpu/config/gpu_finch_features.h -@@ -17,6 +17,7 @@ namespace features { - GPU_EXPORT BASE_DECLARE_FEATURE(kUseGles2ForOopR); - +@@ -24,6 +24,7 @@ GPU_EXPORT BASE_DECLARE_FEATURE(kUseGles2ForOopR); // All features in alphabetical order. The features should be documented -+GPU_EXPORT extern const base::Feature kAImageReaderMediaPlayer; // alongside the definition of their values in the .cc file. #if BUILDFLAG(IS_ANDROID) ++GPU_EXPORT BASE_DECLARE_FEATURE(kAImageReaderMediaPlayer); GPU_EXPORT BASE_DECLARE_FEATURE(kAndroidSurfaceControl); + GPU_EXPORT BASE_DECLARE_FEATURE(kWebViewSurfaceControl); + GPU_EXPORT BASE_DECLARE_FEATURE(kAImageReader); diff --git a/gpu/config/gpu_util.cc b/gpu/config/gpu_util.cc -index 82528e1b97ab6..572ea0893e45e 100644 --- a/gpu/config/gpu_util.cc +++ b/gpu/config/gpu_util.cc @@ -122,6 +122,9 @@ GpuFeatureStatus GetAndroidSurfaceControlFeatureStatus( @@ -170,7 +179,7 @@ index 82528e1b97ab6..572ea0893e45e 100644 if (!gpu_preferences.enable_android_surface_control) return kGpuFeatureStatusDisabled; -@@ -351,6 +354,11 @@ void AdjustGpuFeatureStatusToWorkarounds(GpuFeatureInfo* gpu_feature_info) { +@@ -347,6 +350,11 @@ void AdjustGpuFeatureStatusToWorkarounds(GpuFeatureInfo* gpu_feature_info) { gpu_feature_info->status_values[GPU_FEATURE_TYPE_CANVAS_OOP_RASTERIZATION] = kGpuFeatureStatusBlocklisted; } @@ -183,11 +192,10 @@ index 82528e1b97ab6..572ea0893e45e 100644 // Estimates roughly user total disk space by counting in the drives where diff --git a/gpu/config/gpu_workaround_list.txt b/gpu/config/gpu_workaround_list.txt -index 164df51c709af..f2a7ebad434c3 100644 --- a/gpu/config/gpu_workaround_list.txt +++ b/gpu/config/gpu_workaround_list.txt -@@ -16,6 +16,7 @@ decode_encode_srgb_for_generatemipmap - depth_stencil_renderbuffer_resize_emulation +@@ -13,6 +13,7 @@ count_all_in_varyings_packing + decode_encode_srgb_for_generatemipmap disable_2d_canvas_auto_flush disable_accelerated_av1_decode +disable_aimagereader @@ -195,7 +203,6 @@ index 164df51c709af..f2a7ebad434c3 100644 disable_accelerated_h264_decode disable_accelerated_h264_encode diff --git a/gpu/ipc/service/gpu_init.cc b/gpu/ipc/service/gpu_init.cc -index e8af3b3325636..ae69ecc8a7384 100644 --- a/gpu/ipc/service/gpu_init.cc +++ b/gpu/ipc/service/gpu_init.cc @@ -628,6 +628,13 @@ bool GpuInit::InitializeAndStartSandbox(base::CommandLine* command_line, @@ -213,7 +220,6 @@ index e8af3b3325636..ae69ecc8a7384 100644 kGpuFeatureStatusEnabled || !InitializeVulkan()) { diff --git a/gpu/ipc/service/stream_texture_android.cc b/gpu/ipc/service/stream_texture_android.cc -index 762b8dabc387c..8939050c6f817 100644 --- a/gpu/ipc/service/stream_texture_android.cc +++ b/gpu/ipc/service/stream_texture_android.cc @@ -6,6 +6,7 @@ @@ -241,34 +247,5 @@ index 762b8dabc387c..8939050c6f817 100644 ? TextureOwner::Mode::kAImageReaderInsecure : TextureOwner::Mode::kSurfaceTextureInsecure; } -diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc -index 2c8a257f5ea4a..c1c11e4a8b615 100644 ---- a/media/base/media_switches.cc -+++ b/media/base/media_switches.cc -@@ -950,6 +950,11 @@ BASE_FEATURE(kHardwareSecureDecryptionExperiment, - // Allows automatically disabling hardware secure Content Decryption Module - // (CDM) after failures or crashes to fallback to software secure CDMs. If this - // feature is disabled, the fallback will never happen and users could be stuck -+// Enables the Android Image Reader path for Video decoding(for AVDA and MCVD) -+BASE_FEATURE(kAImageReaderVideoOutput, -+ "AImageReaderVideoOutput", -+ base::FEATURE_ENABLED_BY_DEFAULT); -+ - // in playback failures. - BASE_FEATURE(kHardwareSecureDecryptionFallback, - "HardwareSecureDecryptionFallback", -diff --git a/media/base/media_switches.h b/media/base/media_switches.h -index e59c53e4bb47d..1bbc1ee4056aa 100644 ---- a/media/base/media_switches.h -+++ b/media/base/media_switches.h -@@ -328,6 +328,7 @@ MEDIA_EXPORT BASE_DECLARE_FEATURE(kVideoBlitColorAccuracy); - MEDIA_EXPORT BASE_DECLARE_FEATURE(kVideoToolboxVideoDecoder); - #endif // BUILDFLAG(IS_APPLE) - MEDIA_EXPORT BASE_DECLARE_FEATURE(kWebRTCColorAccuracy); -+MEDIA_EXPORT BASE_DECLARE_FEATURE(kAImageReaderVideoOutput); - MEDIA_EXPORT BASE_DECLARE_FEATURE(kVp9kSVCHWDecoding); - MEDIA_EXPORT BASE_DECLARE_FEATURE(kWebContentsCaptureHiDpi); - MEDIA_EXPORT BASE_DECLARE_FEATURE(kWebrtcMediaCapabilitiesParameters); --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-AllowUserCertificates-flag.patch b/build/bromite_patches/Add-AllowUserCertificates-flag.patch index e4a9db90b939bc269ca32a9d9af8fd772bc8e035..86e113f50a01c779fb5a9d8481a4cfea6bb0390d 100644 --- a/build/bromite_patches/Add-AllowUserCertificates-flag.patch +++ b/build/bromite_patches/Add-AllowUserCertificates-flag.patch @@ -1,26 +1,26 @@ -From c2c6c28c0a830799a637c647f8fecea70a240c6d Mon Sep 17 00:00:00 2001 From: uazo Date: Mon, 26 Apr 2021 13:28:24 +0000 -Subject: [PATCH 130/192] Add AllowUserCertificates flag +Subject: Add AllowUserCertificates flag Original License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - .../org/chromium/chrome/browser/app/ChromeActivity.java | 3 +++ - chrome/browser/about_flags.cc | 7 +++++++ - chrome/browser/flag_descriptions.cc | 5 +++++ - chrome/browser/flag_descriptions.h | 3 +++ - chrome/browser/flags/android/chrome_feature_list.cc | 5 +++++ - chrome/browser/flags/android/chrome_feature_list.h | 1 + - .../chromium/chrome/browser/flags/ChromeFeatureList.java | 4 ++++ - net/android/java/src/org/chromium/net/X509Util.java | 5 +++++ - 8 files changed, 33 insertions(+) + .../chromium/chrome/browser/app/ChromeActivity.java | 3 +++ + chrome/browser/flags/android/chrome_feature_list.cc | 1 + + .../chrome/browser/flags/ChromeFeatureList.java | 4 ++++ + .../Add-AllowUserCertificates-flag.inc | 13 +++++++++++++ + .../Add-AllowUserCertificates-flag.inc | 3 +++ + .../Add-AllowUserCertificates-flag.inc | 1 + + net/android/java/src/org/chromium/net/X509Util.java | 5 +++++ + 7 files changed, 30 insertions(+) + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/Add-AllowUserCertificates-flag.inc + create mode 100644 cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Add-AllowUserCertificates-flag.inc + create mode 100644 cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/Add-AllowUserCertificates-flag.inc diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java -index a4956e49ad6b7..dd309ae5dcfd9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/ChromeActivity.java -@@ -230,6 +230,7 @@ import org.chromium.content_public.browser.ScreenOrientationProvider; +@@ -227,6 +227,7 @@ import org.chromium.content_public.browser.ScreenOrientationProvider; import org.chromium.content_public.browser.SelectionPopupController; import org.chromium.content_public.browser.WebContents; import org.chromium.content_public.common.ContentSwitches; @@ -28,7 +28,7 @@ index a4956e49ad6b7..dd309ae5dcfd9 100644 import org.chromium.printing.PrintManagerDelegateImpl; import org.chromium.printing.PrintingController; import org.chromium.printing.PrintingControllerImpl; -@@ -981,6 +982,8 @@ public abstract class ChromeActivity +@@ -984,6 +985,8 @@ public abstract class ChromeActivity super.onStartWithNative(); ChromeActivitySessionTracker.getInstance().onStartWithNative(); ChromeCachedFlags.getInstance().cacheNativeFlags(); @@ -37,91 +37,18 @@ index a4956e49ad6b7..dd309ae5dcfd9 100644 // postDeferredStartupIfNeeded() is called in TabModelSelectorTabObsever#onLoadStopped(), // #onPageLoadFinished() and #onCrash(). If we are not actively loading a tab (e.g. -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index 1b2515a172b22..a30a18f00179e 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -9309,6 +9309,13 @@ const FeatureEntry kFeatureEntries[] = { - flag_descriptions::kEnableDrDcDescription, kOsAll, - FEATURE_VALUE_TYPE(features::kEnableDrDc)}, - -+#if BUILDFLAG(IS_ANDROID) -+ {"allow-user-certificates", -+ flag_descriptions::kAllowUserCertificatesName, -+ flag_descriptions::kAllowUserCertificatesDescription, kOsAndroid, -+ FEATURE_VALUE_TYPE(chrome::android::kAllowUserCertificates)}, -+#endif // BUILDFLAG(IS_ANDROID) -+ - {"force-gpu-main-thread-to-normal-priority-drdc", - flag_descriptions::kForceGpuMainThreadToNormalPriorityDrDcName, - flag_descriptions::kForceGpuMainThreadToNormalPriorityDrDcDescription, -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index 9faf86f94d203..4032bab43c722 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -16,6 +16,11 @@ - - namespace flag_descriptions { - -+const char kAllowUserCertificatesName[] = "Allow user certificates"; -+const char kAllowUserCertificatesDescription[] = -+ "Allow user CA certificates during " -+ "validation of the certificate chain"; -+ - const char kAccelerated2dCanvasName[] = "Accelerated 2D canvas"; - const char kAccelerated2dCanvasDescription[] = - "Enables the use of the GPU to perform 2d canvas rendering instead of " -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index c095902cd95fc..e95beecefb599 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -42,6 +42,9 @@ namespace flag_descriptions { - - // Cross-platform ------------------------------------------------------------- - -+extern const char kAllowUserCertificatesName[]; -+extern const char kAllowUserCertificatesDescription[]; -+ - extern const char kAccelerated2dCanvasName[]; - extern const char kAccelerated2dCanvasDescription[]; - diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc -index 81cadb4071645..45fb8f39dd1dd 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc -@@ -142,6 +142,7 @@ const base::Feature* const kFeaturesExposedToJava[] = { - &feed::kFeedBoCSigninInterstitial, +@@ -147,6 +147,7 @@ const base::Feature* const kFeaturesExposedToJava[] = { + &feed::kFeedShowSignInCommand, + &feed::kFeedSignedOutViewDemotion, &feed::kFeedUserInteractionReliabilityReport, - &feed::kInterestFeedContentSuggestions, + &kAllowUserCertificates, &feed::kInterestFeedV2, &feed::kInterestFeedV2Autoplay, &feed::kInterestFeedV2Hearts, -@@ -467,6 +468,10 @@ BASE_FEATURE(kSearchReadyOmniboxFeature, - "SearchReadyOmnibox", - base::FEATURE_DISABLED_BY_DEFAULT); - -+BASE_FEATURE(kAllowUserCertificates, -+ "AllowUserCertificates", -+ base::FEATURE_DISABLED_BY_DEFAULT); -+ - BASE_FEATURE(kFocusOmniboxInIncognitoTabIntents, - "FocusOmniboxInIncognitoTabIntents", - base::FEATURE_ENABLED_BY_DEFAULT); -diff --git a/chrome/browser/flags/android/chrome_feature_list.h b/chrome/browser/flags/android/chrome_feature_list.h -index b24ca80ae7978..f279afd2d62f0 100644 ---- a/chrome/browser/flags/android/chrome_feature_list.h -+++ b/chrome/browser/flags/android/chrome_feature_list.h -@@ -22,6 +22,7 @@ BASE_DECLARE_FEATURE(kAdvancedPeripheralsSupport); - BASE_DECLARE_FEATURE(kAdvancedPeripheralsSupportTabStrip); - BASE_DECLARE_FEATURE(kAllowNewIncognitoTabIntents); - BASE_DECLARE_FEATURE(kAndroidAppIntegration); -+BASE_DECLARE_FEATURE(kAllowUserCertificates); - BASE_DECLARE_FEATURE(kAndroidAppIntegrationSafeSearch); - BASE_DECLARE_FEATURE(kAndroidSearchEngineChoiceNotification); - BASE_DECLARE_FEATURE(kAndroidImprovedBookmarks); diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java -index cd651e7d1a787..d0d1a4271442a 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java @@ -98,6 +98,7 @@ public abstract class ChromeFeatureList { @@ -132,25 +59,56 @@ index cd651e7d1a787..d0d1a4271442a 100644 public static final String ADAPTIVE_BUTTON_IN_TOP_TOOLBAR = "AdaptiveButtonInTopToolbar"; public static final String ADAPTIVE_BUTTON_IN_TOP_TOOLBAR_TRANSLATE = "AdaptiveButtonInTopToolbarTranslate"; -@@ -504,6 +505,8 @@ public abstract class ChromeFeatureList { - public static final String XSURFACE_METRICS_REPORTING = "XsurfaceMetricsReporting"; - +@@ -501,6 +502,8 @@ public abstract class ChromeFeatureList { /* Alphabetical: */ + public static final CachedFlag sAndroidAppIntegration = + new CachedFlag(ANDROID_APP_INTEGRATION, false); + public static final CachedFlag sAllowUserCertificates = + new CachedFlag(ALLOW_USER_CERTIFICATES, false); public static final CachedFlag sAppMenuMobileSiteOption = new CachedFlag(APP_MENU_MOBILE_SITE_OPTION, false); public static final CachedFlag sBackGestureActivityTabProvider = -@@ -629,6 +632,7 @@ public abstract class ChromeFeatureList { - +@@ -642,6 +645,7 @@ public abstract class ChromeFeatureList { public static final List sFlagsCachedFullBrowser = List.of( // clang-format off + sAndroidAppIntegration, + sAllowUserCertificates, sAppMenuMobileSiteOption, sBackGestureActivityTabProvider, sBackGestureRefactorActivityAndroid, +diff --git a/cromite_flags/chrome/browser/about_flags_cc/Add-AllowUserCertificates-flag.inc b/cromite_flags/chrome/browser/about_flags_cc/Add-AllowUserCertificates-flag.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/Add-AllowUserCertificates-flag.inc +@@ -0,0 +1,13 @@ ++#ifdef FLAG_SECTION ++ ++#if BUILDFLAG(IS_ANDROID) ++ ++ {"allow-user-certificates", ++ "Allow user certificates", ++ "Allow user CA certificates during " ++ "validation of the certificate chain", kOsAndroid, ++ FEATURE_VALUE_TYPE(chrome::android::kAllowUserCertificates)}, ++ ++#endif ++ ++#endif +diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Add-AllowUserCertificates-flag.inc b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Add-AllowUserCertificates-flag.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/Add-AllowUserCertificates-flag.inc +@@ -0,0 +1,3 @@ ++CROMITE_FEATURE(kAllowUserCertificates, ++ "AllowUserCertificates", ++ base::FEATURE_DISABLED_BY_DEFAULT); +diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/Add-AllowUserCertificates-flag.inc b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/Add-AllowUserCertificates-flag.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/Add-AllowUserCertificates-flag.inc +@@ -0,0 +1 @@ ++BASE_DECLARE_FEATURE(kAllowUserCertificates); diff --git a/net/android/java/src/org/chromium/net/X509Util.java b/net/android/java/src/org/chromium/net/X509Util.java -index 2d1340a43c36e..7b6ce578c3eef 100644 --- a/net/android/java/src/org/chromium/net/X509Util.java +++ b/net/android/java/src/org/chromium/net/X509Util.java @@ -545,6 +545,8 @@ public class X509Util { @@ -172,6 +130,5 @@ index 2d1340a43c36e..7b6ce578c3eef 100644 return new AndroidCertVerifyResult(CertVerifyStatusAndroid.OK, isIssuedByKnownRoot, verifiedChain); } --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-Alt-D-hotkey-to-focus-address-bar.patch b/build/bromite_patches/Add-Alt-D-hotkey-to-focus-address-bar.patch index 7f0715b0cf8f68a4f603a49f6e86cc05aec54c7b..72323e7dcacb7dc1a0f3a0061f48e867c3175940 100644 --- a/build/bromite_patches/Add-Alt-D-hotkey-to-focus-address-bar.patch +++ b/build/bromite_patches/Add-Alt-D-hotkey-to-focus-address-bar.patch @@ -1,7 +1,6 @@ -From bdd8e07d76dd8f5e2b18fdc6117ecf6c657dd2d0 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Tue, 9 Mar 2021 19:43:00 +0100 -Subject: [PATCH 128/192] Add Alt+D hotkey to focus address bar +Subject: Add Alt+D hotkey to focus address bar License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- @@ -9,7 +8,6 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html 1 file changed, 2 insertions(+) diff --git a/chrome/android/java/src/org/chromium/chrome/browser/KeyboardShortcuts.java b/chrome/android/java/src/org/chromium/chrome/browser/KeyboardShortcuts.java -index 736a851a56bb4..dfea155c7c963 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/KeyboardShortcuts.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/KeyboardShortcuts.java @@ -152,6 +152,8 @@ public class KeyboardShortcuts { @@ -21,6 +19,5 @@ index 736a851a56bb4..dfea155c7c963 100644 shortcutGroups.add(chromeFeatureShortcutGroup); KeyboardShortcutGroup webpageShortcutGroup = new KeyboardShortcutGroup( --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-DuckDuckGo-Lite-search-engine.patch b/build/bromite_patches/Add-DuckDuckGo-Lite-search-engine.patch deleted file mode 100644 index cc745704ea692514199352d23258b2359a725bb9..0000000000000000000000000000000000000000 --- a/build/bromite_patches/Add-DuckDuckGo-Lite-search-engine.patch +++ /dev/null @@ -1,864 +0,0 @@ -From 84df6b7913e85a3fcef6625a29ff68900f54bbc5 Mon Sep 17 00:00:00 2001 -From: csagan5 <32685696+csagan5@users.noreply.github.com> -Date: Thu, 12 Oct 2017 11:06:18 +0200 -Subject: [PATCH 048/192] Add DuckDuckGo Lite search engine - -License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html ---- - .../search_engines/prepopulated_engines.json | 10 + - .../search_engines/search_engine_type.h | 1 + - .../template_url_prepopulate_data.cc | 184 +++++++++--------- - 3 files changed, 103 insertions(+), 92 deletions(-) - -diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json -index 31042adbe1137..474c5cf13eac3 100644 ---- a/components/search_engines/prepopulated_engines.json -+++ b/components/search_engines/prepopulated_engines.json -@@ -102,6 +102,16 @@ - "id": 92 - }, - -+ "duckduckgo_light": { -+ "name": "DuckDuckGo Light", -+ "keyword": "duckduckgo.com/lite", -+ "favicon_url": "https://duckduckgo.com/favicon.ico", -+ "search_url": "https://duckduckgo.com/lite/?q={searchTerms}", -+ "suggest_url": "https://duckduckgo.com/ac/?q={searchTerms}&type=list", -+ "type": "SEARCH_ENGINE_DUCKDUCKGOLIGHT", -+ "id": 12 -+ }, -+ - "ecosia": { - "name": "Ecosia", - "keyword": "ecosia.org", -diff --git a/components/search_engines/search_engine_type.h b/components/search_engines/search_engine_type.h -index b77ce20c6b13c..4942bba7c6e8c 100644 ---- a/components/search_engines/search_engine_type.h -+++ b/components/search_engines/search_engine_type.h -@@ -79,6 +79,7 @@ enum SearchEngineType { - SEARCH_ENGINE_STARTER_PACK_HISTORY = 62, - SEARCH_ENGINE_STARTER_PACK_TABS = 63, - SEARCH_ENGINE_GOOGLE_EN = 64, -+ SEARCH_ENGINE_DUCKDUCKGOLIGHT = 65, - - SEARCH_ENGINE_MAX // Bounding value needed for UMA histogram macro. - }; -diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc -index 565245bfe88b6..4120aa5f41550 100644 ---- a/components/search_engines/template_url_prepopulate_data.cc -+++ b/components/search_engines/template_url_prepopulate_data.cc -@@ -42,7 +42,7 @@ const PrepopulatedEngine* const engines_AE[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_ru, - }; - -@@ -60,7 +60,7 @@ const PrepopulatedEngine* const engines_AR[] = { - &googleen, &google, - &bing, - &yahoo_ar, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -68,7 +68,7 @@ const PrepopulatedEngine* const engines_AR[] = { - const PrepopulatedEngine* const engines_AT[] = { - &googleen, &google, - &bing, -- &yahoo_at, -+ &yahoo_at, &duckduckgo_light, - &duckduckgo, - &ecosia, - }; -@@ -78,7 +78,7 @@ const PrepopulatedEngine* const engines_AU[] = { - &googleen, &google, - &bing, - &yahoo_au, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -87,7 +87,7 @@ const PrepopulatedEngine* const engines_BA[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_com, - }; - -@@ -97,7 +97,7 @@ const PrepopulatedEngine* const engines_BE[] = { - &bing, - &yahoo, - &ecosia, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Bulgaria -@@ -105,7 +105,7 @@ const PrepopulatedEngine* const engines_BG[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_ru, - }; - -@@ -114,7 +114,7 @@ const PrepopulatedEngine* const engines_BH[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -123,7 +123,7 @@ const PrepopulatedEngine* const engines_BI[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_ru, - }; - -@@ -132,7 +132,7 @@ const PrepopulatedEngine* const engines_BN[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -141,7 +141,7 @@ const PrepopulatedEngine* const engines_BO[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -150,7 +150,7 @@ const PrepopulatedEngine* const engines_BR[] = { - &googleen, &google, - &bing, - &yahoo_br, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_com, - }; - -@@ -160,7 +160,7 @@ const PrepopulatedEngine* const engines_BY[] = { - &yandex_by, - &mail_ru, - &bing, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Belize -@@ -177,7 +177,7 @@ const PrepopulatedEngine* const engines_CA[] = { - &googleen, &google, - &bing, - &yahoo_ca, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -185,7 +185,7 @@ const PrepopulatedEngine* const engines_CA[] = { - const PrepopulatedEngine* const engines_CH[] = { - &googleen, &google, - &bing, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yahoo_ch, - &ecosia, - }; -@@ -195,7 +195,7 @@ const PrepopulatedEngine* const engines_CL[] = { - &googleen, &google, - &bing, - &yahoo_cl, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -214,7 +214,7 @@ const PrepopulatedEngine* const engines_CO[] = { - &bing, - &yahoo_co, - &duckduckgo, -- &ecosia, -+ &ecosia, &duckduckgo_light, - }; - - // Costa Rica -@@ -222,7 +222,7 @@ const PrepopulatedEngine* const engines_CR[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -232,7 +232,7 @@ const PrepopulatedEngine* const engines_CZ[] = { - &seznam_cz, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Germany -@@ -240,7 +240,7 @@ const PrepopulatedEngine* const engines_DE[] = { - &googleen, &google, - &bing, - &yahoo_de, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -249,7 +249,7 @@ const PrepopulatedEngine* const engines_DK[] = { - &googleen, &google, - &bing, - &yahoo_dk, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -258,7 +258,7 @@ const PrepopulatedEngine* const engines_DO[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -268,7 +268,7 @@ const PrepopulatedEngine* const engines_DZ[] = { - &bing, - &yahoo_fr, - &yandex_com, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Ecuador -@@ -295,7 +295,7 @@ const PrepopulatedEngine* const engines_EG[] = { - &bing, - &yahoo, - &yandex_com, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Spain -@@ -303,7 +303,7 @@ const PrepopulatedEngine* const engines_ES[] = { - &googleen, &google, - &bing, - &yahoo_es, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -312,7 +312,7 @@ const PrepopulatedEngine* const engines_FI[] = { - &googleen, &google, - &bing, - &yahoo_fi, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_ru, - }; - -@@ -339,7 +339,7 @@ const PrepopulatedEngine* const engines_GB[] = { - &googleen, &google, - &bing, - &yahoo_uk, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -348,7 +348,7 @@ const PrepopulatedEngine* const engines_GR[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_ru, - }; - -@@ -357,7 +357,7 @@ const PrepopulatedEngine* const engines_GT[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -367,7 +367,7 @@ const PrepopulatedEngine* const engines_HK[] = { - &bing, - &yahoo_hk, - &baidu, -- &so_360, -+ &so_360, &duckduckgo_light, - }; - - // Honduras -@@ -375,7 +375,7 @@ const PrepopulatedEngine* const engines_HN[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -393,7 +393,7 @@ const PrepopulatedEngine* const engines_HU[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_com, - }; - -@@ -402,7 +402,7 @@ const PrepopulatedEngine* const engines_ID[] = { - &googleen, &google, - &bing, - &yahoo_id, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_com, - }; - -@@ -411,7 +411,7 @@ const PrepopulatedEngine* const engines_IE[] = { - &googleen, &google, - &bing, - &yahoo_uk, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -421,7 +421,7 @@ const PrepopulatedEngine* const engines_IL[] = { - &bing, - &yandex_ru, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // India -@@ -429,7 +429,7 @@ const PrepopulatedEngine* const engines_IN[] = { - &googleen, &google, - &bing, - &yahoo_in, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &info_com, - }; - -@@ -439,7 +439,7 @@ const PrepopulatedEngine* const engines_IQ[] = { - &bing, - &yahoo, - &yandex_tr, -- &petal_search, -+ &petal_search, &duckduckgo_light, - }; - - // Iran -@@ -448,14 +448,14 @@ const PrepopulatedEngine* const engines_IR[] = { - &bing, - &yahoo, - &duckduckgo, -- &ask, -+ &ask, &duckduckgo_light, - }; - - // Iceland - const PrepopulatedEngine* const engines_IS[] = { - &googleen, &google, - &bing, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yahoo, - &ecosia, - }; -@@ -465,7 +465,7 @@ const PrepopulatedEngine* const engines_IT[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -474,7 +474,7 @@ const PrepopulatedEngine* const engines_JM[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -492,7 +492,7 @@ const PrepopulatedEngine* const engines_JP[] = { - &googleen, &google, - &bing, - &yahoo_jp, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &baidu, - }; - -@@ -501,7 +501,7 @@ const PrepopulatedEngine* const engines_KE[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_com, - }; - -@@ -529,7 +529,7 @@ const PrepopulatedEngine* const engines_KZ[] = { - &yandex_kz, - &mail_ru, - &bing, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Lebanon -@@ -537,7 +537,7 @@ const PrepopulatedEngine* const engines_LB[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -545,7 +545,7 @@ const PrepopulatedEngine* const engines_LB[] = { - const PrepopulatedEngine* const engines_LI[] = { - &googleen, &google, - &bing, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yahoo, - &ecosia, - }; -@@ -555,7 +555,7 @@ const PrepopulatedEngine* const engines_LT[] = { - &googleen, &google, - &bing, - &yandex_ru, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yahoo, - }; - -@@ -563,7 +563,7 @@ const PrepopulatedEngine* const engines_LT[] = { - const PrepopulatedEngine* const engines_LU[] = { - &googleen, &google, - &bing, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yahoo, - &ecosia, - }; -@@ -574,7 +574,7 @@ const PrepopulatedEngine* const engines_LV[] = { - &bing, - &yandex_ru, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Libya -@@ -583,7 +583,7 @@ const PrepopulatedEngine* const engines_LY[] = { - &bing, - &yahoo, - &yandex_tr, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Morocco -@@ -592,14 +592,14 @@ const PrepopulatedEngine* const engines_MA[] = { - &bing, - &yahoo_fr, - &yandex_com, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Monaco - const PrepopulatedEngine* const engines_MC[] = { - &googleen, &google, - &bing, -- &yahoo_fr, -+ &yahoo_fr, &duckduckgo_light, - &duckduckgo, - &qwant, - }; -@@ -619,7 +619,7 @@ const PrepopulatedEngine* const engines_ME[] = { - &bing, - &yandex_ru, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Macedonia -@@ -627,7 +627,7 @@ const PrepopulatedEngine* const engines_MK[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_com, - }; - -@@ -636,7 +636,7 @@ const PrepopulatedEngine* const engines_MX[] = { - &googleen, &google, - &bing, - &yahoo_mx, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -645,7 +645,7 @@ const PrepopulatedEngine* const engines_MY[] = { - &googleen, &google, - &bing, - &yahoo_my, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -654,7 +654,7 @@ const PrepopulatedEngine* const engines_NI[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -663,7 +663,7 @@ const PrepopulatedEngine* const engines_NL[] = { - &googleen, &google, - &bing, - &yahoo_nl, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_ru, - }; - -@@ -672,7 +672,7 @@ const PrepopulatedEngine* const engines_NO[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -681,7 +681,7 @@ const PrepopulatedEngine* const engines_NZ[] = { - &googleen, &google, - &bing, - &yahoo_nz, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -699,7 +699,7 @@ const PrepopulatedEngine* const engines_PA[] = { - &googleen, &google, - &bing, - &yahoo_es, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -709,7 +709,7 @@ const PrepopulatedEngine* const engines_PE[] = { - &bing, - &yahoo_pe, - &ecosia, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Philippines -@@ -718,7 +718,7 @@ const PrepopulatedEngine* const engines_PH[] = { - &bing, - &yahoo_ph, - &ecosia, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Pakistan -@@ -726,7 +726,7 @@ const PrepopulatedEngine* const engines_PK[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_com, - }; - -@@ -735,7 +735,7 @@ const PrepopulatedEngine* const engines_PL[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_ru, - }; - -@@ -744,7 +744,7 @@ const PrepopulatedEngine* const engines_PR[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -753,7 +753,7 @@ const PrepopulatedEngine* const engines_PT[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -762,7 +762,7 @@ const PrepopulatedEngine* const engines_PY[] = { - &googleen, &google, - &bing, - &yahoo_es, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -771,7 +771,7 @@ const PrepopulatedEngine* const engines_QA[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_tr, - }; - -@@ -780,7 +780,7 @@ const PrepopulatedEngine* const engines_RO[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_tr, - }; - -@@ -789,7 +789,7 @@ const PrepopulatedEngine* const engines_RS[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_ru, - }; - -@@ -799,7 +799,7 @@ const PrepopulatedEngine* const engines_RU[] = { - &google, - &duckduckgo, - &bing, -- &mail_ru, -+ &mail_ru, &duckduckgo_light, - }; - - // Rwanda -@@ -807,7 +807,7 @@ const PrepopulatedEngine* const engines_RW[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -817,7 +817,7 @@ const PrepopulatedEngine* const engines_SA[] = { - &bing, - &yahoo, - &yandex_com, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Sweden -@@ -825,7 +825,7 @@ const PrepopulatedEngine* const engines_SE[] = { - &googleen, &google, - &bing, - &yahoo_se, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_ru, - }; - -@@ -834,7 +834,7 @@ const PrepopulatedEngine* const engines_SG[] = { - &googleen, &google, - &bing, - &yahoo_sg, -- &baidu, -+ &baidu, &duckduckgo_light, - &duckduckgo, - }; - -@@ -842,7 +842,7 @@ const PrepopulatedEngine* const engines_SG[] = { - const PrepopulatedEngine* const engines_SI[] = { - &googleen, &google, - &bing, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yahoo, - &yandex_com, - }; -@@ -851,7 +851,7 @@ const PrepopulatedEngine* const engines_SI[] = { - const PrepopulatedEngine* const engines_SK[] = { - &googleen, &google, - &bing, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yahoo, - &yandex_ru, - }; -@@ -861,7 +861,7 @@ const PrepopulatedEngine* const engines_SV[] = { - &googleen, &google, - &bing, - &yahoo_es, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -871,7 +871,7 @@ const PrepopulatedEngine* const engines_SY[] = { - &bing, - &yandex_ru, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Thailand -@@ -888,7 +888,7 @@ const PrepopulatedEngine* const engines_TN[] = { - &googleen, &google, - &bing, - &yahoo_fr, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_com, - }; - -@@ -898,7 +898,7 @@ const PrepopulatedEngine* const engines_TR[] = { - &yandex_tr, - &yahoo_tr, - &bing, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - }; - - // Trinidad and Tobago -@@ -906,7 +906,7 @@ const PrepopulatedEngine* const engines_TT[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &yandex_com, - }; - -@@ -915,8 +915,8 @@ const PrepopulatedEngine* const engines_TW[] = { - &googleen, &google, - &yahoo_tw, - &bing, -- &baidu, -- &duckduckgo, -+ &baidu, &duckduckgo_light, -+ &duckduckgo, &duckduckgo_light, - }; - - // Tanzania -@@ -924,7 +924,7 @@ const PrepopulatedEngine* const engines_TZ[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -942,7 +942,7 @@ const PrepopulatedEngine* const engines_US[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -951,7 +951,7 @@ const PrepopulatedEngine* const engines_UY[] = { - &googleen, &google, - &bing, - &yahoo_es, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -978,8 +978,8 @@ const PrepopulatedEngine* const engines_YE[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -- &yandex_com, -+ &duckduckgo, &duckduckgo_light, -+ &yandex_com, &duckduckgo_light, - }; - - // South Africa -@@ -987,7 +987,7 @@ const PrepopulatedEngine* const engines_ZA[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - -@@ -996,7 +996,7 @@ const PrepopulatedEngine* const engines_ZW[] = { - &googleen, &google, - &bing, - &yahoo, -- &duckduckgo, -+ &duckduckgo, &duckduckgo_light, - &ecosia, - }; - --- -2.34.1 - diff --git a/build/bromite_patches/Add-English-only-search-engine.patch b/build/bromite_patches/Add-English-only-search-engine.patch deleted file mode 100644 index cac3361c9ef984c32994a58f803f3ab0b1a3c641..0000000000000000000000000000000000000000 --- a/build/bromite_patches/Add-English-only-search-engine.patch +++ /dev/null @@ -1,1037 +0,0 @@ -From 54421bb51eb370e84a9ca4e6070e831fbedbdcd8 Mon Sep 17 00:00:00 2001 -From: csagan5 <32685696+csagan5@users.noreply.github.com> -Date: Mon, 11 Dec 2017 22:42:11 +0100 -Subject: [PATCH 047/192] Add English-only search engine - -Add a Google search engine that forces languages to English, -disable from all its searches RLZ and field experiments querystring parameters. - -License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html ---- - .../search_engines/prepopulated_engines.json | 21 ++ - .../search_engines/search_engine_type.h | 1 + - .../template_url_prepopulate_data.cc | 216 +++++++++--------- - 3 files changed, 130 insertions(+), 108 deletions(-) - -diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json -index cdfa06094cfcd..31042adbe1137 100644 ---- a/components/search_engines/prepopulated_engines.json -+++ b/components/search_engines/prepopulated_engines.json -@@ -141,6 +141,27 @@ - "id": 1 - }, - -+ "googleen": { -+ "name": "Google in English", -+ "keyword": "googleen", -+ "favicon_url": "https://www.google.com/favicon.ico", -+ "search_url": "{google:baseURL}search?q={searchTerms}&ie={inputEncoding}&hl=en", -+ "suggest_url": "{google:baseSuggestURL}search?client={google:suggestClient}&q={searchTerms}&hl=en", -+ "image_url": "{google:baseURL}searchbyimage/upload?hl=en", -+ "new_tab_url": "{google:baseURL}_/chrome/newtab?hl=en&ie={inputEncoding}", -+ "contextual_search_url": "{google:baseURL}_/contextualsearch?{google:contextualSearchVersion}{google:contextualSearchContextData}&hl=en", -+ "image_url_post_params": "encoded_image={google:imageThumbnail},image_url={google:imageURL},sbisrc={google:imageSearchSource},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight}", -+ "alternate_urls": [ -+ "{google:baseURL}?hl=en#q={searchTerms}", -+ "{google:baseURL}search?hl=en#q={searchTerms}", -+ "{google:baseURL}webhp?hl=en#q={searchTerms}", -+ "{google:baseURL}s?hl=en#q={searchTerms}", -+ "{google:baseURL}s?hl=en&q={searchTerms}" -+ ], -+ "type": "SEARCH_ENGINE_GOOGLE_EN", -+ "id": 13 -+ }, -+ - "mail_ru": { - "name": "@MAIL.RU", - "keyword": "mail.ru", -diff --git a/components/search_engines/search_engine_type.h b/components/search_engines/search_engine_type.h -index ab078967ce677..b77ce20c6b13c 100644 ---- a/components/search_engines/search_engine_type.h -+++ b/components/search_engines/search_engine_type.h -@@ -78,6 +78,7 @@ enum SearchEngineType { - SEARCH_ENGINE_STARTER_PACK_BOOKMARKS = 61, - SEARCH_ENGINE_STARTER_PACK_HISTORY = 62, - SEARCH_ENGINE_STARTER_PACK_TABS = 63, -+ SEARCH_ENGINE_GOOGLE_EN = 64, - - SEARCH_ENGINE_MAX // Bounding value needed for UMA histogram macro. - }; -diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc -index fb459bc4dfedb..565245bfe88b6 100644 ---- a/components/search_engines/template_url_prepopulate_data.cc -+++ b/components/search_engines/template_url_prepopulate_data.cc -@@ -29,7 +29,7 @@ namespace { - - // Default (for countries with no better engine set) - const PrepopulatedEngine* const engines_default[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - }; -@@ -39,7 +39,7 @@ const PrepopulatedEngine* const engines_default[] = { - // clang-format off - // United Arab Emirates - const PrepopulatedEngine* const engines_AE[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -48,7 +48,7 @@ const PrepopulatedEngine* const engines_AE[] = { - - // Albania - const PrepopulatedEngine* const engines_AL[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -57,7 +57,7 @@ const PrepopulatedEngine* const engines_AL[] = { - - // Argentina - const PrepopulatedEngine* const engines_AR[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_ar, - &duckduckgo, -@@ -66,7 +66,7 @@ const PrepopulatedEngine* const engines_AR[] = { - - // Austria - const PrepopulatedEngine* const engines_AT[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_at, - &duckduckgo, -@@ -75,7 +75,7 @@ const PrepopulatedEngine* const engines_AT[] = { - - // Australia - const PrepopulatedEngine* const engines_AU[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_au, - &duckduckgo, -@@ -84,7 +84,7 @@ const PrepopulatedEngine* const engines_AU[] = { - - // Bosnia and Herzegovina - const PrepopulatedEngine* const engines_BA[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -93,7 +93,7 @@ const PrepopulatedEngine* const engines_BA[] = { - - // Belgium - const PrepopulatedEngine* const engines_BE[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &ecosia, -@@ -102,7 +102,7 @@ const PrepopulatedEngine* const engines_BE[] = { - - // Bulgaria - const PrepopulatedEngine* const engines_BG[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -111,7 +111,7 @@ const PrepopulatedEngine* const engines_BG[] = { - - // Bahrain - const PrepopulatedEngine* const engines_BH[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -120,7 +120,7 @@ const PrepopulatedEngine* const engines_BH[] = { - - // Burundi - const PrepopulatedEngine* const engines_BI[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -129,7 +129,7 @@ const PrepopulatedEngine* const engines_BI[] = { - - // Brunei - const PrepopulatedEngine* const engines_BN[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -138,7 +138,7 @@ const PrepopulatedEngine* const engines_BN[] = { - - // Bolivia - const PrepopulatedEngine* const engines_BO[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -147,7 +147,7 @@ const PrepopulatedEngine* const engines_BO[] = { - - // Brazil - const PrepopulatedEngine* const engines_BR[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_br, - &duckduckgo, -@@ -156,7 +156,7 @@ const PrepopulatedEngine* const engines_BR[] = { - - // Belarus - const PrepopulatedEngine* const engines_BY[] = { -- &google, -+ &googleen, &google, - &yandex_by, - &mail_ru, - &bing, -@@ -165,7 +165,7 @@ const PrepopulatedEngine* const engines_BY[] = { - - // Belize - const PrepopulatedEngine* const engines_BZ[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -174,7 +174,7 @@ const PrepopulatedEngine* const engines_BZ[] = { - - // Canada - const PrepopulatedEngine* const engines_CA[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_ca, - &duckduckgo, -@@ -183,7 +183,7 @@ const PrepopulatedEngine* const engines_CA[] = { - - // Switzerland - const PrepopulatedEngine* const engines_CH[] = { -- &google, -+ &googleen, &google, - &bing, - &duckduckgo, - &yahoo_ch, -@@ -192,7 +192,7 @@ const PrepopulatedEngine* const engines_CH[] = { - - // Chile - const PrepopulatedEngine* const engines_CL[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_cl, - &duckduckgo, -@@ -203,14 +203,14 @@ const PrepopulatedEngine* const engines_CL[] = { - const PrepopulatedEngine* const engines_CN[] = { - &baidu, - &bing, -- &sogou, -+ &googleen, &sogou, - &so_360, - &google, - }; - - // Colombia - const PrepopulatedEngine* const engines_CO[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_co, - &duckduckgo, -@@ -219,7 +219,7 @@ const PrepopulatedEngine* const engines_CO[] = { - - // Costa Rica - const PrepopulatedEngine* const engines_CR[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -228,7 +228,7 @@ const PrepopulatedEngine* const engines_CR[] = { - - // Czech Republic - const PrepopulatedEngine* const engines_CZ[] = { -- &google, -+ &googleen, &google, - &seznam_cz, - &bing, - &yahoo, -@@ -237,7 +237,7 @@ const PrepopulatedEngine* const engines_CZ[] = { - - // Germany - const PrepopulatedEngine* const engines_DE[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_de, - &duckduckgo, -@@ -246,7 +246,7 @@ const PrepopulatedEngine* const engines_DE[] = { - - // Denmark - const PrepopulatedEngine* const engines_DK[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_dk, - &duckduckgo, -@@ -255,7 +255,7 @@ const PrepopulatedEngine* const engines_DK[] = { - - // Dominican Republic - const PrepopulatedEngine* const engines_DO[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -264,7 +264,7 @@ const PrepopulatedEngine* const engines_DO[] = { - - // Algeria - const PrepopulatedEngine* const engines_DZ[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_fr, - &yandex_com, -@@ -273,7 +273,7 @@ const PrepopulatedEngine* const engines_DZ[] = { - - // Ecuador - const PrepopulatedEngine* const engines_EC[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_es, - &ecosia, -@@ -282,7 +282,7 @@ const PrepopulatedEngine* const engines_EC[] = { - - // Estonia - const PrepopulatedEngine* const engines_EE[] = { -- &google, -+ &googleen, &google, - &bing, - &yandex_ru, - &duckduckgo, -@@ -291,7 +291,7 @@ const PrepopulatedEngine* const engines_EE[] = { - - // Egypt - const PrepopulatedEngine* const engines_EG[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &yandex_com, -@@ -300,7 +300,7 @@ const PrepopulatedEngine* const engines_EG[] = { - - // Spain - const PrepopulatedEngine* const engines_ES[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_es, - &duckduckgo, -@@ -309,7 +309,7 @@ const PrepopulatedEngine* const engines_ES[] = { - - // Finland - const PrepopulatedEngine* const engines_FI[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_fi, - &duckduckgo, -@@ -318,7 +318,7 @@ const PrepopulatedEngine* const engines_FI[] = { - - // Faroe Islands - const PrepopulatedEngine* const engines_FO[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_uk, - &duckduckgo, -@@ -327,7 +327,7 @@ const PrepopulatedEngine* const engines_FO[] = { - - // France - const PrepopulatedEngine* const engines_FR[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_fr, - &qwant, -@@ -336,7 +336,7 @@ const PrepopulatedEngine* const engines_FR[] = { - - // United Kingdom - const PrepopulatedEngine* const engines_GB[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_uk, - &duckduckgo, -@@ -345,7 +345,7 @@ const PrepopulatedEngine* const engines_GB[] = { - - // Greece - const PrepopulatedEngine* const engines_GR[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -354,7 +354,7 @@ const PrepopulatedEngine* const engines_GR[] = { - - // Guatemala - const PrepopulatedEngine* const engines_GT[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -363,7 +363,7 @@ const PrepopulatedEngine* const engines_GT[] = { - - // Hong Kong - const PrepopulatedEngine* const engines_HK[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_hk, - &baidu, -@@ -372,7 +372,7 @@ const PrepopulatedEngine* const engines_HK[] = { - - // Honduras - const PrepopulatedEngine* const engines_HN[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -381,7 +381,7 @@ const PrepopulatedEngine* const engines_HN[] = { - - // Croatia - const PrepopulatedEngine* const engines_HR[] = { -- &google, -+ &googleen, &google, - &bing, - &duckduckgo, - &yahoo, -@@ -390,7 +390,7 @@ const PrepopulatedEngine* const engines_HR[] = { - - // Hungary - const PrepopulatedEngine* const engines_HU[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -399,7 +399,7 @@ const PrepopulatedEngine* const engines_HU[] = { - - // Indonesia - const PrepopulatedEngine* const engines_ID[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_id, - &duckduckgo, -@@ -408,7 +408,7 @@ const PrepopulatedEngine* const engines_ID[] = { - - // Ireland - const PrepopulatedEngine* const engines_IE[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_uk, - &duckduckgo, -@@ -417,7 +417,7 @@ const PrepopulatedEngine* const engines_IE[] = { - - // Israel - const PrepopulatedEngine* const engines_IL[] = { -- &google, -+ &googleen, &google, - &bing, - &yandex_ru, - &yahoo, -@@ -426,7 +426,7 @@ const PrepopulatedEngine* const engines_IL[] = { - - // India - const PrepopulatedEngine* const engines_IN[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_in, - &duckduckgo, -@@ -435,7 +435,7 @@ const PrepopulatedEngine* const engines_IN[] = { - - // Iraq - const PrepopulatedEngine* const engines_IQ[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &yandex_tr, -@@ -444,7 +444,7 @@ const PrepopulatedEngine* const engines_IQ[] = { - - // Iran - const PrepopulatedEngine* const engines_IR[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -453,7 +453,7 @@ const PrepopulatedEngine* const engines_IR[] = { - - // Iceland - const PrepopulatedEngine* const engines_IS[] = { -- &google, -+ &googleen, &google, - &bing, - &duckduckgo, - &yahoo, -@@ -462,7 +462,7 @@ const PrepopulatedEngine* const engines_IS[] = { - - // Italy - const PrepopulatedEngine* const engines_IT[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -471,7 +471,7 @@ const PrepopulatedEngine* const engines_IT[] = { - - // Jamaica - const PrepopulatedEngine* const engines_JM[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -480,7 +480,7 @@ const PrepopulatedEngine* const engines_JM[] = { - - // Jordan - const PrepopulatedEngine* const engines_JO[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &petal_search, -@@ -489,7 +489,7 @@ const PrepopulatedEngine* const engines_JO[] = { - - // Japan - const PrepopulatedEngine* const engines_JP[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_jp, - &duckduckgo, -@@ -498,7 +498,7 @@ const PrepopulatedEngine* const engines_JP[] = { - - // Kenya - const PrepopulatedEngine* const engines_KE[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -507,7 +507,7 @@ const PrepopulatedEngine* const engines_KE[] = { - - // South Korea - const PrepopulatedEngine* const engines_KR[] = { -- &google, -+ &googleen, &google, - &naver, - &bing, - &daum, -@@ -516,7 +516,7 @@ const PrepopulatedEngine* const engines_KR[] = { - - // Kuwait - const PrepopulatedEngine* const engines_KW[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -525,7 +525,7 @@ const PrepopulatedEngine* const engines_KW[] = { - - // Kazakhstan - const PrepopulatedEngine* const engines_KZ[] = { -- &google, -+ &googleen, &google, - &yandex_kz, - &mail_ru, - &bing, -@@ -534,7 +534,7 @@ const PrepopulatedEngine* const engines_KZ[] = { - - // Lebanon - const PrepopulatedEngine* const engines_LB[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -543,7 +543,7 @@ const PrepopulatedEngine* const engines_LB[] = { - - // Liechtenstein - const PrepopulatedEngine* const engines_LI[] = { -- &google, -+ &googleen, &google, - &bing, - &duckduckgo, - &yahoo, -@@ -552,7 +552,7 @@ const PrepopulatedEngine* const engines_LI[] = { - - // Lithuania - const PrepopulatedEngine* const engines_LT[] = { -- &google, -+ &googleen, &google, - &bing, - &yandex_ru, - &duckduckgo, -@@ -561,7 +561,7 @@ const PrepopulatedEngine* const engines_LT[] = { - - // Luxembourg - const PrepopulatedEngine* const engines_LU[] = { -- &google, -+ &googleen, &google, - &bing, - &duckduckgo, - &yahoo, -@@ -570,7 +570,7 @@ const PrepopulatedEngine* const engines_LU[] = { - - // Latvia - const PrepopulatedEngine* const engines_LV[] = { -- &google, -+ &googleen, &google, - &bing, - &yandex_ru, - &yahoo, -@@ -579,7 +579,7 @@ const PrepopulatedEngine* const engines_LV[] = { - - // Libya - const PrepopulatedEngine* const engines_LY[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &yandex_tr, -@@ -588,7 +588,7 @@ const PrepopulatedEngine* const engines_LY[] = { - - // Morocco - const PrepopulatedEngine* const engines_MA[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_fr, - &yandex_com, -@@ -597,7 +597,7 @@ const PrepopulatedEngine* const engines_MA[] = { - - // Monaco - const PrepopulatedEngine* const engines_MC[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_fr, - &duckduckgo, -@@ -606,7 +606,7 @@ const PrepopulatedEngine* const engines_MC[] = { - - // Moldova - const PrepopulatedEngine* const engines_MD[] = { -- &google, -+ &googleen, &google, - &yandex_ru, - &bing, - &mail_ru, -@@ -615,7 +615,7 @@ const PrepopulatedEngine* const engines_MD[] = { - - // Montenegro - const PrepopulatedEngine* const engines_ME[] = { -- &google, -+ &googleen, &google, - &bing, - &yandex_ru, - &yahoo, -@@ -624,7 +624,7 @@ const PrepopulatedEngine* const engines_ME[] = { - - // Macedonia - const PrepopulatedEngine* const engines_MK[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -633,7 +633,7 @@ const PrepopulatedEngine* const engines_MK[] = { - - // Mexico - const PrepopulatedEngine* const engines_MX[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_mx, - &duckduckgo, -@@ -642,7 +642,7 @@ const PrepopulatedEngine* const engines_MX[] = { - - // Malaysia - const PrepopulatedEngine* const engines_MY[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_my, - &duckduckgo, -@@ -651,7 +651,7 @@ const PrepopulatedEngine* const engines_MY[] = { - - // Nicaragua - const PrepopulatedEngine* const engines_NI[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -660,7 +660,7 @@ const PrepopulatedEngine* const engines_NI[] = { - - // Netherlands - const PrepopulatedEngine* const engines_NL[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_nl, - &duckduckgo, -@@ -669,7 +669,7 @@ const PrepopulatedEngine* const engines_NL[] = { - - // Norway - const PrepopulatedEngine* const engines_NO[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -678,7 +678,7 @@ const PrepopulatedEngine* const engines_NO[] = { - - // New Zealand - const PrepopulatedEngine* const engines_NZ[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_nz, - &duckduckgo, -@@ -687,7 +687,7 @@ const PrepopulatedEngine* const engines_NZ[] = { - - // Oman - const PrepopulatedEngine* const engines_OM[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &petal_search, -@@ -696,7 +696,7 @@ const PrepopulatedEngine* const engines_OM[] = { - - // Panama - const PrepopulatedEngine* const engines_PA[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_es, - &duckduckgo, -@@ -705,7 +705,7 @@ const PrepopulatedEngine* const engines_PA[] = { - - // Peru - const PrepopulatedEngine* const engines_PE[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_pe, - &ecosia, -@@ -714,7 +714,7 @@ const PrepopulatedEngine* const engines_PE[] = { - - // Philippines - const PrepopulatedEngine* const engines_PH[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_ph, - &ecosia, -@@ -723,7 +723,7 @@ const PrepopulatedEngine* const engines_PH[] = { - - // Pakistan - const PrepopulatedEngine* const engines_PK[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -732,7 +732,7 @@ const PrepopulatedEngine* const engines_PK[] = { - - // Poland - const PrepopulatedEngine* const engines_PL[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -741,7 +741,7 @@ const PrepopulatedEngine* const engines_PL[] = { - - // Puerto Rico - const PrepopulatedEngine* const engines_PR[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -750,7 +750,7 @@ const PrepopulatedEngine* const engines_PR[] = { - - // Portugal - const PrepopulatedEngine* const engines_PT[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -759,7 +759,7 @@ const PrepopulatedEngine* const engines_PT[] = { - - // Paraguay - const PrepopulatedEngine* const engines_PY[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_es, - &duckduckgo, -@@ -768,7 +768,7 @@ const PrepopulatedEngine* const engines_PY[] = { - - // Qatar - const PrepopulatedEngine* const engines_QA[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -777,7 +777,7 @@ const PrepopulatedEngine* const engines_QA[] = { - - // Romania - const PrepopulatedEngine* const engines_RO[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -786,7 +786,7 @@ const PrepopulatedEngine* const engines_RO[] = { - - // Serbia - const PrepopulatedEngine* const engines_RS[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -795,7 +795,7 @@ const PrepopulatedEngine* const engines_RS[] = { - - // Russia - const PrepopulatedEngine* const engines_RU[] = { -- &yandex_ru, -+ &googleen, &yandex_ru, - &google, - &duckduckgo, - &bing, -@@ -804,7 +804,7 @@ const PrepopulatedEngine* const engines_RU[] = { - - // Rwanda - const PrepopulatedEngine* const engines_RW[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -813,7 +813,7 @@ const PrepopulatedEngine* const engines_RW[] = { - - // Saudi Arabia - const PrepopulatedEngine* const engines_SA[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &yandex_com, -@@ -822,7 +822,7 @@ const PrepopulatedEngine* const engines_SA[] = { - - // Sweden - const PrepopulatedEngine* const engines_SE[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_se, - &duckduckgo, -@@ -831,7 +831,7 @@ const PrepopulatedEngine* const engines_SE[] = { - - // Singapore - const PrepopulatedEngine* const engines_SG[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_sg, - &baidu, -@@ -840,7 +840,7 @@ const PrepopulatedEngine* const engines_SG[] = { - - // Slovenia - const PrepopulatedEngine* const engines_SI[] = { -- &google, -+ &googleen, &google, - &bing, - &duckduckgo, - &yahoo, -@@ -849,7 +849,7 @@ const PrepopulatedEngine* const engines_SI[] = { - - // Slovakia - const PrepopulatedEngine* const engines_SK[] = { -- &google, -+ &googleen, &google, - &bing, - &duckduckgo, - &yahoo, -@@ -858,7 +858,7 @@ const PrepopulatedEngine* const engines_SK[] = { - - // El Salvador - const PrepopulatedEngine* const engines_SV[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_es, - &duckduckgo, -@@ -867,7 +867,7 @@ const PrepopulatedEngine* const engines_SV[] = { - - // Syria - const PrepopulatedEngine* const engines_SY[] = { -- &google, -+ &googleen, &google, - &bing, - &yandex_ru, - &yahoo, -@@ -876,7 +876,7 @@ const PrepopulatedEngine* const engines_SY[] = { - - // Thailand - const PrepopulatedEngine* const engines_TH[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_th, - &naver, -@@ -885,7 +885,7 @@ const PrepopulatedEngine* const engines_TH[] = { - - // Tunisia - const PrepopulatedEngine* const engines_TN[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_fr, - &duckduckgo, -@@ -894,7 +894,7 @@ const PrepopulatedEngine* const engines_TN[] = { - - // Turkey - const PrepopulatedEngine* const engines_TR[] = { -- &google, -+ &googleen, &google, - &yandex_tr, - &yahoo_tr, - &bing, -@@ -903,7 +903,7 @@ const PrepopulatedEngine* const engines_TR[] = { - - // Trinidad and Tobago - const PrepopulatedEngine* const engines_TT[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -912,7 +912,7 @@ const PrepopulatedEngine* const engines_TT[] = { - - // Taiwan - const PrepopulatedEngine* const engines_TW[] = { -- &google, -+ &googleen, &google, - &yahoo_tw, - &bing, - &baidu, -@@ -921,7 +921,7 @@ const PrepopulatedEngine* const engines_TW[] = { - - // Tanzania - const PrepopulatedEngine* const engines_TZ[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -930,7 +930,7 @@ const PrepopulatedEngine* const engines_TZ[] = { - - // Ukraine - const PrepopulatedEngine* const engines_UA[] = { -- &google, -+ &googleen, &google, - &yandex_ru, - &bing, - &duckduckgo, -@@ -939,7 +939,7 @@ const PrepopulatedEngine* const engines_UA[] = { - - // United States - const PrepopulatedEngine* const engines_US[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -948,7 +948,7 @@ const PrepopulatedEngine* const engines_US[] = { - - // Uruguay - const PrepopulatedEngine* const engines_UY[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_es, - &duckduckgo, -@@ -957,7 +957,7 @@ const PrepopulatedEngine* const engines_UY[] = { - - // Venezuela - const PrepopulatedEngine* const engines_VE[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo_es, - &duckduckgo, -@@ -966,7 +966,7 @@ const PrepopulatedEngine* const engines_VE[] = { - - // Vietnam - const PrepopulatedEngine* const engines_VN[] = { -- &google, -+ &googleen, &google, - &coccoc, - &bing, - &yahoo, -@@ -975,7 +975,7 @@ const PrepopulatedEngine* const engines_VN[] = { - - // Yemen - const PrepopulatedEngine* const engines_YE[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -984,7 +984,7 @@ const PrepopulatedEngine* const engines_YE[] = { - - // South Africa - const PrepopulatedEngine* const engines_ZA[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, -@@ -993,7 +993,7 @@ const PrepopulatedEngine* const engines_ZA[] = { - - // Zimbabwe - const PrepopulatedEngine* const engines_ZW[] = { -- &google, -+ &googleen, &google, - &bing, - &yahoo, - &duckduckgo, --- -2.34.1 - diff --git a/build/bromite_patches/Add-IsCleartextPermitted-flag.patch b/build/bromite_patches/Add-IsCleartextPermitted-flag.patch index 6b234700389c67eb11029e0daefbc5785fc3d207..084b195cd7dbac2cb4d6a56d6f8571623ac14fb8 100644 --- a/build/bromite_patches/Add-IsCleartextPermitted-flag.patch +++ b/build/bromite_patches/Add-IsCleartextPermitted-flag.patch @@ -1,106 +1,60 @@ -From ac498a86a14754cf2372b4f1182205ed79d4ea0d Mon Sep 17 00:00:00 2001 From: uazo Date: Mon, 26 Apr 2021 15:04:11 +0000 -Subject: [PATCH 131/192] Add IsCleartextPermitted flag +Subject: Add IsCleartextPermitted flag Original License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - chrome/browser/about_flags.cc | 4 ++++ - chrome/browser/flag_descriptions.cc | 4 ++++ - chrome/browser/flag_descriptions.h | 3 +++ - net/base/features.cc | 4 ++++ - net/base/features.h | 2 ++ - net/url_request/url_request_http_job.cc | 4 ++++ - 6 files changed, 21 insertions(+) + .../about_flags_cc/Add-IsCleartextPermitted-flag.inc | 8 ++++++++ + .../base/features_cc/Add-IsCleartextPermitted-flag.inc | 3 +++ + .../net/base/features_h/Add-IsCleartextPermitted-flag.inc | 1 + + net/url_request/url_request_http_job.cc | 5 +++++ + 4 files changed, 17 insertions(+) + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/Add-IsCleartextPermitted-flag.inc + create mode 100644 cromite_flags/net/base/features_cc/Add-IsCleartextPermitted-flag.inc + create mode 100644 cromite_flags/net/base/features_h/Add-IsCleartextPermitted-flag.inc -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index a30a18f00179e..cde019cdb2851 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -9516,6 +9516,10 @@ const FeatureEntry kFeatureEntries[] = { - flag_descriptions::kForceOffTextAutosizingName, - flag_descriptions::kForceOffTextAutosizingDescription, kOsAndroid, - FEATURE_VALUE_TYPE(features::kForceOffTextAutosizing)}, +diff --git a/cromite_flags/chrome/browser/about_flags_cc/Add-IsCleartextPermitted-flag.inc b/cromite_flags/chrome/browser/about_flags_cc/Add-IsCleartextPermitted-flag.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/Add-IsCleartextPermitted-flag.inc +@@ -0,0 +1,8 @@ ++#ifdef FLAG_SECTION ++ + {"cleartext-permitted", -+ flag_descriptions::kIsCleartextPermittedName, -+ flag_descriptions::kIsCleartextPermittedDescription, kOsAndroid, ++ "Allow cleartext traffic", ++ "Allow insecure connections over HTTP", kOsAll, + FEATURE_VALUE_TYPE(net::features::kIsCleartextPermitted)}, - #endif - - #if BUILDFLAG(IS_ANDROID) -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index 4032bab43c722..12e206fab161e 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -1947,6 +1947,10 @@ const char kHttpsUpgradesDescription[] = - "Enable automatically upgrading all top-level navigations to HTTPS with " - "fast fallback to HTTP."; - -+const char kIsCleartextPermittedName[] = "Allow cleartext traffic"; -+const char kIsCleartextPermittedDescription[] = -+ "Allow insecure connections over HTTP"; + - const char kIgnoreGpuBlocklistName[] = "Override software rendering list"; - const char kIgnoreGpuBlocklistDescription[] = - "Overrides the built-in software rendering list and enables " -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index e95beecefb599..8e7efeaab8bbb 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -1090,6 +1090,9 @@ extern const char kHideIncognitoMediaMetadataDescription[]; - extern const char kHttpsOnlyModeName[]; - extern const char kHttpsOnlyModeDescription[]; - -+extern const char kIsCleartextPermittedName[]; -+extern const char kIsCleartextPermittedDescription[]; -+ - extern const char kHttpsFirstModeV2Name[]; - extern const char kHttpsFirstModeV2Description[]; - -diff --git a/net/base/features.cc b/net/base/features.cc -index 8d37774c60d90..41dfa7bc63480 100644 ---- a/net/base/features.cc -+++ b/net/base/features.cc -@@ -146,6 +146,10 @@ BASE_FEATURE(kHttpCacheKeyingExperimentControlGroup, - "HttpCacheKeyingExperimentControlGroup", - base::FEATURE_DISABLED_BY_DEFAULT); - -+BASE_FEATURE(kIsCleartextPermitted, -+ "IsCleartextPermitted", -+ base::FEATURE_ENABLED_BY_DEFAULT); -+ - BASE_FEATURE(kTLS13KeyUpdate, - "TLS13KeyUpdate", - base::FEATURE_DISABLED_BY_DEFAULT); -diff --git a/net/base/features.h b/net/base/features.h -index 31e74ad0d6f2f..47a793b517622 100644 ---- a/net/base/features.h -+++ b/net/base/features.h -@@ -30,6 +30,8 @@ NET_EXPORT BASE_DECLARE_FEATURE(kAvoidH2Reprioritization); - // origin requests are restricted to contain at most the source origin. - NET_EXPORT BASE_DECLARE_FEATURE(kCapReferrerToOriginOnCrossOrigin); - ++#endif +diff --git a/cromite_flags/net/base/features_cc/Add-IsCleartextPermitted-flag.inc b/cromite_flags/net/base/features_cc/Add-IsCleartextPermitted-flag.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/net/base/features_cc/Add-IsCleartextPermitted-flag.inc +@@ -0,0 +1,3 @@ ++CROMITE_FEATURE(kIsCleartextPermitted, ++ "IsCleartextPermitted", ++ base::FEATURE_ENABLED_BY_DEFAULT); +diff --git a/cromite_flags/net/base/features_h/Add-IsCleartextPermitted-flag.inc b/cromite_flags/net/base/features_h/Add-IsCleartextPermitted-flag.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/net/base/features_h/Add-IsCleartextPermitted-flag.inc +@@ -0,0 +1 @@ +NET_EXPORT BASE_DECLARE_FEATURE(kIsCleartextPermitted); -+ - // Support for altering the parameters used for DNS transaction timeout. See - // ResolveContext::SecureTransactionTimeout(). - NET_EXPORT BASE_DECLARE_FEATURE(kDnsTransactionDynamicTimeouts); diff --git a/net/url_request/url_request_http_job.cc b/net/url_request/url_request_http_job.cc -index 61b8138de0f00..97eacf1fb40ef 100644 --- a/net/url_request/url_request_http_job.cc +++ b/net/url_request/url_request_http_job.cc -@@ -213,6 +213,10 @@ std::unique_ptr URLRequestHttpJob::Create(URLRequest* request) { +@@ -232,6 +232,11 @@ std::unique_ptr URLRequestHttpJob::Create(URLRequest* request) { + RedirectUtil::ResponseCode::REDIRECT_307_TEMPORARY_REDIRECT, "HSTS"); } - #if BUILDFLAG(IS_ANDROID) + if (base::FeatureList::IsEnabled(net::features::kIsCleartextPermitted) == false) { + return std::make_unique(request, + ERR_CLEARTEXT_NOT_PERMITTED); + } ++ + #if BUILDFLAG(IS_ANDROID) // Check whether the app allows cleartext traffic to this host, and return // ERR_CLEARTEXT_NOT_PERMITTED if not. - if (request->context()->check_cleartext_permitted() && --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-a-proxy-configuration-page.patch b/build/bromite_patches/Add-a-proxy-configuration-page.patch index 672253676b2cf3d751dcc60037342b579dd52c1e..cbbf552092e915274a6a48509076a943b089df94 100644 --- a/build/bromite_patches/Add-a-proxy-configuration-page.patch +++ b/build/bromite_patches/Add-a-proxy-configuration-page.patch @@ -1,7 +1,6 @@ -From 57be1b5a2c42f9530d8acfc6fb091392773c767c Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Thu, 29 Mar 2018 00:43:32 +0200 -Subject: [PATCH 066/192] Add a proxy configuration page +Subject: Add a proxy configuration page Accessible from proxy settings and chrome://proxy Allows to use a PAC script URL, automatic configuration and explicit proxy settings. @@ -20,7 +19,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../java/res/xml/privacy_preferences.xml | 4 + .../privacy/settings/PrivacySettings.java | 1 + .../chrome_autocomplete_provider_client.cc | 2 + - chrome/browser/browser_resources.grd | 4 +- + chrome/browser/browser_resources.grd | 3 + .../extensions/api/proxy/proxy_api_helpers.cc | 2 +- chrome/browser/net/proxy_service_factory.cc | 24 +- chrome/browser/net/proxy_service_factory.h | 3 + @@ -41,7 +40,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../proxy_config/proxy_policy_handler.cc | 2 +- net/proxy_resolution/proxy_config.cc | 52 ++- net/proxy_resolution/proxy_config.h | 3 + - 25 files changed, 981 insertions(+), 18 deletions(-) + 25 files changed, 981 insertions(+), 17 deletions(-) create mode 100644 chrome/browser/resources/proxy_config.css create mode 100644 chrome/browser/resources/proxy_config.html create mode 100644 chrome/browser/resources/proxy_config.js @@ -49,7 +48,6 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html create mode 100644 chrome/browser/ui/webui/proxy_config_ui.h diff --git a/chrome/android/java/res/values/values.xml b/chrome/android/java/res/values/values.xml -index ce68e038c7d31..9a30818faacaa 100644 --- a/chrome/android/java/res/values/values.xml +++ b/chrome/android/java/res/values/values.xml @@ -27,6 +27,9 @@ found in the LICENSE file. @@ -63,7 +61,6 @@ index ce68e038c7d31..9a30818faacaa 100644 1200 200 diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml -index 4c71a1e2ba2ab..68b5042d47935 100644 --- a/chrome/android/java/res/xml/privacy_preferences.xml +++ b/chrome/android/java/res/xml/privacy_preferences.xml @@ -9,6 +9,10 @@ found in the LICENSE file. @@ -78,10 +75,9 @@ index 4c71a1e2ba2ab..68b5042d47935 100644 android:key="clear_browsing_data" android:title="@string/clear_browsing_data_title" diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java -index a946ec6c709f2..a6e901bb87980 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java -@@ -82,6 +82,7 @@ public class PrivacySettings extends PreferenceFragmentCompat +@@ -77,6 +77,7 @@ public class PrivacySettings private static final String PREF_SAFE_BROWSING = "safe_browsing"; private static final String PREF_SYNC_AND_SERVICES_LINK = "sync_and_services_link"; private static final String PREF_PRIVACY_SANDBOX = "privacy_sandbox"; @@ -90,10 +86,9 @@ index a946ec6c709f2..a6e901bb87980 100644 private static final String PREF_INCOGNITO_LOCK = "incognito_lock"; private static final String PREF_THIRD_PARTY_COOKIES = "third_party_cookies"; diff --git a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc -index d08bd3c772c6b..7aa817639291c 100644 --- a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc +++ b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc -@@ -297,6 +297,8 @@ ChromeAutocompleteProviderClient::GetBuiltinsToProvideAsUserTypes() { +@@ -304,6 +304,8 @@ ChromeAutocompleteProviderClient::GetBuiltinsToProvideAsUserTypes() { builtins_to_provide.push_back( base::ASCIIToUTF16(chrome::kChromeUISettingsURL)); #endif @@ -103,10 +98,9 @@ index d08bd3c772c6b..7aa817639291c 100644 base::ASCIIToUTF16(chrome::kChromeUIVersionURL)); return builtins_to_provide; diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd -index a5d1b74743d97..d49348b856951 100644 --- a/chrome/browser/browser_resources.grd +++ b/chrome/browser/browser_resources.grd -@@ -277,11 +277,13 @@ +@@ -252,6 +252,9 @@ @@ -114,15 +108,9 @@ index a5d1b74743d97..d49348b856951 100644 + + - - - -- - diff --git a/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc b/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc -index 20f57baa728cd..2712a2dd618de 100644 --- a/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc +++ b/chrome/browser/extensions/api/proxy/proxy_api_helpers.cc @@ -388,7 +388,7 @@ absl::optional CreateProxyConfigDict( @@ -135,7 +123,6 @@ index 20f57baa728cd..2712a2dd618de 100644 case ProxyPrefs::MODE_SYSTEM: return ProxyConfigDictionary::CreateSystem(); diff --git a/chrome/browser/net/proxy_service_factory.cc b/chrome/browser/net/proxy_service_factory.cc -index 281a393f03936..5dedebc3a9f16 100644 --- a/chrome/browser/net/proxy_service_factory.cc +++ b/chrome/browser/net/proxy_service_factory.cc @@ -6,6 +6,7 @@ @@ -188,7 +175,6 @@ index 281a393f03936..5dedebc3a9f16 100644 + registry->RegisterBooleanPref("proxy_migrated", false); +} diff --git a/chrome/browser/net/proxy_service_factory.h b/chrome/browser/net/proxy_service_factory.h -index a5074896c5ebd..9d2060d09fca2 100644 --- a/chrome/browser/net/proxy_service_factory.h +++ b/chrome/browser/net/proxy_service_factory.h @@ -6,6 +6,7 @@ @@ -209,10 +195,9 @@ index a5074896c5ebd..9d2060d09fca2 100644 // should be used for the system request context and the signin screen // (ChromeOS only). diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc -index 8f75f154b981f..17436d6fab77f 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc -@@ -177,6 +177,8 @@ +@@ -185,6 +185,8 @@ #include "rlz/buildflags/buildflags.h" #include "third_party/abseil-cpp/absl/types/optional.h" @@ -221,7 +206,7 @@ index 8f75f154b981f..17436d6fab77f 100644 #if BUILDFLAG(ENABLE_BACKGROUND_MODE) #include "chrome/browser/background/background_mode_manager.h" #endif -@@ -1410,6 +1412,8 @@ void RegisterLocalState(PrefRegistrySimple* registry) { +@@ -1389,6 +1391,8 @@ void RegisterLocalState(PrefRegistrySimple* registry) { component_updater::RegisterPrefs(registry); domain_reliability::RegisterPrefs(registry); embedder_support::OriginTrialPrefs::RegisterPrefs(registry); @@ -231,7 +216,6 @@ index 8f75f154b981f..17436d6fab77f 100644 ExternalProtocolHandler::RegisterPrefs(registry); flags_ui::PrefServiceFlagsStorage::RegisterPrefs(registry); diff --git a/chrome/browser/prefs/chrome_command_line_pref_store.cc b/chrome/browser/prefs/chrome_command_line_pref_store.cc -index dd4824764ecf6..03019827319af 100644 --- a/chrome/browser/prefs/chrome_command_line_pref_store.cc +++ b/chrome/browser/prefs/chrome_command_line_pref_store.cc @@ -156,7 +156,7 @@ void ChromeCommandLinePrefStore::ApplyProxyMode() { @@ -245,7 +229,6 @@ index dd4824764ecf6..03019827319af 100644 } diff --git a/chrome/browser/resources/proxy_config.css b/chrome/browser/resources/proxy_config.css new file mode 100644 -index 0000000000000..0ce4fc031fa12 --- /dev/null +++ b/chrome/browser/resources/proxy_config.css @@ -0,0 +1,61 @@ @@ -312,7 +295,6 @@ index 0000000000000..0ce4fc031fa12 +} diff --git a/chrome/browser/resources/proxy_config.html b/chrome/browser/resources/proxy_config.html new file mode 100644 -index 0000000000000..71df46a98a601 --- /dev/null +++ b/chrome/browser/resources/proxy_config.html @@ -0,0 +1,77 @@ @@ -395,7 +377,6 @@ index 0000000000000..71df46a98a601 + diff --git a/chrome/browser/resources/proxy_config.js b/chrome/browser/resources/proxy_config.js new file mode 100644 -index 0000000000000..7f92b18dfff49 --- /dev/null +++ b/chrome/browser/resources/proxy_config.js @@ -0,0 +1,278 @@ @@ -678,10 +659,9 @@ index 0000000000000..7f92b18dfff49 + return ProxyConfigView; +})(); diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn -index b499b28307af0..9b37cf6098ee0 100644 --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn -@@ -299,6 +299,8 @@ static_library("ui") { +@@ -301,6 +301,8 @@ static_library("ui") { "webui/metrics_internals/metrics_internals_ui.h", "webui/net_export_ui.cc", "webui/net_export_ui.h", @@ -691,10 +671,9 @@ index b499b28307af0..9b37cf6098ee0 100644 "webui/net_internals/net_internals_ui.h", "webui/ntp_tiles_internals_ui.cc", diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc -index 2eb4bd497a036..b448dcb118d41 100644 --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc -@@ -59,6 +59,7 @@ +@@ -63,6 +63,7 @@ #include "chrome/browser/ui/webui/ntp_tiles_internals_ui.h" #include "chrome/browser/ui/webui/omnibox/omnibox_ui.h" #include "chrome/browser/ui/webui/policy/policy_ui.h" @@ -702,7 +681,7 @@ index 2eb4bd497a036..b448dcb118d41 100644 #include "chrome/browser/ui/webui/predictors/predictors_ui.h" #include "chrome/browser/ui/webui/segmentation_internals/segmentation_internals_ui.h" #include "chrome/browser/ui/webui/signin_internals_ui.h" -@@ -493,6 +494,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui, +@@ -496,6 +497,8 @@ WebUIFactoryFunction GetWebUIFactoryFunction(WebUI* web_ui, return &NewWebUI; if (url.host_piece() == chrome::kChromeUINetExportHost) return &NewWebUI; @@ -713,7 +692,6 @@ index 2eb4bd497a036..b448dcb118d41 100644 if (url.host_piece() == chrome::kChromeUINTPTilesInternalsHost) diff --git a/chrome/browser/ui/webui/proxy_config_ui.cc b/chrome/browser/ui/webui/proxy_config_ui.cc new file mode 100644 -index 0000000000000..e0269904b6dfe --- /dev/null +++ b/chrome/browser/ui/webui/proxy_config_ui.cc @@ -0,0 +1,393 @@ @@ -1112,7 +1090,6 @@ index 0000000000000..e0269904b6dfe +} diff --git a/chrome/browser/ui/webui/proxy_config_ui.h b/chrome/browser/ui/webui/proxy_config_ui.h new file mode 100644 -index 0000000000000..04ef3f7c1fb6d --- /dev/null +++ b/chrome/browser/ui/webui/proxy_config_ui.h @@ -0,0 +1,31 @@ @@ -1148,10 +1125,9 @@ index 0000000000000..04ef3f7c1fb6d + +#endif // CHROME_BROWSER_UI_WEBUI_PROXY_CONFIG_UI_H_ diff --git a/chrome/common/webui_url_constants.cc b/chrome/common/webui_url_constants.cc -index f25f690144d2d..e2610eb6e0f01 100644 --- a/chrome/common/webui_url_constants.cc +++ b/chrome/common/webui_url_constants.cc -@@ -51,6 +51,8 @@ const char kChromeUICertificateViewerHost[] = "view-cert"; +@@ -56,6 +56,8 @@ const char kChromeUICertificateViewerHost[] = "view-cert"; const char kChromeUICertificateViewerURL[] = "chrome://view-cert/"; const char kChromeUIChromeSigninHost[] = "chrome-signin"; const char kChromeUIChromeSigninURL[] = "chrome://chrome-signin/"; @@ -1160,7 +1136,7 @@ index f25f690144d2d..e2610eb6e0f01 100644 const char kChromeUIChromeURLsHost[] = "chrome-urls"; const char kChromeUIChromeURLsURL[] = "chrome://chrome-urls/"; const char kChromeUIComponentsHost[] = "components"; -@@ -436,6 +438,7 @@ bool IsSystemWebUIHost(base::StringPiece host) { +@@ -450,6 +452,7 @@ bool IsSystemWebUIHost(base::StringPiece host) { kChromeUILockScreenNetworkHost, kChromeUILockScreenStartReauthHost, kChromeUIMobileSetupHost, @@ -1168,7 +1144,7 @@ index f25f690144d2d..e2610eb6e0f01 100644 kChromeUIMultiDeviceSetupHost, kChromeUINetworkHost, kChromeUINotificationTesterHost, -@@ -741,6 +744,7 @@ const char* const kChromeHostURLs[] = { +@@ -759,6 +762,7 @@ const char* const kChromeHostURLs[] = { #if !BUILDFLAG(IS_ANDROID) #if !BUILDFLAG(IS_CHROMEOS) kChromeUIAppLauncherPageHost, @@ -1177,10 +1153,9 @@ index f25f690144d2d..e2610eb6e0f01 100644 kChromeUIBookmarksHost, kChromeUIDownloadsHost, diff --git a/chrome/common/webui_url_constants.h b/chrome/common/webui_url_constants.h -index caca46377bbeb..17cce860b2f02 100644 --- a/chrome/common/webui_url_constants.h +++ b/chrome/common/webui_url_constants.h -@@ -138,6 +138,8 @@ extern const char kChromeUINTPTilesInternalsHost[]; +@@ -142,6 +142,8 @@ extern const char kChromeUINTPTilesInternalsHost[]; extern const char kChromeUINaClHost[]; extern const char kChromeUINetExportHost[]; extern const char kChromeUINetExportURL[]; @@ -1190,7 +1165,6 @@ index caca46377bbeb..17cce860b2f02 100644 extern const char kChromeUINetInternalsURL[]; extern const char kChromeUINewTabHost[]; diff --git a/components/proxy_config/pref_proxy_config_tracker_impl.cc b/components/proxy_config/pref_proxy_config_tracker_impl.cc -index 343ab90710d59..eee846925378a 100644 --- a/components/proxy_config/pref_proxy_config_tracker_impl.cc +++ b/components/proxy_config/pref_proxy_config_tracker_impl.cc @@ -244,14 +244,14 @@ PrefProxyConfigTrackerImpl::GetEffectiveProxyConfig( @@ -1219,7 +1193,6 @@ index 343ab90710d59..eee846925378a 100644 proxy_config, kSettingsProxyConfigTrafficAnnotation); return true; diff --git a/components/proxy_config/proxy_config_dictionary.cc b/components/proxy_config/proxy_config_dictionary.cc -index e2c6ce30f8e6e..ba6d314afeca6 100644 --- a/components/proxy_config/proxy_config_dictionary.cc +++ b/components/proxy_config/proxy_config_dictionary.cc @@ -30,6 +30,8 @@ const char kProxyPacMandatory[] = "pac_mandatory"; @@ -1315,7 +1288,6 @@ index e2c6ce30f8e6e..ba6d314afeca6 100644 } diff --git a/components/proxy_config/proxy_config_dictionary.h b/components/proxy_config/proxy_config_dictionary.h -index 6f65a50e97f1f..76a439905877d 100644 --- a/components/proxy_config/proxy_config_dictionary.h +++ b/components/proxy_config/proxy_config_dictionary.h @@ -42,6 +42,7 @@ class PROXY_CONFIG_EXPORT ProxyConfigDictionary { @@ -1347,7 +1319,6 @@ index 6f65a50e97f1f..76a439905877d 100644 base::Value::Dict dict_; }; diff --git a/components/proxy_config/proxy_policy_handler.cc b/components/proxy_config/proxy_policy_handler.cc -index 5976751880f5d..4f8eeacc93347 100644 --- a/components/proxy_config/proxy_policy_handler.cc +++ b/components/proxy_config/proxy_policy_handler.cc @@ -262,7 +262,7 @@ void ProxyPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, @@ -1360,7 +1331,6 @@ index 5976751880f5d..4f8eeacc93347 100644 break; } diff --git a/net/proxy_resolution/proxy_config.cc b/net/proxy_resolution/proxy_config.cc -index 190d25a2d3a50..972e472501699 100644 --- a/net/proxy_resolution/proxy_config.cc +++ b/net/proxy_resolution/proxy_config.cc @@ -112,7 +112,7 @@ void ProxyConfig::ProxyRules::ParseFromString(const std::string& proxy_rules) { @@ -1430,7 +1400,6 @@ index 190d25a2d3a50..972e472501699 100644 const std::string& url_scheme) const { const ProxyList* proxy_server_list = const_cast(this)-> diff --git a/net/proxy_resolution/proxy_config.h b/net/proxy_resolution/proxy_config.h -index c14a396559000..096df1e2e5f65 100644 --- a/net/proxy_resolution/proxy_config.h +++ b/net/proxy_resolution/proxy_config.h @@ -103,6 +103,9 @@ class NET_EXPORT ProxyConfig { @@ -1443,6 +1412,5 @@ index c14a396559000..096df1e2e5f65 100644 // Returns one of {&proxies_for_http, &proxies_for_https, &proxies_for_ftp, // &fallback_proxies}, or NULL if there is no proxy to use. --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-an-always-incognito-mode.patch b/build/bromite_patches/Add-an-always-incognito-mode.patch index 8e67e2196697324e02bf52b9c9039464950a1eb9..e6e3d372d6c1d6998769663430787fa993119ef5 100644 --- a/build/bromite_patches/Add-an-always-incognito-mode.patch +++ b/build/bromite_patches/Add-an-always-incognito-mode.patch @@ -1,7 +1,6 @@ -From d27adb054e24278e3169e4d8a3fd659903ae6863 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sat, 2 Oct 2021 13:20:36 +0200 -Subject: [PATCH 063/192] Add an always-incognito mode +Subject: Add an always-incognito mode Add a preference that causes all new tabs and all clicked links to launch in incognito. Make sure initial incognito status is correctly recognized. @@ -33,8 +32,9 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../CustomTabAppMenuPropertiesDelegate.java | 4 + .../CustomTabIntentDataProvider.java | 5 +- .../browser/download/DownloadUtils.java | 16 +- + .../history/HistoryContentManager.java | 7 +- .../browser/history/HistoryManager.java | 28 ++- - .../chrome/browser/history/HistoryPage.java | 16 ++ + .../chrome/browser/history/HistoryPage.java | 15 ++ .../native_page/NativePageFactory.java | 4 +- .../chrome/browser/ntp/RecentTabsManager.java | 28 ++- .../privacy/settings/IncognitoSettings.java | 160 ++++++++++++++++++ @@ -48,15 +48,11 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../browser/tabmodel/TabPersistentStore.java | 9 + .../browser/toolbar/ToolbarManager.java | 4 +- .../webapps/WebappIntentDataProvider.java | 14 ++ - chrome/browser/about_flags.cc | 4 + - .../browser/android/historical_tab_saver.cc | 22 ++- + .../browser/android/historical_tab_saver.cc | 24 ++- .../chrome_autocomplete_provider_client.cc | 9 + .../chrome_autocomplete_provider_client.h | 1 + .../remote_suggestions_service_factory.cc | 5 + .../host_content_settings_map_factory.cc | 22 ++- - chrome/browser/flag_descriptions.cc | 6 + - chrome/browser/flag_descriptions.h | 3 + - .../flags/android/chrome_feature_list.cc | 4 +- chrome/browser/history/history_tab_helper.cc | 20 +++ chrome/browser/history/history_tab_helper.h | 10 +- .../android/offline_page_bridge.cc | 11 +- @@ -80,24 +76,28 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../browser/content_settings_pref_provider.h | 2 + .../core/browser/host_content_settings_map.cc | 4 +- .../core/browser/host_content_settings_map.h | 3 + - .../core/offline_page_feature.cc | 3 + - .../offline_pages/core/offline_page_feature.h | 1 + .../browser/autocomplete_provider_client.cc | 4 + .../browser/autocomplete_provider_client.h | 1 + .../omnibox/browser/base_search_provider.cc | 2 +- components/omnibox/browser/search_provider.cc | 4 +- - .../host_content_settings_map_factory.cc | 1 + - 67 files changed, 759 insertions(+), 91 deletions(-) + .../add-an-always-incognito-mode.inc | 13 ++ + .../add-an-always-incognito-mode.inc | 1 + + .../add-an-always-incognito-mode.inc | 3 + + .../add-an-always-incognito-mode.inc | 1 + + 65 files changed, 762 insertions(+), 92 deletions(-) create mode 100644 chrome/android/java/res/xml/incognito_preferences.xml create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/AlwaysIncognitoLinkInterceptor.java create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/IncognitoSettings.java create mode 100644 chrome/browser/ui/messages/android/java/src/org/chromium/chrome/browser/ui/messages/snackbar/INeedSnackbarManager.java + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/add-an-always-incognito-mode.inc + create mode 100644 cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-an-always-incognito-mode.inc + create mode 100644 cromite_flags/components/offline_pages/core/offline_page_feature_cc/add-an-always-incognito-mode.inc + create mode 100644 cromite_flags/components/offline_pages/core/offline_page_feature_h/add-an-always-incognito-mode.inc diff --git a/chrome/android/chrome_java_resources.gni b/chrome/android/chrome_java_resources.gni -index 4592ccd7a1d48..25dd9bddf366d 100644 --- a/chrome/android/chrome_java_resources.gni +++ b/chrome/android/chrome_java_resources.gni -@@ -667,6 +667,7 @@ chrome_java_resources = [ +@@ -659,6 +659,7 @@ chrome_java_resources = [ "java/res/xml/main_preferences.xml", "java/res/xml/manage_sync_preferences.xml", "java/res/xml/phone_as_a_security_key_accessory_filter.xml", @@ -106,7 +106,6 @@ index 4592ccd7a1d48..25dd9bddf366d 100644 "java/res/xml/privacy_preferences_v2.xml", "java/res/xml/search_widget_info.xml", diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni -index f6d0511ae94c3..c7972b041e693 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni @@ -3,6 +3,7 @@ @@ -117,17 +116,16 @@ index f6d0511ae94c3..c7972b041e693 100644 "java/src/com/google/android/apps/chrome/appwidget/bookmarks/BookmarkThumbnailWidgetProvider.java", "java/src/org/chromium/chrome/browser/ActivityTabProvider.java", "java/src/org/chromium/chrome/browser/ActivityUtils.java", -@@ -953,6 +954,7 @@ chrome_java_sources = [ - "java/src/org/chromium/chrome/browser/privacy/settings/IncognitoLockSettings.java", +@@ -967,6 +968,7 @@ chrome_java_sources = [ "java/src/org/chromium/chrome/browser/privacy/settings/PrivacyPreferencesManagerImpl.java", "java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java", + "java/src/org/chromium/chrome/browser/privacy_sandbox/ChromeTrackingProtectionDelegate.java", + "java/src/org/chromium/chrome/browser/privacy/settings/IncognitoSettings.java", "java/src/org/chromium/chrome/browser/provider/BaseColumns.java", "java/src/org/chromium/chrome/browser/provider/BookmarkColumns.java", "java/src/org/chromium/chrome/browser/provider/ChromeBrowserProviderImpl.java", diff --git a/chrome/android/java/res/xml/incognito_preferences.xml b/chrome/android/java/res/xml/incognito_preferences.xml new file mode 100644 -index 0000000000000..d52ffe9170b94 --- /dev/null +++ b/chrome/android/java/res/xml/incognito_preferences.xml @@ -0,0 +1,37 @@ @@ -169,10 +167,9 @@ index 0000000000000..d52ffe9170b94 + android:defaultValue="false" /> + diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml -index 7dea487f76b53..31168cba63391 100644 --- a/chrome/android/java/res/xml/privacy_preferences.xml +++ b/chrome/android/java/res/xml/privacy_preferences.xml -@@ -50,6 +50,11 @@ found in the LICENSE file. +@@ -56,6 +56,11 @@ found in the LICENSE file. android:key="secure_dns" android:title="@string/settings_secure_dns_title" android:fragment="org.chromium.chrome.browser.privacy.secure_dns.SecureDnsSettings"/> @@ -186,7 +183,6 @@ index 7dea487f76b53..31168cba63391 100644 android:key="do_not_track" diff --git a/chrome/android/java/src/org/chromium/chrome/browser/AlwaysIncognitoLinkInterceptor.java b/chrome/android/java/src/org/chromium/chrome/browser/AlwaysIncognitoLinkInterceptor.java new file mode 100644 -index 0000000000000..8a547aabb561b --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/AlwaysIncognitoLinkInterceptor.java @@ -0,0 +1,53 @@ @@ -244,10 +240,9 @@ index 0000000000000..8a547aabb561b + } +} diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -index 267f8c441ea51..e2c2f93829e71 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -@@ -58,6 +58,10 @@ import org.chromium.base.task.TaskTraits; +@@ -62,6 +62,10 @@ import org.chromium.base.task.TaskTraits; import org.chromium.build.annotations.UsedByReflection; import org.chromium.cc.input.BrowserControlsState; import org.chromium.chrome.R; @@ -255,10 +250,10 @@ index 267f8c441ea51..e2c2f93829e71 100644 +import org.chromium.components.user_prefs.UserPrefs; +import org.chromium.chrome.browser.preferences.Pref; +import org.chromium.chrome.browser.AlwaysIncognitoLinkInterceptor; - import org.chromium.chrome.browser.IntentHandler.IntentHandlerDelegate; import org.chromium.chrome.browser.IntentHandler.TabOpenType; - import org.chromium.chrome.browser.accessibility_tab_switcher.OverviewListLayout; -@@ -580,9 +584,14 @@ public class ChromeTabbedActivity extends ChromeActivity +@@ -1870,6 +1871,9 @@ public abstract class ChromeActivity throw new IllegalStateException( "Attempting to access TabCreator before initialization"); } @@ -311,7 +305,6 @@ index 7b0cf9b4d69af..893356c7a7d9f 100644 } diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java -index 26e56eb82b03f..211cd162129e7 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java @@ -37,6 +37,7 @@ import org.chromium.base.supplier.OneshotSupplier; @@ -322,7 +315,7 @@ index 26e56eb82b03f..211cd162129e7 100644 import org.chromium.chrome.browser.banners.AppMenuVerbiage; import org.chromium.chrome.browser.bookmarks.BookmarkFeatures; import org.chromium.chrome.browser.bookmarks.BookmarkModel; -@@ -104,6 +105,10 @@ import java.lang.annotation.RetentionPolicy; +@@ -102,6 +103,10 @@ import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; import java.util.List; @@ -333,7 +326,7 @@ index 26e56eb82b03f..211cd162129e7 100644 /** * Base implementation of {@link AppMenuPropertiesDelegate} that handles hiding and showing menu * items based on activity state. -@@ -567,6 +572,13 @@ public class AppMenuPropertiesDelegateImpl implements AppMenuPropertiesDelegate +@@ -569,6 +574,13 @@ public class AppMenuPropertiesDelegateImpl implements AppMenuPropertiesDelegate } private void prepareCommonMenuItems(Menu menu, @MenuGroup int menuGroup, boolean isIncognito) { @@ -347,7 +340,7 @@ index 26e56eb82b03f..211cd162129e7 100644 // We have to iterate all menu items since same menu item ID may be associated with more // than one menu items. boolean isOverviewModeMenu = menuGroup == MenuGroup.OVERVIEW_MODE_MENU; -@@ -627,7 +639,15 @@ public class AppMenuPropertiesDelegateImpl implements AppMenuPropertiesDelegate +@@ -626,7 +638,15 @@ public class AppMenuPropertiesDelegateImpl implements AppMenuPropertiesDelegate } if (item.getItemId() == R.id.recent_tabs_menu_id) { @@ -364,7 +357,7 @@ index 26e56eb82b03f..211cd162129e7 100644 } if (item.getItemId() == R.id.menu_select_tabs) { item.setVisible(isMenuSelectTabsVisible); -@@ -831,7 +851,9 @@ public class AppMenuPropertiesDelegateImpl implements AppMenuPropertiesDelegate +@@ -840,7 +860,9 @@ public class AppMenuPropertiesDelegateImpl implements AppMenuPropertiesDelegate // is not persisted when adding to the homescreen. // * If creating shortcuts it not supported by the current home screen. return WebappsUtils.isAddToHomeIntentSupported() && !isChromeScheme && !isFileScheme @@ -376,7 +369,6 @@ index 26e56eb82b03f..211cd162129e7 100644 /** diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java -index f46b319c4fc0e..3680169398ef4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java @@ -28,6 +28,7 @@ import org.chromium.base.Callback; @@ -415,7 +407,6 @@ index f46b319c4fc0e..3680169398ef4 100644 linkGroup.add(createListItem(Item.SAVE_LINK_AS)); } diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivityLifecycleUmaTracker.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivityLifecycleUmaTracker.java -index b5c3be7662ec9..4d9cb62ecff8b 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivityLifecycleUmaTracker.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivityLifecycleUmaTracker.java @@ -67,31 +67,6 @@ public class CustomTabActivityLifecycleUmaTracker @@ -451,7 +442,6 @@ index b5c3be7662ec9..4d9cb62ecff8b 100644 private void recordUserAction() { diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java -index 9d5327aa84ce9..ca00a6a29cacf 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java @@ -21,6 +21,7 @@ import org.chromium.base.ContextUtils; @@ -473,10 +463,9 @@ index 9d5327aa84ce9..ca00a6a29cacf 100644 boolean isChromeScheme = url.getScheme().equals(UrlConstants.CHROME_SCHEME) || url.getScheme().equals(UrlConstants.CHROME_NATIVE_SCHEME); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java -index 6b61529be5901..65f5ef9cc129d 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabIntentDataProvider.java -@@ -63,6 +63,9 @@ import org.chromium.components.embedder_support.util.UrlConstants; +@@ -66,6 +66,9 @@ import org.chromium.components.embedder_support.util.UrlConstants; import org.chromium.components.version_info.VersionInfo; import org.chromium.device.mojom.ScreenOrientationLockType; @@ -486,7 +475,7 @@ index 6b61529be5901..65f5ef9cc129d 100644 import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; -@@ -1210,7 +1213,7 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid +@@ -1263,7 +1266,7 @@ public class CustomTabIntentDataProvider extends BrowserServicesIntentDataProvid @Override public boolean isIncognito() { @@ -496,10 +485,9 @@ index 6b61529be5901..65f5ef9cc129d 100644 @Nullable diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java -index 3d2a15c9eb6c3..440a6d8685fd4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUtils.java -@@ -33,6 +33,7 @@ import org.chromium.base.annotations.NativeMethods; +@@ -35,6 +35,7 @@ import org.chromium.base.annotations.NativeMethods; import org.chromium.base.metrics.RecordHistogram; import org.chromium.base.metrics.RecordUserAction; import org.chromium.chrome.R; @@ -507,7 +495,7 @@ index 3d2a15c9eb6c3..440a6d8685fd4 100644 import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.IntentHandler; import org.chromium.chrome.browser.app.download.home.DownloadActivity; -@@ -74,6 +75,10 @@ import org.chromium.url.GURL; +@@ -77,6 +78,10 @@ import org.chromium.url.GURL; import java.io.File; @@ -518,7 +506,7 @@ index 3d2a15c9eb6c3..440a6d8685fd4 100644 /** * A class containing some utility static methods. */ -@@ -317,7 +322,16 @@ public class DownloadUtils { +@@ -353,7 +358,16 @@ public class DownloadUtils { // Offline pages isn't supported in Incognito. This should be checked before calling // OfflinePageBridge.getForProfile because OfflinePageBridge instance will not be found // for incognito profile. @@ -536,8 +524,31 @@ index 3d2a15c9eb6c3..440a6d8685fd4 100644 // Check if the page url is supported for saving. Only HTTP and HTTPS pages are allowed. if (!OfflinePageBridge.canSavePage(tab.getUrl())) return false; +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryContentManager.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryContentManager.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryContentManager.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryContentManager.java +@@ -231,7 +231,9 @@ public class HistoryContentManager implements SignInStateObserver, PrefObserver + mHistoryAdapter.generateFooterItems(); + + // Listen to changes in sign in state. +- IdentityServicesProvider.get().getSigninManager(profile).addSignInStateObserver(this); ++ // getSigninManager is null in incognito ++ if (IdentityServicesProvider.get().getSigninManager(profile) != null) ++ IdentityServicesProvider.get().getSigninManager(profile).addSignInStateObserver(this); + + // Create PrefChangeRegistrar to receive notifications on preference changes. + mPrefChangeRegistrar = new PrefChangeRegistrar(); +@@ -266,7 +268,8 @@ public class HistoryContentManager implements SignInStateObserver, PrefObserver + mHistoryAdapter.onDestroyed(); + mLargeIconBridge.destroy(); + mLargeIconBridge = null; +- IdentityServicesProvider.get().getSigninManager(mProfile).removeSignInStateObserver(this); ++ if (IdentityServicesProvider.get().getSigninManager(mProfile) != null) ++ IdentityServicesProvider.get().getSigninManager(mProfile).removeSignInStateObserver(this); + mPrefChangeRegistrar.destroy(); + } + diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java -index 401778c0e5458..61d49d0f26f7e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryManager.java @@ -35,6 +35,7 @@ import com.google.android.material.tabs.TabLayout.OnTabSelectedListener; @@ -548,7 +559,7 @@ index 401778c0e5458..61d49d0f26f7e 100644 import org.chromium.base.supplier.ObservableSupplierImpl; import org.chromium.base.supplier.Supplier; import org.chromium.chrome.R; -@@ -76,6 +77,12 @@ import java.io.Serializable; +@@ -75,6 +76,12 @@ import java.io.Serializable; import java.util.List; import java.util.concurrent.atomic.AtomicReference; @@ -561,7 +572,7 @@ index 401778c0e5458..61d49d0f26f7e 100644 /** * Combines and manages the different UI components of browsing history. */ -@@ -157,7 +164,7 @@ public class HistoryManager implements OnMenuItemClickListener, SelectionObserve +@@ -158,7 +165,7 @@ public class HistoryManager implements OnMenuItemClickListener, SelectionObserve recordUserAction("Show"); // If incognito placeholder is shown, we don't need to create History UI elements. @@ -570,7 +581,7 @@ index 401778c0e5458..61d49d0f26f7e 100644 mSelectableListLayout = null; mRootView = getIncognitoHistoryPlaceholderView(); return; -@@ -594,7 +601,7 @@ public class HistoryManager implements OnMenuItemClickListener, SelectionObserve +@@ -601,7 +608,7 @@ public class HistoryManager implements OnMenuItemClickListener, SelectionObserve private void swapContentView() { boolean toHistoryClusters; @@ -579,7 +590,7 @@ index 401778c0e5458..61d49d0f26f7e 100644 return; } else if (isHistoryClustersUIShowing()) { toHistoryClusters = false; -@@ -657,11 +664,24 @@ public class HistoryManager implements OnMenuItemClickListener, SelectionObserve +@@ -664,11 +671,24 @@ public class HistoryManager implements OnMenuItemClickListener, SelectionObserve && mContentView == mHistoryClustersCoordinator.getActivityContentView(); } @@ -605,7 +616,7 @@ index 401778c0e5458..61d49d0f26f7e 100644 // If Incognito placeholder is shown no need to call any destroy method. return; } -@@ -681,7 +701,7 @@ public class HistoryManager implements OnMenuItemClickListener, SelectionObserve +@@ -688,7 +708,7 @@ public class HistoryManager implements OnMenuItemClickListener, SelectionObserve * @return True if manager handles this event, false if it decides to ignore. */ public boolean onBackPressed() { @@ -615,7 +626,6 @@ index 401778c0e5458..61d49d0f26f7e 100644 return false; } else if (isHistoryClustersUIShowing()) { diff --git a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryPage.java b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryPage.java -index c5b4f80048821..77ed5ad27dac1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryPage.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/history/HistoryPage.java @@ -9,6 +9,7 @@ import android.net.Uri; @@ -639,27 +649,25 @@ index c5b4f80048821..77ed5ad27dac1 100644 /** * Native page for managing browsing history. */ -@@ -39,6 +46,15 @@ public class HistoryPage extends BasicNativePage { - boolean isIncognito, Supplier tabSupplier, String url) { +@@ -39,6 +46,14 @@ public class HistoryPage extends BasicNativePage { + Profile profile, Supplier tabSupplier, String url) { super(host); -+ if (isIncognito && ++ if (profile.isOffTheRecord() && + AlwaysIncognitoLinkInterceptor.isAlwaysIncognito()) { + PrefService prefService = UserPrefs.get(Profile.getLastUsedRegularProfile()); + boolean historyEnabledInIncognito = + prefService.getBoolean(Pref.INCOGNITO_TAB_HISTORY_ENABLED); -+ if (historyEnabledInIncognito == true) isIncognito = false; ++ if (historyEnabledInIncognito == true) profile = profile.getOriginalProfile(); + } -+ + Uri uri = Uri.parse(url); assert uri.getHost().equals(UrlConstants.HISTORY_HOST); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/native_page/NativePageFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/native_page/NativePageFactory.java -index 47450d033b081..0f3682c319db1 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/native_page/NativePageFactory.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/native_page/NativePageFactory.java -@@ -15,6 +15,7 @@ import androidx.annotation.VisibleForTesting; +@@ -16,6 +16,7 @@ import org.chromium.base.jank_tracker.JankTracker; import org.chromium.base.supplier.DestroyableObservableSupplier; import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.Supplier; @@ -667,7 +675,7 @@ index 47450d033b081..0f3682c319db1 100644 import org.chromium.chrome.browser.app.ChromeActivity; import org.chromium.chrome.browser.app.download.home.DownloadPage; import org.chromium.chrome.browser.bookmarks.BookmarkPage; -@@ -226,7 +227,8 @@ public class NativePageFactory { +@@ -232,7 +233,8 @@ public class NativePageFactory { String url, NativePage candidatePage, Tab tab, boolean isIncognito) { NativePage page; @@ -678,7 +686,6 @@ index 47450d033b081..0f3682c319db1 100644 return null; case NativePageType.CANDIDATE: diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java -index a0414fbfcad0c..df675e6fa7000 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java @@ -35,6 +35,15 @@ import org.chromium.components.signin.metrics.SigninAccessPoint; @@ -732,7 +739,6 @@ index a0414fbfcad0c..df675e6fa7000 100644 // Window disposition will select which tab to open. diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/IncognitoSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/IncognitoSettings.java new file mode 100644 -index 0000000000000..b60a5b0951bb9 --- /dev/null +++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/IncognitoSettings.java @@ -0,0 +1,160 @@ @@ -897,18 +903,17 @@ index 0000000000000..b60a5b0951bb9 + } +} diff --git a/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java -index 130443d449f84..b5cf520457519 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java -@@ -72,6 +72,7 @@ import org.chromium.chrome.browser.search_engines.settings.SearchEngineSettings; - import org.chromium.chrome.browser.signin.SyncConsentActivityLauncherImpl; +@@ -75,6 +75,7 @@ import org.chromium.chrome.browser.signin.SyncConsentActivityLauncherImpl; import org.chromium.chrome.browser.site_settings.ChromeSiteSettingsDelegate; import org.chromium.chrome.browser.sync.SyncServiceFactory; + import org.chromium.chrome.browser.ui.device_lock.MissingDeviceLockLauncher; +import org.chromium.chrome.browser.ui.messages.snackbar.INeedSnackbarManager; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager.SnackbarManageable; import org.chromium.components.browser_ui.accessibility.AccessibilitySettings; -@@ -322,6 +323,9 @@ public class SettingsActivity extends ChromeBaseAppCompatActivity +@@ -329,6 +330,9 @@ public class SettingsActivity extends ChromeBaseAppCompatActivity ((PrivacySandboxSettingsBaseFragment) fragment) .setSnackbarManager(getSnackbarManager()); } @@ -919,10 +924,9 @@ index 130443d449f84..b5cf520457519 100644 } diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabModelObserver.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabModelObserver.java -index 6cfc9f42401db..505e63ae4db07 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabModelObserver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabModelObserver.java -@@ -14,6 +14,8 @@ import java.util.ArrayList; +@@ -13,6 +13,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -931,7 +935,7 @@ index 6cfc9f42401db..505e63ae4db07 100644 /** * A tab model observer for managing bulk closures. */ -@@ -41,7 +43,8 @@ public class HistoricalTabModelObserver implements TabModelObserver { +@@ -40,7 +42,8 @@ public class HistoricalTabModelObserver implements TabModelObserver { if (tabs.isEmpty()) return; if (tabs.size() == 1) { @@ -941,7 +945,7 @@ index 6cfc9f42401db..505e63ae4db07 100644 return; } -@@ -72,7 +75,6 @@ public class HistoricalTabModelObserver implements TabModelObserver { +@@ -71,7 +74,6 @@ public class HistoricalTabModelObserver implements TabModelObserver { entries.add(historicalGroup); idToGroup.put(groupId, historicalGroup); } @@ -950,7 +954,6 @@ index 6cfc9f42401db..505e63ae4db07 100644 } } diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabSaver.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabSaver.java -index 0b9241a7f8741..d413e81a8dda5 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabSaver.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabSaver.java @@ -16,7 +16,7 @@ public interface HistoricalTabSaver { @@ -963,10 +966,9 @@ index 0b9241a7f8741..d413e81a8dda5 100644 /** * Creates a Group or Tab entry in TabRestoreService. diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabSaverImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabSaverImpl.java -index 422a5716b6cd3..0ca4a9dd44fd6 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabSaverImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/tab_restore/HistoricalTabSaverImpl.java -@@ -26,6 +26,8 @@ import java.util.Arrays; +@@ -25,6 +25,8 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -975,7 +977,7 @@ index 422a5716b6cd3..0ca4a9dd44fd6 100644 /** * Creates historical entries in TabRestoreService. */ -@@ -59,10 +61,10 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver { +@@ -58,10 +60,10 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver { // HistoricalTabSaver implementation. @Override @@ -988,7 +990,7 @@ index 422a5716b6cd3..0ca4a9dd44fd6 100644 } @Override -@@ -114,7 +116,7 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver { +@@ -113,7 +115,7 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver { // If there is only a single valid tab remaining save it individually. if (validEntries.size() == 1 && validEntries.get(0).isSingleTab()) { @@ -997,7 +999,7 @@ index 422a5716b6cd3..0ca4a9dd44fd6 100644 return; } -@@ -140,11 +142,12 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver { +@@ -139,11 +141,12 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver { CollectionUtil.integerCollectionToIntArray(savedStateVersions)); } @@ -1012,7 +1014,7 @@ index 422a5716b6cd3..0ca4a9dd44fd6 100644 } /** -@@ -152,7 +155,7 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver { +@@ -151,7 +154,7 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver { * internal Chrome scheme, about:blank, or a native page and it cannot be incognito. */ private boolean shouldSave(Tab tab) { @@ -1021,7 +1023,7 @@ index 422a5716b6cd3..0ca4a9dd44fd6 100644 // {@link GURL#getScheme()} is not available in unit tests. if (mIgnoreUrlSchemesForTesting) return true; -@@ -224,7 +227,7 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver { +@@ -223,7 +226,7 @@ public class HistoricalTabSaverImpl implements HistoricalTabSaver { @NativeMethods interface Natives { @@ -1031,7 +1033,6 @@ index 422a5716b6cd3..0ca4a9dd44fd6 100644 ByteBuffer[] byteBuffers, int[] savedStationsVersions); void createHistoricalBulkClosure(TabModel model, int[] groupIds, String[] titles, diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedRootUiCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedRootUiCoordinator.java -index e6263844f95a2..f1381b9bfe1e2 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedRootUiCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabbed_mode/TabbedRootUiCoordinator.java @@ -123,6 +123,8 @@ import org.chromium.components.webapps.bottomsheet.PwaBottomSheetControllerFacto @@ -1043,7 +1044,7 @@ index e6263844f95a2..f1381b9bfe1e2 100644 import org.chromium.ui.base.IntentRequestTracker; import org.chromium.ui.modaldialog.ModalDialogManager; -@@ -794,7 +796,7 @@ public class TabbedRootUiCoordinator extends RootUiCoordinator { +@@ -790,7 +792,7 @@ public class TabbedRootUiCoordinator extends RootUiCoordinator { mAppMenuCoordinator.getAppMenuHandler(), mActivityTabProvider, mToolbarManager.getMenuButtonView(), () -> { mTabCreatorManagerSupplier.get() @@ -1053,7 +1054,6 @@ index e6263844f95a2..f1381b9bfe1e2 100644 NewTabPageLaunchOrigin.WEB_FEED), TabLaunchType.FROM_CHROME_UI); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java -index 18b403cfc342e..4300ad0894ab0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java @@ -53,6 +53,10 @@ import org.chromium.ui.base.PageTransition; @@ -1067,7 +1067,7 @@ index 18b403cfc342e..4300ad0894ab0 100644 /** * This class creates various kinds of new tabs and adds them to the right {@link TabModel}. */ -@@ -487,7 +491,6 @@ public class ChromeTabCreator extends TabCreator { +@@ -517,7 +521,6 @@ public class ChromeTabCreator extends TabCreator { // TODO(crbug.com/1081924): Clean up the launches from SearchActivity/Chrome. public Tab launchUrlFromExternalApp( LoadUrlParams loadUrlParams, String appId, boolean forceNewTab, Intent intent) { @@ -1076,7 +1076,6 @@ index 18b403cfc342e..4300ad0894ab0 100644 // relied on for anything security sensitive. boolean isLaunchedFromChrome = TextUtils.equals(appId, mActivity.getPackageName()); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java -index 5d7832fb69496..1c86eebc01a19 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabModelSelectorImpl.java @@ -10,6 +10,7 @@ import androidx.annotation.Nullable; @@ -1097,10 +1096,9 @@ index 5d7832fb69496..1c86eebc01a19 100644 (ChromeTabCreator) getTabCreatorManager().getTabCreator(false); ChromeTabCreator incognitoTabCreator = diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java -index 8caf8dae6dbf7..20cdf55ecf431 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/TabPersistentStore.java -@@ -55,6 +55,8 @@ import org.chromium.components.embedder_support.util.UrlUtilities; +@@ -50,6 +50,8 @@ import org.chromium.components.embedder_support.util.UrlUtilities; import org.chromium.content_public.browser.LoadUrlParams; import org.chromium.url.GURL; @@ -1109,7 +1107,7 @@ index 8caf8dae6dbf7..20cdf55ecf431 100644 import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -@@ -747,6 +749,13 @@ public class TabPersistentStore { +@@ -651,6 +653,13 @@ public class TabPersistentStore { } } } @@ -1124,7 +1122,6 @@ index 8caf8dae6dbf7..20cdf55ecf431 100644 if (model.isIncognito() != isIncognito) { diff --git a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java -index a61c435b6238a..37065641f06e0 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/toolbar/ToolbarManager.java @@ -40,6 +40,7 @@ import org.chromium.base.supplier.OneshotSupplier; @@ -1135,7 +1132,7 @@ index a61c435b6238a..37065641f06e0 100644 import org.chromium.chrome.browser.IntentHandler; import org.chromium.chrome.browser.app.tab_activity_glue.TabReparentingController; import org.chromium.chrome.browser.app.tabmodel.TabWindowManagerSingleton; -@@ -509,7 +510,8 @@ public class ToolbarManager implements UrlFocusChangeListener, ThemeColorObserve +@@ -556,7 +557,8 @@ public class ToolbarManager implements UrlFocusChangeListener, ThemeColorObserve return ret; } }, @@ -1146,12 +1143,11 @@ index a61c435b6238a..37065641f06e0 100644 assert mControlContainer != null; diff --git a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappIntentDataProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappIntentDataProvider.java -index 4f718f825dfdf..3e6af3acbc59c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappIntentDataProvider.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/webapps/WebappIntentDataProvider.java -@@ -32,6 +32,9 @@ import org.chromium.chrome.browser.flags.ActivityType; - import org.chromium.components.browser_ui.widget.TintedDrawable; +@@ -33,6 +33,9 @@ import org.chromium.components.browser_ui.widget.TintedDrawable; import org.chromium.device.mojom.ScreenOrientationLockType; + import org.chromium.ui.util.ColorUtils; +import org.chromium.base.ContextUtils; +import org.chromium.chrome.browser.AlwaysIncognitoLinkInterceptor; @@ -1159,7 +1155,7 @@ index 4f718f825dfdf..3e6af3acbc59c 100644 /** * Stores info about a web app. */ -@@ -46,6 +49,8 @@ public class WebappIntentDataProvider extends BrowserServicesIntentDataProvider +@@ -47,6 +50,8 @@ public class WebappIntentDataProvider extends BrowserServicesIntentDataProvider private final ColorProviderImpl mColorProvider; private final ColorProviderImpl mDarkColorProvider; @@ -1168,7 +1164,7 @@ index 4f718f825dfdf..3e6af3acbc59c 100644 /** * Returns the toolbar color to use if a custom color is not specified by the webapp. */ -@@ -77,6 +82,10 @@ public class WebappIntentDataProvider extends BrowserServicesIntentDataProvider +@@ -78,6 +83,10 @@ public class WebappIntentDataProvider extends BrowserServicesIntentDataProvider mWebappExtras = webappExtras; mWebApkExtras = webApkExtras; mActivityType = (webApkExtras != null) ? ActivityType.WEB_APK : ActivityType.WEBAPP; @@ -1179,7 +1175,7 @@ index 4f718f825dfdf..3e6af3acbc59c 100644 } @Override -@@ -162,6 +171,11 @@ public class WebappIntentDataProvider extends BrowserServicesIntentDataProvider +@@ -172,6 +181,11 @@ public class WebappIntentDataProvider extends BrowserServicesIntentDataProvider return mWebApkExtras; } @@ -1191,23 +1187,7 @@ index 4f718f825dfdf..3e6af3acbc59c 100644 @Override public @ScreenOrientationLockType.EnumType int getDefaultOrientation() { return mWebappExtras.orientation; -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index d7531ac080f86..de0c0efdddf7d 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -5140,6 +5140,10 @@ const FeatureEntry kFeatureEntries[] = { - flag_descriptions::kOfflinePagesLivePageSharingName, - flag_descriptions::kOfflinePagesLivePageSharingDescription, kOsAndroid, - FEATURE_VALUE_TYPE(offline_pages::kOfflinePagesLivePageSharingFeature)}, -+ {"offline-pages-auto-save", -+ flag_descriptions::kOfflinePagesAutoSaveFeatureName, -+ flag_descriptions::kOfflinePagesAutoSaveFeatureDescription, kOsAndroid, -+ FEATURE_VALUE_TYPE(offline_pages::kOfflinePagesAutoSaveFeature)}, - {"query-tiles", flag_descriptions::kQueryTilesName, - flag_descriptions::kQueryTilesDescription, kOsAndroid, - FEATURE_WITH_PARAMS_VALUE_TYPE(query_tiles::features::kQueryTiles, diff --git a/chrome/browser/android/historical_tab_saver.cc b/chrome/browser/android/historical_tab_saver.cc -index 8757668fa8e58..a46771f1bd970 100644 --- a/chrome/browser/android/historical_tab_saver.cc +++ b/chrome/browser/android/historical_tab_saver.cc @@ -26,6 +26,11 @@ @@ -1249,18 +1229,24 @@ index 8757668fa8e58..a46771f1bd970 100644 if (!service) { return; } -@@ -243,14 +254,15 @@ static void JNI_HistoricalTabSaverImpl_CreateHistoricalTab( +@@ -99,7 +110,7 @@ void CreateHistoricalBulkClosure( + std::vector per_tab_android_group_id, + std::vector tabs, + std::vector web_contents_state) { +- DCHECK(model); ++ if (!model) return; + DCHECK_EQ(android_group_ids.size(), group_titles.size()); + DCHECK_EQ(per_tab_android_group_id.size(), tabs.size()); + +@@ -234,11 +245,12 @@ static void JNI_HistoricalTabSaverImpl_CreateHistoricalTab( JNIEnv* env, const JavaParamRef& jtab_android, const JavaParamRef& state, - jint saved_state_version) { + jint saved_state_version, + jboolean is_always_incognito) { - void* data = env->GetDirectBufferAddress(state); - int size = env->GetDirectBufferCapacity(state); - - WebContentsStateByteBuffer web_contents_state = - WebContentsStateByteBuffer(data, size, (int)saved_state_version); + WebContentsStateByteBuffer web_contents_state = WebContentsStateByteBuffer( + ScopedJavaLocalRef(state), (int)saved_state_version); CreateHistoricalTab(TabAndroid::GetNativeTab(env, jtab_android), - std::move(web_contents_state)); + std::move(web_contents_state), is_always_incognito); @@ -1268,10 +1254,9 @@ index 8757668fa8e58..a46771f1bd970 100644 // static diff --git a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc -index 27b043a2dff7a..d08bd3c772c6b 100644 --- a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc +++ b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.cc -@@ -343,6 +343,15 @@ ChromeAutocompleteProviderClient::GetOnDeviceTailModelService() const { +@@ -350,6 +350,15 @@ ChromeAutocompleteProviderClient::GetOnDeviceTailModelService() const { #endif // BUILDFLAG(BUILD_WITH_TFLITE_LIB) } @@ -1288,7 +1273,6 @@ index 27b043a2dff7a..d08bd3c772c6b 100644 return profile_->IsOffTheRecord(); } diff --git a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.h b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.h -index 954fd5603bb6a..ed6f2306883e4 100644 --- a/chrome/browser/autocomplete/chrome_autocomplete_provider_client.h +++ b/chrome/browser/autocomplete/chrome_autocomplete_provider_client.h @@ -84,6 +84,7 @@ class ChromeAutocompleteProviderClient : public AutocompleteProviderClient { @@ -1300,7 +1284,6 @@ index 954fd5603bb6a..ed6f2306883e4 100644 bool IsGuestSession() const override; bool SearchSuggestEnabled() const override; diff --git a/chrome/browser/autocomplete/remote_suggestions_service_factory.cc b/chrome/browser/autocomplete/remote_suggestions_service_factory.cc -index 4a1e8860b64c0..87e1a48fa2c75 100644 --- a/chrome/browser/autocomplete/remote_suggestions_service_factory.cc +++ b/chrome/browser/autocomplete/remote_suggestions_service_factory.cc @@ -4,6 +4,7 @@ @@ -1311,7 +1294,7 @@ index 4a1e8860b64c0..87e1a48fa2c75 100644 #include "base/no_destructor.h" #include "chrome/browser/autocomplete/document_suggestions_service_factory.h" #include "chrome/browser/profiles/profile.h" -@@ -39,7 +40,11 @@ RemoteSuggestionsServiceFactory::RemoteSuggestionsServiceFactory() +@@ -40,7 +41,11 @@ RemoteSuggestionsServiceFactory::RemoteSuggestionsServiceFactory() : ProfileKeyedServiceFactory( "RemoteSuggestionsService", ProfileSelections::Builder() @@ -1324,7 +1307,6 @@ index 4a1e8860b64c0..87e1a48fa2c75 100644 // Guest mode. .WithGuest(ProfileSelection::kOriginalOnly) diff --git a/chrome/browser/content_settings/host_content_settings_map_factory.cc b/chrome/browser/content_settings/host_content_settings_map_factory.cc -index 6f842a7535a56..241d70c4052eb 100644 --- a/chrome/browser/content_settings/host_content_settings_map_factory.cc +++ b/chrome/browser/content_settings/host_content_settings_map_factory.cc @@ -15,6 +15,7 @@ @@ -1372,54 +1354,7 @@ index 6f842a7535a56..241d70c4052eb 100644 #if BUILDFLAG(ENABLE_EXTENSIONS) // These must be registered before before the HostSettings are passed over to // the IOThread. Simplest to do this on construction. -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index 41f7c6e21de77..09846683d9e1e 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -4116,6 +4116,12 @@ const char kOfflinePagesLivePageSharingDescription[] = - "Enables to share current loaded page as offline page by saving as MHTML " - "first."; - -+const char kOfflinePagesAutoSaveFeatureName[] = -+ "Enables autosave of offline page"; -+const char kOfflinePagesAutoSaveFeatureDescription[] = -+ "Enables autosave of offline page, as automatic switching in case " -+ "the device goes offline."; -+ - const char kPageInfoHistoryName[] = "Page info history"; - const char kPageInfoHistoryDescription[] = - "Enable a history sub page to the page info menu, and a button to forget " -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index 36b991b2f4c7c..fff998efaf7cd 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -2414,6 +2414,9 @@ extern const char kOmahaMinSdkVersionAndroidDescription[]; - extern const char kOmahaMinSdkVersionAndroidMinSdk1Description[]; - extern const char kOmahaMinSdkVersionAndroidMinSdk1000Description[]; - -+extern const char kOfflinePagesAutoSaveFeatureName[]; -+extern const char kOfflinePagesAutoSaveFeatureDescription[]; -+ - extern const char kPageInfoHistoryName[]; - extern const char kPageInfoHistoryDescription[]; - -diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc -index 1ba904380664c..cf06093694030 100644 ---- a/chrome/browser/flags/android/chrome_feature_list.cc -+++ b/chrome/browser/flags/android/chrome_feature_list.cc -@@ -554,8 +554,8 @@ BASE_FEATURE(kCCTFeatureUsage, - BASE_FEATURE(kCCTIncognito, "CCTIncognito", base::FEATURE_ENABLED_BY_DEFAULT); - - BASE_FEATURE(kCCTIncognitoAvailableToThirdParty, -- "CCTIncognitoAvailableToThirdParty", -- base::FEATURE_DISABLED_BY_DEFAULT); -+ "CCTIncognitoAvailableToThirdParty", // must be enabled -+ base::FEATURE_ENABLED_BY_DEFAULT); // in Bromite - - BASE_FEATURE(kCCTIntentFeatureOverrides, - "CCTIntentFeatureOverrides", diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc -index e199e7be077cb..fba6e924e6772 100644 --- a/chrome/browser/history/history_tab_helper.cc +++ b/chrome/browser/history/history_tab_helper.cc @@ -38,6 +38,9 @@ @@ -1432,7 +1367,7 @@ index e199e7be077cb..fba6e924e6772 100644 #else #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_finder.h" -@@ -476,6 +479,13 @@ void HistoryTabHelper::TitleWasSet(NavigationEntry* entry) { +@@ -482,6 +485,13 @@ void HistoryTabHelper::TitleWasSet(NavigationEntry* entry) { history::HistoryService* HistoryTabHelper::GetHistoryService() { Profile* profile = Profile::FromBrowserContext(web_contents()->GetBrowserContext()); @@ -1446,7 +1381,7 @@ index e199e7be077cb..fba6e924e6772 100644 if (profile->IsOffTheRecord()) return nullptr; -@@ -483,6 +493,16 @@ history::HistoryService* HistoryTabHelper::GetHistoryService() { +@@ -489,6 +499,16 @@ history::HistoryService* HistoryTabHelper::GetHistoryService() { profile, ServiceAccessType::IMPLICIT_ACCESS); } @@ -1464,7 +1399,6 @@ index e199e7be077cb..fba6e924e6772 100644 translate_observation_.Reset(); diff --git a/chrome/browser/history/history_tab_helper.h b/chrome/browser/history/history_tab_helper.h -index 859f9067ee50c..df6f3c06285b6 100644 --- a/chrome/browser/history/history_tab_helper.h +++ b/chrome/browser/history/history_tab_helper.h @@ -14,6 +14,8 @@ @@ -1499,7 +1433,6 @@ index 859f9067ee50c..df6f3c06285b6 100644 bool IsEligibleTab(const history::HistoryAddPageArgs& add_page_args) const; diff --git a/chrome/browser/offline_pages/android/offline_page_bridge.cc b/chrome/browser/offline_pages/android/offline_page_bridge.cc -index e567a53a881eb..7de1a718b7044 100644 --- a/chrome/browser/offline_pages/android/offline_page_bridge.cc +++ b/chrome/browser/offline_pages/android/offline_page_bridge.cc @@ -47,6 +47,9 @@ @@ -1530,7 +1463,6 @@ index e567a53a881eb..7de1a718b7044 100644 } diff --git a/chrome/browser/offline_pages/android/offline_page_model_factory.cc b/chrome/browser/offline_pages/android/offline_page_model_factory.cc -index 3c0f1cd75db59..de4c670b29b80 100644 --- a/chrome/browser/offline_pages/android/offline_page_model_factory.cc +++ b/chrome/browser/offline_pages/android/offline_page_model_factory.cc @@ -24,6 +24,9 @@ @@ -1585,7 +1517,6 @@ index 3c0f1cd75db59..de4c670b29b80 100644 + } // namespace offline_pages diff --git a/chrome/browser/offline_pages/android/request_coordinator_factory.cc b/chrome/browser/offline_pages/android/request_coordinator_factory.cc -index 10cf16f6d57c3..f13b974706496 100644 --- a/chrome/browser/offline_pages/android/request_coordinator_factory.cc +++ b/chrome/browser/offline_pages/android/request_coordinator_factory.cc @@ -19,6 +19,7 @@ @@ -1625,9 +1556,9 @@ index 10cf16f6d57c3..f13b974706496 100644 // Depends on OfflinePageModelFactory in SimpleDependencyManager. } -@@ -91,6 +91,12 @@ RequestCoordinator* RequestCoordinatorFactory::GetForBrowserContext( - - KeyedService* RequestCoordinatorFactory::BuildServiceInstanceFor( +@@ -92,6 +92,12 @@ RequestCoordinator* RequestCoordinatorFactory::GetForBrowserContext( + std::unique_ptr + RequestCoordinatorFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* context) const { + if (context->IsOffTheRecord() && + Profile::FromBrowserContext(context)->GetOriginalProfile() @@ -1638,8 +1569,8 @@ index 10cf16f6d57c3..f13b974706496 100644 std::unique_ptr policy(new OfflinerPolicy()); std::unique_ptr offliner; OfflinePageModel* model = -@@ -123,4 +129,16 @@ KeyedService* RequestCoordinatorFactory::BuildServiceInstanceFor( - return request_coordinator; +@@ -122,4 +128,16 @@ RequestCoordinatorFactory::BuildServiceInstanceForBrowserContext( + std::make_unique(profile)); } +content::BrowserContext* @@ -1656,7 +1587,6 @@ index 10cf16f6d57c3..f13b974706496 100644 + } // namespace offline_pages diff --git a/chrome/browser/offline_pages/offline_page_model_factory.h b/chrome/browser/offline_pages/offline_page_model_factory.h -index 98e1a42f20b36..86d76f9a3e7d8 100644 --- a/chrome/browser/offline_pages/offline_page_model_factory.h +++ b/chrome/browser/offline_pages/offline_page_model_factory.h @@ -48,6 +48,7 @@ class OfflinePageModelFactory : public SimpleKeyedServiceFactory { @@ -1668,7 +1598,6 @@ index 98e1a42f20b36..86d76f9a3e7d8 100644 } // namespace offline_pages diff --git a/chrome/browser/offline_pages/recent_tab_helper.cc b/chrome/browser/offline_pages/recent_tab_helper.cc -index 4fec7898e108e..251e8917b22fc 100644 --- a/chrome/browser/offline_pages/recent_tab_helper.cc +++ b/chrome/browser/offline_pages/recent_tab_helper.cc @@ -28,6 +28,11 @@ @@ -1712,7 +1641,6 @@ index 4fec7898e108e..251e8917b22fc 100644 return; } diff --git a/chrome/browser/offline_pages/recent_tab_helper.h b/chrome/browser/offline_pages/recent_tab_helper.h -index 9567d334d86f1..697aed8a8a4c2 100644 --- a/chrome/browser/offline_pages/recent_tab_helper.h +++ b/chrome/browser/offline_pages/recent_tab_helper.h @@ -146,6 +146,9 @@ class RecentTabHelper @@ -1726,7 +1654,6 @@ index 9567d334d86f1..697aed8a8a4c2 100644 // downloads. Null if there's no ongoing request. std::unique_ptr downloads_ongoing_snapshot_info_; diff --git a/chrome/browser/offline_pages/request_coordinator_factory.h b/chrome/browser/offline_pages/request_coordinator_factory.h -index 7d68579a86760..be37d7fa33442 100644 --- a/chrome/browser/offline_pages/request_coordinator_factory.h +++ b/chrome/browser/offline_pages/request_coordinator_factory.h @@ -18,7 +18,7 @@ namespace offline_pages { @@ -1740,7 +1667,7 @@ index 7d68579a86760..be37d7fa33442 100644 static RequestCoordinator* GetForBrowserContext( @@ -36,6 +36,8 @@ class RequestCoordinatorFactory : public ProfileKeyedServiceFactory { - KeyedService* BuildServiceInstanceFor( + std::unique_ptr BuildServiceInstanceForBrowserContext( content::BrowserContext* context) const override; + content::BrowserContext* GetBrowserContextToUse( + content::BrowserContext* context) const override; @@ -1748,10 +1675,9 @@ index 7d68579a86760..be37d7fa33442 100644 } // namespace offline_pages diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc -index 1944adea64d4c..8f75f154b981f 100644 --- a/chrome/browser/prefs/browser_prefs.cc +++ b/chrome/browser/prefs/browser_prefs.cc -@@ -236,6 +236,7 @@ +@@ -249,6 +249,7 @@ #if BUILDFLAG(IS_ANDROID) #include "chrome/browser/accessibility/accessibility_prefs/android/accessibility_prefs_controller.h" @@ -1759,7 +1685,7 @@ index 1944adea64d4c..8f75f154b981f 100644 #include "chrome/browser/android/bookmarks/partner_bookmarks_shim.h" #include "chrome/browser/android/ntp/recent_tabs_page_prefs.h" #include "chrome/browser/android/oom_intervention/oom_intervention_decider.h" -@@ -1796,6 +1797,10 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, +@@ -1781,6 +1782,10 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, usage_stats::UsageStatsBridge::RegisterProfilePrefs(registry); variations::VariationsService::RegisterProfilePrefs(registry); webapps::InstallPromptPrefs::RegisterProfilePrefs(registry); @@ -1771,7 +1697,6 @@ index 1944adea64d4c..8f75f154b981f 100644 bookmarks_webui::RegisterProfilePrefs(registry); browser_sync::ForeignSessionHandler::RegisterProfilePrefs(registry); diff --git a/chrome/browser/profiles/profile_selections.cc b/chrome/browser/profiles/profile_selections.cc -index 7ecd897db8830..4ad14b1003942 100644 --- a/chrome/browser/profiles/profile_selections.cc +++ b/chrome/browser/profiles/profile_selections.cc @@ -5,6 +5,9 @@ @@ -1799,7 +1724,6 @@ index 7ecd897db8830..4ad14b1003942 100644 return profile; case ProfileSelection::kRedirectedToOriginal: diff --git a/chrome/browser/profiles/profile_selections.h b/chrome/browser/profiles/profile_selections.h -index 8eb83625919ce..df626e2ebf430 100644 --- a/chrome/browser/profiles/profile_selections.h +++ b/chrome/browser/profiles/profile_selections.h @@ -6,7 +6,7 @@ @@ -1824,7 +1748,6 @@ index 8eb83625919ce..df626e2ebf430 100644 kRedirectedToOriginal, // Original: Self -- OTR: Original kOffTheRecordOnly // Original: No Profile -- OTR: Self diff --git a/chrome/browser/ui/android/native_page/BUILD.gn b/chrome/browser/ui/android/native_page/BUILD.gn -index 259376bfd3214..777c799e0910d 100644 --- a/chrome/browser/ui/android/native_page/BUILD.gn +++ b/chrome/browser/ui/android/native_page/BUILD.gn @@ -28,7 +28,9 @@ robolectric_library("junit") { @@ -1838,7 +1761,6 @@ index 259376bfd3214..777c799e0910d 100644 ] } diff --git a/chrome/browser/ui/android/native_page/java/src/org/chromium/chrome/browser/ui/native_page/NativePage.java b/chrome/browser/ui/android/native_page/java/src/org/chromium/chrome/browser/ui/native_page/NativePage.java -index d81c018376715..3e61a38b7ab5c 100644 --- a/chrome/browser/ui/android/native_page/java/src/org/chromium/chrome/browser/ui/native_page/NativePage.java +++ b/chrome/browser/ui/android/native_page/java/src/org/chromium/chrome/browser/ui/native_page/NativePage.java @@ -16,6 +16,8 @@ import org.chromium.url.GURL; @@ -1900,10 +1822,9 @@ index d81c018376715..3e61a38b7ab5c 100644 } else if (UrlConstants.EXPLORE_HOST.equals(host)) { return NativePageType.EXPLORE; diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd -index aa35bda9b1066..55d3ab59aca1f 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd -@@ -1408,6 +1408,37 @@ Your Google account may have other forms of browsing history like searches and a +@@ -1431,6 +1431,37 @@ Your Google account may have other forms of browsing history like searches and a Clears history from all synced devices @@ -1942,10 +1863,9 @@ index aa35bda9b1066..55d3ab59aca1f 100644 <link1>Search history</link1> and <link2>other forms of activity</link2> may be saved in your Google Account when you’re signed in. You can delete them anytime. diff --git a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/LocationBarModel.java b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/LocationBarModel.java -index 3f4e661754726..14639486ac4c8 100644 --- a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/LocationBarModel.java +++ b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/LocationBarModel.java -@@ -178,6 +178,7 @@ public class LocationBarModel implements ToolbarDataProvider, LocationBarDataPro +@@ -177,6 +177,7 @@ public class LocationBarModel implements ToolbarDataProvider, LocationBarDataPro protected String mFormattedFullUrl; protected String mUrlForDisplay; private boolean mOmniboxUpdatedConnectionSecurityIndicatorsEnabled; @@ -1953,7 +1873,7 @@ index 3f4e661754726..14639486ac4c8 100644 // notifyUrlChanged and notifySecurityStateChanged are usually called 3 times across a same // document navigation. The first call is usually necessary, which updates the UrlBar to reflect -@@ -200,7 +201,9 @@ public class LocationBarModel implements ToolbarDataProvider, LocationBarDataPro +@@ -199,7 +200,9 @@ public class LocationBarModel implements ToolbarDataProvider, LocationBarDataPro public LocationBarModel(Context context, NewTabPageDelegate newTabPageDelegate, @NonNull UrlFormatter urlFormatter, @NonNull ProfileProvider profileProvider, @NonNull OfflineStatus offlineStatus, @@ -1965,10 +1885,9 @@ index 3f4e661754726..14639486ac4c8 100644 mNtpDelegate = newTabPageDelegate; mUrlFormatter = urlFormatter; diff --git a/chrome/browser/ui/messages/android/BUILD.gn b/chrome/browser/ui/messages/android/BUILD.gn -index c8fd54fdf5650..fb7bde00d9d21 100644 --- a/chrome/browser/ui/messages/android/BUILD.gn +++ b/chrome/browser/ui/messages/android/BUILD.gn -@@ -24,6 +24,7 @@ android_library("java") { +@@ -25,6 +25,7 @@ android_library("java") { srcjar_deps = [ ":jni_headers" ] sources = [ "java/src/org/chromium/chrome/browser/ui/messages/infobar/SimpleConfirmInfoBarBuilder.java", @@ -1978,7 +1897,6 @@ index c8fd54fdf5650..fb7bde00d9d21 100644 "java/src/org/chromium/chrome/browser/ui/messages/snackbar/SnackbarManager.java", diff --git a/chrome/browser/ui/messages/android/java/src/org/chromium/chrome/browser/ui/messages/snackbar/INeedSnackbarManager.java b/chrome/browser/ui/messages/android/java/src/org/chromium/chrome/browser/ui/messages/snackbar/INeedSnackbarManager.java new file mode 100644 -index 0000000000000..18703fa8bf83a --- /dev/null +++ b/chrome/browser/ui/messages/android/java/src/org/chromium/chrome/browser/ui/messages/snackbar/INeedSnackbarManager.java @@ -0,0 +1,27 @@ @@ -2010,10 +1928,9 @@ index 0000000000000..18703fa8bf83a + void setSnackbarManager(SnackbarManager manager); +} diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h -index da940b12a103c..9f29945d75551 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h -@@ -3942,6 +3942,12 @@ inline constexpr char kOutOfProcessSystemDnsResolutionEnabled[] = +@@ -3878,6 +3878,12 @@ inline constexpr char kOutOfProcessSystemDnsResolutionEnabled[] = "net.out_of_process_system_dns_resolution_enabled"; #endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) @@ -2027,10 +1944,9 @@ index da940b12a103c..9f29945d75551 100644 inline constexpr char kHttpAllowlist[] = "https_upgrades.policy.http_allowlist"; diff --git a/components/content_settings/core/browser/content_settings_pref_provider.cc b/components/content_settings/core/browser/content_settings_pref_provider.cc -index 362a28af89211..37ba829e74723 100644 --- a/components/content_settings/core/browser/content_settings_pref_provider.cc +++ b/components/content_settings/core/browser/content_settings_pref_provider.cc -@@ -89,10 +89,12 @@ void PrefProvider::RegisterProfilePrefs( +@@ -87,10 +87,12 @@ void PrefProvider::RegisterProfilePrefs( PrefProvider::PrefProvider(PrefService* prefs, bool off_the_record, @@ -2043,7 +1959,7 @@ index 362a28af89211..37ba829e74723 100644 store_last_modified_(store_last_modified), clock_(base::DefaultClock::GetInstance()) { TRACE_EVENT_BEGIN("startup", "PrefProvider::PrefProvider"); -@@ -115,10 +117,14 @@ PrefProvider::PrefProvider(PrefService* prefs, +@@ -113,10 +115,14 @@ PrefProvider::PrefProvider(PrefService* prefs, WebsiteSettingsRegistry* website_settings = WebsiteSettingsRegistry::GetInstance(); for (const WebsiteSettingsInfo* info : *website_settings) { @@ -2060,7 +1976,6 @@ index 362a28af89211..37ba829e74723 100644 base::Unretained(this))))); } diff --git a/components/content_settings/core/browser/content_settings_pref_provider.h b/components/content_settings/core/browser/content_settings_pref_provider.h -index 12bf884471737..2ad048cef58a1 100644 --- a/components/content_settings/core/browser/content_settings_pref_provider.h +++ b/components/content_settings/core/browser/content_settings_pref_provider.h @@ -37,6 +37,7 @@ class PrefProvider : public UserModifiableProvider { @@ -2071,7 +1986,7 @@ index 12bf884471737..2ad048cef58a1 100644 bool store_last_modified, bool restore_session); -@@ -113,6 +114,7 @@ class PrefProvider : public UserModifiableProvider { +@@ -110,6 +111,7 @@ class PrefProvider : public UserModifiableProvider { raw_ptr prefs_; const bool off_the_record_; @@ -2080,7 +1995,6 @@ index 12bf884471737..2ad048cef58a1 100644 bool store_last_modified_; diff --git a/components/content_settings/core/browser/host_content_settings_map.cc b/components/content_settings/core/browser/host_content_settings_map.cc -index 58e51dacd5b35..27dc8d6d7546c 100644 --- a/components/content_settings/core/browser/host_content_settings_map.cc +++ b/components/content_settings/core/browser/host_content_settings_map.cc @@ -280,6 +280,7 @@ struct ContentSettingEntry { @@ -2109,7 +2023,6 @@ index 58e51dacd5b35..27dc8d6d7546c 100644 content_settings_providers_[PREF_PROVIDER] = std::move(pref_provider_ptr); user_modifiable_providers_.push_back(pref_provider_); diff --git a/components/content_settings/core/browser/host_content_settings_map.h b/components/content_settings/core/browser/host_content_settings_map.h -index a853d29761f4d..c35cbc76df2bf 100644 --- a/components/content_settings/core/browser/host_content_settings_map.h +++ b/components/content_settings/core/browser/host_content_settings_map.h @@ -103,6 +103,7 @@ class HostContentSettingsMap : public content_settings::Observer, @@ -2120,7 +2033,7 @@ index a853d29761f4d..c35cbc76df2bf 100644 bool store_last_modified, bool restore_session, bool should_record_metrics); -@@ -524,6 +525,8 @@ class HostContentSettingsMap : public content_settings::Observer, +@@ -527,6 +528,8 @@ class HostContentSettingsMap : public content_settings::Observer, // Whether this settings map is for an incognito or guest session. bool is_off_the_record_; @@ -2129,34 +2042,7 @@ index a853d29761f4d..c35cbc76df2bf 100644 // Whether ContentSettings in the PrefProvider will store a last_modified // timestamp. bool store_last_modified_; -diff --git a/components/offline_pages/core/offline_page_feature.cc b/components/offline_pages/core/offline_page_feature.cc -index 0fd9e4f89e427..9f0a6a7792016 100644 ---- a/components/offline_pages/core/offline_page_feature.cc -+++ b/components/offline_pages/core/offline_page_feature.cc -@@ -44,6 +44,9 @@ BASE_FEATURE(kOfflinePagesNetworkStateLikelyUnknown, - "OfflinePagesNetworkStateLikelyUnknown", - base::FEATURE_DISABLED_BY_DEFAULT); - -+const base::Feature kOfflinePagesAutoSaveFeature{ -+ "OfflinePagesAutoSaveEnabled", base::FEATURE_DISABLED_BY_DEFAULT}; -+ - const char kPrefetchingOfflinePagesExperimentsOption[] = "exp"; - - bool IsOfflinePagesCTEnabled() { -diff --git a/components/offline_pages/core/offline_page_feature.h b/components/offline_pages/core/offline_page_feature.h -index d9715f87577a1..3603a438e11fe 100644 ---- a/components/offline_pages/core/offline_page_feature.h -+++ b/components/offline_pages/core/offline_page_feature.h -@@ -19,6 +19,7 @@ BASE_DECLARE_FEATURE(kOfflinePagesInDownloadHomeOpenInCctFeature); - BASE_DECLARE_FEATURE(kOfflinePagesDescriptiveFailStatusFeature); - BASE_DECLARE_FEATURE(kOnTheFlyMhtmlHashComputationFeature); - BASE_DECLARE_FEATURE(kOfflinePagesNetworkStateLikelyUnknown); -+extern const base::Feature kOfflinePagesAutoSaveFeature; - - // The parameter name used to find the experiment tag for prefetching offline - // pages. diff --git a/components/omnibox/browser/autocomplete_provider_client.cc b/components/omnibox/browser/autocomplete_provider_client.cc -index 5682ca1c935bb..4757f1dd91791 100644 --- a/components/omnibox/browser/autocomplete_provider_client.cc +++ b/components/omnibox/browser/autocomplete_provider_client.cc @@ -29,3 +29,7 @@ base::WeakPtr @@ -2168,7 +2054,6 @@ index 5682ca1c935bb..4757f1dd91791 100644 + return false; +} diff --git a/components/omnibox/browser/autocomplete_provider_client.h b/components/omnibox/browser/autocomplete_provider_client.h -index b47affe8a2096..3009138e5e1b7 100644 --- a/components/omnibox/browser/autocomplete_provider_client.h +++ b/components/omnibox/browser/autocomplete_provider_client.h @@ -136,6 +136,7 @@ class AutocompleteProviderClient : public OmniboxAction::Client { @@ -2180,7 +2065,6 @@ index b47affe8a2096..3009138e5e1b7 100644 virtual bool SearchSuggestEnabled() const = 0; diff --git a/components/omnibox/browser/base_search_provider.cc b/components/omnibox/browser/base_search_provider.cc -index c3b44ff7635a0..ac9fa06fc03a1 100644 --- a/components/omnibox/browser/base_search_provider.cc +++ b/components/omnibox/browser/base_search_provider.cc @@ -346,7 +346,7 @@ bool BaseSearchProvider::CanSendZeroSuggestRequest( @@ -2193,7 +2077,6 @@ index c3b44ff7635a0..ac9fa06fc03a1 100644 } diff --git a/components/omnibox/browser/search_provider.cc b/components/omnibox/browser/search_provider.cc -index 63b5696e1f8a1..a385686403d8a 100644 --- a/components/omnibox/browser/search_provider.cc +++ b/components/omnibox/browser/search_provider.cc @@ -780,7 +780,9 @@ bool SearchProvider::IsQuerySuitableForSuggest(bool* query_is_private) const { @@ -2207,18 +2090,43 @@ index 63b5696e1f8a1..a385686403d8a 100644 ((default_url && !default_url->suggestions_url().empty() && !*query_is_private) || (keyword_url && !keyword_url->suggestions_url().empty())); -diff --git a/weblayer/browser/host_content_settings_map_factory.cc b/weblayer/browser/host_content_settings_map_factory.cc -index d9e57d3974f97..320462af3751f 100644 ---- a/weblayer/browser/host_content_settings_map_factory.cc -+++ b/weblayer/browser/host_content_settings_map_factory.cc -@@ -45,6 +45,7 @@ HostContentSettingsMapFactory::BuildServiceInstanceFor( - scoped_refptr settings_map = - base::MakeRefCounted( - user_prefs::UserPrefs::Get(context), context->IsOffTheRecord(), -+ /*force_save_site_settings*/false, - /*store_last_modified=*/true, - /*restore_session=*/false, - /*should_record_metrics=*/!context->IsOffTheRecord()); --- -2.34.1 - +diff --git a/cromite_flags/chrome/browser/about_flags_cc/add-an-always-incognito-mode.inc b/cromite_flags/chrome/browser/about_flags_cc/add-an-always-incognito-mode.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/add-an-always-incognito-mode.inc +@@ -0,0 +1,13 @@ ++#ifdef FLAG_SECTION ++ ++#if BUILDFLAG(IS_ANDROID) ++ ++ {"offline-pages-auto-save", ++ "Enables autosave of offline page", ++ "Enables autosave of offline page, as automatic switching in case " ++ "the device goes offline.", kOsAndroid, ++ FEATURE_VALUE_TYPE(offline_pages::kOfflinePagesAutoSaveFeature)}, ++ ++#endif ++ ++#endif +diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-an-always-incognito-mode.inc b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-an-always-incognito-mode.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-an-always-incognito-mode.inc +@@ -0,0 +1 @@ ++SET_CROMITE_FEATURE_ENABLED(kCCTIncognitoAvailableToThirdParty); +diff --git a/cromite_flags/components/offline_pages/core/offline_page_feature_cc/add-an-always-incognito-mode.inc b/cromite_flags/components/offline_pages/core/offline_page_feature_cc/add-an-always-incognito-mode.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/components/offline_pages/core/offline_page_feature_cc/add-an-always-incognito-mode.inc +@@ -0,0 +1,3 @@ ++CROMITE_FEATURE(kOfflinePagesAutoSaveFeature, ++ "OfflinePagesAutoSaveEnabled", ++ base::FEATURE_DISABLED_BY_DEFAULT); +diff --git a/cromite_flags/components/offline_pages/core/offline_page_feature_h/add-an-always-incognito-mode.inc b/cromite_flags/components/offline_pages/core/offline_page_feature_h/add-an-always-incognito-mode.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/components/offline_pages/core/offline_page_feature_h/add-an-always-incognito-mode.inc +@@ -0,0 +1 @@ ++BASE_DECLARE_FEATURE(kOfflinePagesAutoSaveFeature); +-- +2.25.1 diff --git a/build/bromite_patches/Add-bookmark-import-export-actions.patch b/build/bromite_patches/Add-bookmark-import-export-actions.patch index 5a52d81300a8a51ff90fee6f193bc928406b8a21..87fd540564fe4e902faf3c943e5ab74a01217098 100644 --- a/build/bromite_patches/Add-bookmark-import-export-actions.patch +++ b/build/bromite_patches/Add-bookmark-import-export-actions.patch @@ -1,7 +1,6 @@ -From 65fee6a0aae835b2f9ab0c0e16fda4f00c729511 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Wed, 1 Aug 2018 09:19:40 +0200 -Subject: [PATCH 061/192] Add bookmark import/export actions +Subject: Add bookmark import/export actions Add bookmark import/export actions in bookmarks activity and page Reduce permissions needed for bookmarks import/export @@ -27,16 +26,12 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../bookmarks/BookmarkToolbarViewBinder.java | 6 + .../native_page/NativePageFactory.java | 11 +- chrome/browser/BUILD.gn | 11 +- - chrome/browser/about_flags.cc | 8 + .../bookmarks/android/bookmark_bridge.cc | 283 ++++++++++++++++++ .../bookmarks/android/bookmark_bridge.h | 30 +- .../browser/bookmarks/bookmark_html_writer.cc | 11 + .../dialogs/DownloadLocationCustomView.java | 8 +- .../DownloadLocationDialogCoordinator.java | 8 +- - chrome/browser/flag_descriptions.cc | 5 + - chrome/browser/flag_descriptions.h | 3 + - .../flags/android/chrome_feature_list.cc | 6 + - .../flags/android/chrome_feature_list.h | 1 + + .../flags/android/chrome_feature_list.cc | 1 + .../browser/flags/ChromeFeatureList.java | 1 + chrome/browser/importer/profile_writer.cc | 12 + chrome/browser/importer/profile_writer.h | 6 + @@ -44,19 +39,26 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../strings/android_chrome_strings.grd | 18 ++ chrome/common/BUILD.gn | 3 + chrome/utility/BUILD.gn | 7 +- - .../utility/importer/bookmark_html_reader.cc | 27 +- + .../utility/importer/bookmark_html_reader.cc | 28 +- .../utility/importer/bookmark_html_reader.h | 8 + .../headless_select_file_dialog.cc | 4 + + .../add-bookmark-import-export-actions.inc | 12 + + .../add-bookmark-import-export-actions.inc | 4 + + .../add-bookmark-import-export-actions.inc | 1 + .../chromium/ui/base/SelectFileDialog.java | 18 +- .../java/strings/android_ui_strings.grd | 3 + ui/shell_dialogs/select_file_dialog.h | 2 + .../select_file_dialog_android.cc | 6 + ui/shell_dialogs/select_file_dialog_android.h | 2 + + ui/shell_dialogs/select_file_dialog_linux.cc | 4 + + ui/shell_dialogs/select_file_dialog_linux.h | 2 + ui/shell_dialogs/select_file_dialog_win.cc | 5 + - 42 files changed, 915 insertions(+), 29 deletions(-) + 43 files changed, 917 insertions(+), 29 deletions(-) + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/add-bookmark-import-export-actions.inc + create mode 100644 cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-bookmark-import-export-actions.inc + create mode 100644 cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/add-bookmark-import-export-actions.inc diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml -index f2eba66ddc541..8974f51e25548 100644 --- a/chrome/android/java/AndroidManifest.xml +++ b/chrome/android/java/AndroidManifest.xml @@ -62,7 +62,6 @@ by a child template that "extends" this file. @@ -68,7 +70,6 @@ index f2eba66ddc541..8974f51e25548 100644 diff --git a/chrome/android/java/res/menu/bookmark_toolbar_menu.xml b/chrome/android/java/res/menu/bookmark_toolbar_menu.xml -index d57102c6877d1..bb414a0d4069d 100644 --- a/chrome/android/java/res/menu/bookmark_toolbar_menu.xml +++ b/chrome/android/java/res/menu/bookmark_toolbar_menu.xml @@ -23,6 +23,20 @@ found in the LICENSE file. @@ -93,10 +94,9 @@ index d57102c6877d1..bb414a0d4069d 100644 android:id="@+id/close_menu_id" android:icon="@drawable/btn_close" diff --git a/chrome/android/java/res/menu/bookmark_toolbar_menu_improved.xml b/chrome/android/java/res/menu/bookmark_toolbar_menu_improved.xml -index 8e1eaba0161a3..2c4f201c08aa3 100644 --- a/chrome/android/java/res/menu/bookmark_toolbar_menu_improved.xml +++ b/chrome/android/java/res/menu/bookmark_toolbar_menu_improved.xml -@@ -49,6 +49,20 @@ found in the LICENSE file. +@@ -51,6 +51,20 @@ found in the LICENSE file. android:title="@string/create_new_folder" app:showAsAction="ifRoom" app:iconTint="@color/default_icon_color_secondary_tint_list" /> @@ -116,20 +116,19 @@ index 8e1eaba0161a3..2c4f201c08aa3 100644 + app:iconTint="@color/default_icon_color_tint_list" /> mShareDelegateSupplier; private final Supplier mEphemeralTabCoordinatorSupplier; -@@ -74,7 +75,7 @@ public class TabbedModeTabDelegateFactory implements TabDelegateFactory { +@@ -76,7 +77,7 @@ public class TabbedModeTabDelegateFactory implements TabDelegateFactory { private NativePageFactory mNativePageFactory; @@ -148,7 +147,6 @@ index 95604707fc562..4c5af0ebd9d19 100644 Supplier shareDelegateSupplier, Supplier ephemeralTabCoordinatorSupplier, diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/bookmarks/BookmarkActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/app/bookmarks/BookmarkActivity.java -index f1c645990fbce..e21745babe837 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/app/bookmarks/BookmarkActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/bookmarks/BookmarkActivity.java @@ -21,6 +21,11 @@ import org.chromium.chrome.browser.preferences.SharedPreferencesManager; @@ -221,7 +219,6 @@ index f1c645990fbce..e21745babe837 100644 * @return The {@link BookmarkManagerCoordinator} for testing purposes. */ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkBridge.java -index 3cf4fa48a2581..95788b70eff1e 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkBridge.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkBridge.java @@ -4,7 +4,20 @@ @@ -245,7 +242,7 @@ index 3cf4fa48a2581..95788b70eff1e 100644 import android.text.TextUtils; import android.util.Pair; -@@ -38,6 +51,32 @@ import org.chromium.url.GURL; +@@ -37,6 +50,32 @@ import org.chromium.url.GURL; import java.util.ArrayList; import java.util.List; @@ -278,8 +275,8 @@ index 3cf4fa48a2581..95788b70eff1e 100644 /** * Provides the communication channel for Android to fetch and manipulate the * bookmark model stored in native. -@@ -432,6 +471,209 @@ class BookmarkBridge { - mNativeBookmarkBridge, BookmarkBridge.this, id.getId(), id.getType()); +@@ -435,6 +474,209 @@ class BookmarkBridge { + mNativeBookmarkBridge, id.getId(), id.getType()); } + /** @@ -528,18 +525,17 @@ index 3cf4fa48a2581..95788b70eff1e 100644 private static List> createPairsList(int[] left, int[] right) { List> pairList = new ArrayList<>(); for (int i = 0; i < left.length; i++) { -@@ -966,6 +1241,9 @@ class BookmarkBridge { - int getChildCount(long nativeBookmarkBridge, BookmarkBridge caller, long id, int type); - void getChildIds(long nativeBookmarkBridge, BookmarkBridge caller, long id, int type, - List bookmarksList); +@@ -961,6 +1236,9 @@ class BookmarkBridge { + int getChildCount(long nativeBookmarkBridge, long id, int type); + void getChildIds( + long nativeBookmarkBridge, long id, int type, List bookmarksList); + void importBookmarks(long nativeBookmarkBridge, BookmarkBridge caller, WindowAndroid window); + void exportBookmarks(long nativeBookmarkBridge, BookmarkBridge caller, WindowAndroid window, + String export_path); - BookmarkId getChildAt( - long nativeBookmarkBridge, BookmarkBridge caller, long id, int type, int index); - int getTotalBookmarkCount( + BookmarkId getChildAt(long nativeBookmarkBridge, long id, int type, int index); + int getTotalBookmarkCount(long nativeBookmarkBridge, long id, int type); + void setBookmarkTitle(long nativeBookmarkBridge, long id, int type, String title); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkDelegate.java -index 473c4a65a54d4..20582e2552642 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkDelegate.java @@ -60,6 +60,16 @@ public interface BookmarkDelegate { @@ -560,10 +556,9 @@ index 473c4a65a54d4..20582e2552642 100644 * Shows the search UI. */ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerCoordinator.java -index b2afb6cb450e6..bbd7cb16c3fca 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerCoordinator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerCoordinator.java -@@ -47,6 +47,8 @@ import org.chromium.components.image_fetcher.ImageFetcher; +@@ -49,6 +49,8 @@ import org.chromium.components.image_fetcher.ImageFetcher; import org.chromium.components.image_fetcher.ImageFetcherConfig; import org.chromium.components.image_fetcher.ImageFetcherFactory; import org.chromium.ui.KeyboardVisibilityDelegate; @@ -572,7 +567,7 @@ index b2afb6cb450e6..bbd7cb16c3fca 100644 import org.chromium.ui.modaldialog.ModalDialogManager; import org.chromium.ui.modaldialog.ModalDialogManager.ModalDialogType; import org.chromium.ui.modelutil.MVCListAdapter.ModelList; -@@ -225,6 +227,13 @@ public class BookmarkManagerCoordinator +@@ -233,6 +235,13 @@ public class BookmarkManagerCoordinator // Public API implementation. @@ -587,10 +582,9 @@ index b2afb6cb450e6..bbd7cb16c3fca 100644 * Destroys and cleans up itself. This must be called after done using this class. */ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerMediator.java -index 71156d35d80c2..2cb12380fd6a4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkManagerMediator.java -@@ -51,6 +51,8 @@ import org.chromium.components.browser_ui.widget.selectable_list.SelectionDelega +@@ -55,6 +55,8 @@ import org.chromium.components.browser_ui.widget.selectable_list.SelectionDelega import org.chromium.components.browser_ui.widget.selectable_list.SelectionDelegate.SelectionObserver; import org.chromium.components.commerce.core.CommerceSubscription; import org.chromium.components.commerce.core.ShoppingService; @@ -599,7 +593,7 @@ index 71156d35d80c2..2cb12380fd6a4 100644 import org.chromium.components.favicon.LargeIconBridge; import org.chromium.components.feature_engagement.EventConstants; import org.chromium.components.power_bookmarks.PowerBookmarkMeta; -@@ -77,6 +79,9 @@ class BookmarkManagerMediator +@@ -82,6 +84,9 @@ class BookmarkManagerMediator private static boolean sPreventLoadingForTesting; @@ -609,7 +603,7 @@ index 71156d35d80c2..2cb12380fd6a4 100644 /** * Keeps track of whether drag is enabled / active for bookmark lists. */ -@@ -461,6 +466,14 @@ class BookmarkManagerMediator +@@ -513,6 +518,14 @@ class BookmarkManagerMediator mNativePage = nativePage; } @@ -624,7 +618,7 @@ index 71156d35d80c2..2cb12380fd6a4 100644 /** * See BookmarkManager(Coordinator)#updateForUrl */ -@@ -635,6 +648,16 @@ class BookmarkManagerMediator +@@ -689,6 +702,16 @@ class BookmarkManagerMediator } } @@ -640,9 +634,8 @@ index 71156d35d80c2..2cb12380fd6a4 100644 + @Override public void openSearchUi() { - onQueryCallback(""); + onSearchTextChangeCallback(""); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkPage.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkPage.java -index ab5f86200de26..455e22a56a7c4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkPage.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkPage.java @@ -13,6 +13,9 @@ import org.chromium.chrome.browser.ui.messages.snackbar.SnackbarManager; @@ -675,10 +668,9 @@ index ab5f86200de26..455e22a56a7c4 100644 initWithView(mBookmarkManagerCoordinator.getView()); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbar.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbar.java -index 92336e2d67011..3dbea0829516f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbar.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbar.java -@@ -116,6 +116,17 @@ public class BookmarkToolbar extends SelectableListToolbar +@@ -119,6 +119,17 @@ public class BookmarkToolbar extends SelectableListToolbar setOnMenuItemClickListener(dragEnabled ? null : this); } @@ -696,7 +688,7 @@ index 92336e2d67011..3dbea0829516f 100644 void setSearchButtonVisible(boolean visible) { // The improved bookmarks experience embeds search in the list. if (BookmarkFeatures.isAndroidImprovedBookmarksEnabled()) return; -@@ -156,6 +167,8 @@ public class BookmarkToolbar extends SelectableListToolbar +@@ -172,6 +183,8 @@ public class BookmarkToolbar extends SelectableListToolbar void setCurrentFolder(BookmarkId folder) { mCurrentFolder = mBookmarkModel.getBookmarkById(folder); @@ -705,7 +697,7 @@ index 92336e2d67011..3dbea0829516f 100644 } void setNavigateBackRunnable(Runnable navigateBackRunnable) { -@@ -175,6 +188,13 @@ public class BookmarkToolbar extends SelectableListToolbar +@@ -191,6 +204,13 @@ public class BookmarkToolbar extends SelectableListToolbar @Override public boolean onMenuItemClick(MenuItem menuItem) { hideOverflowMenu(); @@ -719,7 +711,7 @@ index 92336e2d67011..3dbea0829516f 100644 return mMenuIdClickedFunction.apply(menuItem.getItemId()); } -@@ -195,6 +215,9 @@ public class BookmarkToolbar extends SelectableListToolbar +@@ -211,6 +231,9 @@ public class BookmarkToolbar extends SelectableListToolbar protected void showNormalView() { super.showNormalView(); @@ -730,13 +722,12 @@ index 92336e2d67011..3dbea0829516f 100644 setSearchButtonVisible(mSearchButtonVisible); setEditButtonVisible(mEditButtonVisible); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarMediator.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarMediator.java -index 62dba243f0ab0..4284e117b57fb 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarMediator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarMediator.java -@@ -81,6 +81,10 @@ class BookmarkToolbarMediator implements BookmarkUiObserver, DragListener, +@@ -109,6 +109,10 @@ class BookmarkToolbarMediator implements BookmarkUiObserver, DragListener, + bookmarkDelegateSupplier.onAvailable((bookmarkDelegate) -> { mBookmarkDelegate = bookmarkDelegate; - mModel.set(BookmarkToolbarProperties.NAVIGATE_BACK_RUNNABLE, - this::openParentForCurrentFolder); + mModel.set(BookmarkToolbarProperties.NAVIGATE_BACK_RUNNABLE, this::onNavigateBack); + mModel.set( + BookmarkToolbarProperties.IMPORT_BOOKMARK_RUNNABLE, mBookmarkDelegate::importBookmarks); + mModel.set( @@ -745,10 +736,9 @@ index 62dba243f0ab0..4284e117b57fb 100644 mBookmarkDelegate.notifyStateChange(this); }); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarProperties.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarProperties.java -index bcaae8aaf8119..96e06b4fb52f9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarProperties.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarProperties.java -@@ -61,11 +61,16 @@ class BookmarkToolbarProperties { +@@ -66,11 +66,16 @@ class BookmarkToolbarProperties { new WritableObjectPropertyKey<>(); static final WritableObjectPropertyKey NAVIGATE_BACK_RUNNABLE = new WritableObjectPropertyKey<>(); @@ -760,17 +750,16 @@ index bcaae8aaf8119..96e06b4fb52f9 100644 static final PropertyKey[] ALL_KEYS = {BOOKMARK_MODEL, BOOKMARK_OPENER, SELECTION_DELEGATE, TITLE, BOOKMARK_UI_MODE, SOFT_KEYBOARD_VISIBLE, IS_DIALOG_UI, DRAG_ENABLED, SEARCH_BUTTON_VISIBLE, EDIT_BUTTON_VISIBLE, NEW_FOLDER_BUTTON_VISIBLE, - NEW_FOLDER_BUTTON_ENABLED, NAVIGATION_BUTTON_STATE, CURRENT_FOLDER, - CHECKED_SORT_MENU_ID, CHECKED_VIEW_MENU_ID, MENU_ID_CLICKED_FUNCTION, -- NAVIGATE_BACK_RUNNABLE, FAKE_SELECTION_STATE_CHANGE}; -+ NAVIGATE_BACK_RUNNABLE, FAKE_SELECTION_STATE_CHANGE, + NEW_FOLDER_BUTTON_ENABLED, NAVIGATION_BUTTON_STATE, CURRENT_FOLDER, SORT_MENU_IDS, + SORT_MENU_IDS_ENABLED, CHECKED_SORT_MENU_ID, CHECKED_VIEW_MENU_ID, +- MENU_ID_CLICKED_FUNCTION, NAVIGATE_BACK_RUNNABLE, FAKE_SELECTION_STATE_CHANGE}; ++ MENU_ID_CLICKED_FUNCTION, NAVIGATE_BACK_RUNNABLE, FAKE_SELECTION_STATE_CHANGE, + IMPORT_BOOKMARK_RUNNABLE, EXPORT_BOOKMARK_RUNNABLE}; } diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarViewBinder.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarViewBinder.java -index 4e69cd9c9c83a..b52ce826aae36 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarViewBinder.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbarViewBinder.java -@@ -56,6 +56,12 @@ class BookmarkToolbarViewBinder { +@@ -61,6 +61,12 @@ class BookmarkToolbarViewBinder { model.get(BookmarkToolbarProperties.CHECKED_VIEW_MENU_ID)); } else if (key == BookmarkToolbarProperties.CURRENT_FOLDER) { bookmarkToolbar.setCurrentFolder(model.get(BookmarkToolbarProperties.CURRENT_FOLDER)); @@ -784,10 +773,9 @@ index 4e69cd9c9c83a..b52ce826aae36 100644 bookmarkToolbar.setNavigateBackRunnable( model.get(BookmarkToolbarProperties.NAVIGATE_BACK_RUNNABLE)); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/native_page/NativePageFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/native_page/NativePageFactory.java -index a29623be5b017..47450d033b081 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/native_page/NativePageFactory.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/native_page/NativePageFactory.java -@@ -15,6 +15,7 @@ import androidx.annotation.VisibleForTesting; +@@ -16,6 +16,7 @@ import org.chromium.base.jank_tracker.JankTracker; import org.chromium.base.supplier.DestroyableObservableSupplier; import org.chromium.base.supplier.ObservableSupplier; import org.chromium.base.supplier.Supplier; @@ -804,7 +792,7 @@ index a29623be5b017..47450d033b081 100644 private final BottomSheetController mBottomSheetController; private final BrowserControlsManager mBrowserControlsManager; private final Supplier mCurrentTabSupplier; -@@ -69,7 +70,7 @@ public class NativePageFactory { +@@ -70,7 +71,7 @@ public class NativePageFactory { private NativePageBuilder mNativePageBuilder; @@ -813,7 +801,7 @@ index a29623be5b017..47450d033b081 100644 @NonNull BottomSheetController sheetController, @NonNull BrowserControlsManager browserControlsManager, @NonNull Supplier currentTabSupplier, -@@ -115,7 +116,7 @@ public class NativePageFactory { +@@ -118,7 +119,7 @@ public class NativePageFactory { @VisibleForTesting static class NativePageBuilder { @@ -822,7 +810,7 @@ index a29623be5b017..47450d033b081 100644 private final BottomSheetController mBottomSheetController; private final Supplier mUma; private final BrowserControlsManager mBrowserControlsManager; -@@ -129,7 +130,7 @@ public class NativePageFactory { +@@ -133,7 +134,7 @@ public class NativePageFactory { private final HomeSurfaceTracker mHomeSurfaceTracker; private final ObservableSupplier mTabContentManagerSupplier; @@ -831,7 +819,7 @@ index a29623be5b017..47450d033b081 100644 BottomSheetController sheetController, BrowserControlsManager browserControlsManager, Supplier currentTabSupplier, Supplier snackbarManagerSupplier, -@@ -169,7 +170,7 @@ public class NativePageFactory { +@@ -175,7 +176,7 @@ public class NativePageFactory { protected NativePage buildBookmarksPage(Tab tab) { return new BookmarkPage(mActivity.getComponentName(), mSnackbarManagerSupplier.get(), mTabModelSelector.isIncognitoSelected(), @@ -841,10 +829,9 @@ index a29623be5b017..47450d033b081 100644 protected NativePage buildDownloadsPage(Tab tab) { diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 05e80b77ea2e4..3e503cb91f5c0 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -204,6 +204,8 @@ static_library("browser") { +@@ -225,6 +225,8 @@ static_library("browser") { "bluetooth/chrome_bluetooth_delegate_impl_client.h", "bookmarks/bookmark_model_factory.cc", "bookmarks/bookmark_model_factory.h", @@ -853,7 +840,7 @@ index 05e80b77ea2e4..3e503cb91f5c0 100644 "bookmarks/chrome_bookmark_client.cc", "bookmarks/chrome_bookmark_client.h", "bookmarks/managed_bookmark_service_factory.cc", -@@ -1880,6 +1882,13 @@ static_library("browser") { +@@ -1968,6 +1970,13 @@ static_library("browser") { ] } @@ -867,7 +854,7 @@ index 05e80b77ea2e4..3e503cb91f5c0 100644 configs += [ "//build/config/compiler:wexit_time_destructors", "//build/config:precompiled_headers", -@@ -3543,8 +3552,6 @@ static_library("browser") { +@@ -3697,8 +3706,6 @@ static_library("browser") { "badging/badge_manager_factory.h", "banners/app_banner_manager_desktop.cc", "banners/app_banner_manager_desktop.h", @@ -876,27 +863,7 @@ index 05e80b77ea2e4..3e503cb91f5c0 100644 "bookmarks/url_and_id.h", "cart/cart_db.cc", "cart/cart_db.h", -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index 78c2b1a2de4e7..d7531ac080f86 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -9475,6 +9475,14 @@ const FeatureEntry kFeatureEntries[] = { - FEATURE_VALUE_TYPE(features::kForceOffTextAutosizing)}, - #endif - -+#if BUILDFLAG(IS_ANDROID) -+ {"export-bookmarks-use-saf", -+ flag_descriptions::kBookmarksExportUseSafName, -+ flag_descriptions::kBookmarksExportUseSafDescription, kOsAndroid, -+ FEATURE_VALUE_TYPE( -+ chrome::android::kBookmarksExportUseSaf)}, -+#endif -+ - #if BUILDFLAG(IS_CHROMEOS_ASH) - {"video-conference", flag_descriptions::kVideoConferenceName, - flag_descriptions::kVideoConferenceDescription, kOsCrOS, diff --git a/chrome/browser/bookmarks/android/bookmark_bridge.cc b/chrome/browser/bookmarks/android/bookmark_bridge.cc -index 3b4213fab1ffd..b0c4c40e9c240 100644 --- a/chrome/browser/bookmarks/android/bookmark_bridge.cc +++ b/chrome/browser/bookmarks/android/bookmark_bridge.cc @@ -58,6 +58,25 @@ @@ -1028,8 +995,8 @@ index 3b4213fab1ffd..b0c4c40e9c240 100644 + select_file_dialog_->ListenerDestroyed(); } - void BookmarkBridge::Destroy(JNIEnv*, const JavaParamRef&) { -@@ -619,6 +726,182 @@ jint BookmarkBridge::GetTotalBookmarkCount( + void BookmarkBridge::Destroy(JNIEnv*) { +@@ -558,6 +665,182 @@ jint BookmarkBridge::GetTotalBookmarkCount( return count; } @@ -1210,10 +1177,9 @@ index 3b4213fab1ffd..b0c4c40e9c240 100644 +} + void BookmarkBridge::SetBookmarkTitle(JNIEnv* env, - const JavaParamRef& obj, jlong id, + jint type, diff --git a/chrome/browser/bookmarks/android/bookmark_bridge.h b/chrome/browser/bookmarks/android/bookmark_bridge.h -index 44388de31493e..f194fe45a09f5 100644 --- a/chrome/browser/bookmarks/android/bookmark_bridge.h +++ b/chrome/browser/bookmarks/android/bookmark_bridge.h @@ -19,6 +19,7 @@ @@ -1244,9 +1210,9 @@ index 44388de31493e..f194fe45a09f5 100644 public: BookmarkBridge(Profile* profile, bookmarks::BookmarkModel* model, -@@ -74,6 +79,12 @@ class BookmarkBridge : public bookmarks::BaseBookmarkModelObserver, - bool IsDoingExtensiveChanges(JNIEnv* env, - const base::android::JavaParamRef& obj); +@@ -72,6 +77,12 @@ class BookmarkBridge : public bookmarks::BaseBookmarkModelObserver, + + bool IsDoingExtensiveChanges(JNIEnv* env); + // SelectFileDialog::Listener implementation. + void FileSelected(const base::FilePath& path, @@ -1256,10 +1222,10 @@ index 44388de31493e..f194fe45a09f5 100644 + jboolean IsEditBookmarksEnabled(JNIEnv* env); - void LoadEmptyPartnerBookmarkShimForTesting( -@@ -171,6 +182,15 @@ class BookmarkBridge : public bookmarks::BaseBookmarkModelObserver, - jlong id, - jint type); + void LoadEmptyPartnerBookmarkShimForTesting(JNIEnv* env); +@@ -84,6 +95,15 @@ class BookmarkBridge : public bookmarks::BaseBookmarkModelObserver, + jlong id, + jint type); + void ImportBookmarks(JNIEnv* env, + const base::android::JavaParamRef& obj, @@ -1270,10 +1236,10 @@ index 44388de31493e..f194fe45a09f5 100644 + const base::android::JavaParamRef& java_window, + const base::android::JavaParamRef& j_export_path); + - void SetBookmarkTitle(JNIEnv* env, - const base::android::JavaParamRef& obj, - jlong id, -@@ -363,12 +383,16 @@ class BookmarkBridge : public bookmarks::BaseBookmarkModelObserver, + void GetTopLevelFolderIds( + JNIEnv* env, + const base::android::JavaParamRef& j_result_obj); +@@ -310,12 +330,16 @@ class BookmarkBridge : public bookmarks::BaseBookmarkModelObserver, void DestroyJavaObject(); raw_ptr profile_; @@ -1290,7 +1256,7 @@ index 44388de31493e..f194fe45a09f5 100644 // Information about the Partner bookmarks (must check for IsLoaded()). // This is owned by profile. -@@ -382,6 +406,10 @@ class BookmarkBridge : public bookmarks::BaseBookmarkModelObserver, +@@ -329,6 +353,10 @@ class BookmarkBridge : public bookmarks::BaseBookmarkModelObserver, // Observes the profile destruction and creation. base::ScopedObservation profile_observation_{this}; @@ -1302,7 +1268,6 @@ index 44388de31493e..f194fe45a09f5 100644 // object. base::WeakPtrFactory weak_ptr_factory_; diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc -index 7451b2923dcb6..2f458ada42c60 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer.cc @@ -27,6 +27,9 @@ @@ -1332,7 +1297,6 @@ index 7451b2923dcb6..2f458ada42c60 100644 PLOG(ERROR) << "Could not create " << path_; return false; diff --git a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLocationCustomView.java b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLocationCustomView.java -index 46b03763a17f8..c6c56e5bf5063 100644 --- a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLocationCustomView.java +++ b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLocationCustomView.java @@ -49,7 +49,7 @@ public class DownloadLocationCustomView @@ -1372,7 +1336,6 @@ index 46b03763a17f8..c6c56e5bf5063 100644 DirectoryOption selected = (DirectoryOption) mFileLocation.getSelectedItem(); return selected; diff --git a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLocationDialogCoordinator.java b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLocationDialogCoordinator.java -index 32c96b9119073..5cb127a6b02b4 100644 --- a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLocationDialogCoordinator.java +++ b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLocationDialogCoordinator.java @@ -36,12 +36,12 @@ import java.util.ArrayList; @@ -1400,41 +1363,10 @@ index 32c96b9119073..5cb127a6b02b4 100644 // Already showing the dialog. if (mDialogModel != null) return; -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index e647063331153..41f7c6e21de77 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -7525,6 +7525,11 @@ const char kThirdPartyProfileManagementDescription[] = - "Enables profile management triggered by third-party sign-ins."; - #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) - -+const char kBookmarksExportUseSafName[] = "Use saf for bookmarks export"; -+const char kBookmarksExportUseSafDescription[] = -+ "When enabled user can choose where save the exported bookmarks " -+ "file."; -+ - // ============================================================================ - // Don't just add flags to the end, put them in the right section in - // alphabetical order just like the header file. -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index 1557928890d3a..36b991b2f4c7c 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -4353,6 +4353,9 @@ extern const char kThirdPartyProfileManagementName[]; - extern const char kThirdPartyProfileManagementDescription[]; - #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) - -+extern const char kBookmarksExportUseSafName[]; -+extern const char kBookmarksExportUseSafDescription[]; -+ - // ============================================================================ - // Don't just add flags to the end, put them in the right section in - // alphabetical order. See top instructions for more. diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc -index e58da3d35ab47..1ba904380664c 100644 --- a/chrome/browser/flags/android/chrome_feature_list.cc +++ b/chrome/browser/flags/android/chrome_feature_list.cc -@@ -180,6 +180,7 @@ const base::Feature* const kFeaturesExposedToJava[] = { +@@ -191,6 +191,7 @@ const base::Feature* const kFeaturesExposedToJava[] = { &kClearOmniboxFocusAfterNavigation, &kCloseTabSuggestions, &kCloseTabSaveTabList, @@ -1442,34 +1374,10 @@ index e58da3d35ab47..1ba904380664c 100644 &kCriticalPersistedTabData, &kCreateNewTabInitializeRenderer, &kCCTBackgroundTab, -@@ -1173,5 +1174,10 @@ BASE_FEATURE(kWebApkTrampolineOnInitialIntent, - "WebApkTrampolineOnInitialIntent", - base::FEATURE_ENABLED_BY_DEFAULT); - -+// disabled by default because of an issue on Android 6.0 -+BASE_FEATURE(kBookmarksExportUseSaf, -+ "BookmarksExportUseSaf", -+ base::FEATURE_DISABLED_BY_DEFAULT); -+ - } // namespace android - } // namespace chrome -diff --git a/chrome/browser/flags/android/chrome_feature_list.h b/chrome/browser/flags/android/chrome_feature_list.h -index 44589bd86f5fa..2da7d473a4652 100644 ---- a/chrome/browser/flags/android/chrome_feature_list.h -+++ b/chrome/browser/flags/android/chrome_feature_list.h -@@ -185,6 +185,7 @@ BASE_DECLARE_FEATURE(kTabStripRedesign); - BASE_DECLARE_FEATURE(kTabletToolbarReordering); - BASE_DECLARE_FEATURE(kTabStripStartupRefactoring); - BASE_DECLARE_FEATURE(kTabToGTSAnimation); -+BASE_DECLARE_FEATURE(kBookmarksExportUseSaf); - BASE_DECLARE_FEATURE(kTestDefaultDisabled); - BASE_DECLARE_FEATURE(kTestDefaultEnabled); - BASE_DECLARE_FEATURE(kThumbnailPlaceholder); diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java -index 723da0089d718..b44789bcae8fb 100644 --- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java +++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java -@@ -478,6 +478,7 @@ public abstract class ChromeFeatureList { +@@ -475,6 +475,7 @@ public abstract class ChromeFeatureList { public static final String USE_LIBUNWINDSTACK_NATIVE_UNWINDER_ANDROID = "UseLibunwindstackNativeUnwinderAndroid"; public static final String USER_BYPASS_UI = "UserBypassUI"; @@ -1478,7 +1386,6 @@ index 723da0089d718..b44789bcae8fb 100644 public static final String VOICE_SEARCH_AUDIO_CAPTURE_POLICY = "VoiceSearchAudioCapturePolicy"; public static final String WEBNOTES_STYLIZE = "WebNotesStylize"; diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc -index 8196f333154dc..7904c2e93ff63 100644 --- a/chrome/browser/importer/profile_writer.cc +++ b/chrome/browser/importer/profile_writer.cc @@ -106,12 +106,14 @@ void ProfileWriter::AddHistoryPage(const history::URLRows& page, @@ -1514,7 +1421,6 @@ index 8196f333154dc..7904c2e93ff63 100644 // If the bookmark bar is currently empty, we should import directly to it. diff --git a/chrome/browser/importer/profile_writer.h b/chrome/browser/importer/profile_writer.h -index fd2612fcc9e3f..febf804edc41f 100644 --- a/chrome/browser/importer/profile_writer.h +++ b/chrome/browser/importer/profile_writer.h @@ -11,6 +11,7 @@ @@ -1538,10 +1444,9 @@ index fd2612fcc9e3f..febf804edc41f 100644 // Adds the TemplateURLs in |template_urls| to the local store. diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java -index c7618ba0989cb..8596c3022dcb3 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java -@@ -108,6 +108,8 @@ public final class ChromePreferenceKeys { +@@ -101,6 +101,8 @@ public final class ChromePreferenceKeys { "enhanced_bookmark_last_used_parent_folder"; public static final String BOOKMARKS_SORT_ORDER = "Chrome.Bookmarks.BookmarkRowSortOrder"; public static final String BOOKMARKS_VISUALS_PREF = "Chrome.Bookmarks.BookmarkRowDisplay"; @@ -1550,7 +1455,7 @@ index c7618ba0989cb..8596c3022dcb3 100644 /** * Whether Chrome is set as the default browser. -@@ -982,6 +984,7 @@ public final class ChromePreferenceKeys { +@@ -992,6 +994,7 @@ public final class ChromePreferenceKeys { AUTOFILL_ASSISTANT_PROACTIVE_HELP_ENABLED, APP_LAUNCH_LAST_KNOWN_ACTIVE_TAB_STATE, APP_LAUNCH_SEARCH_ENGINE_HAD_LOGO, @@ -1559,7 +1464,6 @@ index c7618ba0989cb..8596c3022dcb3 100644 BLUETOOTH_NOTIFICATION_IDS, BOOKMARKS_SORT_ORDER, diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd -index 1a25be398a062..bf095f7de2c72 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd @@ -245,6 +245,24 @@ CHAR_LIMIT guidelines: @@ -1588,10 +1492,9 @@ index 1a25be398a062..bf095f7de2c72 100644 Virtual Reality diff --git a/chrome/common/BUILD.gn b/chrome/common/BUILD.gn -index 8a88d4bbde3f0..d7a0c22ed17e4 100644 --- a/chrome/common/BUILD.gn +++ b/chrome/common/BUILD.gn -@@ -397,6 +397,9 @@ static_library("common_lib") { +@@ -402,6 +402,9 @@ static_library("common_lib") { sources += [ "media/chrome_media_drm_bridge_client.cc", "media/chrome_media_drm_bridge_client.h", @@ -1602,7 +1505,6 @@ index 8a88d4bbde3f0..d7a0c22ed17e4 100644 } else { # Non-Android. diff --git a/chrome/utility/BUILD.gn b/chrome/utility/BUILD.gn -index bf29364c22715..648aed296e74e 100644 --- a/chrome/utility/BUILD.gn +++ b/chrome/utility/BUILD.gn @@ -85,8 +85,6 @@ static_library("utility") { @@ -1614,7 +1516,7 @@ index bf29364c22715..648aed296e74e 100644 "importer/bookmarks_file_importer.cc", "importer/bookmarks_file_importer.h", "importer/external_process_importer_bridge.cc", -@@ -215,6 +213,11 @@ static_library("utility") { +@@ -218,6 +216,11 @@ static_library("utility") { ] } @@ -1627,7 +1529,6 @@ index bf29364c22715..648aed296e74e 100644 if (!is_chromeos && use_nss_certs) { sources += [ diff --git a/chrome/utility/importer/bookmark_html_reader.cc b/chrome/utility/importer/bookmark_html_reader.cc -index 81985a8417569..d819074feffdf 100644 --- a/chrome/utility/importer/bookmark_html_reader.cc +++ b/chrome/utility/importer/bookmark_html_reader.cc @@ -17,7 +17,9 @@ @@ -1656,7 +1557,7 @@ index 81985a8417569..d819074feffdf 100644 } // namespace -@@ -105,14 +109,28 @@ static std::string stripDt(const std::string& lineDt) { +@@ -105,14 +109,29 @@ static std::string stripDt(const std::string& lineDt) { } void ImportBookmarksFile( @@ -1675,7 +1576,8 @@ index 81985a8417569..d819074feffdf 100644 + return; + } + -+ ImportBookmarksFile(cancellation_callback, valid_url_callback, content, bookmarks, search_engines, favicons); ++ ImportBookmarksFile(cancellation_callback, valid_url_callback, ++ content, bookmarks, search_engines, favicons); +} + +void ImportBookmarksFile( @@ -1688,7 +1590,7 @@ index 81985a8417569..d819074feffdf 100644 std::vector lines = base::SplitString( content, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); -@@ -125,6 +143,7 @@ void ImportBookmarksFile( +@@ -125,6 +144,7 @@ void ImportBookmarksFile( std::vector path; size_t toolbar_folder_index = 0; std::string charset = "UTF-8"; // If no charset is specified, assume utf-8. @@ -1696,7 +1598,7 @@ index 81985a8417569..d819074feffdf 100644 for (size_t i = 0; i < lines.size() && (cancellation_callback.is_null() || !cancellation_callback.Run()); -@@ -217,10 +236,12 @@ void ImportBookmarksFile( +@@ -217,10 +237,12 @@ void ImportBookmarksFile( } bookmarks->push_back(entry); @@ -1710,7 +1612,6 @@ index 81985a8417569..d819074feffdf 100644 continue; } diff --git a/chrome/utility/importer/bookmark_html_reader.h b/chrome/utility/importer/bookmark_html_reader.h -index cc2532b6e0c46..8f29e4b2fc6d0 100644 --- a/chrome/utility/importer/bookmark_html_reader.h +++ b/chrome/utility/importer/bookmark_html_reader.h @@ -50,6 +50,14 @@ void ImportBookmarksFile( @@ -1729,7 +1630,6 @@ index cc2532b6e0c46..8f29e4b2fc6d0 100644 // has replacement terms. Chrome treats such bookmarks as search engines rather // than true bookmarks. diff --git a/components/headless/select_file_dialog/headless_select_file_dialog.cc b/components/headless/select_file_dialog/headless_select_file_dialog.cc -index e65d1b291dc2f..63fdce51456d6 100644 --- a/components/headless/select_file_dialog/headless_select_file_dialog.cc +++ b/components/headless/select_file_dialog/headless_select_file_dialog.cc @@ -58,6 +58,10 @@ class HeadlessSelectFileDialog : public ui::SelectFileDialog { @@ -1743,8 +1643,39 @@ index e65d1b291dc2f..63fdce51456d6 100644 SelectFileDialogCallback callback_; }; +diff --git a/cromite_flags/chrome/browser/about_flags_cc/add-bookmark-import-export-actions.inc b/cromite_flags/chrome/browser/about_flags_cc/add-bookmark-import-export-actions.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/add-bookmark-import-export-actions.inc +@@ -0,0 +1,12 @@ ++#ifdef FLAG_SECTION ++ ++#if BUILDFLAG(IS_ANDROID) ++ {"export-bookmarks-use-saf", ++ "Use saf for bookmarks export", ++ "When enabled user can choose where save the exported bookmarks " ++ "file.", kOsAndroid, ++ FEATURE_VALUE_TYPE( ++ chrome::android::kBookmarksExportUseSaf)}, ++#endif ++ ++#endif +diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-bookmark-import-export-actions.inc b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-bookmark-import-export-actions.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-bookmark-import-export-actions.inc +@@ -0,0 +1,4 @@ ++// disabled by default because of an issue on Android 6.0 ++CROMITE_FEATURE(kBookmarksExportUseSaf, ++ "BookmarksExportUseSaf", ++ base::FEATURE_DISABLED_BY_DEFAULT); +diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/add-bookmark-import-export-actions.inc b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/add-bookmark-import-export-actions.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_h/add-bookmark-import-export-actions.inc +@@ -0,0 +1 @@ ++BASE_DECLARE_FEATURE(kBookmarksExportUseSaf); diff --git a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java -index 2124835b7aeaa..523fe81551eaf 100644 --- a/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java +++ b/ui/android/java/src/org/chromium/ui/base/SelectFileDialog.java @@ -45,6 +45,7 @@ import org.chromium.base.task.AsyncTask; @@ -1763,7 +1694,7 @@ index 2124835b7aeaa..523fe81551eaf 100644 private static final String AUDIO_TYPE = "audio"; private static final String ALL_TYPES = "*/*"; -@@ -264,6 +266,11 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, PhotoPick +@@ -306,6 +308,11 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, PhotoPick ResettersForTesting.register(() -> mFileTypes = oldValue); } @@ -1775,7 +1706,7 @@ index 2124835b7aeaa..523fe81551eaf 100644 /** * Creates and starts an intent based on the passed fileTypes and capture value. * @param fileTypes MIME types requested (i.e. "image/*") -@@ -290,7 +297,7 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, PhotoPick +@@ -332,7 +339,7 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, PhotoPick List missingPermissions = new ArrayList<>(); String storagePermission = Manifest.permission.READ_EXTERNAL_STORAGE; boolean shouldUsePhotoPicker = shouldUsePhotoPicker(); @@ -1784,7 +1715,7 @@ index 2124835b7aeaa..523fe81551eaf 100644 // The permission scenario for accessing media has evolved a bit over the years: // Early on, READ_EXTERNAL_STORAGE was required to access media, but that permission was // later deprecated. In its place (starting with Android T) READ_MEDIA_IMAGES and -@@ -339,7 +346,7 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, PhotoPick +@@ -381,7 +388,7 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, PhotoPick } // TODO(finnur): Remove once we figure out the cause of crbug.com/950024. @@ -1793,7 +1724,7 @@ index 2124835b7aeaa..523fe81551eaf 100644 if (permissions.length != requestPermissions.length) { throw new RuntimeException( String.format("Permissions arrays misaligned: %d != %d", -@@ -353,7 +360,7 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, PhotoPick +@@ -395,7 +402,7 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, PhotoPick } } @@ -1802,7 +1733,7 @@ index 2124835b7aeaa..523fe81551eaf 100644 if (permissions[i].equals(storagePermission) || permissions[i].equals(Manifest.permission.READ_MEDIA_IMAGES) || permissions[i].equals( -@@ -630,6 +637,7 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, PhotoPick +@@ -672,6 +679,7 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, PhotoPick } if (!mimeTypes.contains(mimeType)) mimeTypes.add(mimeType); } @@ -1810,7 +1741,7 @@ index 2124835b7aeaa..523fe81551eaf 100644 return mimeTypes; } -@@ -958,6 +966,10 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, PhotoPick +@@ -1000,6 +1008,10 @@ public class SelectFileDialog implements WindowAndroid.IntentCallback, PhotoPick return countAcceptTypesFor(superType) == mFileTypes.size(); } @@ -1822,7 +1753,6 @@ index 2124835b7aeaa..523fe81551eaf 100644 * Checks whether the list of accepted types effectively describes only a single * type, which might be wildcard. For example: diff --git a/ui/android/java/strings/android_ui_strings.grd b/ui/android/java/strings/android_ui_strings.grd -index 57c783e27d97f..a1c563158daa6 100644 --- a/ui/android/java/strings/android_ui_strings.grd +++ b/ui/android/java/strings/android_ui_strings.grd @@ -184,6 +184,9 @@ @@ -1836,10 +1766,9 @@ index 57c783e27d97f..a1c563158daa6 100644 diff --git a/ui/shell_dialogs/select_file_dialog.h b/ui/shell_dialogs/select_file_dialog.h -index 780665236e418..283119e777075 100644 --- a/ui/shell_dialogs/select_file_dialog.h +++ b/ui/shell_dialogs/select_file_dialog.h -@@ -211,6 +211,8 @@ class SHELL_DIALOGS_EXPORT SelectFileDialog +@@ -213,6 +213,8 @@ class SHELL_DIALOGS_EXPORT SelectFileDialog const GURL* caller = nullptr); bool HasMultipleFileTypeChoices(); @@ -1849,7 +1778,6 @@ index 780665236e418..283119e777075 100644 friend class base::RefCountedThreadSafe; diff --git a/ui/shell_dialogs/select_file_dialog_android.cc b/ui/shell_dialogs/select_file_dialog_android.cc -index f6384f36a7436..1ac2e911cea8b 100644 --- a/ui/shell_dialogs/select_file_dialog_android.cc +++ b/ui/shell_dialogs/select_file_dialog_android.cc @@ -142,6 +142,12 @@ void SelectFileDialogImpl::SelectFileImpl( @@ -1866,7 +1794,6 @@ index f6384f36a7436..1ac2e911cea8b 100644 JNIEnv* env = base::android::AttachCurrentThread(); Java_SelectFileDialog_nativeDestroyed(env, java_object_); diff --git a/ui/shell_dialogs/select_file_dialog_android.h b/ui/shell_dialogs/select_file_dialog_android.h -index c5bc6ac23f582..fe6acdfdcbd15 100644 --- a/ui/shell_dialogs/select_file_dialog_android.h +++ b/ui/shell_dialogs/select_file_dialog_android.h @@ -58,6 +58,8 @@ class SelectFileDialogImpl : public SelectFileDialog { @@ -1878,8 +1805,33 @@ index c5bc6ac23f582..fe6acdfdcbd15 100644 protected: ~SelectFileDialogImpl() override; +diff --git a/ui/shell_dialogs/select_file_dialog_linux.cc b/ui/shell_dialogs/select_file_dialog_linux.cc +--- a/ui/shell_dialogs/select_file_dialog_linux.cc ++++ b/ui/shell_dialogs/select_file_dialog_linux.cc +@@ -31,6 +31,10 @@ void SelectFileDialogLinux::ListenerDestroyed() { + listener_ = nullptr; + } + ++void SelectFileDialogLinux::ShowToast(const std::string& message) { ++ // nothing to do, used only on android ++} ++ + bool SelectFileDialogLinux::CallDirectoryExistsOnUIThread( + const base::FilePath& path) { + base::ScopedAllowBlocking scoped_allow_blocking; +diff --git a/ui/shell_dialogs/select_file_dialog_linux.h b/ui/shell_dialogs/select_file_dialog_linux.h +--- a/ui/shell_dialogs/select_file_dialog_linux.h ++++ b/ui/shell_dialogs/select_file_dialog_linux.h +@@ -33,6 +33,8 @@ class SHELL_DIALOGS_EXPORT SelectFileDialogLinux : public SelectFileDialog { + // BaseShellDialog implementation. + void ListenerDestroyed() override; + ++ void ShowToast(const std::string& message) override; ++ + protected: + explicit SelectFileDialogLinux(Listener* listener, + std::unique_ptr policy); diff --git a/ui/shell_dialogs/select_file_dialog_win.cc b/ui/shell_dialogs/select_file_dialog_win.cc -index 04aa920d91675..1f5560ccabdca 100644 --- a/ui/shell_dialogs/select_file_dialog_win.cc +++ b/ui/shell_dialogs/select_file_dialog_win.cc @@ -193,6 +193,7 @@ class SelectFileDialogImpl : public ui::SelectFileDialog, @@ -1901,6 +1853,5 @@ index 04aa920d91675..1f5560ccabdca 100644 bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow owning_window) const { if (!owning_window->GetRootWindow()) return false; --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-custom-tab-intents-privacy-option.patch b/build/bromite_patches/Add-custom-tab-intents-privacy-option.patch index a56b63019425453d3b797c81c701036b066eaf27..10a81604ad3c882f340d69a38c217c566d4dd55a 100644 --- a/build/bromite_patches/Add-custom-tab-intents-privacy-option.patch +++ b/build/bromite_patches/Add-custom-tab-intents-privacy-option.patch @@ -1,7 +1,6 @@ -From dacc97850347a564244d243d0ceda0be3043f3c4 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Wed, 29 Aug 2018 11:03:44 +0200 -Subject: [PATCH 067/192] Add custom tab intents privacy option +Subject: Add custom tab intents privacy option Add custom tab intents privacy option and force open external links in incognito flag. @@ -16,17 +15,17 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../browser/LaunchIntentDispatcher.java | 21 ++++++++++++++++ .../IncognitoCustomTabIntentDataProvider.java | 6 +++++ .../privacy/settings/PrivacySettings.java | 24 +++++++++++++++++++ - .../flags/android/chrome_feature_list.cc | 6 ++--- .../chrome/browser/tab/TabAssociatedApp.java | 6 ++++- .../strings/android_chrome_strings.grd | 14 +++++++++++ - .../core/common/language_experiments.cc | 4 ++-- - 8 files changed, 85 insertions(+), 6 deletions(-) + .../core/common/language_experiments.cc | 1 + + .../add-custom-tab-intents-privacy-option.inc | 2 ++ + 8 files changed, 83 insertions(+), 1 deletion(-) + create mode 100644 cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-custom-tab-intents-privacy-option.inc diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml -index 68b5042d47935..bb0c084bca718 100644 --- a/chrome/android/java/res/xml/privacy_preferences.xml +++ b/chrome/android/java/res/xml/privacy_preferences.xml -@@ -68,6 +68,16 @@ found in the LICENSE file. +@@ -74,6 +74,16 @@ found in the LICENSE file. android:fragment="org.chromium.chrome.browser.privacy.settings.DoNotTrackSettings" android:key="do_not_track" android:title="@string/do_not_track_title"/> @@ -44,10 +43,9 @@ index 68b5042d47935..bb0c084bca718 100644 android:key="privacy_sandbox" android:title="@string/prefs_privacy_sandbox" diff --git a/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java b/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java -index 0fa028c6563c2..f07514c71d290 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/LaunchIntentDispatcher.java -@@ -52,6 +52,9 @@ import java.lang.annotation.Retention; +@@ -55,6 +55,9 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.Set; @@ -57,7 +55,7 @@ index 0fa028c6563c2..f07514c71d290 100644 /** * Dispatches incoming intents to the appropriate activity based on the current configuration and * Intent fired. -@@ -242,6 +245,9 @@ public class LaunchIntentDispatcher implements IntentHandler.IntentHandlerDelega +@@ -246,6 +249,9 @@ public class LaunchIntentDispatcher { */ public static boolean isCustomTabIntent(Intent intent) { if (intent == null) return false; @@ -67,7 +65,7 @@ index 0fa028c6563c2..f07514c71d290 100644 if (CustomTabsIntent.shouldAlwaysUseBrowserUI(intent) || !intent.hasExtra(CustomTabsIntent.EXTRA_SESSION)) { return false; -@@ -261,6 +267,10 @@ public class LaunchIntentDispatcher implements IntentHandler.IntentHandlerDelega +@@ -265,6 +271,10 @@ public class LaunchIntentDispatcher { newIntent.setData(uri); newIntent.setClassName(context, CustomTabActivity.class.getName()); @@ -78,7 +76,7 @@ index 0fa028c6563c2..f07514c71d290 100644 // Since configureIntentForResizableCustomTab() might change the componenet/class // associated with the passed intent, it needs to be called after #setClassName(context, // CustomTabActivity.class.getName()); -@@ -407,6 +417,17 @@ public class LaunchIntentDispatcher implements IntentHandler.IntentHandlerDelega +@@ -411,6 +421,17 @@ public class LaunchIntentDispatcher { if (Intent.ACTION_VIEW.equals(newIntent.getAction()) && !IntentHandler.wasIntentSenderChrome(newIntent)) { @@ -97,7 +95,6 @@ index 0fa028c6563c2..f07514c71d290 100644 newIntent.putExtra(IntentHandler.EXTRA_STARTED_TABBED_CHROME_TASK, true); } diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java -index e73e3525788d9..b7cd3731d9f41 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/IncognitoCustomTabIntentDataProvider.java @@ -38,6 +38,9 @@ import org.chromium.components.browser_ui.widget.TintedDrawable; @@ -121,12 +118,11 @@ index e73e3525788d9..b7cd3731d9f41 100644 } diff --git a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java -index a6e901bb87980..e2efe95eb3723 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/privacy/settings/PrivacySettings.java -@@ -103,6 +103,9 @@ public class PrivacySettings extends PreferenceFragmentCompat - private HelpAndFeedbackLauncher mHelpAndFeedbackLauncher; - private Profile mProfile; +@@ -97,6 +97,9 @@ public class PrivacySettings + private ManagedPreferenceDelegate mManagedPreferenceDelegate; + private IncognitoLockSettings mIncognitoLockSettings; + private ChromeSwitchPreference allowCustomTabIntentsPref; + private ChromeSwitchPreference openExternalLinksPref; @@ -134,7 +130,7 @@ index a6e901bb87980..e2efe95eb3723 100644 @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { getActivity().setTitle(R.string.prefs_privacy_security); -@@ -246,6 +249,9 @@ public class PrivacySettings extends PreferenceFragmentCompat +@@ -247,6 +250,9 @@ public class PrivacySettings new SpanApplier.SpanInfo("", "", servicesLink)); } @@ -144,9 +140,9 @@ index a6e901bb87980..e2efe95eb3723 100644 @Override public boolean onPreferenceChange(Preference preference, Object newValue) { String key = preference.getKey(); -@@ -260,6 +266,14 @@ public class PrivacySettings extends PreferenceFragmentCompat +@@ -263,6 +269,14 @@ public class PrivacySettings } else if (PREF_SEARCH_SUGGESTIONS.equals(key)) { - UserPrefs.get(Profile.getLastUsedRegularProfile()) + UserPrefs.get(getProfile()) .setBoolean(Pref.SEARCH_SUGGEST_ENABLED, (boolean) newValue); + } else if (PREF_ALLOW_CUSTOM_TAB_INTENTS.equals(key)) { + SharedPreferences.Editor sharedPreferencesEditor = ContextUtils.getAppSharedPreferences().edit(); @@ -159,8 +155,8 @@ index a6e901bb87980..e2efe95eb3723 100644 } return true; } -@@ -283,6 +297,16 @@ public class PrivacySettings extends PreferenceFragmentCompat - UserPrefs.get(mProfile).getBoolean(Pref.CAN_MAKE_PAYMENT_ENABLED)); +@@ -287,6 +301,16 @@ public class PrivacySettings + UserPrefs.get(getProfile()).getBoolean(Pref.CAN_MAKE_PAYMENT_ENABLED)); } + allowCustomTabIntentsPref = @@ -175,33 +171,8 @@ index a6e901bb87980..e2efe95eb3723 100644 + Preference doNotTrackPref = findPreference(PREF_DO_NOT_TRACK); if (doNotTrackPref != null) { - doNotTrackPref.setSummary(UserPrefs.get(mProfile).getBoolean(Pref.ENABLE_DO_NOT_TRACK) -diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc -index cf06093694030..7d851dcccf177 100644 ---- a/chrome/browser/flags/android/chrome_feature_list.cc -+++ b/chrome/browser/flags/android/chrome_feature_list.cc -@@ -558,8 +558,8 @@ BASE_FEATURE(kCCTIncognitoAvailableToThirdParty, - base::FEATURE_ENABLED_BY_DEFAULT); // in Bromite - - BASE_FEATURE(kCCTIntentFeatureOverrides, -- "CCTIntentFeatureOverrides", -- base::FEATURE_ENABLED_BY_DEFAULT); -+ "CCTIntentFeatureOverrides", // must be disabled -+ base::FEATURE_DISABLED_BY_DEFAULT); // in Bromite - - BASE_FEATURE(kCCTPageInsightsHub, - "CCTPageInsightsHub", -@@ -567,7 +567,7 @@ BASE_FEATURE(kCCTPageInsightsHub, - - BASE_FEATURE(kCCTPostMessageAPI, - "CCTPostMessageAPI", -- base::FEATURE_ENABLED_BY_DEFAULT); -+ base::FEATURE_DISABLED_BY_DEFAULT); - - BASE_FEATURE(kCCTPrefetchDelayShowOnStart, - "CCTPrefetchDelayShowOnStart", + doNotTrackPref.setSummary( diff --git a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabAssociatedApp.java b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabAssociatedApp.java -index 9ea6ff6d6d85f..16c6a1fd44976 100644 --- a/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabAssociatedApp.java +++ b/chrome/browser/tab/java/src/org/chromium/chrome/browser/tab/TabAssociatedApp.java @@ -84,7 +84,11 @@ public final class TabAssociatedApp extends TabWebContentsUserData implements Im @@ -218,10 +189,9 @@ index 9ea6ff6d6d85f..16c6a1fd44976 100644 return tab.getLaunchType() == TabLaunchType.FROM_EXTERNAL_APP && !TextUtils.equals(app.getAppId(), packageName); diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd -index efe12c746f899..81cf2c14f3339 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd -@@ -5087,6 +5087,20 @@ To change this setting, <resetlink>reset sync

<resetlink>reset sync

Resume @@ -243,20 +213,20 @@ index efe12c746f899..81cf2c14f3339 100644 Show your Chrome activity in Digital Wellbeing? diff --git a/components/language/core/common/language_experiments.cc b/components/language/core/common/language_experiments.cc -index 8846600ff1bd5..300f4bae8f166 100644 --- a/components/language/core/common/language_experiments.cc +++ b/components/language/core/common/language_experiments.cc -@@ -18,8 +18,8 @@ BASE_FEATURE(kContentLanguagesInLanguagePicker, - "ContentLanguagesInLanguagePicker", - base::FEATURE_DISABLED_BY_DEFAULT); - BASE_FEATURE(kCctAutoTranslate, -- "CCTAutoTranslate", -- base::FEATURE_ENABLED_BY_DEFAULT); -+ "CCTAutoTranslate", // Always disabled -+ base::FEATURE_DISABLED_BY_DEFAULT); // in Bromite - +@@ -24,4 +24,5 @@ BASE_FEATURE(kCctAutoTranslate, // Params: const char kContentLanguagesDisableObserversParam[] = "disable_observers"; --- -2.34.1 - + ++SET_CROMITE_FEATURE_DISABLED(kCctAutoTranslate); + } // namespace language +diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-custom-tab-intents-privacy-option.inc b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-custom-tab-intents-privacy-option.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/add-custom-tab-intents-privacy-option.inc +@@ -0,0 +1,2 @@ ++SET_CROMITE_FEATURE_DISABLED(kCCTIntentFeatureOverrides); ++SET_CROMITE_FEATURE_DISABLED(kCCTPostMessageAPI); +-- +2.25.1 diff --git a/build/bromite_patches/Add-exit-menu-item.patch b/build/bromite_patches/Add-exit-menu-item.patch index 7397d49a9c34ed8b9bdc67168195f01c0c48446c..a4861472cea24f10ff0f0d1356a08d0328b6616c 100644 --- a/build/bromite_patches/Add-exit-menu-item.patch +++ b/build/bromite_patches/Add-exit-menu-item.patch @@ -1,7 +1,6 @@ -From 8d1a9ef8978784037f4667ca43c3c47f724c2d96 Mon Sep 17 00:00:00 2001 From: Serg Date: Tue, 31 Jan 2017 22:12:27 -0500 -Subject: [PATCH 054/192] Add exit menu item +Subject: Add exit menu item Corrected Exit functionality @@ -16,10 +15,9 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html 6 files changed, 26 insertions(+), 1 deletion(-) diff --git a/chrome/android/java/res/menu/main_menu.xml b/chrome/android/java/res/menu/main_menu.xml -index 89e85421d844e..ff60ec8ddf5f5 100644 --- a/chrome/android/java/res/menu/main_menu.xml +++ b/chrome/android/java/res/menu/main_menu.xml -@@ -161,6 +161,9 @@ found in the LICENSE file. +@@ -163,6 +163,9 @@ found in the LICENSE file. @@ -29,7 +27,7 @@ index 89e85421d844e..ff60ec8ddf5f5 100644 -@@ -187,6 +190,9 @@ found in the LICENSE file. +@@ -189,6 +192,9 @@ found in the LICENSE file. @@ -40,7 +38,6 @@ index 89e85421d844e..ff60ec8ddf5f5 100644 diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ApplicationLifetime.java b/chrome/android/java/src/org/chromium/chrome/browser/ApplicationLifetime.java -index 38987c86b46d9..7ba324967588f 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ApplicationLifetime.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ApplicationLifetime.java @@ -6,6 +6,7 @@ package org.chromium.chrome.browser; @@ -60,10 +57,9 @@ index 38987c86b46d9..7ba324967588f 100644 observer.onTerminate(restart); } diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -index 2aa6ab6379d63..267f8c441ea51 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -@@ -229,6 +229,8 @@ import java.util.Locale; +@@ -236,6 +236,8 @@ import java.util.Locale; import java.util.Set; import java.util.concurrent.atomic.AtomicBoolean; @@ -72,7 +68,7 @@ index 2aa6ab6379d63..267f8c441ea51 100644 /** * This is the main activity for ChromeMobile when not running in document mode. All the tabs * are accessible via a chrome specific tab switching UI. -@@ -2265,6 +2267,8 @@ public class ChromeTabbedActivity extends ChromeActivity +@@ -2391,6 +2392,11 @@ public abstract class ChromeActivity return true; } @@ -106,7 +101,6 @@ index 07541d1c0e73d..dcba20cd2f282 100644 UpdateMenuItemHelper.getInstance().onMenuItemClicked(this); return true; diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeLifetimeController.java b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeLifetimeController.java -index 85548428958f9..93379024a0d94 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeLifetimeController.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeLifetimeController.java @@ -82,7 +82,11 @@ class ChromeLifetimeController implements ApplicationLifetime.Observer, @@ -123,10 +117,9 @@ index 85548428958f9..93379024a0d94 100644 @Override diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd -index 2e03f7dacec79..1a25be398a062 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd -@@ -3741,6 +3741,9 @@ To change this setting, <resetlink>reset sync

<resetlink>reset sync

Dark theme @@ -136,6 +129,5 @@ index 2e03f7dacec79..1a25be398a062 100644 Appearance --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-flag-for-omnibox-autocomplete-filtering.patch b/build/bromite_patches/Add-flag-for-omnibox-autocomplete-filtering.patch index 3529b284452da8fda6fd36ee9fd9c219a31ab74f..1355753c9033432c677bab57b7259c023235e50e 100644 --- a/build/bromite_patches/Add-flag-for-omnibox-autocomplete-filtering.patch +++ b/build/bromite_patches/Add-flag-for-omnibox-autocomplete-filtering.patch @@ -1,62 +1,21 @@ -From 1fcad47a0f26587b8b6150685dd34335fad1cc6c Mon Sep 17 00:00:00 2001 From: Blaise Date: Sat, 22 Aug 2020 08:52:40 -0500 -Subject: [PATCH 132/192] Add flag for omnibox autocomplete filtering +Subject: Add flag for omnibox autocomplete filtering Adds a flag that restricts whether search history, clipboard, bookmarks and internal chrome:// pages will be used for the autocomplete results. License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - chrome/browser/about_flags.cc | 22 ++++++++++++++++++- - .../browser/autocomplete_controller.cc | 10 +++++++++ - .../omnibox/browser/history_url_provider.cc | 3 +++ - components/omnibox/browser/search_provider.cc | 4 ++++ - components/url_formatter/url_fixer.cc | 4 ++++ - 5 files changed, 42 insertions(+), 1 deletion(-) + .../browser/autocomplete_controller.cc | 10 ++++++ + .../omnibox/browser/history_url_provider.cc | 3 ++ + components/omnibox/browser/search_provider.cc | 4 +++ + components/url_formatter/url_fixer.cc | 4 +++ + ...lag-for-omnibox-autocomplete-filtering.inc | 32 +++++++++++++++++++ + 5 files changed, 53 insertions(+) + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/Add-flag-for-omnibox-autocomplete-filtering.inc -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index cde019cdb2851..75e4850949020 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -589,6 +589,22 @@ const FeatureEntry::FeatureVariation kReaderModeDiscoverabilityVariations[] = { - #endif // BUILDFLAG(IS_ANDROID) - - #if BUILDFLAG(IS_ANDROID) -+const FeatureEntry::Choice kOmniboxAutocompleteFiltering[] = { -+ {flags_ui::kGenericExperimentChoiceDefault, "", ""}, -+ {"Search suggestions only", -+ "omnibox-autocomplete-filtering", -+ "search"}, -+ {"Search suggestions and bookmarks", -+ "omnibox-autocomplete-filtering", -+ "search-bookmarks"}, -+ {"Search suggestions and internal chrome pages", -+ "omnibox-autocomplete-filtering", -+ "search-chrome"}, -+ {"Search suggestions, bookmarks, and internal chrome pages", -+ "omnibox-autocomplete-filtering", -+ "search-bookmarks-chrome"}, -+}; -+ - const FeatureEntry::FeatureParam kAdaptiveButton_AlwaysNone[] = { - {"mode", "always-none"}}; - const FeatureEntry::FeatureParam kAdaptiveButton_AlwaysNewTab[] = { -@@ -4701,7 +4717,11 @@ const FeatureEntry kFeatureEntries[] = { - kOsMac | kOsLinux | kOsWin, - FEATURE_VALUE_TYPE(features::kSystemNotifications)}, - #endif // BUILDFLAG(ENABLE_SYSTEM_NOTIFICATIONS) && !BUILDFLAG(IS_CHROMEOS_ASH) --#if BUILDFLAG(IS_ANDROID) -+#if BUILDFLAG(IS_ANDROID) // Bromite autocomplete filtering -+ {"omnibox-autocomplete-filtering", -+ "Omnibox Autocomplete Filtering", -+ "Restrict omnibox autocomplete results to a combination of search suggestions (if enabled), bookmarks, and internal chrome pages.", -+ kOsAll, MULTI_VALUE_TYPE(kOmniboxAutocompleteFiltering)}, - {"adaptive-button-in-top-toolbar", - flag_descriptions::kAdaptiveButtonInTopToolbarName, - flag_descriptions::kAdaptiveButtonInTopToolbarDescription, kOsAndroid, diff --git a/components/omnibox/browser/autocomplete_controller.cc b/components/omnibox/browser/autocomplete_controller.cc -index 1af55724187f0..dd1d6b8713493 100644 --- a/components/omnibox/browser/autocomplete_controller.cc +++ b/components/omnibox/browser/autocomplete_controller.cc @@ -18,6 +18,7 @@ @@ -67,7 +26,7 @@ index 1af55724187f0..dd1d6b8713493 100644 #include "base/feature_list.h" #include "base/format_macros.h" #include "base/functional/bind.h" -@@ -366,6 +367,15 @@ AutocompleteController::AutocompleteController( +@@ -305,6 +306,15 @@ AutocompleteController::AutocompleteController( provider_client_->GetOmniboxTriggeredFeatureService()), steady_state_omnibox_position_( metrics::OmniboxEventProto::UNKNOWN_POSITION) { @@ -84,7 +43,6 @@ index 1af55724187f0..dd1d6b8713493 100644 // Providers run in the order they're added. Async providers should run first diff --git a/components/omnibox/browser/history_url_provider.cc b/components/omnibox/browser/history_url_provider.cc -index 471a49da4421e..e586f793a2459 100644 --- a/components/omnibox/browser/history_url_provider.cc +++ b/components/omnibox/browser/history_url_provider.cc @@ -478,6 +478,9 @@ void HistoryURLProvider::Start(const AutocompleteInput& input, @@ -98,7 +56,6 @@ index 471a49da4421e..e586f793a2459 100644 history::HistoryService* const history_service = client()->GetHistoryService(); diff --git a/components/omnibox/browser/search_provider.cc b/components/omnibox/browser/search_provider.cc -index a385686403d8a..c686720ef0ade 100644 --- a/components/omnibox/browser/search_provider.cc +++ b/components/omnibox/browser/search_provider.cc @@ -12,6 +12,7 @@ @@ -120,7 +77,6 @@ index a385686403d8a..c686720ef0ade 100644 // we still have the last results and don't need to do anything. if (minimal_changes) diff --git a/components/url_formatter/url_fixer.cc b/components/url_formatter/url_fixer.cc -index 3db922698161e..1fa79fc8eef3a 100644 --- a/components/url_formatter/url_fixer.cc +++ b/components/url_formatter/url_fixer.cc @@ -7,6 +7,8 @@ @@ -141,6 +97,42 @@ index 3db922698161e..1fa79fc8eef3a 100644 url.append(kChromeUIDefaultHost); FixupPort(trimmed, parts.port, &url); FixupPath(trimmed, parts.path, &url); --- -2.34.1 - +diff --git a/cromite_flags/chrome/browser/about_flags_cc/Add-flag-for-omnibox-autocomplete-filtering.inc b/cromite_flags/chrome/browser/about_flags_cc/Add-flag-for-omnibox-autocomplete-filtering.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/Add-flag-for-omnibox-autocomplete-filtering.inc +@@ -0,0 +1,32 @@ ++#if BUILDFLAG(IS_ANDROID) ++ ++#ifdef FEATURE_PARAM_SECTION ++ ++const FeatureEntry::Choice kOmniboxAutocompleteFiltering[] = { ++ {flags_ui::kGenericExperimentChoiceDefault, "", ""}, ++ {"Search suggestions only", ++ "omnibox-autocomplete-filtering", ++ "search"}, ++ {"Search suggestions and bookmarks", ++ "omnibox-autocomplete-filtering", ++ "search-bookmarks"}, ++ {"Search suggestions and internal chrome pages", ++ "omnibox-autocomplete-filtering", ++ "search-chrome"}, ++ {"Search suggestions, bookmarks, and internal chrome pages", ++ "omnibox-autocomplete-filtering", ++ "search-bookmarks-chrome"}, ++}; ++ ++#endif ++ ++#ifdef FLAG_SECTION ++ ++ {"omnibox-autocomplete-filtering", ++ "Omnibox Autocomplete Filtering", ++ "Restrict omnibox autocomplete results to a combination of search suggestions (if enabled), bookmarks, and internal chrome pages.", ++ kOsAll, MULTI_VALUE_TYPE(kOmniboxAutocompleteFiltering)}, ++ ++#endif ++ ++#endif +-- +2.25.1 diff --git a/build/bromite_patches/Add-flag-for-save-data-header.patch b/build/bromite_patches/Add-flag-for-save-data-header.patch index b8d3eda9d25f5c615b98e25219c0360be3958317..3bdc1e9fa35373ff6f2617b6fc2aa3803624700f 100644 --- a/build/bromite_patches/Add-flag-for-save-data-header.patch +++ b/build/bromite_patches/Add-flag-for-save-data-header.patch @@ -1,65 +1,19 @@ -From e0497105e85dbffca54704f8a885267c6432cf45 Mon Sep 17 00:00:00 2001 From: Wengling Chen Date: Mon, 1 Feb 2021 19:18:55 +0200 -Subject: [PATCH 159/192] Add flag for save-data-header +Subject: Add flag for save-data-header License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - chrome/browser/about_flags.cc | 5 ++++- - chrome/browser/flag_descriptions.cc | 4 ++++ - chrome/browser/flag_descriptions.h | 3 +++ - .../browser/loader/browser_initiated_resource_request.cc | 8 ++++++++ - services/network/public/cpp/features.cc | 5 +++++ - services/network/public/cpp/features.h | 2 ++ - 6 files changed, 26 insertions(+), 1 deletion(-) + .../loader/browser_initiated_resource_request.cc | 8 ++++++++ + .../about_flags_cc/Add-flag-for-save-data-header.inc | 10 ++++++++++ + .../cpp/features_cc/Add-flag-for-save-data-header.inc | 4 ++++ + .../cpp/features_h/Add-flag-for-save-data-header.inc | 1 + + 4 files changed, 23 insertions(+) + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/Add-flag-for-save-data-header.inc + create mode 100644 cromite_flags/services/network/public/cpp/features_cc/Add-flag-for-save-data-header.inc + create mode 100644 cromite_flags/services/network/public/cpp/features_h/Add-flag-for-save-data-header.inc -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index 9f33b38a77a7f..0006633c72b7b 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -5308,7 +5308,10 @@ const FeatureEntry kFeatureEntries[] = { - {"force-text-direction", flag_descriptions::kForceTextDirectionName, - flag_descriptions::kForceTextDirectionDescription, kOsAll, - MULTI_VALUE_TYPE(kForceTextDirectionChoices)}, --#if BUILDFLAG(IS_ANDROID) -+#if BUILDFLAG(IS_ANDROID) // Bromite save data header -+ {"enable-save-data-header", flag_descriptions::kEnableSaveDataHeaderName, -+ flag_descriptions::kEnableSaveDataHeaderDescription, kOsAndroid, -+ FEATURE_VALUE_TYPE(network::features::kEnableSaveDataHeader)}, - {"force-update-menu-type", flag_descriptions::kUpdateMenuTypeName, - flag_descriptions::kUpdateMenuTypeDescription, kOsAndroid, - MULTI_VALUE_TYPE(kForceUpdateMenuTypeChoices)}, -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index 1a2ef005ff6a8..7b2a885c9a4cc 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -1386,6 +1386,10 @@ const char kDeprecateAltBasedSixPackDescription[] = - "Show deprecation notifications and disable functionality for Alt based " - "six pack deprecations. The Search based versions continue to work."; - -+const char kEnableSaveDataHeaderName[] = "Enable save-data header"; -+const char kEnableSaveDataHeaderDescription[] = -+ "Enable save-data header without enabling Data Saver."; -+ - const char kDeprecateOldKeyboardShortcutsAcceleratorName[] = - "Enable deprecation notifications for Ctrl+Alt+/ to open Keyboard " - "shortcuts app"; -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index 7b062e1f597fd..fb4a3613f4249 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -715,6 +715,9 @@ extern const char kDeprecateAltBasedSixPackDescription[]; - extern const char kDeprecateOldKeyboardShortcutsAcceleratorName[]; - extern const char kDeprecateOldKeyboardShortcutsAcceleratorDescription[]; - -+extern const char kEnableSaveDataHeaderName[]; -+extern const char kEnableSaveDataHeaderDescription[]; -+ - extern const char kMemlogName[]; - extern const char kMemlogDescription[]; - extern const char kMemlogModeMinimal[]; diff --git a/content/browser/loader/browser_initiated_resource_request.cc b/content/browser/loader/browser_initiated_resource_request.cc -index eccf66c36501d..3a517f4d9f103 100644 --- a/content/browser/loader/browser_initiated_resource_request.cc +++ b/content/browser/loader/browser_initiated_resource_request.cc @@ -4,6 +4,9 @@ @@ -86,35 +40,35 @@ index eccf66c36501d..3a517f4d9f103 100644 if (should_update_existing_headers) { headers->RemoveHeader("Save-Data"); } -diff --git a/services/network/public/cpp/features.cc b/services/network/public/cpp/features.cc -index 0538a4f7f55b0..452c66c24ab84 100644 ---- a/services/network/public/cpp/features.cc -+++ b/services/network/public/cpp/features.cc -@@ -13,6 +13,11 @@ - - namespace network::features { - -+// Enable save-data header separately (without enabled data reduction service). -+BASE_FEATURE(kEnableSaveDataHeader, -+ "EnableSaveDataHeader", -+ base::FEATURE_DISABLED_BY_DEFAULT); +diff --git a/cromite_flags/chrome/browser/about_flags_cc/Add-flag-for-save-data-header.inc b/cromite_flags/chrome/browser/about_flags_cc/Add-flag-for-save-data-header.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/Add-flag-for-save-data-header.inc +@@ -0,0 +1,10 @@ + - BASE_FEATURE(kNetworkErrorLogging, - "NetworkErrorLogging", // disabled by default - base::FEATURE_DISABLED_BY_DEFAULT); // in bromite -diff --git a/services/network/public/cpp/features.h b/services/network/public/cpp/features.h -index a24fd57094b72..d4d6967aa8833 100644 ---- a/services/network/public/cpp/features.h -+++ b/services/network/public/cpp/features.h -@@ -89,6 +89,8 @@ extern uint32_t GetLoaderChunkSize(); - COMPONENT_EXPORT(NETWORK_CPP) - BASE_DECLARE_FEATURE(kCorsNonWildcardRequestHeadersSupport); - -+COMPONENT_EXPORT(NETWORK_CPP) BASE_DECLARE_FEATURE(kEnableSaveDataHeader); ++#ifdef FLAG_SECTION + - COMPONENT_EXPORT(NETWORK_CPP) BASE_DECLARE_FEATURE(kNetworkServiceMemoryCache); - - COMPONENT_EXPORT(NETWORK_CPP) BASE_DECLARE_FEATURE(kOmitCorsClientCert); --- -2.34.1 - ++ // Bromite save data header ++ {"enable-save-data-header", ++ "Enable save-data header", ++ "Enable save-data header without enabling Data Saver.", kOsAll, ++ FEATURE_VALUE_TYPE(network::features::kEnableSaveDataHeader)}, ++ ++#endif +diff --git a/cromite_flags/services/network/public/cpp/features_cc/Add-flag-for-save-data-header.inc b/cromite_flags/services/network/public/cpp/features_cc/Add-flag-for-save-data-header.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/services/network/public/cpp/features_cc/Add-flag-for-save-data-header.inc +@@ -0,0 +1,4 @@ ++// Enable save-data header separately (without enabled data reduction service). ++CROMITE_FEATURE(kEnableSaveDataHeader, ++ "EnableSaveDataHeader", ++ base::FEATURE_DISABLED_BY_DEFAULT); +diff --git a/cromite_flags/services/network/public/cpp/features_h/Add-flag-for-save-data-header.inc b/cromite_flags/services/network/public/cpp/features_h/Add-flag-for-save-data-header.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/services/network/public/cpp/features_h/Add-flag-for-save-data-header.inc +@@ -0,0 +1 @@ ++COMPONENT_EXPORT(NETWORK_CPP) BASE_DECLARE_FEATURE(kEnableSaveDataHeader); +-- +2.25.1 diff --git a/build/bromite_patches/Add-flag-to-configure-maximum-connections-per-host.patch b/build/bromite_patches/Add-flag-to-configure-maximum-connections-per-host.patch index 6cbfdeee7fcab343c36d72ef66593c48e0d420f4..b054ea13b7462b9e7c366bb502200fe5d70532f4 100644 --- a/build/bromite_patches/Add-flag-to-configure-maximum-connections-per-host.patch +++ b/build/bromite_patches/Add-flag-to-configure-maximum-connections-per-host.patch @@ -1,7 +1,6 @@ -From f9d09645f620097086fb8d70e944c539995ed6e4 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sun, 8 Jul 2018 22:42:04 +0200 -Subject: [PATCH 058/192] Add flag to configure maximum connections per host +Subject: Add flag to configure maximum connections per host With the introduction of this flag it is possible to increase the maximum allowed connections per host; this can however be detrimental to devices @@ -9,73 +8,16 @@ with limited CPU/memory resources and it is disabled by default. License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - chrome/browser/about_flags.cc | 8 ++++++++ - chrome/browser/flag_descriptions.cc | 4 ++++ - chrome/browser/flag_descriptions.h | 3 +++ .../common/network_features.cc | 3 +++ .../common/network_features.h | 4 ++++ .../common/network_switch_list.h | 4 ++++ .../spoof_checks/top_domains/BUILD.gn | 1 + + ...o-configure-maximum-connections-per-host.inc | 17 +++++++++++++++++ net/socket/client_socket_pool_manager.cc | 17 +++++++++++++++++ - 8 files changed, 44 insertions(+) + 6 files changed, 46 insertions(+) + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/add-flag-to-configure-maximum-connections-per-host.inc -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index 3f5f94ed63936..78c2b1a2de4e7 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -1236,6 +1236,11 @@ const FeatureEntry::Choice kForceColorProfileChoices[] = { - switches::kForceDisplayColorProfile, "hdr10"}, - }; - -+const FeatureEntry::Choice kMaxConnectionsPerHostChoices[] = { -+ {features::kMaxConnectionsPerHostChoiceDefault, "", ""}, -+ {features::kMaxConnectionsPerHostChoice15, switches::kMaxConnectionsPerHost, "15"}, -+}; -+ - const FeatureEntry::Choice kMemlogModeChoices[] = { - {flags_ui::kGenericExperimentChoiceDisabled, "", ""}, - {flag_descriptions::kMemlogModeMinimal, heap_profiling::kMemlogMode, -@@ -5210,6 +5215,9 @@ const FeatureEntry kFeatureEntries[] = { - FEATURE_VALUE_TYPE(chrome::android::kShareSheetCustomActionsPolish)}, - - #endif // BUILDFLAG(IS_ANDROID) -+ {"max-connections-per-host", flag_descriptions::kMaxConnectionsPerHostName, -+ flag_descriptions::kMaxConnectionsPerHostDescription, kOsAll, -+ MULTI_VALUE_TYPE(kMaxConnectionsPerHostChoices)}, - {"disallow-doc-written-script-loads", - flag_descriptions::kDisallowDocWrittenScriptsUiName, - flag_descriptions::kDisallowDocWrittenScriptsUiDescription, kOsAll, -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index 9b9d00359008a..e647063331153 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -2157,6 +2157,10 @@ const char kUnthrottledNestedTimeoutDescription[] = - "websites abusing the API will still eventually have their setTimeouts " - "clamped."; - -+const char kMaxConnectionsPerHostName[] = "Maximum connections per host"; -+const char kMaxConnectionsPerHostDescription[] = -+ "Customize maximum allowed connections per host."; -+ - const char kMediaRouterCastAllowAllIPsName[] = - "Connect to Cast devices on all IP addresses"; - const char kMediaRouterCastAllowAllIPsDescription[] = -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index e6dc3d91746f3..1557928890d3a 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -1219,6 +1219,9 @@ extern const char kUndoAutofillDescription[]; - extern const char kUnthrottledNestedTimeoutName[]; - extern const char kUnthrottledNestedTimeoutDescription[]; - -+extern const char kMaxConnectionsPerHostName[]; -+extern const char kMaxConnectionsPerHostDescription[]; -+ - extern const char kMediaRouterCastAllowAllIPsName[]; - extern const char kMediaRouterCastAllowAllIPsDescription[]; - diff --git a/components/network_session_configurator/common/network_features.cc b/components/network_session_configurator/common/network_features.cc -index c1bd42fa99e7b..f6387f1cd9362 100644 --- a/components/network_session_configurator/common/network_features.cc +++ b/components/network_session_configurator/common/network_features.cc @@ -8,4 +8,7 @@ @@ -87,7 +29,6 @@ index c1bd42fa99e7b..f6387f1cd9362 100644 + } // namespace features diff --git a/components/network_session_configurator/common/network_features.h b/components/network_session_configurator/common/network_features.h -index 84d71f126019d..0cbcd7f5b0d17 100644 --- a/components/network_session_configurator/common/network_features.h +++ b/components/network_session_configurator/common/network_features.h @@ -10,6 +10,10 @@ @@ -102,7 +43,6 @@ index 84d71f126019d..0cbcd7f5b0d17 100644 #endif // COMPONENTS_NETWORK_SESSION_CONFIGURATOR_COMMON_NETWORK_FEATURES_H_ diff --git a/components/network_session_configurator/common/network_switch_list.h b/components/network_session_configurator/common/network_switch_list.h -index 9f759da5d665a..0d152ec53fb1e 100644 --- a/components/network_session_configurator/common/network_switch_list.h +++ b/components/network_session_configurator/common/network_switch_list.h @@ -19,6 +19,10 @@ NETWORK_SWITCH(kEnableUserAlternateProtocolPorts, @@ -117,7 +57,6 @@ index 9f759da5d665a..0d152ec53fb1e 100644 NETWORK_SWITCH(kIgnoreCertificateErrors, "ignore-certificate-errors") diff --git a/components/url_formatter/spoof_checks/top_domains/BUILD.gn b/components/url_formatter/spoof_checks/top_domains/BUILD.gn -index 97c28c796637b..c3083e3dc11c0 100644 --- a/components/url_formatter/spoof_checks/top_domains/BUILD.gn +++ b/components/url_formatter/spoof_checks/top_domains/BUILD.gn @@ -89,6 +89,7 @@ executable("make_top_domain_list_variables") { @@ -128,8 +67,29 @@ index 97c28c796637b..c3083e3dc11c0 100644 ] if (is_ios) { frameworks = [ "UIKit.framework" ] +diff --git a/cromite_flags/chrome/browser/about_flags_cc/add-flag-to-configure-maximum-connections-per-host.inc b/cromite_flags/chrome/browser/about_flags_cc/add-flag-to-configure-maximum-connections-per-host.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/add-flag-to-configure-maximum-connections-per-host.inc +@@ -0,0 +1,17 @@ ++#ifdef FEATURE_PARAM_SECTION ++ ++const FeatureEntry::Choice kMaxConnectionsPerHostChoices[] = { ++ {features::kMaxConnectionsPerHostChoiceDefault, "", ""}, ++ {features::kMaxConnectionsPerHostChoice15, switches::kMaxConnectionsPerHost, "15"}, ++}; ++ ++#endif ++ ++#ifdef FLAG_SECTION ++ ++ {"max-connections-per-host", ++ "Maximum connections per host", ++ "Customize maximum allowed connections per host.", kOsAll, ++ MULTI_VALUE_TYPE(kMaxConnectionsPerHostChoices)}, ++ ++#endif diff --git a/net/socket/client_socket_pool_manager.cc b/net/socket/client_socket_pool_manager.cc -index 521ebc8f5023e..41692c9212b16 100644 --- a/net/socket/client_socket_pool_manager.cc +++ b/net/socket/client_socket_pool_manager.cc @@ -19,6 +19,10 @@ @@ -163,6 +123,5 @@ index 521ebc8f5023e..41692c9212b16 100644 return g_max_sockets_per_group[pool_type]; } --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-flag-to-control-video-playback-resume-feature.patch b/build/bromite_patches/Add-flag-to-control-video-playback-resume-feature.patch index 4ace952c83e1acbbea6fd53aec1ec2d5db08ba51..3d295070c9e921bb10e3c152645fa9c7f64ace08 100644 --- a/build/bromite_patches/Add-flag-to-control-video-playback-resume-feature.patch +++ b/build/bromite_patches/Add-flag-to-control-video-playback-resume-feature.patch @@ -1,82 +1,40 @@ -From d6e9d7342d348956f362623156bd2358360416e1 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Thu, 25 Oct 2018 23:13:34 +0200 -Subject: [PATCH 053/192] Add flag to control video playback resume feature +Subject: Add flag to control video playback resume feature Disable it by default on Android as it is everywhere else License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - chrome/browser/about_flags.cc | 4 ++++ - chrome/browser/flag_descriptions.cc | 5 +++++ - chrome/browser/flag_descriptions.h | 3 +++ - media/base/media_switches.cc | 8 ++------ - 4 files changed, 14 insertions(+), 6 deletions(-) + ...lag-to-control-video-playback-resume-feature.inc | 13 +++++++++++++ + ...lag-to-control-video-playback-resume-feature.inc | 1 + + 2 files changed, 14 insertions(+) + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/add-flag-to-control-video-playback-resume-feature.inc + create mode 100644 cromite_flags/media/base/media_switches_cc/add-flag-to-control-video-playback-resume-feature.inc -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index 9f77b18dcbb73..82741e95ba8a4 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -3940,6 +3940,10 @@ const FeatureEntry kFeatureEntries[] = { - chrome::android::kContextualSearchSuppressShortView, - kContextualSearchSuppressShortViewVariations, - "ContextualSearchSuppressShortView")}, +diff --git a/cromite_flags/chrome/browser/about_flags_cc/add-flag-to-control-video-playback-resume-feature.inc b/cromite_flags/chrome/browser/about_flags_cc/add-flag-to-control-video-playback-resume-feature.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/add-flag-to-control-video-playback-resume-feature.inc +@@ -0,0 +1,13 @@ ++#ifdef FLAG_SECTION ++ ++#if BUILDFLAG(IS_ANDROID) ++ + {"resume-background-video", -+ flag_descriptions::kResumeBackgroundVideoName, -+ flag_descriptions::kResumeBackgroundVideoDescription, kOsAll, ++ "Resume background video.", ++ "Resume background video playback when tab re-gains focus; additionally, " ++ "it will pause video playback every single time you switch tabs.", kOsAll, + FEATURE_VALUE_TYPE(media::kResumeBackgroundVideo)}, - {"related-searches", flag_descriptions::kRelatedSearchesName, - flag_descriptions::kRelatedSearchesDescription, kOsAndroid, - FEATURE_WITH_PARAMS_VALUE_TYPE(chrome::android::kRelatedSearches, -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index c0f92c31f481b..c631c713f425c 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -1462,6 +1462,11 @@ const char kEnableManagedConfigurationWebApiDescription[] = - "Allows website to access a managed configuration provided by the device " - "administrator for the origin."; - -+const char kResumeBackgroundVideoName[] = "Resume background video."; -+const char kResumeBackgroundVideoDescription[] = -+ "Resume background video playback when tab re-gains focus; additionally, " -+ "it will pause video playback every single time you switch tabs."; + - const char kEnablePixelCanvasRecordingName[] = "Enable pixel canvas recording"; - const char kEnablePixelCanvasRecordingDescription[] = - "Pixel canvas recording allows the compositor to raster contents aligned " -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index e408454306339..302a8e99a898e 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -800,6 +800,9 @@ extern const char kEnablePenetratingImageSelectionDescription[]; - extern const char kEnablePerfettoSystemTracingName[]; - extern const char kEnablePerfettoSystemTracingDescription[]; - -+extern const char kResumeBackgroundVideoName[]; -+extern const char kResumeBackgroundVideoDescription[]; ++#endif // BUILDFLAG(IS_ANDROID) + - extern const char kEnablePeripheralCustomizationName[]; - extern const char kEnablePeripheralCustomizationDescription[]; - -diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc -index bb277d181b482..2b16d6450bbcf 100644 ---- a/media/base/media_switches.cc -+++ b/media/base/media_switches.cc -@@ -353,12 +353,8 @@ BASE_FEATURE(kPreloadMetadataLazyLoad, - // Let videos be resumed via remote controls (for example, the notification) - // when in background. - BASE_FEATURE(kResumeBackgroundVideo, -- "resume-background-video", --#if BUILDFLAG(IS_ANDROID) -- base::FEATURE_ENABLED_BY_DEFAULT --#else -- base::FEATURE_DISABLED_BY_DEFAULT --#endif -+ "resume-background-video", // disabled by default -+ base::FEATURE_DISABLED_BY_DEFAULT // in Bromite - ); - - // When enabled, MediaCapabilities will check with GPU Video Accelerator --- -2.34.1 - ++#endif // ifdef FLAG_SECTION +diff --git a/cromite_flags/media/base/media_switches_cc/add-flag-to-control-video-playback-resume-feature.inc b/cromite_flags/media/base/media_switches_cc/add-flag-to-control-video-playback-resume-feature.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/media/base/media_switches_cc/add-flag-to-control-video-playback-resume-feature.inc +@@ -0,0 +1 @@ ++SET_CROMITE_FEATURE_DISABLED(kResumeBackgroundVideo); +-- +2.25.1 diff --git a/build/bromite_patches/Add-flag-to-disable-IPv6-probes.patch b/build/bromite_patches/Add-flag-to-disable-IPv6-probes.patch index 04b3b38046208971c044e895c6633325d14634ee..e9c227d3c511e74a4dc7f70f28adb38e7be5d878 100644 --- a/build/bromite_patches/Add-flag-to-disable-IPv6-probes.patch +++ b/build/bromite_patches/Add-flag-to-disable-IPv6-probes.patch @@ -1,67 +1,48 @@ -From c53479d9c03c31df8167cb9af0da335c2f08beb5 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sun, 18 Nov 2018 13:06:49 +0100 -Subject: [PATCH 074/192] Add flag to disable IPv6 probes +Subject: Add flag to disable IPv6 probes License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - chrome/browser/about_flags.cc | 4 ++++ - chrome/browser/flag_descriptions.cc | 4 ++++ - chrome/browser/flag_descriptions.h | 3 +++ - net/BUILD.gn | 1 + - net/base/features.cc | 4 ++++ - net/base/features.h | 3 +++ - net/dns/host_resolver_manager.cc | 11 +++++++++++ - services/network/public/cpp/features.cc | 5 +++++ - services/network/public/cpp/features.h | 1 + - 9 files changed, 36 insertions(+) + .../add-flag-to-disable-IPv6-probes.inc | 8 ++++++++ + .../features_cc/add-flag-to-disable-IPv6-probes.inc | 3 +++ + .../features_h/add-flag-to-disable-IPv6-probes.inc | 2 ++ + net/BUILD.gn | 1 + + net/dns/host_resolver_manager.cc | 11 +++++++++++ + 5 files changed, 25 insertions(+) + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/add-flag-to-disable-IPv6-probes.inc + create mode 100644 cromite_flags/net/base/features_cc/add-flag-to-disable-IPv6-probes.inc + create mode 100644 cromite_flags/net/base/features_h/add-flag-to-disable-IPv6-probes.inc -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index de0c0efdddf7d..53968d336c2cd 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -6581,6 +6581,10 @@ const FeatureEntry kFeatureEntries[] = { - {"enable-reader-mode-in-cct", flag_descriptions::kReaderModeInCCTName, - flag_descriptions::kReaderModeInCCTDescription, kOsAndroid, - FEATURE_VALUE_TYPE(chrome::android::kReaderModeInCCT)}, +diff --git a/cromite_flags/chrome/browser/about_flags_cc/add-flag-to-disable-IPv6-probes.inc b/cromite_flags/chrome/browser/about_flags_cc/add-flag-to-disable-IPv6-probes.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/add-flag-to-disable-IPv6-probes.inc +@@ -0,0 +1,8 @@ ++#ifdef FLAG_SECTION ++ + {"ipv6-probing", -+ flag_descriptions::kIPv6ProbingName, -+ flag_descriptions::kIPv6ProbingDescription, kOsAll, ++ "Enable IPv6 probing.", ++ "Send IPv6 probes to a RIPE DNS address to verify IPv6 connectivity.", kOsAll, + FEATURE_VALUE_TYPE(net::features::kIPv6Probing)}, - #endif // BUILDFLAG(IS_ANDROID) - - {"shopping-collection", -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index 09846683d9e1e..dc0270b5ac63d 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -3883,6 +3883,10 @@ const char kCCTTextFragmentLookupApiEnabledName[] = - const char kCCTTextFragmentLookupApiEnabledDescription[] = - "Enable CCT API to lookup text fragments"; - -+const char kIPv6ProbingName[] = "Enable IPv6 probing."; -+const char kIPv6ProbingDescription[] = -+ "Send IPv6 probes to a RIPE DNS address to verify IPv6 connectivity."; -+ - const char kChimeAlwaysShowNotificationDescription[] = - "A debug flag to always show Chime notification after receiving a payload."; - const char kChimeAlwaysShowNotificationName[] = -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index fff998efaf7cd..65f03f17d0566 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -880,6 +880,9 @@ extern const char kEnableWasmStringrefName[]; - extern const char kEnableWasmStringrefDescription[]; - - extern const char kEnableWasmTieringName[]; -+extern const char kIPv6ProbingName[]; -+extern const char kIPv6ProbingDescription[]; + - extern const char kEnableWasmTieringDescription[]; - - extern const char kEvDetailsInPageInfoName[]; ++#endif // ifdef FLAG_SECTION +diff --git a/cromite_flags/net/base/features_cc/add-flag-to-disable-IPv6-probes.inc b/cromite_flags/net/base/features_cc/add-flag-to-disable-IPv6-probes.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/net/base/features_cc/add-flag-to-disable-IPv6-probes.inc +@@ -0,0 +1,3 @@ ++CROMITE_FEATURE(kIPv6Probing, ++ "IPv6Probing", ++ base::FEATURE_ENABLED_BY_DEFAULT); +diff --git a/cromite_flags/net/base/features_h/add-flag-to-disable-IPv6-probes.inc b/cromite_flags/net/base/features_h/add-flag-to-disable-IPv6-probes.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/net/base/features_h/add-flag-to-disable-IPv6-probes.inc +@@ -0,0 +1,2 @@ ++// Enable IPv6 ping probes to RIPE DNS. ++NET_EXPORT BASE_DECLARE_FEATURE(kIPv6Probing); diff --git a/net/BUILD.gn b/net/BUILD.gn -index a57b48653375f..8883c27b66b2a 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn @@ -1094,6 +1094,7 @@ component("net") { @@ -72,37 +53,7 @@ index a57b48653375f..8883c27b66b2a 100644 ] public_deps = [ -diff --git a/net/base/features.cc b/net/base/features.cc -index 83e2e83e4e41e..508e4dfdf52f1 100644 ---- a/net/base/features.cc -+++ b/net/base/features.cc -@@ -41,6 +41,10 @@ BASE_FEATURE(kUseDnsHttpsSvcb, - const base::FeatureParam kUseDnsHttpsSvcbEnforceSecureResponse{ - &kUseDnsHttpsSvcb, "UseDnsHttpsSvcbEnforceSecureResponse", false}; - -+BASE_FEATURE(kIPv6Probing, -+ "IPv6Probing", -+ base::FEATURE_ENABLED_BY_DEFAULT); -+ - const base::FeatureParam kUseDnsHttpsSvcbInsecureExtraTimeMax{ - &kUseDnsHttpsSvcb, "UseDnsHttpsSvcbInsecureExtraTimeMax", - base::Milliseconds(50)}; -diff --git a/net/base/features.h b/net/base/features.h -index ffd83d9a3cef3..31e74ad0d6f2f 100644 ---- a/net/base/features.h -+++ b/net/base/features.h -@@ -52,6 +52,9 @@ NET_EXPORT BASE_DECLARE_FEATURE(kUseDnsHttpsSvcb); - NET_EXPORT extern const base::FeatureParam - kUseDnsHttpsSvcbEnforceSecureResponse; - -+// Enable IPv6 ping probes to RIPE DNS. -+NET_EXPORT BASE_DECLARE_FEATURE(kIPv6Probing); -+ - // If we are still waiting for an HTTPS transaction after all the - // other transactions in an insecure DnsTask have completed, we will compute a - // timeout for the remaining transaction. The timeout will be diff --git a/net/dns/host_resolver_manager.cc b/net/dns/host_resolver_manager.cc -index 6bac84e8ed049..e46d04ff04f4f 100644 --- a/net/dns/host_resolver_manager.cc +++ b/net/dns/host_resolver_manager.cc @@ -110,6 +110,7 @@ @@ -137,34 +88,5 @@ index 6bac84e8ed049..e46d04ff04f4f 100644 if (probing_ipv6_) { ipv6_request_callbacks_.push_back(std::move(callback)); return ERR_IO_PENDING; -diff --git a/services/network/public/cpp/features.cc b/services/network/public/cpp/features.cc -index 7bbe56c972ea8..e743370a28421 100644 ---- a/services/network/public/cpp/features.cc -+++ b/services/network/public/cpp/features.cc -@@ -31,6 +31,11 @@ BASE_FEATURE(kThrottleDelayable, - "ThrottleDelayable", - base::FEATURE_ENABLED_BY_DEFAULT); - -+// Enable IPv6 ping probes to RIPE DNS. -+BASE_FEATURE(kIPv6Probing, -+ "IPv6Probing", -+ base::FEATURE_ENABLED_BY_DEFAULT); -+ - // When kPriorityRequestsDelayableOnSlowConnections is enabled, HTTP - // requests fetched from a SPDY/QUIC/H2 proxies can be delayed by the - // ResourceScheduler just as HTTP/1.1 resources are. However, requests from such -diff --git a/services/network/public/cpp/features.h b/services/network/public/cpp/features.h -index ec6703eadc6ca..a24fd57094b72 100644 ---- a/services/network/public/cpp/features.h -+++ b/services/network/public/cpp/features.h -@@ -17,6 +17,7 @@ namespace features { - COMPONENT_EXPORT(NETWORK_CPP) BASE_DECLARE_FEATURE(kNetworkErrorLogging); - COMPONENT_EXPORT(NETWORK_CPP) BASE_DECLARE_FEATURE(kReporting); - COMPONENT_EXPORT(NETWORK_CPP) BASE_DECLARE_FEATURE(kThrottleDelayable); -+COMPONENT_EXPORT(NETWORK_CPP) BASE_DECLARE_FEATURE(kIPv6Probing); - COMPONENT_EXPORT(NETWORK_CPP) - BASE_DECLARE_FEATURE(kDelayRequestsOnMultiplexedConnections); - COMPONENT_EXPORT(NETWORK_CPP) --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-flag-to-disable-external-intent-requests.patch b/build/bromite_patches/Add-flag-to-disable-external-intent-requests.patch index 671e4ff335d2247e6f9966de88678a96c8277530..8e37f8c7bed7c217685c4b6c89d9ce09a8f4e017 100644 --- a/build/bromite_patches/Add-flag-to-disable-external-intent-requests.patch +++ b/build/bromite_patches/Add-flag-to-disable-external-intent-requests.patch @@ -1,65 +1,33 @@ -From 2d095a3f4867f4ed1a77f895af42419ff17bc3b5 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Tue, 25 May 2021 19:46:14 +0200 -Subject: [PATCH 134/192] Add flag to disable external intent requests +Subject: Add flag to disable external intent requests Adds a new flag that allows to control the switch with same name; when flag is disabled no external intent will ever be allowed, for any URL. License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - chrome/browser/about_flags.cc | 5 +++++ - chrome/browser/flag_descriptions.cc | 6 ++++++ - chrome/browser/flag_descriptions.h | 3 +++ - 3 files changed, 14 insertions(+) + ...Add-flag-to-disable-external-intent-requests.inc | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/Add-flag-to-disable-external-intent-requests.inc -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index 238830494377d..f56710802c16a 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -3881,6 +3881,11 @@ const FeatureEntry kFeatureEntries[] = { - {"ui-disable-partial-swap", flag_descriptions::kUiPartialSwapName, - flag_descriptions::kUiPartialSwapDescription, kOsAll, - SINGLE_DISABLE_VALUE_TYPE(switches::kUIDisablePartialSwap)}, +diff --git a/cromite_flags/chrome/browser/about_flags_cc/Add-flag-to-disable-external-intent-requests.inc b/cromite_flags/chrome/browser/about_flags_cc/Add-flag-to-disable-external-intent-requests.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/Add-flag-to-disable-external-intent-requests.inc +@@ -0,0 +1,13 @@ +#if BUILDFLAG(IS_ANDROID) -+ {"allow-external-intent-requests", flag_descriptions::kDisableExternalIntentRequestsName, -+ flag_descriptions::kDisableExternalIntentRequestsDescription, kOsAll, ++ ++#ifdef FLAG_SECTION ++ ++ {"allow-external-intent-requests", ++ "Allow forward URL requests to external intents", ++ "If disabled, URL requests will never" ++ "allow for redirecting to an external intent.", kOsAndroid, + SINGLE_DISABLE_VALUE_TYPE("disable-external-intent-requests")}, -+#endif - {"disable-webrtc-hw-decoding", flag_descriptions::kWebrtcHwDecodingName, - flag_descriptions::kWebrtcHwDecodingDescription, kOsAndroid | kOsCrOS, - SINGLE_DISABLE_VALUE_TYPE(switches::kDisableWebRtcHWDecoding)}, -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index 1a7fef357fdf0..8deefef5e23a4 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -4184,6 +4184,12 @@ const char kPolicyLogsPageAndroidDescription[] = - "Enable the new chrome://policy-logs page containing logs for debugging " - "policy related issues on Android."; - -+const char kDisableExternalIntentRequestsName[] = -+ "Allow forward URL requests to external intents"; -+const char kDisableExternalIntentRequestsDescription[] = -+ "If disabled, URL requests will never" -+ "allow for redirecting to an external intent."; + - const char kQueryTilesName[] = "Show query tiles"; - const char kQueryTilesDescription[] = "Shows query tiles in Chrome"; - const char kQueryTilesNTPName[] = "Show query tiles in NTP"; -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index ebc797abde0fc..978a9c4dcd81c 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -2467,6 +2467,9 @@ extern const char kQueryTilesNTPDescription[]; - extern const char kQueryTilesOnStartName[]; - extern const char kQueryTilesOnStartDescription[]; - extern const char kQueryTilesSingleTierName[]; -+extern const char kDisableExternalIntentRequestsName[]; -+extern const char kDisableExternalIntentRequestsDescription[]; ++#endif + - extern const char kQueryTilesSingleTierDescription[]; - extern const char kQueryTilesEnableQueryEditingName[]; - extern const char kQueryTilesEnableQueryEditingDescription[]; --- -2.34.1 - ++#endif +-- +2.25.1 diff --git a/build/bromite_patches/Add-flag-to-disable-vibration.patch b/build/bromite_patches/Add-flag-to-disable-vibration.patch index 645d1d674648188d8a934084f094998a541d0a62..42e332d4a43d6edc5ca9366b261f627ce4fab057 100644 --- a/build/bromite_patches/Add-flag-to-disable-vibration.patch +++ b/build/bromite_patches/Add-flag-to-disable-vibration.patch @@ -1,69 +1,26 @@ -From 5f15917126eeded5dc07c69d5cedfaff35455d1b Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sun, 27 Jun 2021 17:35:39 +0200 -Subject: [PATCH 137/192] Add flag to disable vibration +Subject: Add flag to disable vibration License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - chrome/browser/about_flags.cc | 4 ++++ - chrome/browser/flag_descriptions.cc | 3 +++ - chrome/browser/flag_descriptions.h | 2 ++ - content/child/runtime_features.cc | 1 + - content/public/common/content_features.cc | 5 +++++ - content/public/common/content_features.h | 2 ++ - third_party/blink/public/platform/web_runtime_features.h | 1 + - .../blink/renderer/modules/vibration/vibration_controller.cc | 3 +++ - .../blink/renderer/platform/exported/web_runtime_features.cc | 4 ++++ - .../blink/renderer/platform/runtime_enabled_features.json5 | 4 ++++ - 10 files changed, 29 insertions(+) + content/child/runtime_features.cc | 1 + + .../about_flags_cc/Add-flag-to-disable-vibration.inc | 8 ++++++++ + .../content_features_cc/Add-flag-to-disable-vibration.inc | 4 ++++ + .../content_features_h/Add-flag-to-disable-vibration.inc | 1 + + third_party/blink/public/platform/web_runtime_features.h | 1 + + .../renderer/modules/vibration/vibration_controller.cc | 3 +++ + .../renderer/platform/exported/web_runtime_features.cc | 4 ++++ + .../renderer/platform/runtime_enabled_features.json5 | 4 ++++ + 8 files changed, 26 insertions(+) + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/Add-flag-to-disable-vibration.inc + create mode 100644 cromite_flags/content/public/common/content_features_cc/Add-flag-to-disable-vibration.inc + create mode 100644 cromite_flags/content/public/common/content_features_h/Add-flag-to-disable-vibration.inc -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index adaf8a1350291..feaa4584c8a98 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -8115,6 +8115,10 @@ const FeatureEntry kFeatureEntries[] = { - FEATURE_VALUE_TYPE(features::kNewMacNotificationAPI)}, - #endif - -+ {"enable-vibration", flag_descriptions::kEnableVibrationName, -+ flag_descriptions::kEnableVibrationDescription, kOsAll, -+ FEATURE_VALUE_TYPE(features::kVibration)}, -+ - #if BUILDFLAG(IS_CHROMEOS_ASH) - {"exo-consumed-by-ime-by-flag", - flag_descriptions::kExoConsumedByImeByFlagName, -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index a0754d0ed5723..4fd26779df83e 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -7123,6 +7123,9 @@ const char kLacrosMergeIcuDataFileDescription[] = - "Enables sharing common areas of icudtl.dat between Ash and Lacros."; - #endif // #if BUILDFLAG(IS_CHROMEOS_LACROS) - -+const char kEnableVibrationName[] = "Vibration"; -+const char kEnableVibrationDescription[] = "Enable vibration API; an user gesture will still be needed."; -+ - #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_LINUX) - const char kGetAllScreensMediaName[] = "GetAllScreensMedia API"; - const char kGetAllScreensMediaDescription[] = -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index 4bc4ddb5ce607..e21404e9bc26f 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -4341,6 +4341,8 @@ extern const char kWebUITabStripTabDragIntegrationName[]; - extern const char kWebUITabStripTabDragIntegrationDescription[]; - #endif // BUILDFLAG(ENABLE_WEBUI_TAB_STRIP) && BUILDFLAG(IS_CHROMEOS_ASH) - -+extern const char kEnableVibrationName[]; -+extern const char kEnableVibrationDescription[]; - #if defined(TOOLKIT_VIEWS) || BUILDFLAG(IS_ANDROID) - - extern const char kAutofillCreditCardUploadName[]; diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc -index bf469ba421e52..66fc5dbfbbc8b 100644 --- a/content/child/runtime_features.cc +++ b/content/child/runtime_features.cc -@@ -101,6 +101,7 @@ void SetRuntimeFeatureDefaultsForPlatform( +@@ -103,6 +103,7 @@ void SetRuntimeFeatureDefaultsForPlatform( if (command_line.HasSwitch(switches::kDisableMediaSessionAPI)) { WebRuntimeFeatures::EnableMediaSession(false); } @@ -71,37 +28,35 @@ index bf469ba421e52..66fc5dbfbbc8b 100644 #endif #if BUILDFLAG(IS_ANDROID) -diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc -index 8c354153db71c..6440081a1eed0 100644 ---- a/content/public/common/content_features.cc -+++ b/content/public/common/content_features.cc -@@ -169,6 +169,11 @@ BASE_FEATURE(kBackForwardCacheMemoryControls, - #endif - ); - -+// Enables vibration; an user gesture will still be required if enabled. -+BASE_FEATURE(kVibration, -+ "VibrationEnabled", -+ base::FEATURE_DISABLED_BY_DEFAULT); +diff --git a/cromite_flags/chrome/browser/about_flags_cc/Add-flag-to-disable-vibration.inc b/cromite_flags/chrome/browser/about_flags_cc/Add-flag-to-disable-vibration.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/Add-flag-to-disable-vibration.inc +@@ -0,0 +1,8 @@ ++#ifdef FLAG_SECTION + - // When this feature is enabled, private network requests initiated from - // non-secure contexts in the `public` address space are blocked. - // -diff --git a/content/public/common/content_features.h b/content/public/common/content_features.h -index 01ce3746b5f15..6f9ef9a746c6e 100644 ---- a/content/public/common/content_features.h -+++ b/content/public/common/content_features.h -@@ -348,6 +348,8 @@ CONTENT_EXPORT BASE_DECLARE_FEATURE(kWarmUpNetworkProcess); - CONTENT_EXPORT BASE_DECLARE_FEATURE(kWebNfc); - - #endif // BUILDFLAG(IS_ANDROID) -+CONTENT_EXPORT BASE_DECLARE_FEATURE(kVibration); ++ {"enable-vibration", ++ "Vibration", ++ "Enable vibration API; an user gesture will still be needed.", kOsAll, ++ FEATURE_VALUE_TYPE(features::kVibration)}, + - - #if BUILDFLAG(IS_MAC) - CONTENT_EXPORT BASE_DECLARE_FEATURE(kDeviceMonitorMac); ++#endif +diff --git a/cromite_flags/content/public/common/content_features_cc/Add-flag-to-disable-vibration.inc b/cromite_flags/content/public/common/content_features_cc/Add-flag-to-disable-vibration.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/content/public/common/content_features_cc/Add-flag-to-disable-vibration.inc +@@ -0,0 +1,4 @@ ++// Enables vibration; an user gesture will still be required if enabled. ++CROMITE_FEATURE(kVibration, ++ "VibrationEnabled", ++ base::FEATURE_DISABLED_BY_DEFAULT); +diff --git a/cromite_flags/content/public/common/content_features_h/Add-flag-to-disable-vibration.inc b/cromite_flags/content/public/common/content_features_h/Add-flag-to-disable-vibration.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/content/public/common/content_features_h/Add-flag-to-disable-vibration.inc +@@ -0,0 +1 @@ ++CONTENT_EXPORT BASE_DECLARE_FEATURE(kVibration); diff --git a/third_party/blink/public/platform/web_runtime_features.h b/third_party/blink/public/platform/web_runtime_features.h -index 23e1afbedeb56..141981145abeb 100644 --- a/third_party/blink/public/platform/web_runtime_features.h +++ b/third_party/blink/public/platform/web_runtime_features.h @@ -70,6 +70,7 @@ class BLINK_PLATFORM_EXPORT WebRuntimeFeatures : public WebRuntimeFeaturesBase { @@ -113,7 +68,6 @@ index 23e1afbedeb56..141981145abeb 100644 WebRuntimeFeatures() = delete; }; diff --git a/third_party/blink/renderer/modules/vibration/vibration_controller.cc b/third_party/blink/renderer/modules/vibration/vibration_controller.cc -index f8e6a5495a14d..64e8b9eb0587b 100644 --- a/third_party/blink/renderer/modules/vibration/vibration_controller.cc +++ b/third_party/blink/renderer/modules/vibration/vibration_controller.cc @@ -29,6 +29,7 @@ @@ -134,7 +88,6 @@ index f8e6a5495a14d..64e8b9eb0587b 100644 } diff --git a/third_party/blink/renderer/platform/exported/web_runtime_features.cc b/third_party/blink/renderer/platform/exported/web_runtime_features.cc -index 69af1a7b9f0be..b3e720a08ea8f 100644 --- a/third_party/blink/renderer/platform/exported/web_runtime_features.cc +++ b/third_party/blink/renderer/platform/exported/web_runtime_features.cc @@ -52,6 +52,10 @@ void WebRuntimeFeatures::EnableTestOnlyFeatures(bool enable) { @@ -149,10 +102,9 @@ index 69af1a7b9f0be..b3e720a08ea8f 100644 RuntimeEnabledFeatures::SetOriginTrialControlledFeaturesEnabled(enable); } diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -index f5d8699b53384..bfcca5ab88e88 100644 --- a/third_party/blink/renderer/platform/runtime_enabled_features.json5 +++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5 -@@ -2461,6 +2461,10 @@ +@@ -2638,6 +2638,10 @@ status: {"Android": "stable"}, base_feature: "none", }, @@ -163,6 +115,5 @@ index f5d8699b53384..bfcca5ab88e88 100644 { name: "OriginIsolationHeader", status: "stable", --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-lifetime-options-for-permissions.patch b/build/bromite_patches/Add-lifetime-options-for-permissions.patch index 28f7e364da1bbbdf5c98f54d72cd1e11a4ac2c6b..7b006d76ccec1c6cd3b236c583cb1c0db13891f7 100644 --- a/build/bromite_patches/Add-lifetime-options-for-permissions.patch +++ b/build/bromite_patches/Add-lifetime-options-for-permissions.patch @@ -1,7 +1,6 @@ -From 2ab682f0b3b3122ac50953aef842a13e11ea5cba Mon Sep 17 00:00:00 2001 From: uazo Date: Fri, 8 Apr 2022 11:04:04 +0000 -Subject: [PATCH 164/192] Add lifetime options for permissions +Subject: Add lifetime options for permissions Indicate the session mode for content-settings by using the constraint `content_settings::SessionModel` as UserSession when setting the value, and also make use of an expiration time value. @@ -57,7 +56,11 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../one_time_permissions_tracker.cc | 33 +++++++- .../one_time_permissions_tracker.h | 5 +- .../one_time_permissions_tracker_factory.cc | 2 +- + .../embedded_permission_prompt_ask_view.cc | 2 +- .../permission_prompt_bubble_base_view.cc | 2 +- + .../browser/content_autofill_driver.cc | 64 ++++++++------- + .../content/browser/content_autofill_driver.h | 2 +- + .../autofill/core/browser/autofill_driver.h | 2 + .../site_settings/PermissionInfo.java | 14 +++- .../site_settings/SingleWebsiteSettings.java | 10 +++ .../WebsitePreferenceBridge.java | 6 +- @@ -81,17 +84,16 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../android/permissions_android_strings.grd | 17 ++++ .../geolocation_permission_context_android.cc | 35 ++++++-- .../geolocation_permission_context_android.h | 14 +++- - .../permissions/permission_context_base.cc | 55 +++++++++++-- - .../permissions/permission_context_base.h | 25 +++++- + .../permissions/permission_context_base.cc | 51 ++++++++++-- + .../permissions/permission_context_base.h | 23 +++++- components/permissions/permission_prompt.h | 3 +- - components/permissions/permission_request.cc | 34 +++++++- - components/permissions/permission_request.h | 18 ++++- + components/permissions/permission_request.cc | 30 ++++++- + components/permissions/permission_request.h | 16 +++- .../permissions/permission_request_manager.cc | 45 +++++++---- .../permissions/permission_request_manager.h | 11 ++- - 35 files changed, 521 insertions(+), 60 deletions(-) + 39 files changed, 547 insertions(+), 92 deletions(-) diff --git a/chrome/browser/permissions/last_tab_standing_tracker.cc b/chrome/browser/permissions/last_tab_standing_tracker.cc -index 5df1981731e0e..247155065ce68 100644 --- a/chrome/browser/permissions/last_tab_standing_tracker.cc +++ b/chrome/browser/permissions/last_tab_standing_tracker.cc @@ -7,6 +7,32 @@ @@ -139,11 +141,10 @@ index 5df1981731e0e..247155065ce68 100644 + } } diff --git a/chrome/browser/permissions/one_time_permissions_tracker.cc b/chrome/browser/permissions/one_time_permissions_tracker.cc -index f400a95c022fa..31354261bca8a 100644 --- a/chrome/browser/permissions/one_time_permissions_tracker.cc +++ b/chrome/browser/permissions/one_time_permissions_tracker.cc -@@ -18,8 +18,34 @@ - #include "components/permissions/features.h" +@@ -19,8 +19,34 @@ + #include "components/permissions/permission_context_base.h" #include "content/public/browser/visibility.h" #include "url/gurl.h" +#include "components/content_settings/core/browser/host_content_settings_map.h" @@ -178,7 +179,7 @@ index f400a95c022fa..31354261bca8a 100644 OneTimePermissionsTracker::~OneTimePermissionsTracker() = default; OneTimePermissionsTracker::OriginTrackEntry::OriginTrackEntry() = default; -@@ -93,6 +119,11 @@ void OneTimePermissionsTracker::WebContentsUnloadedOrigin( +@@ -108,6 +134,11 @@ void OneTimePermissionsTracker::WebContentsUnloadedOrigin( observer.OnLastPageFromOriginClosed(origin); } } @@ -191,7 +192,6 @@ index f400a95c022fa..31354261bca8a 100644 } diff --git a/chrome/browser/permissions/one_time_permissions_tracker.h b/chrome/browser/permissions/one_time_permissions_tracker.h -index 168f8e1344c2e..e223b3e6a8244 100644 --- a/chrome/browser/permissions/one_time_permissions_tracker.h +++ b/chrome/browser/permissions/one_time_permissions_tracker.h @@ -12,6 +12,7 @@ @@ -211,7 +211,7 @@ index 168f8e1344c2e..e223b3e6a8244 100644 ~OneTimePermissionsTracker() override; OneTimePermissionsTracker(const OneTimePermissionsTracker&) = delete; -@@ -127,7 +128,7 @@ class OneTimePermissionsTracker : public KeyedService { +@@ -136,7 +137,7 @@ class OneTimePermissionsTracker : public KeyedService { base::ObserverList observer_list_; std::map origin_tracker_; @@ -221,31 +221,241 @@ index 168f8e1344c2e..e223b3e6a8244 100644 }; diff --git a/chrome/browser/permissions/one_time_permissions_tracker_factory.cc b/chrome/browser/permissions/one_time_permissions_tracker_factory.cc -index cab98b40bf1de..30b1b56f87f75 100644 --- a/chrome/browser/permissions/one_time_permissions_tracker_factory.cc +++ b/chrome/browser/permissions/one_time_permissions_tracker_factory.cc -@@ -40,5 +40,5 @@ bool OneTimePermissionsTrackerFactory::ServiceIsCreatedWithBrowserContext() - - KeyedService* OneTimePermissionsTrackerFactory::BuildServiceInstanceFor( +@@ -41,5 +41,5 @@ bool OneTimePermissionsTrackerFactory::ServiceIsCreatedWithBrowserContext() + std::unique_ptr + OneTimePermissionsTrackerFactory::BuildServiceInstanceForBrowserContext( content::BrowserContext* context) const { -- return new OneTimePermissionsTracker(); -+ return new OneTimePermissionsTracker(context); +- return std::make_unique(); ++ return std::make_unique(context); } +diff --git a/chrome/browser/ui/views/permissions/embedded_permission_prompt_ask_view.cc b/chrome/browser/ui/views/permissions/embedded_permission_prompt_ask_view.cc +--- a/chrome/browser/ui/views/permissions/embedded_permission_prompt_ask_view.cc ++++ b/chrome/browser/ui/views/permissions/embedded_permission_prompt_ask_view.cc +@@ -34,7 +34,7 @@ void EmbeddedPermissionPromptAskView::RunButtonCallback(int button_id) { + + if (delegate()) { + if (button == ButtonType::kAllowThisTime) { +- delegate()->AcceptThisTime(); ++ delegate()->AcceptThisTime(content_settings::LifetimeMode::OnlyThisTime); + } else if (button == ButtonType::kAllow) { + delegate()->Accept(); + } diff --git a/chrome/browser/ui/views/permissions/permission_prompt_bubble_base_view.cc b/chrome/browser/ui/views/permissions/permission_prompt_bubble_base_view.cc -index d64456f3a7681..c220b0448f287 100644 --- a/chrome/browser/ui/views/permissions/permission_prompt_bubble_base_view.cc +++ b/chrome/browser/ui/views/permissions/permission_prompt_bubble_base_view.cc -@@ -336,7 +336,7 @@ void PermissionPromptBubbleBaseView::RunButtonCallbacks( - delegate_->Accept(); +@@ -263,7 +263,7 @@ void PermissionPromptBubbleBaseView::RunButtonCallback(int button_id) { return; case PermissionDialogButton::kAcceptOnce: + RecordDecision(permissions::PermissionAction::GRANTED_ONCE); - delegate_->AcceptThisTime(); -+ delegate_->AcceptThisTime(content_settings::LifetimeMode::Always); ++ delegate_->AcceptThisTime(content_settings::LifetimeMode::OnlyThisTime); return; case PermissionDialogButton::kDeny: - delegate_->Deny(); + RecordDecision(permissions::PermissionAction::DENIED); +diff --git a/components/autofill/content/browser/content_autofill_driver.cc b/components/autofill/content/browser/content_autofill_driver.cc +--- a/components/autofill/content/browser/content_autofill_driver.cc ++++ b/components/autofill/content/browser/content_autofill_driver.cc +@@ -412,8 +412,8 @@ void ContentAutofillDriver::FormsSeen( + const std::vector& removed_forms) { + target->GetAutofillManager().OnFormsSeen( + WithNewVersion(updated_forms), removed_forms); +- if (target->secondary_autofill_manager_) { +- target->secondary_autofill_manager_->OnFormsSeen( ++ if (target->secondary_autofill_manager()) { ++ target->secondary_autofill_manager()->OnFormsSeen( + WithNewVersion(updated_forms), removed_forms); + } + }); +@@ -443,8 +443,8 @@ void ContentAutofillDriver::FormSubmitted( + } + target->GetAutofillManager().OnFormSubmitted( + WithNewVersion(form), known_success, submission_source); +- if (target->secondary_autofill_manager_) { +- target->secondary_autofill_manager_->OnFormSubmitted( ++ if (target->secondary_autofill_manager()) { ++ target->secondary_autofill_manager()->OnFormSubmitted( + WithNewVersion(form), known_success, submission_source); + } + }); +@@ -468,8 +468,8 @@ void ContentAutofillDriver::TextFieldDidChange(const FormData& raw_form, + base::TimeTicks timestamp) { + target->GetAutofillManager().OnTextFieldDidChange( + WithNewVersion(form), field, bounding_box, timestamp); +- if (target->secondary_autofill_manager_) { +- target->secondary_autofill_manager_->OnTextFieldDidChange( ++ if (target->secondary_autofill_manager()) { ++ target->secondary_autofill_manager()->OnTextFieldDidChange( + WithNewVersion(form), field, bounding_box, timestamp); + } + }); +@@ -491,8 +491,8 @@ void ContentAutofillDriver::TextFieldDidScroll(const FormData& raw_form, + const FormFieldData& field, const gfx::RectF& bounding_box) { + target->GetAutofillManager().OnTextFieldDidScroll(WithNewVersion(form), + field, bounding_box); +- if (target->secondary_autofill_manager_) { +- target->secondary_autofill_manager_->OnTextFieldDidScroll( ++ if (target->secondary_autofill_manager()) { ++ target->secondary_autofill_manager()->OnTextFieldDidScroll( + WithNewVersion(form), field, bounding_box); + } + }); +@@ -515,8 +515,8 @@ void ContentAutofillDriver::SelectControlDidChange( + const FormFieldData& field, const gfx::RectF& bounding_box) { + target->GetAutofillManager().OnSelectControlDidChange( + WithNewVersion(form), field, bounding_box); +- if (target->secondary_autofill_manager_) { +- target->secondary_autofill_manager_->OnSelectControlDidChange( ++ if (target->secondary_autofill_manager()) { ++ target->secondary_autofill_manager()->OnSelectControlDidChange( + WithNewVersion(form), field, bounding_box); + } + }); +@@ -541,8 +541,8 @@ void ContentAutofillDriver::AskForValuesToFill( + AutofillSuggestionTriggerSource trigger_source) { + target->GetAutofillManager().OnAskForValuesToFill( + WithNewVersion(form), field, bounding_box, trigger_source); +- if (target->secondary_autofill_manager_) { +- target->secondary_autofill_manager_->OnAskForValuesToFill( ++ if (target->secondary_autofill_manager()) { ++ target->secondary_autofill_manager()->OnAskForValuesToFill( + WithNewVersion(form), field, bounding_box, trigger_source); + } + }); +@@ -556,8 +556,8 @@ void ContentAutofillDriver::HidePopup() { + DCHECK(!target->IsPrerendering()) + << "We should never affect UI while prerendering"; + target->GetAutofillManager().OnHidePopup(); +- if (target->secondary_autofill_manager_) +- target->secondary_autofill_manager_->OnHidePopup(); ++ if (target->secondary_autofill_manager()) ++ target->secondary_autofill_manager()->OnHidePopup(); + }); + } + +@@ -569,8 +569,8 @@ void ContentAutofillDriver::FocusNoLongerOnForm(bool had_interacted_form) { + this, had_interacted_form, + [](autofill::AutofillDriver* target, bool had_interacted_form) { + target->GetAutofillManager().OnFocusNoLongerOnForm(had_interacted_form); +- if (target->secondary_autofill_manager_) +- target->secondary_autofill_manager_->OnFocusNoLongerOnForm(had_interacted_form); ++ if (target->secondary_autofill_manager()) ++ target->secondary_autofill_manager()->OnFocusNoLongerOnForm(had_interacted_form); + }); + } + +@@ -590,15 +590,15 @@ void ContentAutofillDriver::FocusOnFormField(const FormData& raw_form, + const FormFieldData& field, const gfx::RectF& bounding_box) { + target->GetAutofillManager().OnFocusOnFormField(WithNewVersion(form), + field, bounding_box); +- if (target->secondary_autofill_manager_) { +- target->secondary_autofill_manager_->OnFocusOnFormField( ++ if (target->secondary_autofill_manager()) { ++ target->secondary_autofill_manager()->OnFocusOnFormField( + WithNewVersion(form), field, bounding_box); + } + }, + [](autofill::AutofillDriver* target) { + target->GetAutofillManager().OnFocusNoLongerOnForm(true); +- if (target->secondary_autofill_manager_) { +- target->secondary_autofill_manager_->OnFocusNoLongerOnForm(true); ++ if (target->secondary_autofill_manager()) { ++ target->secondary_autofill_manager()->OnFocusNoLongerOnForm(true); + } + }); + } +@@ -614,8 +614,8 @@ void ContentAutofillDriver::DidFillAutofillFormData(const FormData& raw_form, + base::TimeTicks timestamp) { + target->GetAutofillManager().OnDidFillAutofillFormData( + WithNewVersion(form), timestamp); +- if (target->secondary_autofill_manager_) { +- target->secondary_autofill_manager_->OnDidFillAutofillFormData( ++ if (target->secondary_autofill_manager()) { ++ target->secondary_autofill_manager()->OnDidFillAutofillFormData( + WithNewVersion(form), timestamp); + } + }); +@@ -627,8 +627,8 @@ void ContentAutofillDriver::DidEndTextFieldEditing() { + } + router().DidEndTextFieldEditing(this, [](autofill::AutofillDriver* target) { + target->GetAutofillManager().OnDidEndTextFieldEditing(); +- if (target->secondary_autofill_manager_) +- target->secondary_autofill_manager_->OnDidEndTextFieldEditing(); ++ if (target->secondary_autofill_manager()) ++ target->secondary_autofill_manager()->OnDidEndTextFieldEditing(); + }); + } + +@@ -643,8 +643,8 @@ void ContentAutofillDriver::SelectOrSelectListFieldOptionsDidChange( + cast(target) + ->GetAutofillManager() + .OnSelectOrSelectListFieldOptionsDidChange(WithNewVersion(form)); +- if (target->secondary_autofill_manager_) { +- target->secondary_autofill_manager_->OnSelectOrSelectMenuFieldOptionsDidChange( ++ if (target->secondary_autofill_manager()) { ++ target->secondary_autofill_manager()->OnSelectOrSelectListFieldOptionsDidChange( + WithNewVersion(form)); + } + }); +@@ -666,8 +666,8 @@ void ContentAutofillDriver::JavaScriptChangedAutofilledValue( + const FormFieldData& field, const std::u16string& old_value) { + target->GetAutofillManager().OnJavaScriptChangedAutofilledValue( + WithNewVersion(form), field, old_value); +- if (target->secondary_autofill_manager_) { +- target->secondary_autofill_manager_->OnJavaScriptChangedAutofilledValue( ++ if (target->secondary_autofill_manager()) { ++ target->secondary_autofill_manager()->OnJavaScriptChangedAutofilledValue( + WithNewVersion(form), field, old_value); + } + }); +@@ -682,8 +682,8 @@ void ContentAutofillDriver::OnContextMenuShownInField( + const FieldGlobalId& field_global_id) { + target->GetAutofillManager().OnContextMenuShownInField(form_global_id, + field_global_id); +- if (target->secondary_autofill_manager_) +- target->secondary_autofill_manager_->OnContextMenuShownInField(form_global_id, field_global_id); ++ if (target->secondary_autofill_manager()) ++ target->secondary_autofill_manager()->OnContextMenuShownInField(form_global_id, field_global_id); + }); + } + +@@ -708,6 +708,10 @@ ContentAutofillDriver::GetAutofillAgent() { + return autofill_agent_; + } + ++raw_ptr ContentAutofillDriver::secondary_autofill_manager() { ++ return secondary_autofill_manager_.get(); ++} ++ + void ContentAutofillDriver::SetFrameAndFormMetaData( + FormData& form, + FormFieldData* optional_field) const { +diff --git a/components/autofill/content/browser/content_autofill_driver.h b/components/autofill/content/browser/content_autofill_driver.h +--- a/components/autofill/content/browser/content_autofill_driver.h ++++ b/components/autofill/content/browser/content_autofill_driver.h +@@ -132,7 +132,7 @@ class ContentAutofillDriver : public AutofillDriver, + autofill_manager_ = std::move(autofill_manager); + secondary_autofill_manager_ = std::move(secondary_autofill_manager); + } +- AutofillManager* secondary_autofill_manager() { return secondary_autofill_manager_.get(); } ++ raw_ptr secondary_autofill_manager() override; + + content::RenderFrameHost* render_frame_host() { return &*render_frame_host_; } + const content::RenderFrameHost* render_frame_host() const { +diff --git a/components/autofill/core/browser/autofill_driver.h b/components/autofill/core/browser/autofill_driver.h +--- a/components/autofill/core/browser/autofill_driver.h ++++ b/components/autofill/core/browser/autofill_driver.h +@@ -69,6 +69,8 @@ class AutofillDriver { + // Returns the AutofillManager owned by the AutofillDriver. + virtual AutofillManager& GetAutofillManager() = 0; + ++ virtual raw_ptr secondary_autofill_manager() = 0; ++ + // Returns whether the AutofillDriver instance is associated with an active + // frame in the MPArch sense. + virtual bool IsInActiveFrame() const = 0; diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/PermissionInfo.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/PermissionInfo.java -index b396373609a2b..c9500b68f5678 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/PermissionInfo.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/PermissionInfo.java @@ -9,6 +9,7 @@ import androidx.annotation.Nullable; @@ -256,27 +466,24 @@ index b396373609a2b..c9500b68f5678 100644 import java.io.Serializable; -@@ -20,19 +21,30 @@ public class PermissionInfo implements Serializable { +@@ -20,9 +21,15 @@ public class PermissionInfo implements Serializable { private final String mEmbedder; private final String mOrigin; private final @ContentSettingsType int mContentSettingsType; + private final @SessionModel int mSessionModel; - - public PermissionInfo(@ContentSettingsType int type, String origin, String embedder) { - this(type, origin, embedder, false); - } - ++ + public PermissionInfo(@ContentSettingsType int type, String origin, String embedder, boolean isEmbargoed) { + this(type, origin, embedder, isEmbargoed, 0); + } -+ + public PermissionInfo( - @ContentSettingsType int type, String origin, String embedder, boolean isEmbargoed) { + @ContentSettingsType int type, String origin, String embedder, boolean isEmbargoed, + @SessionModel int sessionModel) { assert WebsitePermissionsFetcher.getPermissionsType(type) - == WebsitePermissionsFetcher.WebsitePermissionsType.PERMISSION_INFO; - mOrigin = origin; + == WebsitePermissionsFetcher.WebsitePermissionsType.PERMISSION_INFO + : "invalid type: " +@@ -31,6 +38,11 @@ public class PermissionInfo implements Serializable { mEmbedder = embedder; mContentSettingsType = type; mIsEmbargoed = isEmbargoed; @@ -289,7 +496,6 @@ index b396373609a2b..c9500b68f5678 100644 public @ContentSettingsType int getContentSettingsType() { diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleWebsiteSettings.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleWebsiteSettings.java -index bca33587c1c7d..ae9bd5ad63ca9 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleWebsiteSettings.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleWebsiteSettings.java @@ -38,6 +38,7 @@ import org.chromium.components.browser_ui.settings.TextMessagePreference; @@ -300,7 +506,7 @@ index bca33587c1c7d..ae9bd5ad63ca9 100644 import org.chromium.components.embedder_support.util.Origin; import org.chromium.content_public.browser.BrowserContextHandle; -@@ -546,6 +547,11 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment +@@ -558,6 +559,11 @@ public class SingleWebsiteSettings extends BaseSiteSettingsFragment } } @@ -312,7 +518,7 @@ index bca33587c1c7d..ae9bd5ad63ca9 100644 private void setUpClearDataPreference() { ClearWebsiteStorage preference = findPreference(PREF_CLEAR_DATA); long usage = mSite.getTotalUsage(); -@@ -975,6 +981,10 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment +@@ -1024,6 +1030,10 @@ public class SingleWebsiteSettings extends BaseSiteSettingsFragment if (contentType == mHighlightedPermission) { switchPreference.setBackgroundColor(mHighlightColor); } @@ -324,7 +530,6 @@ index bca33587c1c7d..ae9bd5ad63ca9 100644 /** diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/WebsitePreferenceBridge.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/WebsitePreferenceBridge.java -index 5a076d74e90ee..56c555a49c34d 100644 --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/WebsitePreferenceBridge.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/WebsitePreferenceBridge.java @@ -9,6 +9,7 @@ import org.chromium.base.annotations.CalledByNative; @@ -355,7 +560,6 @@ index 5a076d74e90ee..56c555a49c34d 100644 @CalledByNative diff --git a/components/browser_ui/site_settings/android/website_preference_bridge.cc b/components/browser_ui/site_settings/android/website_preference_bridge.cc -index 0fa4e79185eea..9f88a0b4a7a0c 100644 --- a/components/browser_ui/site_settings/android/website_preference_bridge.cc +++ b/components/browser_ui/site_settings/android/website_preference_bridge.cc @@ -131,7 +131,8 @@ typedef void (*InfoListInsertionFunction)( @@ -387,7 +591,6 @@ index 0fa4e79185eea..9f88a0b4a7a0c 100644 } } diff --git a/components/browser_ui/strings/android/browser_ui_strings.grd b/components/browser_ui/strings/android/browser_ui_strings.grd -index becda89edd71c..c0ecc4f410d5e 100644 --- a/components/browser_ui/strings/android/browser_ui_strings.grd +++ b/components/browser_ui/strings/android/browser_ui_strings.grd @@ -642,6 +642,11 @@ @@ -403,7 +606,6 @@ index becda89edd71c..c0ecc4f410d5e 100644 Ad personalization diff --git a/components/content_settings/android/BUILD.gn b/components/content_settings/android/BUILD.gn -index 1501e0fdf459f..f9ef7f7b0b4b7 100644 --- a/components/content_settings/android/BUILD.gn +++ b/components/content_settings/android/BUILD.gn @@ -60,6 +60,7 @@ java_cpp_enum("content_settings_enums_javagen") { @@ -415,10 +617,9 @@ index 1501e0fdf459f..f9ef7f7b0b4b7 100644 visibility = [ ":*" ] # Depend on through :content_settings_enums_java } diff --git a/components/content_settings/core/browser/content_settings_utils.cc b/components/content_settings/core/browser/content_settings_utils.cc -index ab48ce7c18779..6ddea11a0388f 100644 --- a/components/content_settings/core/browser/content_settings_utils.cc +++ b/components/content_settings/core/browser/content_settings_utils.cc -@@ -186,6 +186,42 @@ bool IsConstraintPersistent(const ContentSettingConstraints& constraints) { +@@ -174,6 +174,42 @@ bool IsConstraintPersistent(const ContentSettingConstraints& constraints) { return constraints.session_model() == SessionModel::Durable; } @@ -462,7 +663,6 @@ index ab48ce7c18779..6ddea11a0388f 100644 // Last visit is not tracked for notification permission as it shouldn't be // auto-revoked. diff --git a/components/content_settings/core/browser/content_settings_utils.h b/components/content_settings/core/browser/content_settings_utils.h -index 978fcb1b8f2ff..90db87a40c683 100644 --- a/components/content_settings/core/browser/content_settings_utils.h +++ b/components/content_settings/core/browser/content_settings_utils.h @@ -73,6 +73,12 @@ bool IsConstraintPersistent(const ContentSettingConstraints& constraints); @@ -479,7 +679,6 @@ index 978fcb1b8f2ff..90db87a40c683 100644 base::Time GetCoarseVisitedTime(base::Time time); diff --git a/components/content_settings/core/common/content_settings_constraints.h b/components/content_settings/core/common/content_settings_constraints.h -index dfb4fdf0f25be..e9b26eb99af07 100644 --- a/components/content_settings/core/common/content_settings_constraints.h +++ b/components/content_settings/core/common/content_settings_constraints.h @@ -23,6 +23,8 @@ namespace content_settings { @@ -508,7 +707,6 @@ index dfb4fdf0f25be..e9b26eb99af07 100644 class ContentSettingConstraints { public: diff --git a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoController.java b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoController.java -index 153dfc08bfc26..347ad127f07ef 100644 --- a/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoController.java +++ b/components/page_info/android/java/src/org/chromium/components/page_info/PageInfoController.java @@ -336,9 +336,9 @@ public class PageInfoController implements PageInfoMainController, ModalDialogPr @@ -524,7 +722,6 @@ index 153dfc08bfc26..347ad127f07ef 100644 /** diff --git a/components/page_info/android/java/src/org/chromium/components/page_info/PermissionParamsListBuilder.java b/components/page_info/android/java/src/org/chromium/components/page_info/PermissionParamsListBuilder.java -index e2c68173872eb..c93058f16d59d 100644 --- a/components/page_info/android/java/src/org/chromium/components/page_info/PermissionParamsListBuilder.java +++ b/components/page_info/android/java/src/org/chromium/components/page_info/PermissionParamsListBuilder.java @@ -44,8 +44,9 @@ public class PermissionParamsListBuilder { @@ -550,7 +747,7 @@ index e2c68173872eb..c93058f16d59d 100644 } } -@@ -124,13 +129,15 @@ public class PermissionParamsListBuilder { +@@ -123,13 +128,15 @@ public class PermissionParamsListBuilder { public final String nameMidSentence; public final int type; public final @ContentSettingValues int setting; @@ -568,10 +765,9 @@ index e2c68173872eb..c93058f16d59d 100644 @Override diff --git a/components/page_info/android/page_info_controller_android.cc b/components/page_info/android/page_info_controller_android.cc -index 257104ea67a99..1c07407525d66 100644 --- a/components/page_info/android/page_info_controller_android.cc +++ b/components/page_info/android/page_info_controller_android.cc -@@ -158,6 +158,8 @@ void PageInfoControllerAndroid::SetPermissionInfo( +@@ -154,6 +154,8 @@ void PageInfoControllerAndroid::SetPermissionInfo( std::map user_specified_settings_to_display; @@ -580,7 +776,7 @@ index 257104ea67a99..1c07407525d66 100644 for (const auto& permission : permission_info_list) { if (base::Contains(permissions_to_display, permission.type)) { -@@ -166,6 +168,8 @@ void PageInfoControllerAndroid::SetPermissionInfo( +@@ -162,6 +164,8 @@ void PageInfoControllerAndroid::SetPermissionInfo( if (setting_to_display) { user_specified_settings_to_display[permission.type] = *setting_to_display; @@ -589,7 +785,7 @@ index 257104ea67a99..1c07407525d66 100644 } } } -@@ -182,7 +186,8 @@ void PageInfoControllerAndroid::SetPermissionInfo( +@@ -178,7 +182,8 @@ void PageInfoControllerAndroid::SetPermissionInfo( ConvertUTF16ToJavaString(env, setting_title), ConvertUTF16ToJavaString(env, setting_title_mid_sentence), static_cast(permission), @@ -599,7 +795,7 @@ index 257104ea67a99..1c07407525d66 100644 } } -@@ -195,7 +200,8 @@ void PageInfoControllerAndroid::SetPermissionInfo( +@@ -191,7 +196,8 @@ void PageInfoControllerAndroid::SetPermissionInfo( env, controller_jobject_, ConvertUTF16ToJavaString(env, object_title), ConvertUTF16ToJavaString(env, object_title), static_cast(chosen_object->ui_info->content_settings_type), @@ -610,10 +806,9 @@ index 257104ea67a99..1c07407525d66 100644 Java_PageInfoController_updatePermissionDisplay(env, controller_jobject_); diff --git a/components/page_info/page_info.cc b/components/page_info/page_info.cc -index 0be5287fa5328..282aa89f992b5 100644 --- a/components/page_info/page_info.cc +++ b/components/page_info/page_info.cc -@@ -1172,6 +1172,8 @@ void PageInfo::PopulatePermissionInfo(PermissionInfo& permission_info, +@@ -1184,6 +1184,8 @@ void PageInfo::PopulatePermissionInfo(PermissionInfo& permission_info, permission_info.source = info.source; permission_info.is_one_time = (info.metadata.session_model() == content_settings::SessionModel::OneTime); @@ -623,7 +818,6 @@ index 0be5287fa5328..282aa89f992b5 100644 auto* page_specific_content_settings = GetPageSpecificContentSettings(); if (page_specific_content_settings && setting == CONTENT_SETTING_ALLOW) { diff --git a/components/page_info/page_info.h b/components/page_info/page_info.h -index 2a10d89b46a4d..8925c7ba766dd 100644 --- a/components/page_info/page_info.h +++ b/components/page_info/page_info.h @@ -199,6 +199,7 @@ class PageInfo : private content_settings::CookieControlsObserver, @@ -635,7 +829,6 @@ index 2a10d89b46a4d..8925c7ba766dd 100644 // embedded origins. absl::optional requesting_origin; diff --git a/components/permissions/android/java/src/org/chromium/components/permissions/PermissionDialogDelegate.java b/components/permissions/android/java/src/org/chromium/components/permissions/PermissionDialogDelegate.java -index ad45ed899c63f..b4fc982b5b57d 100644 --- a/components/permissions/android/java/src/org/chromium/components/permissions/PermissionDialogDelegate.java +++ b/components/permissions/android/java/src/org/chromium/components/permissions/PermissionDialogDelegate.java @@ -8,6 +8,7 @@ import org.chromium.base.annotations.CalledByNative; @@ -646,7 +839,7 @@ index ad45ed899c63f..b4fc982b5b57d 100644 /** * Delegate class for modal permission dialogs. Contains all of the data displayed in a prompt, -@@ -43,6 +44,9 @@ public class PermissionDialogDelegate { +@@ -46,6 +47,9 @@ public class PermissionDialogDelegate { /** The {@link ContentSettingsType}s requested in this dialog. */ private int[] mContentSettingsTypes; @@ -656,7 +849,7 @@ index ad45ed899c63f..b4fc982b5b57d 100644 public WindowAndroid getWindow() { return mWindow; } -@@ -72,6 +76,15 @@ public class PermissionDialogDelegate { +@@ -79,6 +83,15 @@ public class PermissionDialogDelegate { PermissionDialogDelegateJni.get().accept(mNativeDelegatePtr, PermissionDialogDelegate.this); } @@ -673,7 +866,6 @@ index ad45ed899c63f..b4fc982b5b57d 100644 assert mNativeDelegatePtr != 0; PermissionDialogDelegateJni.get().cancel(mNativeDelegatePtr, PermissionDialogDelegate.this); diff --git a/components/permissions/android/java/src/org/chromium/components/permissions/PermissionDialogModel.java b/components/permissions/android/java/src/org/chromium/components/permissions/PermissionDialogModel.java -index 9b67228efb01d..ef57c286a5dec 100644 --- a/components/permissions/android/java/src/org/chromium/components/permissions/PermissionDialogModel.java +++ b/components/permissions/android/java/src/org/chromium/components/permissions/PermissionDialogModel.java @@ -16,6 +16,17 @@ import org.chromium.ui.UiUtils; @@ -694,16 +886,16 @@ index 9b67228efb01d..ef57c286a5dec 100644 /** * This class creates the model for permission dialog. */ -@@ -34,7 +45,7 @@ class PermissionDialogModel { - TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds( - messageTextView, delegate.getDrawableId(), 0, 0, 0); +@@ -41,7 +52,7 @@ class PermissionDialogModel { + secondaryTextView.setVisibility(View.VISIBLE); + } - return new PropertyModel.Builder(ModalDialogProperties.ALL_KEYS) + PropertyModel pm = new PropertyModel.Builder(ModalDialogProperties.ALL_KEYS) .with(ModalDialogProperties.CONTROLLER, controller) + .with(ModalDialogProperties.FOCUS_DIALOG, true) .with(ModalDialogProperties.CUSTOM_VIEW, customView) - .with(ModalDialogProperties.POSITIVE_BUTTON_TEXT, delegate.getPrimaryButtonText()) -@@ -45,6 +56,74 @@ class PermissionDialogModel { +@@ -53,6 +64,74 @@ class PermissionDialogModel { .with(ModalDialogProperties.BUTTON_TAP_PROTECTION_PERIOD_MS, UiUtils.PROMPT_INPUT_PROTECTION_SHORT_DELAY_MS) .build(); @@ -779,10 +971,9 @@ index 9b67228efb01d..ef57c286a5dec 100644 private static View loadDialogView(Context context) { diff --git a/components/permissions/android/permission_prompt/permission_dialog_delegate.cc b/components/permissions/android/permission_prompt/permission_dialog_delegate.cc -index 6e8491786f6d0..5931748e9bd81 100644 --- a/components/permissions/android/permission_prompt/permission_dialog_delegate.cc +++ b/components/permissions/android/permission_prompt/permission_dialog_delegate.cc -@@ -67,6 +67,11 @@ void PermissionDialogJavaDelegate::DismissDialog() { +@@ -68,6 +68,11 @@ void PermissionDialogJavaDelegate::DismissDialog() { Java_PermissionDialogDelegate_dismissFromNative(env, j_delegate_); } @@ -794,7 +985,7 @@ index 6e8491786f6d0..5931748e9bd81 100644 // static void PermissionDialogDelegate::Create( content::WebContents* web_contents, -@@ -95,12 +100,26 @@ PermissionDialogDelegate* PermissionDialogDelegate::CreateForTesting( +@@ -96,12 +101,26 @@ PermissionDialogDelegate* PermissionDialogDelegate::CreateForTesting( void PermissionDialogDelegate::Accept(JNIEnv* env, const JavaParamRef& obj) { DCHECK(permission_prompt_); @@ -822,7 +1013,6 @@ index 6e8491786f6d0..5931748e9bd81 100644 } diff --git a/components/permissions/android/permission_prompt/permission_dialog_delegate.h b/components/permissions/android/permission_prompt/permission_dialog_delegate.h -index d0f1df73b7536..76c5685b7d613 100644 --- a/components/permissions/android/permission_prompt/permission_dialog_delegate.h +++ b/components/permissions/android/permission_prompt/permission_dialog_delegate.h @@ -35,6 +35,7 @@ class PermissionDialogJavaDelegate { @@ -834,10 +1024,9 @@ index d0f1df73b7536..76c5685b7d613 100644 private: base::android::ScopedJavaGlobalRef j_delegate_; diff --git a/components/permissions/android/permission_prompt/permission_prompt_android.cc b/components/permissions/android/permission_prompt/permission_prompt_android.cc -index 40f263ea1e33f..59ec7c86e6866 100644 --- a/components/permissions/android/permission_prompt/permission_prompt_android.cc +++ b/components/permissions/android/permission_prompt/permission_prompt_android.cc -@@ -46,6 +46,14 @@ void PermissionPromptAndroid::Accept() { +@@ -47,6 +47,14 @@ void PermissionPromptAndroid::Accept() { delegate_->Accept(); } @@ -853,7 +1042,6 @@ index 40f263ea1e33f..59ec7c86e6866 100644 delegate_->Deny(); } diff --git a/components/permissions/android/permission_prompt/permission_prompt_android.h b/components/permissions/android/permission_prompt/permission_prompt_android.h -index 39e962f4e11d2..ae4252d2d5893 100644 --- a/components/permissions/android/permission_prompt/permission_prompt_android.h +++ b/components/permissions/android/permission_prompt/permission_prompt_android.h @@ -46,7 +46,9 @@ class PermissionPromptAndroid : public PermissionPrompt { @@ -867,7 +1055,6 @@ index 39e962f4e11d2..ae4252d2d5893 100644 void SetLearnMoreClicked(); bool ShouldCurrentRequestUseQuietUI(); diff --git a/components/permissions/android/permissions_android_strings.grd b/components/permissions/android/permissions_android_strings.grd -index 32d18773dfb46..1b610345f9f72 100644 --- a/components/permissions/android/permissions_android_strings.grd +++ b/components/permissions/android/permissions_android_strings.grd @@ -264,6 +264,23 @@ @@ -895,10 +1082,9 @@ index 32d18773dfb46..1b610345f9f72 100644 %1$sitem_name (%2$sitem id) diff --git a/components/permissions/contexts/geolocation_permission_context_android.cc b/components/permissions/contexts/geolocation_permission_context_android.cc -index f347db796304f..64b20371a62bc 100644 --- a/components/permissions/contexts/geolocation_permission_context_android.cc +++ b/components/permissions/contexts/geolocation_permission_context_android.cc -@@ -161,7 +161,20 @@ void GeolocationPermissionContextAndroid::NotifyPermissionSet( +@@ -163,7 +163,20 @@ void GeolocationPermissionContextAndroid::NotifyPermissionSet( bool is_final_decision) { DCHECK(!is_one_time); DCHECK(is_final_decision); @@ -919,7 +1105,7 @@ index f347db796304f..64b20371a62bc 100644 bool is_default_search = IsRequestingOriginDSE(requesting_origin); if (content_setting == CONTENT_SETTING_ALLOW && !location_settings_->IsSystemLocationSettingEnabled()) { -@@ -174,7 +187,8 @@ void GeolocationPermissionContextAndroid::NotifyPermissionSet( +@@ -176,7 +189,8 @@ void GeolocationPermissionContextAndroid::NotifyPermissionSet( if (IsInLocationSettingsBackOff(is_default_search)) { FinishNotifyPermissionSet(id, requesting_origin, embedding_origin, std::move(callback), false /* persist */, @@ -929,7 +1115,7 @@ index f347db796304f..64b20371a62bc 100644 return; } -@@ -192,7 +206,8 @@ void GeolocationPermissionContextAndroid::NotifyPermissionSet( +@@ -194,7 +208,8 @@ void GeolocationPermissionContextAndroid::NotifyPermissionSet( !location_settings_dialog_callback_.is_null()) { FinishNotifyPermissionSet(id, requesting_origin, embedding_origin, std::move(callback), false /* persist */, @@ -939,7 +1125,7 @@ index f347db796304f..64b20371a62bc 100644 return; } -@@ -204,12 +219,13 @@ void GeolocationPermissionContextAndroid::NotifyPermissionSet( +@@ -206,12 +221,13 @@ void GeolocationPermissionContextAndroid::NotifyPermissionSet( base::BindOnce( &GeolocationPermissionContextAndroid::OnLocationSettingsDialogShown, weak_factory_.GetWeakPtr(), requesting_origin, embedding_origin, @@ -954,8 +1140,8 @@ index f347db796304f..64b20371a62bc 100644 + is_one_time, lifetime_option); } - PermissionResult -@@ -376,6 +392,7 @@ void GeolocationPermissionContextAndroid::OnLocationSettingsDialogShown( + content::PermissionResult +@@ -377,6 +393,7 @@ void GeolocationPermissionContextAndroid::OnLocationSettingsDialogShown( const GURL& embedding_origin, bool persist, ContentSetting content_setting, @@ -963,7 +1149,7 @@ index f347db796304f..64b20371a62bc 100644 LocationSettingsDialogOutcome prompt_outcome) { bool is_default_search = IsRequestingOriginDSE(requesting_origin); if (prompt_outcome == GRANTED) { -@@ -393,7 +410,8 @@ void GeolocationPermissionContextAndroid::OnLocationSettingsDialogShown( +@@ -394,7 +411,8 @@ void GeolocationPermissionContextAndroid::OnLocationSettingsDialogShown( FinishNotifyPermissionSet( location_settings_dialog_request_id_, requesting_origin, embedding_origin, @@ -973,7 +1159,7 @@ index f347db796304f..64b20371a62bc 100644 location_settings_dialog_request_id_ = PermissionRequestID(content::GlobalRenderFrameHostId(0, 0), -@@ -406,10 +424,11 @@ void GeolocationPermissionContextAndroid::FinishNotifyPermissionSet( +@@ -407,10 +425,11 @@ void GeolocationPermissionContextAndroid::FinishNotifyPermissionSet( const GURL& embedding_origin, BrowserPermissionCallback callback, bool persist, @@ -989,10 +1175,9 @@ index f347db796304f..64b20371a62bc 100644 void GeolocationPermissionContextAndroid::SetLocationSettingsForTesting( diff --git a/components/permissions/contexts/geolocation_permission_context_android.h b/components/permissions/contexts/geolocation_permission_context_android.h -index c05093c1e2328..0ba67e184b7db 100644 --- a/components/permissions/contexts/geolocation_permission_context_android.h +++ b/components/permissions/contexts/geolocation_permission_context_android.h -@@ -91,6 +91,15 @@ class GeolocationPermissionContextAndroid +@@ -89,6 +89,15 @@ class GeolocationPermissionContextAndroid ContentSetting content_setting, bool is_one_time, bool is_final_decision) override; @@ -1005,10 +1190,10 @@ index c05093c1e2328..0ba67e184b7db 100644 + bool is_one_time, + bool is_final_decision, + content_settings::LifetimeMode lifetime_option) override; - PermissionResult UpdatePermissionStatusWithDeviceStatus( - PermissionResult result, + content::PermissionResult UpdatePermissionStatusWithDeviceStatus( + content::PermissionResult result, const GURL& requesting_origin, -@@ -133,6 +142,7 @@ class GeolocationPermissionContextAndroid +@@ -131,6 +140,7 @@ class GeolocationPermissionContextAndroid const GURL& embedding_origin, bool persist, ContentSetting content_setting, @@ -1016,7 +1201,7 @@ index c05093c1e2328..0ba67e184b7db 100644 LocationSettingsDialogOutcome prompt_outcome); void FinishNotifyPermissionSet(const PermissionRequestID& id, -@@ -140,7 +150,9 @@ class GeolocationPermissionContextAndroid +@@ -138,7 +148,9 @@ class GeolocationPermissionContextAndroid const GURL& embedding_origin, BrowserPermissionCallback callback, bool persist, @@ -1028,31 +1213,26 @@ index c05093c1e2328..0ba67e184b7db 100644 std::unique_ptr location_settings_; diff --git a/components/permissions/permission_context_base.cc b/components/permissions/permission_context_base.cc -index 9bc4af3e1110f..7dcae884eb337 100644 --- a/components/permissions/permission_context_base.cc +++ b/components/permissions/permission_context_base.cc -@@ -249,6 +249,20 @@ PermissionContextBase::CreatePermissionRequest( +@@ -262,6 +262,16 @@ PermissionContextBase::CreatePermissionRequest( std::move(delete_callback)); } -+std::unique_ptr -+PermissionContextBase::CreatePermissionRequest( -+ const GURL& request_origin, -+ ContentSettingsType content_settings_type, -+ bool has_gesture, ++std::unique_ptr PermissionContextBase::CreatePermissionRequest( + content::WebContents* web_contents, ++ PermissionRequestData request_data, + PermissionRequest::PermissionDecidedCallbackWithLifetime permission_decided_callback, + base::OnceClosure delete_callback) const { + return std::make_unique( -+ request_origin, ContentSettingsTypeToRequestType(content_settings_type), -+ has_gesture, std::move(permission_decided_callback), ++ std::move(request_data), std::move(permission_decided_callback), + std::move(delete_callback)); +} + - PermissionResult PermissionContextBase::GetPermissionStatus( + content::PermissionResult PermissionContextBase::GetPermissionStatus( content::RenderFrameHost* render_frame_host, const GURL& requesting_origin, -@@ -428,7 +442,8 @@ void PermissionContextBase::PermissionDecided(const PermissionRequestID& id, +@@ -506,7 +516,8 @@ void PermissionContextBase::PermissionDecided(const PermissionRequestID& id, const GURL& embedding_origin, ContentSetting content_setting, bool is_one_time, @@ -1062,7 +1242,7 @@ index 9bc4af3e1110f..7dcae884eb337 100644 DCHECK(content_setting == CONTENT_SETTING_ALLOW || content_setting == CONTENT_SETTING_BLOCK || content_setting == CONTENT_SETTING_DEFAULT); -@@ -443,13 +458,14 @@ void PermissionContextBase::PermissionDecided(const PermissionRequestID& id, +@@ -521,13 +532,14 @@ void PermissionContextBase::PermissionDecided(const PermissionRequestID& id, // missing if a permission prompt was preignored and we already notified an // origin about it. if (request->second.second) { @@ -1081,7 +1261,7 @@ index 9bc4af3e1110f..7dcae884eb337 100644 } } -@@ -501,11 +517,27 @@ void PermissionContextBase::NotifyPermissionSet( +@@ -573,11 +585,27 @@ void PermissionContextBase::NotifyPermissionSet( ContentSetting content_setting, bool is_one_time, bool is_final_decision) { @@ -1110,7 +1290,7 @@ index 9bc4af3e1110f..7dcae884eb337 100644 } if (is_final_decision) { -@@ -535,6 +567,15 @@ void PermissionContextBase::UpdateContentSetting(const GURL& requesting_origin, +@@ -607,6 +635,15 @@ void PermissionContextBase::UpdateContentSetting(const GURL& requesting_origin, const GURL& embedding_origin, ContentSetting content_setting, bool is_one_time) { @@ -1126,7 +1306,7 @@ index 9bc4af3e1110f..7dcae884eb337 100644 DCHECK_EQ(requesting_origin, requesting_origin.DeprecatedGetOriginAsURL()); DCHECK_EQ(embedding_origin, embedding_origin.DeprecatedGetOriginAsURL()); DCHECK(content_setting == CONTENT_SETTING_ALLOW || -@@ -544,6 +585,8 @@ void PermissionContextBase::UpdateContentSetting(const GURL& requesting_origin, +@@ -616,6 +653,8 @@ void PermissionContextBase::UpdateContentSetting(const GURL& requesting_origin, constraints.set_session_model(is_one_time ? content_settings::SessionModel::OneTime : content_settings::SessionModel::Durable); @@ -1136,10 +1316,9 @@ index 9bc4af3e1110f..7dcae884eb337 100644 #if !BUILDFLAG(IS_ANDROID) if (base::FeatureList::IsEnabled( diff --git a/components/permissions/permission_context_base.h b/components/permissions/permission_context_base.h -index 35971997d12c7..a10e5b6fcebd2 100644 --- a/components/permissions/permission_context_base.h +++ b/components/permissions/permission_context_base.h -@@ -143,6 +143,15 @@ class PermissionContextBase : public content_settings::Observer { +@@ -149,6 +149,15 @@ class PermissionContextBase : public content_settings::Observer { // Updates stored content setting if persist is set, updates tab indicators // and runs the callback to finish the request. @@ -1155,7 +1334,7 @@ index 35971997d12c7..a10e5b6fcebd2 100644 virtual void NotifyPermissionSet(const PermissionRequestID& id, const GURL& requesting_origin, const GURL& embedding_origin, -@@ -164,6 +173,11 @@ class PermissionContextBase : public content_settings::Observer { +@@ -170,6 +179,11 @@ class PermissionContextBase : public content_settings::Observer { // Store the decided permission as a content setting. // virtual since the permission might be stored with different restrictions // (for example for desktop notifications). @@ -1167,22 +1346,20 @@ index 35971997d12c7..a10e5b6fcebd2 100644 virtual void UpdateContentSetting(const GURL& requesting_origin, const GURL& embedding_origin, ContentSetting content_setting, -@@ -196,6 +210,14 @@ class PermissionContextBase : public content_settings::Observer { +@@ -200,6 +214,12 @@ class PermissionContextBase : public content_settings::Observer { PermissionRequest::PermissionDecidedCallback permission_decided_callback, base::OnceClosure delete_callback) const; + virtual std::unique_ptr CreatePermissionRequest( -+ const GURL& request_origin, -+ ContentSettingsType content_settings_type, -+ bool has_gesture, + content::WebContents* web_contents, ++ PermissionRequestData request_data, + PermissionRequest::PermissionDecidedCallbackWithLifetime permission_decided_callback, + base::OnceClosure delete_callback) const; + - ContentSettingsType content_settings_type() const { - return content_settings_type_; - } -@@ -222,7 +244,8 @@ class PermissionContextBase : public content_settings::Observer { + base::ObserverList permission_observers_; + + // Set by subclasses to inform the base class that they will handle adding +@@ -222,7 +242,8 @@ class PermissionContextBase : public content_settings::Observer { const GURL& embedding_origin, ContentSetting content_setting, bool is_one_time, @@ -1190,10 +1367,9 @@ index 35971997d12c7..a10e5b6fcebd2 100644 + bool is_final_decision, + content_settings::LifetimeMode lifetime_option); - raw_ptr browser_context_; - const ContentSettingsType content_settings_type_; + void NotifyObservers(const ContentSettingsPattern& primary_pattern, + const ContentSettingsPattern& secondary_pattern, diff --git a/components/permissions/permission_prompt.h b/components/permissions/permission_prompt.h -index d61ebaee55c5d..8cec8785f4a08 100644 --- a/components/permissions/permission_prompt.h +++ b/components/permissions/permission_prompt.h @@ -65,8 +65,9 @@ class PermissionPrompt { @@ -1208,29 +1384,24 @@ index d61ebaee55c5d..8cec8785f4a08 100644 virtual void Ignore() = 0; diff --git a/components/permissions/permission_request.cc b/components/permissions/permission_request.cc -index 8baca976c0ac3..9cd4ccd4d33e6 100644 --- a/components/permissions/permission_request.cc +++ b/components/permissions/permission_request.cc -@@ -28,6 +28,18 @@ PermissionRequest::PermissionRequest( +@@ -37,6 +37,14 @@ PermissionRequest::PermissionRequest( permission_decided_callback_(std::move(permission_decided_callback)), delete_callback_(std::move(delete_callback)) {} +PermissionRequest::PermissionRequest( -+ const GURL& requesting_origin, -+ RequestType request_type, -+ bool has_gesture, ++ PermissionRequestData request_data, + PermissionDecidedCallbackWithLifetime permission_decided_callback, + base::OnceClosure delete_callback) -+ : requesting_origin_(requesting_origin), -+ request_type_(request_type), -+ has_gesture_(has_gesture), ++ : data_(std::move(request_data)), + permission_decided_callback_withlifetime_(std::move(permission_decided_callback)), + delete_callback_(std::move(delete_callback)) {} + PermissionRequest::~PermissionRequest() { DCHECK(delete_callback_.is_null()); } -@@ -257,19 +269,37 @@ bool PermissionRequest::ShouldUseTwoOriginPrompt() const { +@@ -276,19 +284,37 @@ bool PermissionRequest::ShouldUseTwoOriginPrompt() const { permissions::features::kPermissionStorageAccessAPI); } @@ -1271,10 +1442,9 @@ index 8baca976c0ac3..9cd4ccd4d33e6 100644 /*is_one_time=*/false, is_final_decision); } diff --git a/components/permissions/permission_request.h b/components/permissions/permission_request.h -index aa585003b8458..e8e6ec6c55ae1 100644 --- a/components/permissions/permission_request.h +++ b/components/permissions/permission_request.h -@@ -43,6 +43,11 @@ class PermissionRequest { +@@ -44,6 +44,11 @@ class PermissionRequest { bool /*is_one_time*/, bool /*is_final_decision*/)>; @@ -1286,20 +1456,18 @@ index aa585003b8458..e8e6ec6c55ae1 100644 // `permission_decided_callback` is called when the permission request is // resolved by the user (see comment on PermissionDecidedCallback above). // `delete_callback` is called when the permission request is no longer needed -@@ -58,6 +63,12 @@ class PermissionRequest { +@@ -63,6 +68,10 @@ class PermissionRequest { PermissionDecidedCallback permission_decided_callback, base::OnceClosure delete_callback); -+ PermissionRequest(const GURL& requesting_origin, -+ RequestType request_type, -+ bool has_gesture, ++ PermissionRequest(PermissionRequestData request_data, + PermissionDecidedCallbackWithLifetime permission_decided_callback, + base::OnceClosure delete_callback); + PermissionRequest(const PermissionRequest&) = delete; PermissionRequest& operator=(const PermissionRequest&) = delete; -@@ -119,10 +130,10 @@ class PermissionRequest { +@@ -128,10 +137,10 @@ class PermissionRequest { // If |is_one_time| is true the permission will last until all tabs of // |origin| are closed or navigated away from, and then the permission will // automatically expire after 1 day. @@ -1312,7 +1480,7 @@ index aa585003b8458..e8e6ec6c55ae1 100644 // Called when the user has cancelled the permission request. This // corresponds to a denial, but is segregated in case the context needs to -@@ -170,6 +181,9 @@ class PermissionRequest { +@@ -174,6 +183,9 @@ class PermissionRequest { // Called once a decision is made about the permission. PermissionDecidedCallback permission_decided_callback_; @@ -1323,7 +1491,6 @@ index aa585003b8458..e8e6ec6c55ae1 100644 // caller. base::OnceClosure delete_callback_; diff --git a/components/permissions/permission_request_manager.cc b/components/permissions/permission_request_manager.cc -index b77e176dd1b9a..2e4d5de971300 100644 --- a/components/permissions/permission_request_manager.cc +++ b/components/permissions/permission_request_manager.cc @@ -155,7 +155,7 @@ void PermissionRequestManager::AddRequest( @@ -1398,7 +1565,7 @@ index b77e176dd1b9a..2e4d5de971300 100644 } NotifyRequestDecided(PermissionAction::DENIED); -@@ -1162,32 +1173,32 @@ PermissionRequestManager::VisitDuplicateRequests( +@@ -1165,32 +1176,32 @@ PermissionRequestManager::VisitDuplicateRequests( void PermissionRequestManager::PermissionGrantedIncludingDuplicates( PermissionRequest* request, @@ -1441,17 +1608,16 @@ index b77e176dd1b9a..2e4d5de971300 100644 request); } -@@ -1436,7 +1447,7 @@ void PermissionRequestManager::LogWarningToConsole(const char* message) { +@@ -1439,7 +1450,7 @@ void PermissionRequestManager::LogWarningToConsole(const char* message) { void PermissionRequestManager::DoAutoResponseForTesting() { switch (auto_response_for_test_) { case ACCEPT_ONCE: - AcceptThisTime(); -+ AcceptThisTime(content_settings::LifetimeMode::Always); ++ AcceptThisTime(content_settings::LifetimeMode::OnlyThisTime); break; case ACCEPT_ALL: Accept(); diff --git a/components/permissions/permission_request_manager.h b/components/permissions/permission_request_manager.h -index 80505ee3af9db..2fc3c626205af 100644 --- a/components/permissions/permission_request_manager.h +++ b/components/permissions/permission_request_manager.h @@ -159,8 +159,10 @@ class PermissionRequestManager @@ -1481,6 +1647,5 @@ index 80505ee3af9db..2fc3c626205af 100644 // Calls Cancelled on a request and all its duplicates. void CancelledIncludingDuplicates(PermissionRequest* request, bool is_final_decision = true); --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-menu-item-to-bookmark-all-tabs.patch b/build/bromite_patches/Add-menu-item-to-bookmark-all-tabs.patch index b587d3fea91371e121c600c05df50821b2d5dfd3..8ebb1c48c8dd252fae1fdfcaef55e39080121c37 100644 --- a/build/bromite_patches/Add-menu-item-to-bookmark-all-tabs.patch +++ b/build/bromite_patches/Add-menu-item-to-bookmark-all-tabs.patch @@ -1,40 +1,37 @@ -From bcf63e9bf569667104c2144d94489da0aaa87b5a Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Thu, 18 Feb 2021 21:22:52 +0100 -Subject: [PATCH 125/192] Add menu item to bookmark all tabs +Subject: Add menu item to bookmark all tabs License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - chrome/android/java/res/menu/main_menu.xml | 7 +++ - .../chrome/browser/ChromeTabbedActivity.java | 24 ++++++++ - .../browser/bookmarks/BookmarkBridge.java | 61 +++++++++++++++++++ - .../browser/bookmarks/BookmarkUtils.java | 4 ++ - .../bookmarks/android/bookmark_bridge.cc | 19 +++++- - .../bookmarks/android/bookmark_bridge.h | 4 ++ + chrome/android/java/res/menu/main_menu.xml | 7 ++ + .../chrome/browser/ChromeTabbedActivity.java | 24 +++++++ + .../browser/bookmarks/BookmarkBridge.java | 64 +++++++++++++++++++ + .../bookmarks/android/bookmark_bridge.cc | 43 +++++++++++++ + .../bookmarks/android/bookmark_bridge.h | 8 +++ .../browser/bookmarks/bookmark_html_writer.cc | 8 ++- .../bookmarks/chrome_bookmark_client.cc | 2 + .../dialogs/DownloadLocationCustomView.java | 4 +- .../strings/android_chrome_strings.grd | 3 + components/bookmark_bar_strings.grdp | 6 ++ .../bookmarks/browser/bookmark_codec.cc | 22 +++++-- - components/bookmarks/browser/bookmark_codec.h | 7 ++- + components/bookmarks/browser/bookmark_codec.h | 7 +- .../browser/bookmark_load_details.cc | 4 ++ .../bookmarks/browser/bookmark_load_details.h | 3 + .../bookmarks/browser/bookmark_model.cc | 3 +- - components/bookmarks/browser/bookmark_model.h | 7 +++ + components/bookmarks/browser/bookmark_model.h | 7 ++ components/bookmarks/browser/bookmark_node.cc | 11 ++++ components/bookmarks/browser/bookmark_node.h | 4 ++ .../bookmarks/browser/bookmark_uuids.cc | 3 + components/bookmarks/browser/bookmark_uuids.h | 1 + components/bookmarks/browser/model_loader.cc | 3 +- .../bookmark_specifics_conversions.cc | 1 + - 23 files changed, 200 insertions(+), 11 deletions(-) + 22 files changed, 228 insertions(+), 10 deletions(-) diff --git a/chrome/android/java/res/menu/main_menu.xml b/chrome/android/java/res/menu/main_menu.xml -index 6e7eff229907d..ac0aad12b3dda 100644 --- a/chrome/android/java/res/menu/main_menu.xml +++ b/chrome/android/java/res/menu/main_menu.xml -@@ -69,6 +69,10 @@ found in the LICENSE file. +@@ -71,6 +71,10 @@ found in the LICENSE file. @@ -45,10 +42,10 @@ index 6e7eff229907d..ac0aad12b3dda 100644 -@@ -184,6 +188,9 @@ found in the LICENSE file. - +@@ -183,6 +187,9 @@ found in the LICENSE file. + + @@ -56,10 +53,9 @@ index 6e7eff229907d..ac0aad12b3dda 100644 android:title="@string/menu_select_tabs" android:icon="@drawable/ic_select_tabs" /> diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -index fa55eb8d43dc9..a93251c24b3e9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -@@ -82,6 +82,7 @@ import org.chromium.chrome.browser.back_press.MinimizeAppAndCloseTabBackPressHan +@@ -84,6 +84,7 @@ import org.chromium.chrome.browser.back_press.MinimizeAppAndCloseTabBackPressHan import org.chromium.chrome.browser.bookmarks.BookmarkUtils; import org.chromium.chrome.browser.browserservices.intents.WebappConstants; import org.chromium.chrome.browser.compositor.CompositorViewHolder; @@ -67,7 +63,7 @@ index fa55eb8d43dc9..a93251c24b3e9 100644 import org.chromium.chrome.browser.compositor.layouts.Layout; import org.chromium.chrome.browser.compositor.layouts.LayoutManagerChrome; import org.chromium.chrome.browser.compositor.layouts.LayoutManagerChromePhone; -@@ -2288,6 +2289,8 @@ public class ChromeTabbedActivity extends ChromeActivity getTabModelSelector().closeAllTabs()); RecordUserAction.record("MobileMenuCloseAllTabs"); @@ -76,8 +72,8 @@ index fa55eb8d43dc9..a93251c24b3e9 100644 } else if (id == R.id.close_all_incognito_tabs_menu_id) { // Close only incognito tabs CloseAllTabsDialog.show(this, getModalDialogManagerSupplier(), -@@ -2353,6 +2356,27 @@ public class ChromeTabbedActivity extends ChromeActivity mObservers = new ObserverList<>(); + + private static final String TAG = "BookmarkBridge"; + private long mNativeBookmarkBridge; private boolean mIsDestroyed; private boolean mIsDoingExtensiveChanges; -@@ -377,6 +384,16 @@ class BookmarkBridge { - mNativeBookmarkBridge, BookmarkBridge.this); +@@ -375,6 +382,16 @@ class BookmarkBridge { + return mMobileFolderId; } + /** @@ -153,14 +148,15 @@ index 95788b70eff1e..2c46d17385741 100644 /** * @return Id representing the special "other" folder from bookmark model. */ -@@ -1012,6 +1029,49 @@ class BookmarkBridge { - mNativeBookmarkBridge, BookmarkBridge.this, title, url); +@@ -1008,6 +1025,50 @@ class BookmarkBridge { + return BookmarkBridgeJni.get().addToReadingList(mNativeBookmarkBridge, title, url); } + // Used to bookmark all tabs in a specific folder, created if not existing + public BookmarkId addToTabsCollection(Context context, Tab tab) { + BookmarkId parent = getTabsCollectionFolderId(); -+ BookmarkId existingId = getUserBookmarkIdForTab(tab); ++ BookmarkId existingId = BookmarkBridgeJni.get().getBookmarkIdForTabsCollection( ++ mNativeBookmarkBridge, tab.getOriginalUrl()); + if (existingId != null && existingId.getId() != BookmarkId.INVALID_ID) { + BookmarkId existingBookmarkId = new BookmarkId(existingId.getId(), BookmarkType.NORMAL); + BookmarkItem existingBookmark = getBookmarkById(existingBookmarkId); @@ -203,60 +199,71 @@ index 95788b70eff1e..2c46d17385741 100644 /** * @param url The URL of the reading list item. * @return The reading list item with the URL, or null if no such reading list item. -@@ -1232,6 +1292,7 @@ class BookmarkBridge { - void getAllFoldersWithDepths(long nativeBookmarkBridge, BookmarkBridge caller, - List folderList, List depthList); - BookmarkId getRootFolderId(long nativeBookmarkBridge, BookmarkBridge caller); +@@ -1221,12 +1282,15 @@ class BookmarkBridge { + void getImageUrlForBookmark(long nativeBookmarkBridge, GURL url, Callback callback); + BookmarkId getBookmarkIdForWebContents( + long nativeBookmarkBridge, WebContents webContents, boolean onlyEditable); ++ BookmarkId getBookmarkIdForTabsCollection( ++ long nativeBookmarkBridge, GURL url); + BookmarkItem getBookmarkById(long nativeBookmarkBridge, long id, int type); + void getTopLevelFolderIds(long nativeBookmarkBridge, List bookmarksList); + BookmarkId getReadingListFolder(long nativeBookmarkBridge); + void getAllFoldersWithDepths( + long nativeBookmarkBridge, List folderList, List depthList); + BookmarkId getRootFolderId(long nativeBookmarkBridge); + BookmarkId getTabsCollectionFolderId(long nativeBookmarkBridge, BookmarkBridge caller); - BookmarkId getMobileFolderId(long nativeBookmarkBridge, BookmarkBridge caller); - BookmarkId getOtherFolderId(long nativeBookmarkBridge, BookmarkBridge caller); - BookmarkId getDesktopFolderId(long nativeBookmarkBridge, BookmarkBridge caller); -diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java -index 2eaf9a695d60d..b7b46031880e6 100644 ---- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java -+++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkUtils.java -@@ -615,6 +615,7 @@ public class BookmarkUtils { - List topLevelFolders = new ArrayList<>(); - BookmarkId desktopNodeId = bookmarkModel.getDesktopFolderId(); - BookmarkId mobileNodeId = bookmarkModel.getMobileFolderId(); -+ BookmarkId tabsCollectionNodeId = bookmarkModel.getTabsCollectionFolderId(); - BookmarkId othersNodeId = bookmarkModel.getOtherFolderId(); - - List specialFoldersIds = -@@ -640,6 +641,9 @@ public class BookmarkUtils { - if (bookmarkModel.isFolderVisible(mobileNodeId)) { - topLevelFolders.add(mobileNodeId); - } -+ if (bookmarkModel.isFolderVisible(tabsCollectionNodeId)) { -+ topLevelFolders.add(tabsCollectionNodeId); -+ } - if (bookmarkModel.isFolderVisible(desktopNodeId)) { - topLevelFolders.add(desktopNodeId); - } + BookmarkId getMobileFolderId(long nativeBookmarkBridge); + BookmarkId getOtherFolderId(long nativeBookmarkBridge); + BookmarkId getDesktopFolderId(long nativeBookmarkBridge); diff --git a/chrome/browser/bookmarks/android/bookmark_bridge.cc b/chrome/browser/bookmarks/android/bookmark_bridge.cc -index b0c4c40e9c240..f9745329803d7 100644 --- a/chrome/browser/bookmarks/android/bookmark_bridge.cc +++ b/chrome/browser/bookmarks/android/bookmark_bridge.cc -@@ -470,12 +470,17 @@ void BookmarkBridge::GetTopLevelFolderIds( - std::size_t special_count = top_level_folders.size(); - - if (get_normal) { -- DCHECK_EQ(4u, bookmark_model_->root_node()->children().size()); -+ DCHECK_EQ(5u, bookmark_model_->root_node()->children().size()); - for (const auto& node : bookmark_model_->mobile_node()->children()) { - if (node->is_folder()) - top_level_folders.push_back(node.get()); - } +@@ -330,6 +330,33 @@ void BookmarkBridge::GetImageUrlForBookmark( + base::BindOnce(&HandleImageUrlResponse, callback)); + } -+ for (const auto& node : bookmark_model_->tabs_collection_node()->children()) { -+ if (node->is_folder()) -+ top_level_folders.push_back(node.get()); ++base::android::ScopedJavaLocalRef ++BookmarkBridge::GetBookmarkIdForTabsCollection( ++ JNIEnv* env, ++ const JavaParamRef& url) { ++ DCHECK_CURRENTLY_ON(BrowserThread::UI); ++ ++ GURL gurl = *url::GURLAndroid::ToNativeGURL(env, url); ++ ++ bookmarks::BookmarkModel* model = ++ BookmarkModelFactory::GetForBrowserContext(profile_); ++ ++ std::vector nodes = ++ model->GetNodesByURL(gurl); ++ std::sort(nodes.begin(), nodes.end(), &bookmarks::MoreRecentlyAdded); ++ ++ for (const auto* node : nodes) { ++ for (const auto& child : model->tabs_collection_node()->children()) { ++ if (node->id() == child->id()) { ++ return JavaBookmarkIdCreateBookmarkId(env, node->id(), ++ GetBookmarkType(node)); ++ } + } ++ } ++ ++ return nullptr; ++} + - for (const auto& node : bookmark_model_->bookmark_bar_node()->children()) { - if (node->is_folder()) - top_level_folders.push_back(node.get()); -@@ -523,6 +528,7 @@ void BookmarkBridge::GetAllFoldersWithDepths( + base::android::ScopedJavaLocalRef + BookmarkBridge::GetBookmarkIdForWebContents( + JNIEnv* env, +@@ -436,6 +463,10 @@ void BookmarkBridge::GetTopLevelFolderIds( + } + top_level_folders.push_back(root_child.get()); + } ++ for (const auto& node : bookmark_model_->tabs_collection_node()->children()) { ++ if (node->is_folder()) ++ top_level_folders.push_back(node.get()); ++ } + + if (managed_bookmark_service_->managed_node() && + !managed_bookmark_service_->managed_node()->children().empty()) { +@@ -479,6 +510,7 @@ void BookmarkBridge::GetAllFoldersWithDepths( // Vector to temporarily contain all child bookmarks at same level for sorting std::vector bookmarks = { bookmark_model_->mobile_node(), @@ -264,8 +271,8 @@ index b0c4c40e9c240..f9745329803d7 100644 bookmark_model_->bookmark_bar_node(), bookmark_model_->other_node(), }; -@@ -575,6 +581,17 @@ ScopedJavaLocalRef BookmarkBridge::GetMobileFolderId( - return folder_id_obj; +@@ -1051,6 +1083,17 @@ void BookmarkBridge::GetBookmarksOfType( + } } +ScopedJavaLocalRef BookmarkBridge::GetTabsCollectionFolderId( @@ -279,26 +286,35 @@ index b0c4c40e9c240..f9745329803d7 100644 + return folder_id_obj; +} + - ScopedJavaLocalRef BookmarkBridge::GetOtherFolderId( + ScopedJavaLocalRef BookmarkBridge::AddFolder( JNIEnv* env, - const JavaParamRef& obj) { + const JavaParamRef& j_parent_id_obj, diff --git a/chrome/browser/bookmarks/android/bookmark_bridge.h b/chrome/browser/bookmarks/android/bookmark_bridge.h -index f194fe45a09f5..ef6ad825b903f 100644 --- a/chrome/browser/bookmarks/android/bookmark_bridge.h +++ b/chrome/browser/bookmarks/android/bookmark_bridge.h -@@ -133,6 +133,10 @@ class BookmarkBridge : public bookmarks::BaseBookmarkModelObserver, +@@ -69,6 +69,10 @@ class BookmarkBridge : public bookmarks::BaseBookmarkModelObserver, + const base::android::JavaParamRef& j_url, + const base::android::JavaParamRef& j_callback); + ++ base::android::ScopedJavaLocalRef GetBookmarkIdForTabsCollection( ++ JNIEnv* env, ++ const base::android::JavaParamRef& url); ++ + base::android::ScopedJavaLocalRef GetBookmarkIdForWebContents( JNIEnv* env, - const base::android::JavaParamRef& obj); + +@@ -205,6 +209,10 @@ class BookmarkBridge : public bookmarks::BaseBookmarkModelObserver, + const base::android::JavaParamRef& j_list, + jint type); + base::android::ScopedJavaLocalRef GetTabsCollectionFolderId( + JNIEnv* env, + const base::android::JavaParamRef& obj); + - base::android::ScopedJavaLocalRef GetOtherFolderId( + base::android::ScopedJavaLocalRef AddFolder( JNIEnv* env, - const base::android::JavaParamRef& obj); + const base::android::JavaParamRef& j_parent_id_obj, diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc -index 2f458ada42c60..ad61a33630e61 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer.cc @@ -190,15 +190,19 @@ class Writer : public base::RefCountedThreadSafe { @@ -332,10 +348,9 @@ index 2f458ada42c60..ad61a33630e61 100644 FetchNextFavicon(); else diff --git a/chrome/browser/bookmarks/chrome_bookmark_client.cc b/chrome/browser/bookmarks/chrome_bookmark_client.cc -index 247da1056dae1..81c56bacf0ab7 100644 --- a/chrome/browser/bookmarks/chrome_bookmark_client.cc +++ b/chrome/browser/bookmarks/chrome_bookmark_client.cc -@@ -106,6 +106,8 @@ bool ChromeBookmarkClient::IsPermanentNodeVisibleWhenEmpty( +@@ -160,6 +160,8 @@ bool ChromeBookmarkClient::IsPermanentNodeVisibleWhenEmpty( return !is_mobile; case bookmarks::BookmarkNode::MOBILE: return is_mobile; @@ -345,7 +360,6 @@ index 247da1056dae1..81c56bacf0ab7 100644 return false; diff --git a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLocationCustomView.java b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLocationCustomView.java -index c6c56e5bf5063..a49059193334b 100644 --- a/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLocationCustomView.java +++ b/chrome/browser/download/android/java/src/org/chromium/chrome/browser/download/dialogs/DownloadLocationCustomView.java @@ -79,7 +79,7 @@ public class DownloadLocationCustomView @@ -367,10 +381,9 @@ index c6c56e5bf5063..a49059193334b 100644 } diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd -index 6ae11fc0b71ef..3198555c554c0 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd -@@ -3871,6 +3871,9 @@ To change this setting, <resetlink>reset sync

<resetlink>reset sync

Select tabs @@ -381,7 +394,6 @@ index 6ae11fc0b71ef..3198555c554c0 100644 Get image descriptions diff --git a/components/bookmark_bar_strings.grdp b/components/bookmark_bar_strings.grdp -index 2f737d348e586..c78b9bb5490d2 100644 --- a/components/bookmark_bar_strings.grdp +++ b/components/bookmark_bar_strings.grdp @@ -20,6 +20,9 @@ @@ -405,7 +417,6 @@ index 2f737d348e586..c78b9bb5490d2 100644 Other Bookmarks diff --git a/components/bookmarks/browser/bookmark_codec.cc b/components/bookmarks/browser/bookmark_codec.cc -index 187520ff6cb69..8afed3e19f10a 100644 --- a/components/bookmarks/browser/bookmark_codec.cc +++ b/components/bookmarks/browser/bookmark_codec.cc @@ -36,6 +36,7 @@ const char BookmarkCodec::kBookmarkBarFolderNameKey[] = "bookmark_bar"; @@ -517,7 +528,6 @@ index 187520ff6cb69..8afed3e19f10a 100644 } diff --git a/components/bookmarks/browser/bookmark_codec.h b/components/bookmarks/browser/bookmark_codec.h -index 930d0ad114572..da0e9c24c249c 100644 --- a/components/bookmarks/browser/bookmark_codec.h +++ b/components/bookmarks/browser/bookmark_codec.h @@ -46,6 +46,7 @@ class BookmarkCodec { @@ -563,7 +573,6 @@ index 930d0ad114572..da0e9c24c249c 100644 // Helper to recursively reassign IDs. void ReassignIDsHelper(BookmarkNode* node); diff --git a/components/bookmarks/browser/bookmark_load_details.cc b/components/bookmarks/browser/bookmark_load_details.cc -index 9a44f40824bed..73ccfbb9059f9 100644 --- a/components/bookmarks/browser/bookmark_load_details.cc +++ b/components/bookmarks/browser/bookmark_load_details.cc @@ -37,6 +37,10 @@ BookmarkLoadDetails::BookmarkLoadDetails(BookmarkClient* client) @@ -578,7 +587,6 @@ index 9a44f40824bed..73ccfbb9059f9 100644 BookmarkLoadDetails::~BookmarkLoadDetails() = default; diff --git a/components/bookmarks/browser/bookmark_load_details.h b/components/bookmarks/browser/bookmark_load_details.h -index eed55313469c8..f6145e2f1277e 100644 --- a/components/bookmarks/browser/bookmark_load_details.h +++ b/components/bookmarks/browser/bookmark_load_details.h @@ -47,6 +47,7 @@ class BookmarkLoadDetails { @@ -587,31 +595,30 @@ index eed55313469c8..f6145e2f1277e 100644 BookmarkPermanentNode* other_folder_node() { return other_folder_node_; } + BookmarkPermanentNode* tabs_collection_folder_node() { return tabs_collection_folder_node_; } - TitledUrlIndex* index() { return index_.get(); } - std::unique_ptr owned_index() { return std::move(index_); } -@@ -112,6 +113,8 @@ class BookmarkLoadDetails { + std::unique_ptr owned_titled_url_index() { + return std::move(titled_url_index_); +@@ -119,6 +120,8 @@ class BookmarkLoadDetails { nullptr; raw_ptr mobile_folder_node_ = nullptr; + raw_ptr tabs_collection_folder_node_ = + nullptr; LoadManagedNodeCallback load_managed_node_callback_; - std::unique_ptr index_; - BookmarkNode::MetaInfoMap model_meta_info_map_; + std::unique_ptr titled_url_index_; + UuidIndex uuid_index_; diff --git a/components/bookmarks/browser/bookmark_model.cc b/components/bookmarks/browser/bookmark_model.cc -index 162556334e2fc..aa13a067aeeb0 100644 --- a/components/bookmarks/browser/bookmark_model.cc +++ b/components/bookmarks/browser/bookmark_model.cc -@@ -818,7 +818,7 @@ bool BookmarkModel::HasBookmarks() { - bool BookmarkModel::HasNoUserCreatedBookmarksOrFolders() { +@@ -845,7 +845,7 @@ bool BookmarkModel::HasBookmarks() const { + bool BookmarkModel::HasNoUserCreatedBookmarksOrFolders() const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return bookmark_bar_node_->children().empty() && - other_node_->children().empty() && mobile_node_->children().empty(); + other_node_->children().empty() && mobile_node_->children().empty() && tabs_collection_node_->children().empty(); } - bool BookmarkModel::IsBookmarked(const GURL& url) { -@@ -1124,6 +1124,7 @@ void BookmarkModel::DoneLoading(std::unique_ptr details) { + bool BookmarkModel::IsBookmarked(const GURL& url) const { +@@ -1155,6 +1155,7 @@ void BookmarkModel::DoneLoading(std::unique_ptr details) { bookmark_bar_node_ = details->bb_node(); other_node_ = details->other_folder_node(); mobile_node_ = details->mobile_folder_node(); @@ -620,10 +627,9 @@ index 162556334e2fc..aa13a067aeeb0 100644 titled_url_index_->SetNodeSorter( std::make_unique(client_.get())); diff --git a/components/bookmarks/browser/bookmark_model.h b/components/bookmarks/browser/bookmark_model.h -index 815a6cf5f7c4f..b36193dc864d3 100644 --- a/components/bookmarks/browser/bookmark_model.h +++ b/components/bookmarks/browser/bookmark_model.h -@@ -131,6 +131,12 @@ class BookmarkModel final : public BookmarkUndoProvider, +@@ -132,6 +132,12 @@ class BookmarkModel final : public BookmarkUndoProvider, return mobile_node_; } @@ -636,7 +642,7 @@ index 815a6cf5f7c4f..b36193dc864d3 100644 bool is_root_node(const BookmarkNode* node) const { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); return node == root_; -@@ -491,6 +497,7 @@ class BookmarkModel final : public BookmarkUndoProvider, +@@ -495,6 +501,7 @@ class BookmarkModel final : public BookmarkUndoProvider, nullptr; raw_ptr mobile_node_ = nullptr; @@ -645,7 +651,6 @@ index 815a6cf5f7c4f..b36193dc864d3 100644 // The maximum ID assigned to the bookmark nodes in the model. int64_t next_node_id_ = 1; diff --git a/components/bookmarks/browser/bookmark_node.cc b/components/bookmarks/browser/bookmark_node.cc -index 8b66e51afdcc1..d1876c4d152e1 100644 --- a/components/bookmarks/browser/bookmark_node.cc +++ b/components/bookmarks/browser/bookmark_node.cc @@ -239,6 +239,17 @@ BookmarkPermanentNode::CreateMobileBookmarks(int64_t id, @@ -667,7 +672,6 @@ index 8b66e51afdcc1..d1876c4d152e1 100644 Type type, const base::Uuid& uuid, diff --git a/components/bookmarks/browser/bookmark_node.h b/components/bookmarks/browser/bookmark_node.h -index 53a3d8c41ac53..875aba93dc1ae 100644 --- a/components/bookmarks/browser/bookmark_node.h +++ b/components/bookmarks/browser/bookmark_node.h @@ -35,6 +35,7 @@ class BookmarkNode : public ui::TreeNode, public TitledUrlNode { @@ -689,12 +693,11 @@ index 53a3d8c41ac53..875aba93dc1ae 100644 // Constructor is private to disallow the construction of permanent nodes // other than the well-known ones, see factory methods. diff --git a/components/bookmarks/browser/bookmark_uuids.cc b/components/bookmarks/browser/bookmark_uuids.cc -index c31fac979886b..4fc90832dd560 100644 --- a/components/bookmarks/browser/bookmark_uuids.cc +++ b/components/bookmarks/browser/bookmark_uuids.cc -@@ -33,6 +33,9 @@ const char kManagedNodeUuid[] = "323123f4-9381-5aee-80e6-ea5fca2f7672"; - // > uuid.uuid5(bookmarks_namespace, "shopping_collection") - const char kShoppingCollectionUuid[] = "e55c13d5-c108-52a6-bfd5-590b885500d0"; +@@ -35,6 +35,9 @@ const char kManagedNodeUuid[] = "323123f4-9381-5aee-80e6-ea5fca2f7672"; + // see https://crbug.com/1484372 for details. + const char kShoppingCollectionUuid[] = "89fc5b66-beb6-56c1-a99b-70635d7df201"; +const char kTabsCollectionBookmarksNodeUuid[] = + "00000000-0000-4000-a000-000000000006"; @@ -703,7 +706,6 @@ index c31fac979886b..4fc90832dd560 100644 // syncer::InferGuidForLegacyBookmark() with an empty input. const char kBannedUuidDueToPastSyncBug[] = diff --git a/components/bookmarks/browser/bookmark_uuids.h b/components/bookmarks/browser/bookmark_uuids.h -index c59b64038c5d4..27d632c471e3b 100644 --- a/components/bookmarks/browser/bookmark_uuids.h +++ b/components/bookmarks/browser/bookmark_uuids.h @@ -14,6 +14,7 @@ extern const char kBookmarkBarNodeUuid[]; @@ -715,10 +717,9 @@ index c59b64038c5d4..27d632c471e3b 100644 // A bug in sync caused some problematic UUIDs to be produced. diff --git a/components/bookmarks/browser/model_loader.cc b/components/bookmarks/browser/model_loader.cc -index 7b19a6617fd89..d81817620b5f0 100644 --- a/components/bookmarks/browser/model_loader.cc +++ b/components/bookmarks/browser/model_loader.cc -@@ -60,7 +60,8 @@ void LoadBookmarks(const base::FilePath& path, +@@ -45,7 +45,8 @@ void LoadBookmarks(const base::FilePath& path, std::string sync_metadata_str; BookmarkCodec codec; codec.Decode(*root_dict, details->bb_node(), details->other_folder_node(), @@ -729,7 +730,6 @@ index 7b19a6617fd89..d81817620b5f0 100644 details->set_sync_metadata_str(std::move(sync_metadata_str)); details->set_max_id(std::max(max_node_id, details->max_id())); diff --git a/components/sync_bookmarks/bookmark_specifics_conversions.cc b/components/sync_bookmarks/bookmark_specifics_conversions.cc -index ca6a2752ac811..32b18cd55051f 100644 --- a/components/sync_bookmarks/bookmark_specifics_conversions.cc +++ b/components/sync_bookmarks/bookmark_specifics_conversions.cc @@ -447,6 +447,7 @@ sync_pb::BookmarkSpecifics::Type GetProtoTypeFromBookmarkNode( @@ -740,6 +740,5 @@ index ca6a2752ac811..32b18cd55051f 100644 DCHECK(node->is_folder()); return sync_pb::BookmarkSpecifics::FOLDER; } --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-menu-item-to-view-source.patch b/build/bromite_patches/Add-menu-item-to-view-source.patch index 3361e91860a039123cba795627da5bedb261eae0..279633b2feca1db736afe1ead37b3a51a1381944 100644 --- a/build/bromite_patches/Add-menu-item-to-view-source.patch +++ b/build/bromite_patches/Add-menu-item-to-view-source.patch @@ -1,7 +1,6 @@ -From e98c8856c303b8ed2d63608bd9c84712c9c9305b Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Mon, 13 Jul 2020 00:37:06 +0200 -Subject: [PATCH 107/192] Add menu item to view source +Subject: Add menu item to view source License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- @@ -15,7 +14,6 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html 7 files changed, 36 insertions(+) diff --git a/chrome/android/java/res/menu/custom_tabs_menu.xml b/chrome/android/java/res/menu/custom_tabs_menu.xml -index 5cbabcc7c98d2..4a98471bffb07 100644 --- a/chrome/android/java/res/menu/custom_tabs_menu.xml +++ b/chrome/android/java/res/menu/custom_tabs_menu.xml @@ -55,6 +55,9 @@ found in the LICENSE file. @@ -29,10 +27,9 @@ index 5cbabcc7c98d2..4a98471bffb07 100644 android:title="@string/menu_install_webapp" android:orderInCategory="2" /> diff --git a/chrome/android/java/res/menu/main_menu.xml b/chrome/android/java/res/menu/main_menu.xml -index 6bcd575f5c91e..6e7eff229907d 100644 --- a/chrome/android/java/res/menu/main_menu.xml +++ b/chrome/android/java/res/menu/main_menu.xml -@@ -111,6 +111,9 @@ found in the LICENSE file. +@@ -113,6 +113,9 @@ found in the LICENSE file. @@ -43,10 +40,9 @@ index 6bcd575f5c91e..6e7eff229907d 100644 android:title="@string/menu_install_webapp" android:icon="@drawable/ic_install_webapp" /> diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -index e96e8955b97be..fa55eb8d43dc9 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -@@ -2313,6 +2313,8 @@ public class ChromeTabbedActivity extends ChromeActivity +@@ -2525,6 +2525,11 @@ public abstract class ChromeActivity return doOpenWebApk(currentTab); } @@ -72,10 +67,9 @@ index 893356c7a7d9f..a4956e49ad6b7 100644 boolean usingDesktopUserAgent = currentTab.getWebContents().getNavigationController().getUseDesktopUserAgent(); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java -index 211cd162129e7..4cf89cda35950 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/app/appmenu/AppMenuPropertiesDelegateImpl.java -@@ -552,6 +552,7 @@ public class AppMenuPropertiesDelegateImpl implements AppMenuPropertiesDelegate +@@ -550,6 +550,7 @@ public class AppMenuPropertiesDelegateImpl implements AppMenuPropertiesDelegate isChromeScheme, isFileScheme, isContentScheme, isIncognito, url)); updateRequestDesktopSiteMenuItem(menu, currentTab, true /* can show */, isChromeScheme); @@ -83,7 +77,7 @@ index 211cd162129e7..4cf89cda35950 100644 updateAutoDarkMenuItem(menu, currentTab, isChromeScheme); -@@ -1133,6 +1134,23 @@ public class AppMenuPropertiesDelegateImpl implements AppMenuPropertiesDelegate +@@ -1142,6 +1143,23 @@ public class AppMenuPropertiesDelegateImpl implements AppMenuPropertiesDelegate } } @@ -108,7 +102,6 @@ index 211cd162129e7..4cf89cda35950 100644 * Updates the request desktop site item's state. * diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java -index ca00a6a29cacf..e8678081b4a7c 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabAppMenuPropertiesDelegate.java @@ -241,6 +241,7 @@ public class CustomTabAppMenuPropertiesDelegate extends AppMenuPropertiesDelegat @@ -120,7 +113,6 @@ index ca00a6a29cacf..e8678081b4a7c 100644 } } diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd -index c004ab5d7a186..f874f81537b71 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd @@ -314,6 +314,10 @@ CHAR_LIMIT guidelines: @@ -134,6 +126,5 @@ index c004ab5d7a186..f874f81537b71 100644 You and Google --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-option-to-force-tablet-UI.patch b/build/bromite_patches/Add-option-to-force-tablet-UI.patch index 8b77e71099ebe05d8a176769ceb8c664d2ae252a..aeebeba663b5ad9f76f040f3c91153d532d12804 100644 --- a/build/bromite_patches/Add-option-to-force-tablet-UI.patch +++ b/build/bromite_patches/Add-option-to-force-tablet-UI.patch @@ -1,15 +1,15 @@ -From 4f62d262b02c3bab7d7329009d21aadee3095dc5 Mon Sep 17 00:00:00 2001 From: Wengling Chen Date: Mon, 1 Feb 2021 19:18:55 +0200 -Subject: [PATCH 127/192] Add option to force tablet UI +Subject: Add option to force tablet UI License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- .../ChromeAccessibilitySettingsDelegate.java | 19 +++++++++++++++++++ + .../chrome/browser/ui/RootUiCoordinator.java | 5 ++++- .../preferences/ChromePreferenceKeys.java | 1 + .../LegacyChromePreferenceKeys.java | 1 + .../omnibox/LocationBarCoordinator.java | 2 +- - .../strings/android_chrome_strings.grd | 6 ++++++ + .../strings/android_chrome_strings.grd | 7 +++++++ .../toolbar/top/ToolbarControlContainer.java | 5 ++--- components/BUILD.gn | 6 +++--- .../res/xml/accessibility_preferences.xml | 5 +++++ @@ -17,14 +17,13 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../AccessibilitySettingsDelegate.java | 2 ++ ui/android/BUILD.gn | 2 ++ .../chromium/ui/base/DeviceFormFactor.java | 5 +++++ - 12 files changed, 57 insertions(+), 7 deletions(-) + 13 files changed, 62 insertions(+), 8 deletions(-) diff --git a/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/ChromeAccessibilitySettingsDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/ChromeAccessibilitySettingsDelegate.java -index 16adf88cd50f7..7e35ced51b523 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/ChromeAccessibilitySettingsDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/ChromeAccessibilitySettingsDelegate.java -@@ -77,6 +77,25 @@ public class ChromeAccessibilitySettingsDelegate implements AccessibilitySetting - return new ReaderForAccessibilityDelegate(mProfile); +@@ -94,6 +94,25 @@ public class ChromeAccessibilitySettingsDelegate implements AccessibilitySetting + return new TextSizeContrastAccessibilityDelegate(getBrowserContextHandle()); } + private static class ForceTabletUIDelegate implements BooleanPreferenceDelegate { @@ -49,35 +48,54 @@ index 16adf88cd50f7..7e35ced51b523 100644 @Override public void addExtraPreferences(PreferenceFragmentCompat fragment) { if (ImageDescriptionsController.getInstance().shouldShowImageDescriptionsMenuItem()) { +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java b/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/ui/RootUiCoordinator.java +@@ -100,6 +100,7 @@ import org.chromium.chrome.browser.paint_preview.DemoPaintPreview; + import org.chromium.chrome.browser.password_manager.ManagePasswordsReferrer; + import org.chromium.chrome.browser.password_manager.PasswordManagerLauncher; + import org.chromium.chrome.browser.preferences.SharedPreferencesManager; ++import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; + import org.chromium.chrome.browser.price_tracking.PriceTrackingButtonController; + import org.chromium.chrome.browser.profiles.Profile; + import org.chromium.chrome.browser.quick_delete.QuickDeleteController; +@@ -1444,7 +1445,9 @@ public class RootUiCoordinator + if (!mSupportsFindInPageSupplier.getAsBoolean()) return; + + int stubId = R.id.find_toolbar_stub; +- if (DeviceFormFactor.isNonMultiDisplayContextOnTablet(mActivity)) { ++ if (DeviceFormFactor.isNonMultiDisplayContextOnTablet(mActivity) && ++ !SharedPreferencesManager.getInstance().readBoolean( ++ ChromePreferenceKeys.FLAGS_FORCE_TABLET_UI_ENABLED, false)) { + stubId = R.id.find_toolbar_tablet_stub; + } + mFindToolbarManager = new FindToolbarManager(mActivity.findViewById(stubId), diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java -index a78a936c3177f..f920daba5c9c5 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java -@@ -374,6 +374,7 @@ public final class ChromePreferenceKeys { +@@ -355,6 +355,7 @@ public final class ChromePreferenceKeys { AccessibilityConstants.FONT_USER_SET_FORCE_ENABLE_ZOOM; public static final String HISTORY_SHOW_HISTORY_INFO = "history_home_show_info"; + public static final String FLAGS_FORCE_TABLET_UI_ENABLED = "force_tablet_ui_enabled"; /** Keys used to save settings related to homepage. */ - public static final String HOMEPAGE_CUSTOM_URI = "homepage_custom_uri"; + public static final String DEPRECATED_HOMEPAGE_CUSTOM_URI = "homepage_custom_uri"; diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java -index 3663a9ee67edf..92f7a055d6bac 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java -@@ -65,6 +65,7 @@ public class LegacyChromePreferenceKeys { - ChromePreferenceKeys.FLAGS_CACHED_SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT, +@@ -64,6 +64,7 @@ public class LegacyChromePreferenceKeys { + ChromePreferenceKeys.FLAGS_CACHED_START_SURFACE_ENABLED, ChromePreferenceKeys.FLAGS_CACHED_TAB_GROUPS_ANDROID_ENABLED, ChromePreferenceKeys.FONT_USER_FONT_SCALE_FACTOR, + ChromePreferenceKeys.FLAGS_FORCE_TABLET_UI_ENABLED, ChromePreferenceKeys.FONT_USER_SET_FORCE_ENABLE_ZOOM, ChromePreferenceKeys.HISTORY_SHOW_HISTORY_INFO, - ChromePreferenceKeys.HOMEPAGE_CUSTOM_URI, + ChromePreferenceKeys.HOMEPAGE_ENABLED, diff --git a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/LocationBarCoordinator.java b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/LocationBarCoordinator.java -index f6770c2ea02e1..57196951523dd 100644 --- a/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/LocationBarCoordinator.java +++ b/chrome/browser/ui/android/omnibox/java/src/org/chromium/chrome/browser/omnibox/LocationBarCoordinator.java -@@ -685,7 +685,7 @@ public class LocationBarCoordinator +@@ -691,7 +691,7 @@ public class LocationBarCoordinator } private boolean isTabletWindow() { @@ -87,24 +105,23 @@ index f6770c2ea02e1..57196951523dd 100644 /* package */ LocationBarMediator getMediatorForTesting() { diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd -index 3198555c554c0..a93ae631ae6a8 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd -@@ -1702,6 +1702,12 @@ Your Google account may have other forms of browsing history like searches and a - - Temporarily links this data to your Google Account when you’re signed in, to protect you across Google apps +@@ -1765,6 +1765,13 @@ Your Google account may have other forms of browsing history like searches and a + Protection from trackers (third-party cookies, IP tracking, invasive scripts, and more) + + + Open chromium in Tablet Mode + + + Force Tablet Mode + - ++ + Safety check diff --git a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarControlContainer.java b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarControlContainer.java -index 1635f445e6314..d5b4038172800 100644 --- a/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarControlContainer.java +++ b/chrome/browser/ui/android/toolbar/java/src/org/chromium/chrome/browser/toolbar/top/ToolbarControlContainer.java @@ -166,9 +166,8 @@ public class ToolbarControlContainer extends OptimizedFrameLayout implements Con @@ -120,10 +137,9 @@ index 1635f445e6314..d5b4038172800 100644 backgroundDrawable.setTintMode(PorterDuff.Mode.MULTIPLY); diff --git a/components/BUILD.gn b/components/BUILD.gn -index 9ae45227c765a..08b765a18c9b2 100644 --- a/components/BUILD.gn +++ b/components/BUILD.gn -@@ -68,7 +68,7 @@ if (is_ios) { +@@ -71,7 +71,7 @@ if (is_ios) { # Omit Lacros because it allows //components to depend on //chrome, which in # turn depends on //extensions. @@ -132,7 +148,7 @@ index 9ae45227c765a..08b765a18c9b2 100644 disallowed_extension_deps_ = [ # Components should largely not depend on //extensions. Since // extensions # is not a component target and is linked with //chrome, depending on most -@@ -736,7 +736,7 @@ test("components_unittests") { +@@ -817,7 +817,7 @@ test("components_unittests") { # On other platforms, no components should depend on Chrome. # Since //chrome depends on //extensions, we also only assert_no_deps on # extensions targets for non-lacros builds. @@ -141,7 +157,7 @@ index 9ae45227c765a..08b765a18c9b2 100644 assert_no_deps = [ "//chrome/*" ] assert_no_deps += disallowed_extension_deps_ } -@@ -1025,7 +1025,7 @@ if (use_blink) { +@@ -1103,7 +1103,7 @@ if (use_blink) { # dependency. On other platforms, no components should depend on Chrome. # Since //chrome depends on //extensions, we also only assert_no_deps on # extensions targets for non-lacros builds. @@ -151,12 +167,11 @@ index 9ae45227c765a..08b765a18c9b2 100644 assert_no_deps += disallowed_extension_deps_ } diff --git a/components/browser_ui/accessibility/android/java/res/xml/accessibility_preferences.xml b/components/browser_ui/accessibility/android/java/res/xml/accessibility_preferences.xml -index 04e522c74af48..2fc5bcc4e2976 100644 --- a/components/browser_ui/accessibility/android/java/res/xml/accessibility_preferences.xml +++ b/components/browser_ui/accessibility/android/java/res/xml/accessibility_preferences.xml -@@ -36,6 +36,11 @@ found in the LICENSE file. - android:summary="@string/accessibility_tab_switcher_summary" - android:title="@string/accessibility_tab_switcher_title" /> +@@ -35,6 +35,11 @@ found in the LICENSE file. + android:summary="@string/reader_for_accessibility_summary" + android:title="@string/reader_for_accessibility_title" /> + diff --git a/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettings.java b/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettings.java -index 77f841d447d7e..2e582921f433d 100644 --- a/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettings.java +++ b/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettings.java -@@ -30,6 +30,8 @@ public class AccessibilitySettings extends PreferenceFragmentCompat - public static final String PREF_READER_FOR_ACCESSIBILITY = "reader_for_accessibility"; +@@ -33,6 +33,8 @@ public class AccessibilitySettings extends PreferenceFragmentCompat public static final String PREF_CAPTIONS = "captions"; + public static final String PREF_ZOOM_INFO = "zoom_info"; + private BooleanPreferenceDelegate mForceTabletUIDelegate; + static final String PREF_FORCE_TABLET_UI = "force_tablet_ui"; private TextScalePreference mTextScalePref; private PageZoomPreference mPageZoomDefaultZoomPref; private ChromeSwitchPreference mPageZoomAlwaysShowPref; -@@ -109,6 +111,12 @@ public class AccessibilitySettings extends PreferenceFragmentCompat +@@ -117,6 +119,12 @@ public class AccessibilitySettings extends PreferenceFragmentCompat getPreferenceScreen().removePreference(readerForAccessibilityPref); } @@ -189,10 +203,10 @@ index 77f841d447d7e..2e582921f433d 100644 + forceTabletUiPref.setChecked(mForceTabletUIDelegate.isEnabled()); + forceTabletUiPref.setOnPreferenceChangeListener(this); + - ChromeSwitchPreference accessibilityTabSwitcherPref = - (ChromeSwitchPreference) findPreference( - AccessibilityConstants.ACCESSIBILITY_TAB_SWITCHER); -@@ -165,6 +173,8 @@ public class AccessibilitySettings extends PreferenceFragmentCompat + Preference captions = findPreference(PREF_CAPTIONS); + captions.setOnPreferenceClickListener(preference -> { + Intent intent = new Intent(Settings.ACTION_CAPTIONING_SETTINGS); +@@ -174,6 +182,8 @@ public class AccessibilitySettings extends PreferenceFragmentCompat mFontSizePrefs.setUserFontScaleFactor((Float) newValue); } else if (PREF_FORCE_ENABLE_ZOOM.equals(preference.getKey())) { mFontSizePrefs.setForceEnableZoomFromUser((Boolean) newValue); @@ -202,12 +216,11 @@ index 77f841d447d7e..2e582921f433d 100644 if (mReaderForAccessibilityDelegate != null) { mReaderForAccessibilityDelegate.setEnabled((Boolean) newValue); diff --git a/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettingsDelegate.java b/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettingsDelegate.java -index f1a4f4a02c056..41a0726e9bad8 100644 --- a/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettingsDelegate.java +++ b/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettingsDelegate.java -@@ -44,6 +44,8 @@ public interface AccessibilitySettingsDelegate { +@@ -60,6 +60,8 @@ public interface AccessibilitySettingsDelegate { */ - BooleanPreferenceDelegate getReaderForAccessibilityDelegate(); + IntegerPreferenceDelegate getTextSizeContrastAccessibilityDelegate(); + BooleanPreferenceDelegate getForceTabletUIDelegate(); + @@ -215,10 +228,9 @@ index f1a4f4a02c056..41a0726e9bad8 100644 * Allows the embedder to add more preferences to the preference screen. * diff --git a/ui/android/BUILD.gn b/ui/android/BUILD.gn -index f49b09257e4e7..0bba2850d5773 100644 --- a/ui/android/BUILD.gn +++ b/ui/android/BUILD.gn -@@ -409,6 +409,8 @@ android_library("ui_no_recycler_view_java") { +@@ -411,6 +411,8 @@ android_library("ui_no_recycler_view_java") { ":ui_android_features_java", ":ui_java_resources", ":ui_utils_java", @@ -228,7 +240,6 @@ index f49b09257e4e7..0bba2850d5773 100644 "//base:jni_java", "//build/android:build_java", diff --git a/ui/android/java/src/org/chromium/ui/base/DeviceFormFactor.java b/ui/android/java/src/org/chromium/ui/base/DeviceFormFactor.java -index b7efa9f648f31..3df825d11052e 100644 --- a/ui/android/java/src/org/chromium/ui/base/DeviceFormFactor.java +++ b/ui/android/java/src/org/chromium/ui/base/DeviceFormFactor.java @@ -12,6 +12,8 @@ import androidx.annotation.VisibleForTesting; @@ -250,6 +261,5 @@ index b7efa9f648f31..3df825d11052e 100644 return detectScreenWidthBucket(context) >= SCREEN_BUCKET_TABLET; } --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-option-to-not-persist-tabs-across-sessions.patch b/build/bromite_patches/Add-option-to-not-persist-tabs-across-sessions.patch index 4aecac494c43ca9a6b188495b95ec63dccb40cbb..c8567cec25a666d11b8b7619ead18d3c651980ac 100644 --- a/build/bromite_patches/Add-option-to-not-persist-tabs-across-sessions.patch +++ b/build/bromite_patches/Add-option-to-not-persist-tabs-across-sessions.patch @@ -1,7 +1,6 @@ -From 0652be489d2c11a83862158b89bee4c3506e22dc Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sat, 7 Sep 2019 15:07:42 +0200 -Subject: [PATCH 065/192] Add option to not persist tabs across sessions +Subject: Add option to not persist tabs across sessions License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- @@ -12,10 +11,9 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/chrome/android/java/res/xml/privacy_preferences.xml b/chrome/android/java/res/xml/privacy_preferences.xml -index 31168cba63391..4c71a1e2ba2ab 100644 --- a/chrome/android/java/res/xml/privacy_preferences.xml +++ b/chrome/android/java/res/xml/privacy_preferences.xml -@@ -55,6 +55,11 @@ found in the LICENSE file. +@@ -61,6 +61,11 @@ found in the LICENSE file. android:title="@string/incognito_settings_title" android:summary="@string/incognito_settings_summary" android:fragment="org.chromium.chrome.browser.privacy.settings.IncognitoSettings"/> @@ -28,10 +26,9 @@ index 31168cba63391..4c71a1e2ba2ab 100644 android:fragment="org.chromium.chrome.browser.privacy.settings.DoNotTrackSettings" android:key="do_not_track" diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -index e2c2f93829e71..e96e8955b97be 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java -@@ -39,6 +39,7 @@ import org.chromium.base.BuildInfo; +@@ -40,6 +40,7 @@ import org.chromium.base.BuildInfo; import org.chromium.base.Callback; import org.chromium.base.CallbackController; import org.chromium.base.CommandLine; @@ -39,7 +36,7 @@ index e2c2f93829e71..e96e8955b97be 100644 import org.chromium.base.IntentUtils; import org.chromium.base.Log; import org.chromium.base.MemoryPressureListener; -@@ -1265,8 +1266,10 @@ public class ChromeTabbedActivity extends ChromeActivity<resetlink>reset sync

<resetlink>reset sync

IMAGE @@ -123,6 +118,5 @@ index 55d3ab59aca1f..efe12c746f899 100644 LINK --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-option-to-use-home-page-as-NTP.patch b/build/bromite_patches/Add-option-to-use-home-page-as-NTP.patch index e22cfc81d5ee2ad3a28cde85ead667eccf577c37..9b6f7b16572ac0374fa73f1a2ccdd3cf7ff35517 100644 --- a/build/bromite_patches/Add-option-to-use-home-page-as-NTP.patch +++ b/build/bromite_patches/Add-option-to-use-home-page-as-NTP.patch @@ -1,28 +1,26 @@ -From b4f05e2c0dea7f0e9b3d8e89c35c92fbfd83c524 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sat, 20 Nov 2021 15:36:54 +0000 -Subject: [PATCH 118/192] Add option to use home page as NTP +Subject: Add option to use home page as NTP And allow use about:blank as default homepage License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - .../tab_management/TabGridDialogMediator.java | 7 ++++++- - .../tasks/tab_management/TabGroupUiMediator.java | 7 ++++++- + .../tab_management/TabGridDialogMediator.java | 9 ++++++++- + .../tasks/tab_management/TabGroupUiMediator.java | 8 +++++++- .../java/res/xml/homepage_preferences.xml | 5 +++++ .../chrome/browser/homepage/HomepageManager.java | 16 ++++++++++++++++ .../homepage/settings/HomepageSettings.java | 12 ++++++++++++ .../chrome/browser/metrics/LaunchMetrics.java | 1 - - .../browser/tabmodel/ChromeTabCreator.java | 7 +++++++ + .../browser/tabmodel/ChromeTabCreator.java | 8 ++++++++ .../preferences/ChromePreferenceKeys.java | 1 + .../preferences/LegacyChromePreferenceKeys.java | 1 + .../android/strings/android_chrome_strings.grd | 3 +++ chrome/browser/ui/browser_ui_prefs.cc | 2 ++ chrome/common/pref_names.h | 4 ++++ - 12 files changed, 63 insertions(+), 3 deletions(-) + 12 files changed, 67 insertions(+), 3 deletions(-) diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java -index 5f12387c05368..f29c86612efb8 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGridDialogMediator.java @@ -18,6 +18,7 @@ import org.chromium.base.Callback; @@ -33,13 +31,22 @@ index 5f12387c05368..f29c86612efb8 100644 import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.TabCreationState; import org.chromium.chrome.browser.tab.TabLaunchType; -@@ -578,9 +579,13 @@ public class TabGridDialogMediator +@@ -44,6 +45,7 @@ import org.chromium.ui.KeyboardVisibilityDelegate; + import org.chromium.ui.base.DeviceFormFactor; + import org.chromium.ui.modelutil.PropertyModel; + import org.chromium.ui.text.EmptyTextWatcher; ++import org.chromium.url.GURL; + + import java.util.ArrayList; + import java.util.List; +@@ -564,9 +566,14 @@ public class TabGridDialogMediator assert relatedTabs.size() > 0; + String url = UrlConstants.NTP_URL; + if (HomepageManager.getInstance().getPrefNTPIsHomepageEnabled()) { -+ url = HomepageManager.getInstance().getHomepageUri(); ++ GURL gurl = HomepageManager.getInstance().getHomepageGurl(); ++ url = gurl != null ? gurl.getSpec() : url; + } Tab parentTabToAttach = relatedTabs.get(relatedTabs.size() - 1); mTabCreatorManager.getTabCreator(currentTab.isIncognito()) @@ -49,7 +56,6 @@ index 5f12387c05368..f29c86612efb8 100644 RecordUserAction.record("MobileNewTabOpened." + mComponentName); }; diff --git a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java -index 3765322c8f0c0..fa3ddb43ddf8c 100644 --- a/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java +++ b/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiMediator.java @@ -17,6 +17,7 @@ import org.chromium.base.metrics.RecordUserAction; @@ -60,13 +66,14 @@ index 3765322c8f0c0..fa3ddb43ddf8c 100644 import org.chromium.chrome.browser.layouts.LayoutStateProvider; import org.chromium.chrome.browser.layouts.LayoutStateProvider.LayoutStateObserver; import org.chromium.chrome.browser.layouts.LayoutType; -@@ -350,8 +351,12 @@ public class TabGroupUiMediator implements BackPressHandler { +@@ -345,8 +346,13 @@ public class TabGroupUiMediator implements BackPressHandler { + assert relatedTabs.size() > 0; - parentTabToAttach = relatedTabs.get(relatedTabs.size() - 1); - } + parentTabToAttach = relatedTabs.get(relatedTabs.size() - 1); + String url = UrlConstants.NTP_URL; + if (HomepageManager.getInstance().getPrefNTPIsHomepageEnabled()) { -+ url = HomepageManager.getInstance().getHomepageUri(); ++ GURL gurl = HomepageManager.getInstance().getHomepageGurl(); ++ url = gurl != null ? gurl.getSpec() : url; + } mTabCreatorManager.getTabCreator(currentTab.isIncognito()) - .createNewTab(new LoadUrlParams(UrlConstants.NTP_URL), @@ -75,7 +82,6 @@ index 3765322c8f0c0..fa3ddb43ddf8c 100644 RecordUserAction.record("MobileNewTabOpened." + TabGroupUiCoordinator.COMPONENT_NAME); }; diff --git a/chrome/android/java/res/xml/homepage_preferences.xml b/chrome/android/java/res/xml/homepage_preferences.xml -index 3796a71e33826..ad7282896808e 100644 --- a/chrome/android/java/res/xml/homepage_preferences.xml +++ b/chrome/android/java/res/xml/homepage_preferences.xml @@ -14,6 +14,11 @@ found in the LICENSE file. @@ -91,10 +97,9 @@ index 3796a71e33826..ad7282896808e 100644 android:key="homepage_radio_group" android:selectable="false" diff --git a/chrome/android/java/src/org/chromium/chrome/browser/homepage/HomepageManager.java b/chrome/android/java/src/org/chromium/chrome/browser/homepage/HomepageManager.java -index a5cdf2cc84df4..f715110bb3ee4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/homepage/HomepageManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/homepage/HomepageManager.java -@@ -228,6 +228,22 @@ public class HomepageManager implements HomepagePolicyManager.HomepagePolicyStat +@@ -238,6 +238,22 @@ public class HomepageManager implements HomepagePolicyManager.HomepagePolicyStat notifyHomepageUpdated(); } @@ -115,30 +120,29 @@ index a5cdf2cc84df4..f715110bb3ee4 100644 + } + /** - * @return User specified homepage custom URI string. + * @return User specified homepage custom GURL. */ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/homepage/settings/HomepageSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/homepage/settings/HomepageSettings.java -index aeb3547efb095..a23f78d6cda22 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/homepage/settings/HomepageSettings.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/homepage/settings/HomepageSettings.java -@@ -22,6 +22,7 @@ import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; - import org.chromium.components.browser_ui.settings.SettingsUtils; +@@ -22,6 +22,7 @@ import org.chromium.components.browser_ui.settings.SettingsUtils; import org.chromium.components.embedder_support.util.UrlUtilities; import org.chromium.components.url_formatter.UrlFormatter; + import org.chromium.url.GURL; +import org.chromium.components.embedder_support.util.UrlConstants; /** * Fragment that allows the user to configure homepage related preferences. -@@ -32,6 +33,8 @@ public class HomepageSettings extends PreferenceFragmentCompat { +@@ -32,6 +33,8 @@ public class HomepageSettings extends ChromeBaseSettingsFragment { @VisibleForTesting public static final String PREF_HOMEPAGE_RADIO_GROUP = "homepage_radio_group"; + private static final String PREF_NTP_HOMEPAGE_SWITCH = "ntp_is_homepage_switch"; + - /** - * Delegate used to mark that the homepage is being managed. - * Created for {@link org.chromium.chrome.browser.settings.HomepagePreferences} -@@ -72,6 +75,15 @@ public class HomepageSettings extends PreferenceFragmentCompat { + private HomepageManager mHomepageManager; + private RadioButtonGroupHomepagePreference mRadioButtons; + +@@ -65,6 +68,15 @@ public class HomepageSettings extends ChromeBaseSettingsFragment { }); mRadioButtons.setupPreferenceValues(createPreferenceValuesForRadioGroup()); @@ -155,36 +159,35 @@ index aeb3547efb095..a23f78d6cda22 100644 } diff --git a/chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java b/chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java -index 40f30858f0180..2849b22a08148 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/metrics/LaunchMetrics.java @@ -103,7 +103,6 @@ public class LaunchMetrics { - boolean showHomeButton, boolean homepageIsNtp, String homepageUrl) { - if (homepageUrl == null) { - homepageUrl = ""; -- assert !showHomeButton : "Homepage should be disabled for a null URL"; + public static void recordHomePageLaunchMetrics( + boolean showHomeButton, boolean homepageIsNtp, GURL homepageGurl) { + if (homepageGurl.isEmpty()) { +- assert !showHomeButton : "Homepage should be disabled for an empty GURL"; } LaunchMetricsJni.get().recordHomePageLaunchMetrics( - showHomeButton, homepageIsNtp, homepageUrl); + showHomeButton, homepageIsNtp, homepageGurl); diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java -index 4300ad0894ab0..acf440dfd0a36 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/tabmodel/ChromeTabCreator.java -@@ -26,6 +26,7 @@ import org.chromium.chrome.browser.app.tab_activity_glue.ReparentingTask; - import org.chromium.chrome.browser.compositor.CompositorViewHolder; +@@ -27,6 +27,7 @@ import org.chromium.chrome.browser.compositor.CompositorViewHolder; import org.chromium.chrome.browser.flags.ChromeFeatureList; import org.chromium.chrome.browser.incognito.IncognitoUtils; + import org.chromium.chrome.browser.new_tab_url.DseNewTabUrlManager; +import org.chromium.chrome.browser.homepage.HomepageManager; import org.chromium.chrome.browser.ntp.NewTabPageLaunchOrigin; import org.chromium.chrome.browser.ntp.NewTabPageUtils; import org.chromium.chrome.browser.prefetch.settings.PreloadPagesSettingsBridge; -@@ -472,6 +473,12 @@ public class ChromeTabCreator extends TabCreator { +@@ -502,6 +503,13 @@ public class ChromeTabCreator extends TabCreator { * @return the created tab. */ public Tab launchUrl(String url, @TabLaunchType int type, Intent intent, long intentTimestamp) { + if (!mIncognito && url.equals(UrlConstants.NTP_URL)) { + if (HomepageManager.getInstance().getPrefNTPIsHomepageEnabled()) { -+ url = HomepageManager.getInstance().getHomepageUri(); ++ GURL gurl = HomepageManager.getInstance().getHomepageGurl(); ++ url = gurl != null ? gurl.getSpec() : url; + } + } + @@ -192,23 +195,21 @@ index 4300ad0894ab0..acf440dfd0a36 100644 loadUrlParams.setIntentReceivedTimestamp(intentTimestamp); return createNewTab(loadUrlParams, type, null, intent); diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java -index 8596c3022dcb3..a78a936c3177f 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/ChromePreferenceKeys.java -@@ -385,6 +385,7 @@ public final class ChromePreferenceKeys { - public static final String HOMEPAGE_PARTNER_CUSTOMIZED_DEFAULT_GURL = - "Chrome.Homepage.PartnerCustomizedDefaultGurl"; +@@ -367,6 +367,7 @@ public final class ChromePreferenceKeys { + public static final String HOMEPAGE_USE_CHROME_NTP = "Chrome.Homepage.UseNTP"; + public static final String HOMEPAGE_USE_DEFAULT_URI = "homepage_partner_enabled"; + public static final String HOMEPAGE_NTP_IS_HOMEPAGE = "newtabpage_is_homepage"; /** * Key used to save homepage location set by enterprise policy */ diff --git a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java -index 8eecb99b97f6f..3663a9ee67edf 100644 --- a/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java +++ b/chrome/browser/preferences/android/java/src/org/chromium/chrome/browser/preferences/LegacyChromePreferenceKeys.java -@@ -70,6 +70,7 @@ public class LegacyChromePreferenceKeys { - ChromePreferenceKeys.HOMEPAGE_CUSTOM_URI, +@@ -68,6 +68,7 @@ public class LegacyChromePreferenceKeys { + ChromePreferenceKeys.HISTORY_SHOW_HISTORY_INFO, ChromePreferenceKeys.HOMEPAGE_ENABLED, ChromePreferenceKeys.HOMEPAGE_USE_DEFAULT_URI, + ChromePreferenceKeys.HOMEPAGE_NTP_IS_HOMEPAGE, @@ -216,10 +217,9 @@ index 8eecb99b97f6f..3663a9ee67edf 100644 ChromePreferenceKeys.LATEST_UNSUPPORTED_VERSION, ChromePreferenceKeys.LOCALE_MANAGER_AUTO_SWITCH, diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd -index f874f81537b71..6ae11fc0b71ef 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd -@@ -1514,6 +1514,9 @@ Your Google account may have other forms of browsing history like searches and a +@@ -1540,6 +1540,9 @@ Your Google account may have other forms of browsing history like searches and a Last hour @@ -230,10 +230,9 @@ index f874f81537b71..6ae11fc0b71ef 100644 Last 24 hours diff --git a/chrome/browser/ui/browser_ui_prefs.cc b/chrome/browser/ui/browser_ui_prefs.cc -index 3024320b2d014..3ce76a2ae9827 100644 --- a/chrome/browser/ui/browser_ui_prefs.cc +++ b/chrome/browser/ui/browser_ui_prefs.cc -@@ -65,6 +65,8 @@ void RegisterBrowserUserPrefs(user_prefs::PrefRegistrySyncable* registry) { +@@ -70,6 +70,8 @@ void RegisterBrowserUserPrefs(user_prefs::PrefRegistrySyncable* registry) { GetHomeButtonAndHomePageIsNewTabPageFlags()); registry->RegisterBooleanPref(prefs::kShowHomeButton, false, GetHomeButtonAndHomePageIsNewTabPageFlags()); @@ -243,10 +242,9 @@ index 3024320b2d014..3ce76a2ae9827 100644 registry->RegisterInt64Pref(prefs::kDefaultBrowserLastDeclined, 0); bool reset_check_default = false; diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h -index 03237079edc8d..caa31c9e129df 100644 --- a/chrome/common/pref_names.h +++ b/chrome/common/pref_names.h -@@ -1310,6 +1310,10 @@ inline constexpr char kUsedPolicyCertificates[] = +@@ -1283,6 +1283,10 @@ inline constexpr char kUsedPolicyCertificates[] = // visible on the toolbar. inline constexpr char kShowHomeButton[] = "browser.show_home_button"; @@ -257,6 +255,5 @@ index 03237079edc8d..caa31c9e129df 100644 // Boolean pref to define the default setting for "block offensive words". // The old key value is kept to avoid unnecessary migration code. inline constexpr char kSpeechRecognitionFilterProfanities[] = --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-search-engine.patch b/build/bromite_patches/Add-search-engine.patch new file mode 100644 index 0000000000000000000000000000000000000000..6910720b50615b80c411c3c089710bfe25b63a1e --- /dev/null +++ b/build/bromite_patches/Add-search-engine.patch @@ -0,0 +1,97 @@ +From: csagan5 <32685696+csagan5@users.noreply.github.com> +Date: Mon, 11 Dec 2017 22:42:11 +0100 +Subject: Add search engine + +Add a Google search engine that forces languages to English, +disable from all its searches RLZ and field experiments querystring parameters. +Add DuckDuckGo Lite + +License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html +--- + .../search_engines/prepopulated_engines.json | 31 +++++++++++++++++++ + .../search_engines/search_engine_type.h | 2 ++ + .../template_url_prepopulate_data.cc | 3 ++ + 3 files changed, 36 insertions(+) + +diff --git a/components/search_engines/prepopulated_engines.json b/components/search_engines/prepopulated_engines.json +--- a/components/search_engines/prepopulated_engines.json ++++ b/components/search_engines/prepopulated_engines.json +@@ -113,6 +113,16 @@ + "id": 92 + }, + ++ "duckduckgo_light": { ++ "name": "DuckDuckGo Light", ++ "keyword": "duckduckgo.com/lite", ++ "favicon_url": "https://duckduckgo.com/favicon.ico", ++ "search_url": "https://duckduckgo.com/lite/?q={searchTerms}", ++ "suggest_url": "https://duckduckgo.com/ac/?q={searchTerms}&type=list", ++ "type": "SEARCH_ENGINE_DUCKDUCKGOLIGHT", ++ "id": 12 ++ }, ++ + "ecosia": { + "name": "Ecosia", + "keyword": "ecosia.org", +@@ -171,6 +181,27 @@ + "id": 111 + }, + ++ "googleen": { ++ "name": "Google in English", ++ "keyword": "googleen", ++ "favicon_url": "https://www.google.com/favicon.ico", ++ "search_url": "{google:baseURL}search?q={searchTerms}&ie={inputEncoding}&hl=en", ++ "suggest_url": "{google:baseSuggestURL}search?client={google:suggestClient}&q={searchTerms}&hl=en", ++ "image_url": "{google:baseURL}searchbyimage/upload?hl=en", ++ "new_tab_url": "{google:baseURL}_/chrome/newtab?hl=en&ie={inputEncoding}", ++ "contextual_search_url": "{google:baseURL}_/contextualsearch?{google:contextualSearchVersion}{google:contextualSearchContextData}&hl=en", ++ "image_url_post_params": "encoded_image={google:imageThumbnail},image_url={google:imageURL},sbisrc={google:imageSearchSource},original_width={google:imageOriginalWidth},original_height={google:imageOriginalHeight}", ++ "alternate_urls": [ ++ "{google:baseURL}?hl=en#q={searchTerms}", ++ "{google:baseURL}search?hl=en#q={searchTerms}", ++ "{google:baseURL}webhp?hl=en#q={searchTerms}", ++ "{google:baseURL}s?hl=en#q={searchTerms}", ++ "{google:baseURL}s?hl=en&q={searchTerms}" ++ ], ++ "type": "SEARCH_ENGINE_GOOGLE_EN", ++ "id": 13 ++ }, ++ + "mail_ru": { + "name": "@MAIL.RU", + "keyword": "mail.ru", +diff --git a/components/search_engines/search_engine_type.h b/components/search_engines/search_engine_type.h +--- a/components/search_engines/search_engine_type.h ++++ b/components/search_engines/search_engine_type.h +@@ -88,6 +88,8 @@ enum SearchEngineType { + SEARCH_ENGINE_QUENDU = 69, + SEARCH_ENGINE_BRAVE = 70, + SEARCH_ENGINE_KARMA = 71, ++ SEARCH_ENGINE_GOOGLE_EN = 72, ++ SEARCH_ENGINE_DUCKDUCKGOLIGHT = 73, + + SEARCH_ENGINE_MAX // Bounding value needed for UMA histogram macro. + }; +diff --git a/components/search_engines/template_url_prepopulate_data.cc b/components/search_engines/template_url_prepopulate_data.cc +--- a/components/search_engines/template_url_prepopulate_data.cc ++++ b/components/search_engines/template_url_prepopulate_data.cc +@@ -56,6 +56,7 @@ struct EngineAndTier { + + // Default (for countries with no better engine set) + constexpr EngineAndTier engines_default[] = { ++ {SearchEngineTier::kTopEngines, &googleen}, + {SearchEngineTier::kTopEngines, &google}, + {SearchEngineTier::kTopEngines, &bing}, + {SearchEngineTier::kTopEngines, &yahoo}, +@@ -1608,6 +1609,8 @@ const std::vector GetPrepopulationSetFromCountryID( + for (size_t i = 0; i < num_engines; i++) { + t_url.push_back(engines[i]); + } ++ t_url.push_back({SearchEngineTier::kTopEngines, &googleen}); ++ t_url.push_back({SearchEngineTier::kTopEngines, &duckduckgo_light}); + return t_url; + } + +-- +2.25.1 diff --git a/build/bromite_patches/Add-site-engagement-flag.patch b/build/bromite_patches/Add-site-engagement-flag.patch index 0d9ddb38e0b99af566c2b1952e325bdc701634a0..f9105f723f765fdaf37dcb273845425e57bb6245 100644 --- a/build/bromite_patches/Add-site-engagement-flag.patch +++ b/build/bromite_patches/Add-site-engagement-flag.patch @@ -1,29 +1,27 @@ -From fcc9d8969aca34d7f82d0270de79a70a33ab30c9 Mon Sep 17 00:00:00 2001 From: uazo Date: Mon, 2 May 2022 11:48:03 +0000 -Subject: [PATCH 170/192] Add site engagement flag +Subject: Add site engagement flag Disabled by default. Original License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - chrome/browser/about_flags.cc | 6 ++++ - chrome/browser/flag_descriptions.cc | 5 +++ - chrome/browser/flag_descriptions.h | 3 ++ + chrome/browser/about_flags.cc | 1 + .../content/site_engagement_score.cc | 5 +++ components/site_engagement/core/BUILD.gn | 6 ++++ - components/site_engagement/core/features.cc | 29 ++++++++++++++++ + components/site_engagement/core/features.cc | 30 ++++++++++++++++ components/site_engagement/core/features.h | 34 +++++++++++++++++++ - 7 files changed, 88 insertions(+) + .../Add-site-engagement-flag.inc | 10 ++++++ + 6 files changed, 86 insertions(+) create mode 100644 components/site_engagement/core/features.cc create mode 100644 components/site_engagement/core/features.h + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/Add-site-engagement-flag.inc diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index bc1a9f986ff8c..1a967fcb42c29 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -144,6 +144,7 @@ +@@ -148,6 +148,7 @@ #include "components/segmentation_platform/public/features.h" #include "components/send_tab_to_self/features.h" #include "components/services/heap_profiling/public/cpp/switches.h" @@ -31,50 +29,7 @@ index bc1a9f986ff8c..1a967fcb42c29 100644 #include "components/shared_highlighting/core/common/shared_highlighting_features.h" #include "components/signin/core/browser/dice_account_reconcilor_delegate.h" #include "components/signin/public/base/signin_buildflags.h" -@@ -9564,6 +9565,11 @@ const FeatureEntry kFeatureEntries[] = { - kLargeFaviconFromGoogleVariations, - "LargeFaviconFromGoogle")}, - -+ {"site-engagement", -+ flag_descriptions::kSiteEngagementName, -+ flag_descriptions::kSiteEngagementDescription, kOsAll, -+ FEATURE_VALUE_TYPE(site_engagement::features::kSiteEngagement)}, -+ - #if BUILDFLAG(IS_ANDROID) - {"force-off-text-autosizing", - flag_descriptions::kForceOffTextAutosizingName, -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index 1c8b73b87da7f..df16e84247120 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -3770,6 +3770,11 @@ const char kSkipServiceWorkerFetchHandlerDescription[] = - "Skips starting the service worker and run the fetch handler if the fetch " - "handler is recognized as skippable."; - -+const char kSiteEngagementName[] = -+ "Enable site engagement feature"; -+const char kSiteEngagementDescription[] = -+ "Site Engagement Service provides information about how engaged a user is with a origin; this affects which NTP tiles are automatically created."; -+ - const char kWebSQLAccessName[] = "Allows access to WebSQL APIs"; - const char kWebSQLAccessDescription[] = - "The WebSQL API is enabled by default, but can be disabled here."; -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index 39c1bc44ac2ef..269c8f89b2640 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -2198,6 +2198,9 @@ extern const char kReduceAcceptLanguageDescription[]; - extern const char kSkipServiceWorkerFetchHandlerName[]; - extern const char kSkipServiceWorkerFetchHandlerDescription[]; - -+extern const char kSiteEngagementName[]; -+extern const char kSiteEngagementDescription[]; -+ - extern const char kWebSQLAccessName[]; - extern const char kWebSQLAccessDescription[]; - diff --git a/components/site_engagement/content/site_engagement_score.cc b/components/site_engagement/content/site_engagement_score.cc -index b5f8f39dca4b8..18b3ba8919005 100644 --- a/components/site_engagement/content/site_engagement_score.cc +++ b/components/site_engagement/content/site_engagement_score.cc @@ -18,6 +18,7 @@ @@ -97,7 +52,6 @@ index b5f8f39dca4b8..18b3ba8919005 100644 origin_, GURL(), ContentSettingsType::SITE_ENGAGEMENT, base::Value(std::move(*score_dict_))); diff --git a/components/site_engagement/core/BUILD.gn b/components/site_engagement/core/BUILD.gn -index 4975a87fc555c..307b7a27c29a0 100644 --- a/components/site_engagement/core/BUILD.gn +++ b/components/site_engagement/core/BUILD.gn @@ -4,8 +4,14 @@ @@ -117,10 +71,9 @@ index 4975a87fc555c..307b7a27c29a0 100644 } diff --git a/components/site_engagement/core/features.cc b/components/site_engagement/core/features.cc new file mode 100644 -index 0000000000000..a8c8bed9df7b6 --- /dev/null +++ b/components/site_engagement/core/features.cc -@@ -0,0 +1,29 @@ +@@ -0,0 +1,30 @@ +/* + This file is part of Bromite. + @@ -145,14 +98,14 @@ index 0000000000000..a8c8bed9df7b6 +namespace site_engagement { +namespace features { + -+const base::Feature kSiteEngagement{"SiteEngagement", -+ base::FEATURE_DISABLED_BY_DEFAULT}; ++CROMITE_FEATURE(kSiteEngagement, ++ "SiteEngagement", ++ base::FEATURE_DISABLED_BY_DEFAULT); + +} // namespace features +} // namespace site_engagement diff --git a/components/site_engagement/core/features.h b/components/site_engagement/core/features.h new file mode 100644 -index 0000000000000..2eaf1540dca6b --- /dev/null +++ b/components/site_engagement/core/features.h @@ -0,0 +1,34 @@ @@ -184,12 +137,26 @@ index 0000000000000..2eaf1540dca6b +namespace features { + +// Enable site engagement -+extern const base::Feature kSiteEngagement; ++BASE_DECLARE_FEATURE(kSiteEngagement); + +} // namespace features +} // namespace site_engagement + +#endif // SITE_ENGAGEMENT_CORE_FEATURES_H_ --- -2.34.1 - +diff --git a/cromite_flags/chrome/browser/about_flags_cc/Add-site-engagement-flag.inc b/cromite_flags/chrome/browser/about_flags_cc/Add-site-engagement-flag.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/Add-site-engagement-flag.inc +@@ -0,0 +1,10 @@ ++#ifdef FLAG_SECTION ++ ++ {"site-engagement", ++ "Enable site engagement feature", ++ "Site Engagement Service provides information about how " ++ "engaged a user is with a origin; this affects which NTP " ++ "tiles are automatically created.", kOsAll, ++ FEATURE_VALUE_TYPE(site_engagement::features::kSiteEngagement)}, ++ ++#endif +-- +2.25.1 diff --git a/build/bromite_patches/Add-support-for-ISupportHelpAndFeedback.patch b/build/bromite_patches/Add-support-for-ISupportHelpAndFeedback.patch index d23b3f40507139fdf3035da03ab80c5412ba9d45..e9b9026e24af04c858afc806bf74164517ee27a4 100644 --- a/build/bromite_patches/Add-support-for-ISupportHelpAndFeedback.patch +++ b/build/bromite_patches/Add-support-for-ISupportHelpAndFeedback.patch @@ -1,7 +1,6 @@ -From d4c8c3a1e2acb49f8f714c30edf51dc32f59c956 Mon Sep 17 00:00:00 2001 From: uazo Date: Mon, 17 May 2021 12:30:12 +0000 -Subject: [PATCH 015/192] Add support for ISupportHelpAndFeedback +Subject: Add support for ISupportHelpAndFeedback Original License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html @@ -11,18 +10,17 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java -index fb1b2661cbb45..130443d449f84 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/settings/SettingsActivity.java -@@ -83,6 +83,7 @@ import org.chromium.components.browser_ui.settings.CustomDividerFragment; +@@ -86,6 +86,7 @@ import org.chromium.components.browser_ui.settings.CustomDividerFragment; import org.chromium.components.browser_ui.settings.FragmentSettingsLauncher; import org.chromium.components.browser_ui.settings.PaddedDividerItemDecoration; import org.chromium.components.browser_ui.settings.SettingsLauncher; +import org.chromium.components.browser_ui.settings.SettingsUtils; import org.chromium.components.browser_ui.site_settings.SiteSettingsCategory; - import org.chromium.components.browser_ui.site_settings.SiteSettingsPreferenceFragment; + import org.chromium.components.browser_ui.site_settings.BaseSiteSettingsFragment; import org.chromium.components.browser_ui.util.TraceEventVectorDrawableCompat; -@@ -398,8 +399,12 @@ public class SettingsActivity extends ChromeBaseAppCompatActivity +@@ -417,8 +418,12 @@ public class SettingsActivity extends ChromeBaseAppCompatActivity finish(); return true; } else if (item.getItemId() == R.id.menu_id_general_help) { @@ -38,7 +36,6 @@ index fb1b2661cbb45..130443d449f84 100644 } return super.onOptionsItemSelected(item); diff --git a/components/browser_ui/settings/android/java/src/org/chromium/components/browser_ui/settings/SettingsUtils.java b/components/browser_ui/settings/android/java/src/org/chromium/components/browser_ui/settings/SettingsUtils.java -index 2c2340191f930..65975f026fa67 100644 --- a/components/browser_ui/settings/android/java/src/org/chromium/components/browser_ui/settings/SettingsUtils.java +++ b/components/browser_ui/settings/android/java/src/org/chromium/components/browser_ui/settings/SettingsUtils.java @@ -97,4 +97,8 @@ public class SettingsUtils { @@ -50,6 +47,5 @@ index 2c2340191f930..65975f026fa67 100644 + void onHelpAndFeebackPressed(); + } } --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-support-for-writing-URIs.patch b/build/bromite_patches/Add-support-for-writing-URIs.patch index 3261c41940af3e37d97dc36eebb87ddcadc8fac7..9122d43c06df39aa6d589d66416f178e8c3433ff 100644 --- a/build/bromite_patches/Add-support-for-writing-URIs.patch +++ b/build/bromite_patches/Add-support-for-writing-URIs.patch @@ -1,7 +1,6 @@ -From ba6f4dedcf923b69c13393abd5c862d2f9f6cb21 Mon Sep 17 00:00:00 2001 From: uazo Date: Tue, 12 Apr 2022 15:58:01 +0000 -Subject: [PATCH 060/192] Add support for writing URIs +Subject: Add support for writing URIs Allows native-side URI file writing @@ -14,7 +13,6 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html 3 files changed, 47 insertions(+) diff --git a/base/android/content_uri_utils.cc b/base/android/content_uri_utils.cc -index 2ab50fcc48832..300e79d86d9a8 100644 --- a/base/android/content_uri_utils.cc +++ b/base/android/content_uri_utils.cc @@ -30,6 +30,16 @@ File OpenContentUriForRead(const FilePath& content_uri) { @@ -35,7 +33,6 @@ index 2ab50fcc48832..300e79d86d9a8 100644 JNIEnv* env = base::android::AttachCurrentThread(); ScopedJavaLocalRef j_uri = diff --git a/base/android/content_uri_utils.h b/base/android/content_uri_utils.h -index 33665f6cf70aa..ce9a6d75ab424 100644 --- a/base/android/content_uri_utils.h +++ b/base/android/content_uri_utils.h @@ -18,6 +18,10 @@ namespace base { @@ -50,7 +47,6 @@ index 33665f6cf70aa..ce9a6d75ab424 100644 BASE_EXPORT bool ContentUriExists(const FilePath& content_uri); diff --git a/base/android/java/src/org/chromium/base/ContentUriUtils.java b/base/android/java/src/org/chromium/base/ContentUriUtils.java -index 27501317a8206..cfef594067d00 100644 --- a/base/android/java/src/org/chromium/base/ContentUriUtils.java +++ b/base/android/java/src/org/chromium/base/ContentUriUtils.java @@ -23,6 +23,9 @@ import org.chromium.base.annotations.CalledByNative; @@ -74,7 +70,7 @@ index 27501317a8206..cfef594067d00 100644 + ContentResolver resolver = ContextUtils.getApplicationContext().getContentResolver(); + ContentProviderClient client = resolver.acquireContentProviderClient( + uri.getAuthority()); -+ ParcelFileDescriptor pfd = client.openFile(uri, "rw"); ++ ParcelFileDescriptor pfd = client.openFile(uri, "wt"); + int fd = pfd.detachFd(); + client.close(); + return fd; @@ -100,6 +96,5 @@ index 27501317a8206..cfef594067d00 100644 /** * Check whether a content URI exists. * --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-webGL-site-setting.patch b/build/bromite_patches/Add-webGL-site-setting.patch index b001dfd0b7bb31df2ada515c9e8ae474ab8c886a..5a69ec9a8cf7dd6339f3da974b61fbebc4e99353 100644 --- a/build/bromite_patches/Add-webGL-site-setting.patch +++ b/build/bromite_patches/Add-webGL-site-setting.patch @@ -1,7 +1,6 @@ -From 8e60b0aa533ff7ba976004f54a81f00de853cd6a Mon Sep 17 00:00:00 2001 From: uazo Date: Tue, 3 May 2022 14:44:11 +0000 -Subject: [PATCH 019/192] Add webGL site setting +Subject: Add webGL site setting Do not provide any device information when serving context creation errors. @@ -26,7 +25,6 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebGLContentSetting.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebGLContentSetting.java new file mode 100644 -index 0000000000000..f7bb6433b714d --- /dev/null +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebGLContentSetting.java @@ -0,0 +1,92 @@ @@ -124,7 +122,6 @@ index 0000000000000..f7bb6433b714d +} diff --git a/components/browser_ui/strings/bromite_content_settings/webgl.grdp b/components/browser_ui/strings/bromite_content_settings/webgl.grdp new file mode 100644 -index 0000000000000..53635991ed294 --- /dev/null +++ b/components/browser_ui/strings/bromite_content_settings/webgl.grdp @@ -0,0 +1,27 @@ @@ -157,7 +154,6 @@ index 0000000000000..53635991ed294 + diff --git a/components/content_settings/core/browser/bromite_content_settings/webgl.inc b/components/content_settings/core/browser/bromite_content_settings/webgl.inc new file mode 100644 -index 0000000000000..3ff01832baef4 --- /dev/null +++ b/components/content_settings/core/browser/bromite_content_settings/webgl.inc @@ -0,0 +1,22 @@ @@ -185,13 +181,11 @@ index 0000000000000..3ff01832baef4 + .set_mid_sentence_ui(IDS_SITE_SETTINGS_TYPE_WEBGL); diff --git a/components/content_settings/core/common/bromite_content_settings/WEBGL.inc b/components/content_settings/core/common/bromite_content_settings/WEBGL.inc new file mode 100644 -index 0000000000000..30dc2ff2d125f --- /dev/null +++ b/components/content_settings/core/common/bromite_content_settings/WEBGL.inc @@ -0,0 +1 @@ + WEBGL, diff --git a/third_party/blink/renderer/core/execution_context/execution_context.cc b/third_party/blink/renderer/core/execution_context/execution_context.cc -index efc08516fd1bb..485ba73ada1f1 100644 --- a/third_party/blink/renderer/core/execution_context/execution_context.cc +++ b/third_party/blink/renderer/core/execution_context/execution_context.cc @@ -84,6 +84,13 @@ blink::WebContentSettingsClient* GetContentSettingsClientFor( @@ -209,10 +203,9 @@ index efc08516fd1bb..485ba73ada1f1 100644 Agent* agent, bool is_window) diff --git a/third_party/blink/renderer/core/execution_context/execution_context.h b/third_party/blink/renderer/core/execution_context/execution_context.h -index 72f9eca8d4a84..71b10f5a48244 100644 --- a/third_party/blink/renderer/core/execution_context/execution_context.h +++ b/third_party/blink/renderer/core/execution_context/execution_context.h -@@ -115,6 +115,8 @@ enum ReasonForCallingCanExecuteScripts { +@@ -116,6 +116,8 @@ enum ReasonForCallingCanExecuteScripts { enum ReferrerPolicySource { kPolicySourceHttpHeader, kPolicySourceMetaTag }; @@ -222,7 +215,6 @@ index 72f9eca8d4a84..71b10f5a48244 100644 // properties of script execution environments on the web (i.e, common between // script executing in a window and script executing in a worker), such as: diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc -index 74a289a88a953..8783d3560f727 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc +++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.cc @@ -248,6 +248,13 @@ void WebGLRenderingContextBase::InitializeWebGLContextLimits( @@ -279,10 +271,9 @@ index 74a289a88a953..8783d3560f727 100644 !host->IsWebGL1Enabled()) || (context_type == Platform::kWebGL2ContextType && diff --git a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h -index 2261611fdd586..58a3066ac23a1 100644 --- a/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h +++ b/third_party/blink/renderer/modules/webgl/webgl_rendering_context_base.h -@@ -1936,6 +1936,8 @@ class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext, +@@ -1937,6 +1937,8 @@ class MODULES_EXPORT WebGLRenderingContextBase : public CanvasRenderingContext, DOMArrayBufferView* pixels, int64_t offset); @@ -291,6 +282,5 @@ index 2261611fdd586..58a3066ac23a1 100644 // Record Canvas/OffscreenCanvas.RenderingContextDrawnTo at the first draw // call. void RecordUKMCanvasDrawnToAtFirstDrawCall(); --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Add-webRTC-site-settings.patch b/build/bromite_patches/Add-webRTC-site-settings.patch index 9c2ca379fb64a3227f521a113578756e9a27cf39..5fc32e931d4ef94bb858d4d97415c28c0b5354ba 100644 --- a/build/bromite_patches/Add-webRTC-site-settings.patch +++ b/build/bromite_patches/Add-webRTC-site-settings.patch @@ -1,7 +1,6 @@ -From 5d4af42b4e5d6d6a86af19192bf998ad4226d48e Mon Sep 17 00:00:00 2001 From: uazo Date: Fri, 6 May 2022 14:27:17 +0000 -Subject: [PATCH 020/192] Add webRTC site settings +Subject: Add webRTC site settings Requires patch: Content-settings-infrastructure.patch @@ -23,7 +22,6 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebRTCContentSetting.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebRTCContentSetting.java new file mode 100644 -index 0000000000000..90db1c61a577a --- /dev/null +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebRTCContentSetting.java @@ -0,0 +1,93 @@ @@ -122,7 +120,6 @@ index 0000000000000..90db1c61a577a +} diff --git a/components/browser_ui/strings/bromite_content_settings/webrtc.grdp b/components/browser_ui/strings/bromite_content_settings/webrtc.grdp new file mode 100644 -index 0000000000000..cf4fd02e990e1 --- /dev/null +++ b/components/browser_ui/strings/bromite_content_settings/webrtc.grdp @@ -0,0 +1,27 @@ @@ -155,7 +152,6 @@ index 0000000000000..cf4fd02e990e1 + diff --git a/components/content_settings/core/browser/bromite_content_settings/webrtc.inc b/components/content_settings/core/browser/bromite_content_settings/webrtc.inc new file mode 100644 -index 0000000000000..69b2de0ff52fa --- /dev/null +++ b/components/content_settings/core/browser/bromite_content_settings/webrtc.inc @@ -0,0 +1,22 @@ @@ -183,16 +179,14 @@ index 0000000000000..69b2de0ff52fa + .set_mid_sentence_ui(IDS_SITE_SETTINGS_TYPE_WEBRTC_MID_SENTENCE); diff --git a/components/content_settings/core/common/bromite_content_settings/WEBRTC.inc b/components/content_settings/core/common/bromite_content_settings/WEBRTC.inc new file mode 100644 -index 0000000000000..9af8b04d7949e --- /dev/null +++ b/components/content_settings/core/common/bromite_content_settings/WEBRTC.inc @@ -0,0 +1 @@ + WEBRTC, diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc -index 3ed83696b33f3..4912585888b84 100644 --- a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc +++ b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc -@@ -35,6 +35,7 @@ +@@ -37,6 +37,7 @@ #include "third_party/blink/public/common/peerconnection/webrtc_ip_handling_policy.h" #include "third_party/blink/public/platform/modules/webrtc/webrtc_logging.h" #include "third_party/blink/public/platform/platform.h" @@ -200,7 +194,7 @@ index 3ed83696b33f3..4912585888b84 100644 #include "third_party/blink/public/platform/web_url.h" #include "third_party/blink/public/web/modules/mediastream/media_stream_video_source.h" #include "third_party/blink/public/web/web_document.h" -@@ -739,6 +740,11 @@ PeerConnectionDependencyFactory::CreatePortAllocator( +@@ -781,6 +782,11 @@ PeerConnectionDependencyFactory::CreatePortAllocator( // origin. WebRTCIPHandlingPolicy policy = GetWebRTCIPHandlingPolicy(webrtc_ip_handling_policy); @@ -213,7 +207,6 @@ index 3ed83696b33f3..4912585888b84 100644 // TODO(guoweis): specify the flag of disabling local candidate // collection when webrtc is updated. diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc -index 1d750f9cb2296..280210171d68c 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc @@ -12,6 +12,8 @@ @@ -241,7 +234,6 @@ index 1d750f9cb2296..280210171d68c 100644 capabilities->setCodecs(HeapVector>()); capabilities->setHeaderExtensions( diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc -index d054b9a0f8e1a..6beddc4471207 100644 --- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc +++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc @@ -17,6 +17,8 @@ @@ -253,7 +245,7 @@ index d054b9a0f8e1a..6beddc4471207 100644 #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_insertable_streams.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_rtcp_parameters.h" -@@ -950,6 +952,14 @@ RTCRtpCapabilities* RTCRtpSender::getCapabilities(ScriptState* state, +@@ -1004,6 +1006,14 @@ RTCRtpCapabilities* RTCRtpSender::getCapabilities(ScriptState* state, if (kind != "audio" && kind != "video") return nullptr; @@ -268,6 +260,5 @@ index d054b9a0f8e1a..6beddc4471207 100644 RTCRtpCapabilities* capabilities = RTCRtpCapabilities::Create(); capabilities->setCodecs(HeapVector>()); capabilities->setHeaderExtensions( --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Allow-building-without-enable_reporting.patch b/build/bromite_patches/Allow-building-without-enable_reporting.patch index 45e405b5b2de8bc61e35fd0ab6ef8a44e8a52a3f..c0f6ae5c287fae62ac5d9b4e5d8871a4e4fcb191 100644 --- a/build/bromite_patches/Allow-building-without-enable_reporting.patch +++ b/build/bromite_patches/Allow-building-without-enable_reporting.patch @@ -1,7 +1,6 @@ -From af7ded228141d30812c7766cff17f7630168051d Mon Sep 17 00:00:00 2001 From: Zoraver Kang Date: Fri, 22 May 2020 22:43:27 -0400 -Subject: [PATCH 140/192] Allow building without enable_reporting +Subject: Allow building without enable_reporting License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- @@ -13,10 +12,10 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../renderer_host/render_frame_host_impl.cc | 6 ------ .../web_package/signed_exchange_reporter.cc | 2 ++ ...content_switch_dependent_feature_overrides.cc | 1 + - net/base/features.cc | 2 +- + .../Allow-building-without-enable_reporting.inc | 2 ++ + net/base/features.cc | 1 + net/reporting/reporting_service.cc | 6 ++++++ services/network/network_context.h | 4 ++-- - services/network/public/cpp/features.cc | 6 +++--- services/network/public/mojom/BUILD.gn | 1 - .../network/public/mojom/network_context.mojom | 2 ++ .../core/frame/csp/content_security_policy.cc | 3 +++ @@ -25,10 +24,10 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../renderer/core/frame/reporting_context.cc | 9 +++++++++ .../renderer/core/frame/reporting_context.h | 7 +++++-- .../renderer/core/frame/reporting_observer.cc | 3 +-- - 20 files changed, 59 insertions(+), 31 deletions(-) + 20 files changed, 58 insertions(+), 27 deletions(-) + create mode 100644 cromite_flags/services/network/public/cpp/features_cc/Allow-building-without-enable_reporting.inc diff --git a/chrome/browser/net/chrome_report_sender.cc b/chrome/browser/net/chrome_report_sender.cc -index 44c6864687a21..d914ae08612ec 100644 --- a/chrome/browser/net/chrome_report_sender.cc +++ b/chrome/browser/net/chrome_report_sender.cc @@ -85,6 +85,7 @@ void SendReport( @@ -40,10 +39,9 @@ index 44c6864687a21..d914ae08612ec 100644 resource_request->url = report_uri; resource_request->method = "POST"; diff --git a/content/browser/devtools/protocol/network_handler.cc b/content/browser/devtools/protocol/network_handler.cc -index a5c43bbdf09c2..77a7304636853 100644 --- a/content/browser/devtools/protocol/network_handler.cc +++ b/content/browser/devtools/protocol/network_handler.cc -@@ -1299,6 +1299,7 @@ String BuildReportStatus(const net::ReportingReport::Status status) { +@@ -1314,6 +1314,7 @@ String BuildReportStatus(const net::ReportingReport::Status status) { } } @@ -51,7 +49,7 @@ index a5c43bbdf09c2..77a7304636853 100644 std::vector ComputeReportingURLs(RenderFrameHostImpl* frame_host) { std::vector urls; frame_host->ForEachRenderFrameHostWithAction( -@@ -1312,6 +1313,7 @@ std::vector ComputeReportingURLs(RenderFrameHostImpl* frame_host) { +@@ -1327,6 +1328,7 @@ std::vector ComputeReportingURLs(RenderFrameHostImpl* frame_host) { }); return urls; } @@ -60,7 +58,6 @@ index a5c43bbdf09c2..77a7304636853 100644 } // namespace diff --git a/content/browser/network/cross_origin_embedder_policy_reporter.cc b/content/browser/network/cross_origin_embedder_policy_reporter.cc -index c6e0784009602..37e66a4576f9d 100644 --- a/content/browser/network/cross_origin_embedder_policy_reporter.cc +++ b/content/browser/network/cross_origin_embedder_policy_reporter.cc @@ -4,6 +4,7 @@ @@ -99,7 +96,6 @@ index c6e0784009602..37e66a4576f9d 100644 } // namespace content diff --git a/content/browser/network/cross_origin_opener_policy_reporter.cc b/content/browser/network/cross_origin_opener_policy_reporter.cc -index bf2df309fa7c2..46467cfb34885 100644 --- a/content/browser/network/cross_origin_opener_policy_reporter.cc +++ b/content/browser/network/cross_origin_opener_policy_reporter.cc @@ -18,25 +18,17 @@ @@ -177,7 +173,6 @@ index bf2df309fa7c2..46467cfb34885 100644 } // namespace content diff --git a/content/browser/network/reporting_service_proxy.cc b/content/browser/network/reporting_service_proxy.cc -index 44a10ccda2cf6..cdabde61cb8ea 100644 --- a/content/browser/network/reporting_service_proxy.cc +++ b/content/browser/network/reporting_service_proxy.cc @@ -11,6 +11,7 @@ @@ -204,10 +199,9 @@ index 44a10ccda2cf6..cdabde61cb8ea 100644 const int render_process_id_; diff --git a/content/browser/renderer_host/render_frame_host_impl.cc b/content/browser/renderer_host/render_frame_host_impl.cc -index 8525270e85ccb..2dc9bc023ba2a 100644 --- a/content/browser/renderer_host/render_frame_host_impl.cc +++ b/content/browser/renderer_host/render_frame_host_impl.cc -@@ -13360,12 +13360,6 @@ void RenderFrameHostImpl::MaybeGenerateCrashReport( +@@ -13489,12 +13489,6 @@ void RenderFrameHostImpl::MaybeGenerateCrashReport( base::Value::Dict body; if (!reason.empty()) body.Set("reason", reason); @@ -221,7 +215,6 @@ index 8525270e85ccb..2dc9bc023ba2a 100644 void RenderFrameHostImpl::SendCommitNavigation( diff --git a/content/browser/web_package/signed_exchange_reporter.cc b/content/browser/web_package/signed_exchange_reporter.cc -index 2da894ca9ccfa..b624edd47d71a 100644 --- a/content/browser/web_package/signed_exchange_reporter.cc +++ b/content/browser/web_package/signed_exchange_reporter.cc @@ -128,6 +128,7 @@ void ReportResult( @@ -241,10 +234,9 @@ index 2da894ca9ccfa..b624edd47d71a 100644 } // namespace diff --git a/content/public/common/content_switch_dependent_feature_overrides.cc b/content/public/common/content_switch_dependent_feature_overrides.cc -index 8a9b2ff57d197..d3e1fc11967c6 100644 --- a/content/public/common/content_switch_dependent_feature_overrides.cc +++ b/content/public/common/content_switch_dependent_feature_overrides.cc -@@ -7,6 +7,7 @@ +@@ -9,6 +9,7 @@ #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "net/base/features.h" @@ -252,21 +244,25 @@ index 8a9b2ff57d197..d3e1fc11967c6 100644 #include "services/network/public/cpp/features.h" #include "services/network/public/cpp/network_switches.h" #include "third_party/blink/public/common/features.h" +diff --git a/cromite_flags/services/network/public/cpp/features_cc/Allow-building-without-enable_reporting.inc b/cromite_flags/services/network/public/cpp/features_cc/Allow-building-without-enable_reporting.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/services/network/public/cpp/features_cc/Allow-building-without-enable_reporting.inc +@@ -0,0 +1,2 @@ ++SET_CROMITE_FEATURE_DISABLED(kNetworkErrorLogging); ++SET_CROMITE_FEATURE_DISABLED(kReporting); diff --git a/net/base/features.cc b/net/base/features.cc -index 41dfa7bc63480..640f5b8f93f2b 100644 --- a/net/base/features.cc +++ b/net/base/features.cc -@@ -242,7 +242,7 @@ extern const base::FeatureParam kTimeoutTcpConnectAttemptMax( +@@ -224,6 +224,7 @@ extern const base::FeatureParam kTimeoutTcpConnectAttemptMax( + base::Seconds(30)); + #if BUILDFLAG(ENABLE_REPORTING) ++#error Attempting to build with enable_reporting BASE_FEATURE(kDocumentReporting, "DocumentReporting", -- base::FEATURE_ENABLED_BY_DEFAULT); -+ base::FEATURE_DISABLED_BY_DEFAULT); - #endif // BUILDFLAG(ENABLE_REPORTING) - - #if BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA) + base::FEATURE_ENABLED_BY_DEFAULT); diff --git a/net/reporting/reporting_service.cc b/net/reporting/reporting_service.cc -index 75ec4d24f3b6d..da1ce56867538 100644 --- a/net/reporting/reporting_service.cc +++ b/net/reporting/reporting_service.cc @@ -211,6 +211,12 @@ class ReportingServiceImpl : public ReportingService { @@ -283,7 +279,6 @@ index 75ec4d24f3b6d..da1ce56867538 100644 context_->cache()->AddReport( reporting_source, network_anonymization_key, sanitized_url, user_agent, diff --git a/services/network/network_context.h b/services/network/network_context.h -index b2b848b38840b..3f50c687a95c7 100644 --- a/services/network/network_context.h +++ b/services/network/network_context.h @@ -473,10 +473,10 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) NetworkContext @@ -299,29 +294,10 @@ index b2b848b38840b..3f50c687a95c7 100644 void AddDomainReliabilityContextForTesting( const url::Origin& origin, const GURL& upload_url, -diff --git a/services/network/public/cpp/features.cc b/services/network/public/cpp/features.cc -index a22ad71f7c32a..b9683742c4385 100644 ---- a/services/network/public/cpp/features.cc -+++ b/services/network/public/cpp/features.cc -@@ -14,10 +14,10 @@ - namespace network::features { - - BASE_FEATURE(kNetworkErrorLogging, -- "NetworkErrorLogging", -- base::FEATURE_ENABLED_BY_DEFAULT); -+ "NetworkErrorLogging", // disabled by default -+ base::FEATURE_DISABLED_BY_DEFAULT); // in bromite - --BASE_FEATURE(kReporting, "Reporting", base::FEATURE_ENABLED_BY_DEFAULT); -+BASE_FEATURE(kReporting, "Reporting", base::FEATURE_DISABLED_BY_DEFAULT); // disabled by default - - // Based on the field trial parameters, this feature will override the value of - // the maximum number of delayable requests allowed in flight. The number of diff --git a/services/network/public/mojom/BUILD.gn b/services/network/public/mojom/BUILD.gn -index 311985f787a85..d6a4da7274b39 100644 --- a/services/network/public/mojom/BUILD.gn +++ b/services/network/public/mojom/BUILD.gn -@@ -1431,7 +1431,6 @@ mojom("mojom") { +@@ -1427,7 +1427,6 @@ mojom("mojom") { export_define_blink = "BLINK_PLATFORM_IMPLEMENTATION=1" export_header_blink = "third_party/blink/public/platform/web_common.h" if (enable_reporting) { @@ -330,10 +306,9 @@ index 311985f787a85..d6a4da7274b39 100644 } diff --git a/services/network/public/mojom/network_context.mojom b/services/network/public/mojom/network_context.mojom -index e1385ffd42940..25cec7c08ce34 100644 --- a/services/network/public/mojom/network_context.mojom +++ b/services/network/public/mojom/network_context.mojom -@@ -1169,6 +1169,7 @@ interface NetworkContext { +@@ -1196,6 +1196,7 @@ interface NetworkContext { // provided |network_isolation_key|. // // Spec: https://w3c.github.io/reporting/#concept-reports @@ -341,7 +316,7 @@ index e1385ffd42940..25cec7c08ce34 100644 QueueReport(string type, string group, url.mojom.Url url, -@@ -1182,6 +1183,7 @@ interface NetworkContext { +@@ -1209,6 +1210,7 @@ interface NetworkContext { // Note that this queued report will never be delivered if no reporting // endpoint matching is registered for with the provided // |network_isolation_key|. @@ -350,7 +325,6 @@ index e1385ffd42940..25cec7c08ce34 100644 NetworkAnonymizationKey network_anonymization_key); diff --git a/third_party/blink/renderer/core/frame/csp/content_security_policy.cc b/third_party/blink/renderer/core/frame/csp/content_security_policy.cc -index a588d41ff283a..cae080360baf9 100644 --- a/third_party/blink/renderer/core/frame/csp/content_security_policy.cc +++ b/third_party/blink/renderer/core/frame/csp/content_security_policy.cc @@ -28,6 +28,7 @@ @@ -378,7 +352,6 @@ index a588d41ff283a..cae080360baf9 100644 AuditsIssue audits_issue = AuditsIssue::CreateContentSecurityPolicyIssue( *violation_data, header_type == ContentSecurityPolicyType::kReport, diff --git a/third_party/blink/renderer/core/frame/local_frame.cc b/third_party/blink/renderer/core/frame/local_frame.cc -index 336215b71f630..f2ca47225e545 100644 --- a/third_party/blink/renderer/core/frame/local_frame.cc +++ b/third_party/blink/renderer/core/frame/local_frame.cc @@ -42,6 +42,7 @@ @@ -389,7 +362,7 @@ index 336215b71f630..f2ca47225e545 100644 #include "services/network/public/cpp/features.h" #include "services/network/public/mojom/content_security_policy.mojom-blink.h" #include "services/network/public/mojom/source_location.mojom-blink.h" -@@ -2504,9 +2505,11 @@ void LocalFrame::MainFrameInteractive() { +@@ -2502,9 +2503,11 @@ void LocalFrame::MainFrameInteractive() { } } @@ -402,7 +375,6 @@ index 336215b71f630..f2ca47225e545 100644 // static void LocalFrame::NotifyUserActivation( diff --git a/third_party/blink/renderer/core/frame/local_frame.h b/third_party/blink/renderer/core/frame/local_frame.h -index eb4ce179cb09e..35f542133787f 100644 --- a/third_party/blink/renderer/core/frame/local_frame.h +++ b/third_party/blink/renderer/core/frame/local_frame.h @@ -35,9 +35,9 @@ @@ -416,7 +388,7 @@ index eb4ce179cb09e..35f542133787f 100644 #include "services/device/public/mojom/device_posture_provider.mojom-blink-forward.h" #include "services/metrics/public/cpp/ukm_source_id.h" #include "services/network/public/mojom/fetch_api.mojom-blink-forward.h" -@@ -629,9 +629,9 @@ class CORE_EXPORT LocalFrame final +@@ -627,9 +627,9 @@ class CORE_EXPORT LocalFrame final void FinishedScrollSequence(); SmoothScrollSequencer* GetSmoothScrollSequencer() const; @@ -429,7 +401,6 @@ index eb4ce179cb09e..35f542133787f 100644 // associated interface with the legacy Chrome IPC channel. mojom::blink::LocalFrameHost& GetLocalFrameHostRemote() const; diff --git a/third_party/blink/renderer/core/frame/reporting_context.cc b/third_party/blink/renderer/core/frame/reporting_context.cc -index dc32fd90d945a..c06fe44b1b7f1 100644 --- a/third_party/blink/renderer/core/frame/reporting_context.cc +++ b/third_party/blink/renderer/core/frame/reporting_context.cc @@ -4,6 +4,7 @@ @@ -493,7 +464,6 @@ index dc32fd90d945a..c06fe44b1b7f1 100644 } // namespace blink diff --git a/third_party/blink/renderer/core/frame/reporting_context.h b/third_party/blink/renderer/core/frame/reporting_context.h -index 68e9fc988a2d6..ec033d78813bf 100644 --- a/third_party/blink/renderer/core/frame/reporting_context.h +++ b/third_party/blink/renderer/core/frame/reporting_context.h @@ -5,6 +5,7 @@ @@ -529,7 +499,6 @@ index 68e9fc988a2d6..ec033d78813bf 100644 HeapMojoReceiver receiver_; }; diff --git a/third_party/blink/renderer/core/frame/reporting_observer.cc b/third_party/blink/renderer/core/frame/reporting_observer.cc -index 89c04a3d0f726..b34c1f85d7694 100644 --- a/third_party/blink/renderer/core/frame/reporting_observer.cc +++ b/third_party/blink/renderer/core/frame/reporting_observer.cc @@ -62,8 +62,7 @@ void ReportingObserver::QueueReport(Report* report) { @@ -542,6 +511,5 @@ index 89c04a3d0f726..b34c1f85d7694 100644 } bool ReportingObserver::Buffered() { --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Allow-building-without-supervised-users.patch b/build/bromite_patches/Allow-building-without-supervised-users.patch index b35a5bad8c836c03d752b02bc2ddfb9aac61b57a..a0737cff6f480cd4cc1ff466c497b18b9875ec13 100644 --- a/build/bromite_patches/Allow-building-without-supervised-users.patch +++ b/build/bromite_patches/Allow-building-without-supervised-users.patch @@ -1,7 +1,6 @@ -From c87087b8b33da4d49581eae8e7fe0d8cfc1f1369 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Mon, 21 Feb 2022 01:24:11 +0100 -Subject: [PATCH 153/192] Allow building without supervised users +Subject: Allow building without supervised users License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- @@ -20,10 +19,9 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html 12 files changed, 29 insertions(+), 13 deletions(-) diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn -index 8a1fa40a1e7aa..8194a946c15c6 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn -@@ -3480,7 +3480,6 @@ generate_jni("chrome_jni_headers") { +@@ -3604,7 +3604,6 @@ generate_jni("chrome_jni_headers") { "java/src/org/chromium/chrome/browser/status_indicator/StatusIndicatorSceneLayer.java", "java/src/org/chromium/chrome/browser/suggestions/mostvisited/MostVisitedSites.java", "java/src/org/chromium/chrome/browser/suggestions/mostvisited/MostVisitedSitesBridge.java", @@ -32,22 +30,20 @@ index 8a1fa40a1e7aa..8194a946c15c6 100644 "java/src/org/chromium/chrome/browser/tab/TabBrowserControlsConstraintsHelper.java", "java/src/org/chromium/chrome/browser/tab/TabFavicon.java", diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni -index 87ddc92e24f7e..7c5779f77bf09 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni -@@ -1060,7 +1060,6 @@ chrome_java_sources = [ +@@ -1074,7 +1074,6 @@ chrome_java_sources = [ "java/src/org/chromium/chrome/browser/suggestions/tile/TileGroupDelegateImpl.java", "java/src/org/chromium/chrome/browser/suggestions/tile/TileRenderer.java", "java/src/org/chromium/chrome/browser/suggestions/tile/TopSitesTileView.java", - "java/src/org/chromium/chrome/browser/supervised_user/ChildAccountService.java", "java/src/org/chromium/chrome/browser/survey/ChromeSurveyController.java", - "java/src/org/chromium/chrome/browser/survey/SurveyController.java", "java/src/org/chromium/chrome/browser/sync/SyncErrorNotifier.java", + "java/src/org/chromium/chrome/browser/sync/TrustedVaultClient.java", diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn -index 38787b5f4c80e..de54aa91f1759 100644 --- a/chrome/browser/BUILD.gn +++ b/chrome/browser/BUILD.gn -@@ -3046,8 +3046,6 @@ static_library("browser") { +@@ -3182,8 +3182,6 @@ static_library("browser") { "feed/android/refresh_task_scheduler_impl.cc", "feed/android/refresh_task_scheduler_impl.h", "feed/android/web_feed_bridge.cc", @@ -56,7 +52,7 @@ index 38787b5f4c80e..de54aa91f1759 100644 "file_select_helper_contacts_android.cc", "file_select_helper_contacts_android.h", "first_run/android/first_run_prefs.cc", -@@ -3262,10 +3260,6 @@ static_library("browser") { +@@ -3398,10 +3396,6 @@ static_library("browser") { "ssl/chrome_security_state_model_delegate.h", "ssl/known_interception_disclosure_infobar.cc", "ssl/known_interception_disclosure_infobar.h", @@ -68,10 +64,9 @@ index 38787b5f4c80e..de54aa91f1759 100644 "sync/glue/synced_tab_delegate_android.h", "sync/glue/synced_window_delegate_android.cc", diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc -index 854e064b46d38..b77e1e2778232 100644 --- a/chrome/browser/extensions/api/settings_private/prefs_util.cc +++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc -@@ -987,9 +987,11 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlistedKeys() { +@@ -1027,9 +1027,11 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlistedKeys() { settings_api::PrefType::PREF_TYPE_BOOLEAN; #endif @@ -84,7 +79,6 @@ index 854e064b46d38..b77e1e2778232 100644 #if BUILDFLAG(IS_CHROMEOS_LACROS) (*s_allowlist)[::prefs::kUseAshProxy] = diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc -index 2de1d788b43b8..983235212478e 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -691,10 +691,12 @@ void ProfileImpl::DoFinalInit(CreateMode create_mode) { @@ -115,10 +109,9 @@ index 2de1d788b43b8..983235212478e 100644 void ProfileImpl::UpdateNameInStorage() { diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc -index 26b23873b37f4..d6f52f0ecbb62 100644 --- a/chrome/browser/profiles/profile_manager.cc +++ b/chrome/browser/profiles/profile_manager.cc -@@ -1178,6 +1178,7 @@ void ProfileManager::InitProfileUserPrefs(Profile* profile) { +@@ -1219,6 +1219,7 @@ void ProfileManager::InitProfileUserPrefs(Profile* profile) { profile->GetPrefs()->SetString(prefs::kProfileName, profile_name); } @@ -126,7 +119,7 @@ index 26b23873b37f4..d6f52f0ecbb62 100644 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); bool force_supervised_user_id = #if BUILDFLAG(IS_CHROMEOS_ASH) -@@ -1199,6 +1200,7 @@ void ProfileManager::InitProfileUserPrefs(Profile* profile) { +@@ -1240,6 +1241,7 @@ void ProfileManager::InitProfileUserPrefs(Profile* profile) { profile->GetPrefs()->SetString(prefs::kSupervisedUserId, supervised_user_id); } @@ -134,7 +127,7 @@ index 26b23873b37f4..d6f52f0ecbb62 100644 #if !BUILDFLAG(IS_ANDROID) if (profile->IsNewProfile()) { profile->GetPrefs()->SetBoolean(prefs::kHasSeenWelcomePage, false); -@@ -1966,8 +1968,10 @@ void ProfileManager::AddProfileToStorage(Profile* profile) { +@@ -2035,8 +2037,10 @@ void ProfileManager::AddProfileToStorage(Profile* profile) { init_params.icon_index = profile->GetPrefs()->GetInteger(prefs::kProfileAvatarIndex); @@ -146,7 +139,6 @@ index 26b23873b37f4..d6f52f0ecbb62 100644 #if BUILDFLAG(IS_CHROMEOS_ASH) user_manager::User* user = diff --git a/chrome/browser/ui/webui/managed_ui_handler.cc b/chrome/browser/ui/webui/managed_ui_handler.cc -index 5a9861e233fa9..7120aad88c697 100644 --- a/chrome/browser/ui/webui/managed_ui_handler.cc +++ b/chrome/browser/ui/webui/managed_ui_handler.cc @@ -90,9 +90,11 @@ void ManagedUIHandler::AddObservers() { @@ -162,10 +154,9 @@ index 5a9861e233fa9..7120aad88c697 100644 void ManagedUIHandler::RemoveObservers() { diff --git a/chrome/browser/ui/webui/management/management_ui_handler.cc b/chrome/browser/ui/webui/management/management_ui_handler.cc -index efb1f0799ec6f..0637f3fd1dc4f 100644 --- a/chrome/browser/ui/webui/management/management_ui_handler.cc +++ b/chrome/browser/ui/webui/management/management_ui_handler.cc -@@ -1423,10 +1423,12 @@ void ManagementUIHandler::AddObservers() { +@@ -1456,10 +1456,12 @@ void ManagementUIHandler::AddObservers() { pref_registrar_.Init(profile->GetPrefs()); @@ -179,7 +170,6 @@ index efb1f0799ec6f..0637f3fd1dc4f 100644 #if BUILDFLAG(IS_CHROMEOS_ASH) pref_registrar_.Add( diff --git a/components/supervised_user/buildflags.gni b/components/supervised_user/buildflags.gni -index 7c1d7a2c912e3..77e35248336ec 100644 --- a/components/supervised_user/buildflags.gni +++ b/components/supervised_user/buildflags.gni @@ -4,9 +4,5 @@ @@ -194,7 +184,6 @@ index 7c1d7a2c912e3..77e35248336ec 100644 + enable_supervised_users = false } diff --git a/components/supervised_user/core/common/pref_names.h b/components/supervised_user/core/common/pref_names.h -index 34099d0378513..ec1641f0ec1f9 100644 --- a/components/supervised_user/core/common/pref_names.h +++ b/components/supervised_user/core/common/pref_names.h @@ -5,8 +5,10 @@ @@ -216,7 +205,6 @@ index 34099d0378513..ec1641f0ec1f9 100644 + #endif // COMPONENTS_SUPERVISED_USER_CORE_COMMON_PREF_NAMES_H_ diff --git a/components/supervised_user/core/common/supervised_user_constants.cc b/components/supervised_user/core/common/supervised_user_constants.cc -index 4fe93bce8bc43..1c40d69fe39c1 100644 --- a/components/supervised_user/core/common/supervised_user_constants.cc +++ b/components/supervised_user/core/common/supervised_user_constants.cc @@ -68,6 +68,7 @@ const char kChromeOSAvatarIndex[] = "chromeos-avatar-index"; @@ -236,7 +224,6 @@ index 4fe93bce8bc43..1c40d69fe39c1 100644 const base::FilePath::CharType kSupervisedUserSettingsFilename[] = FILE_PATH_LITERAL("Managed Mode Settings"); diff --git a/components/supervised_user/core/common/supervised_user_utils.cc b/components/supervised_user/core/common/supervised_user_utils.cc -index 05200defc3914..c7fe0f748ddee 100644 --- a/components/supervised_user/core/common/supervised_user_utils.cc +++ b/components/supervised_user/core/common/supervised_user_utils.cc @@ -76,11 +76,15 @@ GURL NormalizeUrl(const GURL& url) { @@ -270,6 +257,5 @@ index 05200defc3914..c7fe0f748ddee 100644 } } // namespace supervised_user --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Allow-playing-audio-in-background.patch b/build/bromite_patches/Allow-playing-audio-in-background.patch index bdd48e6429d557510a6bbdef601e8872eb193eae..766d7bb3749288527f836d56b9f8ee9155707a56 100644 --- a/build/bromite_patches/Allow-playing-audio-in-background.patch +++ b/build/bromite_patches/Allow-playing-audio-in-background.patch @@ -1,7 +1,6 @@ -From c415ef600671a19210837579825a52a41a858b6b Mon Sep 17 00:00:00 2001 From: AlexeyBarabash Date: Thu, 2 Nov 2017 18:21:16 +0200 -Subject: [PATCH 052/192] Allow playing audio in background +Subject: Allow playing audio in background License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- @@ -10,10 +9,9 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/third_party/blink/renderer/platform/media/web_media_player_impl.cc b/third_party/blink/renderer/platform/media/web_media_player_impl.cc -index d2fde962467c5..3c802da166563 100644 --- a/third_party/blink/renderer/platform/media/web_media_player_impl.cc +++ b/third_party/blink/renderer/platform/media/web_media_player_impl.cc -@@ -1184,6 +1184,12 @@ bool WebMediaPlayerImpl::HasAudio() const { +@@ -1176,6 +1176,12 @@ bool WebMediaPlayerImpl::HasAudio() const { return pipeline_metadata_.has_audio; } @@ -26,7 +24,7 @@ index d2fde962467c5..3c802da166563 100644 void WebMediaPlayerImpl::EnabledAudioTracksChanged( const WebVector& enabledTrackIds) { DCHECK(main_task_runner_->BelongsToCurrentThread()); -@@ -3513,7 +3519,10 @@ bool WebMediaPlayerImpl::ShouldPausePlaybackWhenHidden() const { +@@ -3484,7 +3490,10 @@ bool WebMediaPlayerImpl::ShouldPausePlaybackWhenHidden() const { : HasAudio(); // Audio only stream is allowed to play when in background. @@ -39,7 +37,6 @@ index d2fde962467c5..3c802da166563 100644 // MediaPlayer always signals audio and video, so use an empty natural size to diff --git a/third_party/blink/renderer/platform/media/web_media_player_impl.h b/third_party/blink/renderer/platform/media/web_media_player_impl.h -index 9498bbefd9fbf..7b646531adf71 100644 --- a/third_party/blink/renderer/platform/media/web_media_player_impl.h +++ b/third_party/blink/renderer/platform/media/web_media_player_impl.h @@ -200,6 +200,9 @@ class PLATFORM_EXPORT WebMediaPlayerImpl @@ -52,6 +49,5 @@ index 9498bbefd9fbf..7b646531adf71 100644 void EnabledAudioTracksChanged( const WebVector& enabledTrackIds) override; void SelectedVideoTrackChanged( --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Always-use-new-tab-page-for-default-home-page.patch b/build/bromite_patches/Always-use-new-tab-page-for-default-home-page.patch index dcad834f941788a71017d03a778d3f6b2d5ff9fa..4df336597cb686f04951bed412931f7adabee145 100644 --- a/build/bromite_patches/Always-use-new-tab-page-for-default-home-page.patch +++ b/build/bromite_patches/Always-use-new-tab-page-for-default-home-page.patch @@ -1,30 +1,73 @@ -From f9040cb7bed96a87d3afbfc713e1efd1cf84957e Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Wed, 27 Jun 2018 11:02:38 +0200 -Subject: [PATCH 025/192] Always use new tab page for default home page +Subject: Always use new tab page for default home page Ignore any partner-provided home page. License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- .../org/chromium/chrome/browser/homepage/HomepageManager.java | 4 ---- - 1 file changed, 4 deletions(-) + .../partnercustomizations/PartnerBrowserCustomizations.java | 2 +- + .../org/chromium/components/search_engines/TemplateUrl.java | 1 + + .../search_engines/android/template_url_service_android.cc | 1 + + .../always-use-new-tab-page-for-default-home-page.inc | 2 ++ + 5 files changed, 5 insertions(+), 5 deletions(-) + create mode 100755 cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/always-use-new-tab-page-for-default-home-page.inc diff --git a/chrome/android/java/src/org/chromium/chrome/browser/homepage/HomepageManager.java b/chrome/android/java/src/org/chromium/chrome/browser/homepage/HomepageManager.java -index 6acf3ff6d7ff6..a5cdf2cc84df4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/homepage/HomepageManager.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/homepage/HomepageManager.java -@@ -152,10 +152,6 @@ public class HomepageManager implements HomepagePolicyManager.HomepagePolicyStat - * if the homepage button is force enabled via flag. +@@ -168,10 +168,6 @@ public class HomepageManager implements HomepagePolicyManager.HomepagePolicyStat + * tab page if the homepage button is force enabled via flag. */ - public static String getDefaultHomepageUri() { + public static GURL getDefaultHomepageGurl() { - if (PartnerBrowserCustomizations.getInstance().isHomepageProviderAvailableAndEnabled()) { -- return PartnerBrowserCustomizations.getInstance().getHomePageUrl().getSpec(); +- return PartnerBrowserCustomizations.getInstance().getHomePageUrl(); - } - - String homepagePartnerDefaultUri; String homepagePartnerDefaultGurlSerialized = SharedPreferencesManager.getInstance().readString( --- -2.34.1 - + ChromePreferenceKeys.HOMEPAGE_PARTNER_CUSTOMIZED_DEFAULT_GURL, ""); +diff --git a/chrome/browser/partnercustomizations/java/src/org/chromium/chrome/browser/partnercustomizations/PartnerBrowserCustomizations.java b/chrome/browser/partnercustomizations/java/src/org/chromium/chrome/browser/partnercustomizations/PartnerBrowserCustomizations.java +--- a/chrome/browser/partnercustomizations/java/src/org/chromium/chrome/browser/partnercustomizations/PartnerBrowserCustomizations.java ++++ b/chrome/browser/partnercustomizations/java/src/org/chromium/chrome/browser/partnercustomizations/PartnerBrowserCustomizations.java +@@ -214,7 +214,7 @@ public class PartnerBrowserCustomizations { + boolean systemOrPreStable = + (context.getApplicationInfo().flags & ApplicationInfo.FLAG_SYSTEM) == 1 + || !VersionInfo.isStableBuild(); +- if (!systemOrPreStable) { ++ if ((true)) { + // Only allow partner customization if this browser is a system package, or + // is in pre-stable channels. + return null; +diff --git a/components/search_engines/android/java/src/org/chromium/components/search_engines/TemplateUrl.java b/components/search_engines/android/java/src/org/chromium/components/search_engines/TemplateUrl.java +--- a/components/search_engines/android/java/src/org/chromium/components/search_engines/TemplateUrl.java ++++ b/components/search_engines/android/java/src/org/chromium/components/search_engines/TemplateUrl.java +@@ -75,6 +75,7 @@ public class TemplateUrl { + * prepopulated_engines.json. + */ + public String getNewTabURL() { ++ if ((true)) return null; + return TemplateUrlJni.get().getNewTabURL(mTemplateUrlPtr); + } + +diff --git a/components/search_engines/android/template_url_service_android.cc b/components/search_engines/android/template_url_service_android.cc +--- a/components/search_engines/android/template_url_service_android.cc ++++ b/components/search_engines/android/template_url_service_android.cc +@@ -324,6 +324,7 @@ jboolean TemplateUrlServiceAndroid::SetPlayAPISearchEngine( + const base::android::JavaParamRef& + jimage_translate_target_language_param_key, + jboolean set_as_default) { ++ if ((true)) return false; + // Check if there is already a search engine created from Play API. + TemplateURLService::TemplateURLVector template_urls = + template_url_service_->GetTemplateURLs(); +diff --git a/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/always-use-new-tab-page-for-default-home-page.inc b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/always-use-new-tab-page-for-default-home-page.inc +new file mode 100755 +--- /dev/null ++++ b/cromite_flags/chrome/browser/flags/android/chrome_feature_list_cc/always-use-new-tab-page-for-default-home-page.inc +@@ -0,0 +1,2 @@ ++SET_CROMITE_FEATURE_DISABLED(kNewTabSearchEngineUrlAndroid); ++SET_CROMITE_FEATURE_DISABLED(kPartnerCustomizationsUma); +-- +2.25.1 diff --git a/build/bromite_patches/AudioBuffer-AnalyserNode-fp-mitigations.patch b/build/bromite_patches/AudioBuffer-AnalyserNode-fp-mitigations.patch index 8969aba75036435e562a2a722f3df7730ecfb040..c8677db7686ee3371b5b6f15c401a514a2c6277d 100644 --- a/build/bromite_patches/AudioBuffer-AnalyserNode-fp-mitigations.patch +++ b/build/bromite_patches/AudioBuffer-AnalyserNode-fp-mitigations.patch @@ -1,17 +1,14 @@ -From 29987d607a6cc3d4d4ad1261524fbde4f5cf4808 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sun, 25 Mar 2018 21:49:37 +0200 -Subject: [PATCH 056/192] AudioBuffer, AnalyserNode: fp mitigations +Subject: AudioBuffer, AnalyserNode: fp mitigations Truncate base latency precision to two digits License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- - chrome/browser/about_flags.cc | 4 ++++ - chrome/browser/flag_descriptions.cc | 5 +++++ - chrome/browser/flag_descriptions.h | 3 +++ - third_party/blink/common/features.cc | 4 ++++ - third_party/blink/public/common/features.h | 2 ++ + .../AudioBuffer-AnalyserNode-fp-mitigations.inc | 8 ++++++++ + .../AudioBuffer-AnalyserNode-fp-mitigations.inc | 3 +++ + .../AudioBuffer-AnalyserNode-fp-mitigations.inc | 1 + .../renderer/modules/webaudio/audio_buffer.cc | 14 ++++++++++++++ .../blink/renderer/modules/webaudio/audio_buffer.h | 2 ++ .../renderer/modules/webaudio/audio_context.cc | 5 ++++- @@ -19,83 +16,39 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../renderer/modules/webaudio/base_audio_context.h | 2 ++ .../modules/webaudio/offline_audio_context.cc | 1 + .../renderer/modules/webaudio/realtime_analyser.cc | 7 +++++++ - 12 files changed, 60 insertions(+), 1 deletion(-) + 10 files changed, 54 insertions(+), 1 deletion(-) + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/AudioBuffer-AnalyserNode-fp-mitigations.inc + create mode 100644 cromite_flags/third_party/blink/common/features_cc/AudioBuffer-AnalyserNode-fp-mitigations.inc + create mode 100644 cromite_flags/third_party/blink/common/features_h/AudioBuffer-AnalyserNode-fp-mitigations.inc -diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc -index 82741e95ba8a4..73d1dd5a999d9 100644 ---- a/chrome/browser/about_flags.cc -+++ b/chrome/browser/about_flags.cc -@@ -3881,6 +3881,10 @@ const FeatureEntry kFeatureEntries[] = { - flag_descriptions::kKioskEnableAppServiceDescription, kOsCrOS, - FEATURE_VALUE_TYPE(features::kKioskEnableAppService)}, - #endif // BUILDFLAG(IS_CHROMEOS) +diff --git a/cromite_flags/chrome/browser/about_flags_cc/AudioBuffer-AnalyserNode-fp-mitigations.inc b/cromite_flags/chrome/browser/about_flags_cc/AudioBuffer-AnalyserNode-fp-mitigations.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/AudioBuffer-AnalyserNode-fp-mitigations.inc +@@ -0,0 +1,8 @@ ++#ifdef FLAG_SECTION ++ + {"fingerprinting-audio-context-data-noise", -+ flag_descriptions::kAudioContextShuffleEnabledName, -+ flag_descriptions::kAudioContextShuffleEnabledDescription, kOsAll, ++ "Enable Audio Context fingerprint deception", ++ "Scale the output values of rendered data with a randomly selected factor.", kOsAll, + FEATURE_VALUE_TYPE(blink::features::kAudioContextShuffleEnabled)}, - #if !BUILDFLAG(IS_ANDROID) - {"enable-webrtc-remote-event-log", - flag_descriptions::kWebRtcRemoteEventLogName, -diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc -index c631c713f425c..9b9d00359008a 100644 ---- a/chrome/browser/flag_descriptions.cc -+++ b/chrome/browser/flag_descriptions.cc -@@ -3639,6 +3639,11 @@ const char kWebTransportDeveloperModeDescription[] = - "When enabled, removes the requirement that all certificates used for " - "WebTransport over HTTP/3 are issued by a known certificate root."; - -+const char kAudioContextShuffleEnabledName[] = -+ "Enable Audio Context fingerprint deception"; -+const char kAudioContextShuffleEnabledDescription[] = -+ "Scale the output values of rendered data with a randomly selected factor."; -+ - const char kWebUsbDeviceDetectionName[] = - "Automatic detection of WebUSB-compatible devices"; - const char kWebUsbDeviceDetectionDescription[] = -diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h -index 302a8e99a898e..e6dc3d91746f3 100644 ---- a/chrome/browser/flag_descriptions.h -+++ b/chrome/browser/flag_descriptions.h -@@ -2095,6 +2095,9 @@ extern const char kWebRtcRemoteEventLogDescription[]; - extern const char kWebrtcUseMinMaxVEADimensionsName[]; - extern const char kWebrtcUseMinMaxVEADimensionsDescription[]; - -+extern const char kAudioContextShuffleEnabledName[]; -+extern const char kAudioContextShuffleEnabledDescription[]; + - extern const char kWebTransportDeveloperModeName[]; - extern const char kWebTransportDeveloperModeDescription[]; - -diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc -index ae80cfe4aec94..fe7912e08aed7 100644 ---- a/third_party/blink/common/features.cc -+++ b/third_party/blink/common/features.cc -@@ -244,6 +244,10 @@ BASE_FEATURE(kBiddingAndScoringDebugReportingAPI, - "BiddingAndScoringDebugReportingAPI", - base::FEATURE_DISABLED_BY_DEFAULT); - -+BASE_FEATURE(kAudioContextShuffleEnabled, -+ "AudioContextShuffleEnabled", -+ base::FEATURE_ENABLED_BY_DEFAULT); -+ - // Blink garbage collection. - // Enables compaction of backing stores on Blink's heap. - BASE_FEATURE(kBlinkHeapCompaction, -diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h -index 6ece6ab12363f..0be0e4712487d 100644 ---- a/third_party/blink/public/common/features.h -+++ b/third_party/blink/public/common/features.h -@@ -149,6 +149,8 @@ BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kBlinkHeapConcurrentSweeping); - BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kBlinkHeapIncrementalMarking); - BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kBlinkHeapIncrementalMarkingStress); - ++#endif +diff --git a/cromite_flags/third_party/blink/common/features_cc/AudioBuffer-AnalyserNode-fp-mitigations.inc b/cromite_flags/third_party/blink/common/features_cc/AudioBuffer-AnalyserNode-fp-mitigations.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/third_party/blink/common/features_cc/AudioBuffer-AnalyserNode-fp-mitigations.inc +@@ -0,0 +1,3 @@ ++CROMITE_FEATURE(kAudioContextShuffleEnabled, ++ "AudioContextShuffleEnabled", ++ base::FEATURE_ENABLED_BY_DEFAULT); +diff --git a/cromite_flags/third_party/blink/common/features_h/AudioBuffer-AnalyserNode-fp-mitigations.inc b/cromite_flags/third_party/blink/common/features_h/AudioBuffer-AnalyserNode-fp-mitigations.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/third_party/blink/common/features_h/AudioBuffer-AnalyserNode-fp-mitigations.inc +@@ -0,0 +1 @@ +BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kAudioContextShuffleEnabled); -+ - BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE( - kBlockingDownloadsInAdFrameWithoutUserActivation); - diff --git a/third_party/blink/renderer/modules/webaudio/audio_buffer.cc b/third_party/blink/renderer/modules/webaudio/audio_buffer.cc -index 2e032806463bb..e75d55be56435 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_buffer.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_buffer.cc @@ -196,6 +196,20 @@ AudioBuffer::AudioBuffer(AudioBus* bus) @@ -120,7 +73,6 @@ index 2e032806463bb..e75d55be56435 100644 unsigned channel_index, ExceptionState& exception_state) { diff --git a/third_party/blink/renderer/modules/webaudio/audio_buffer.h b/third_party/blink/renderer/modules/webaudio/audio_buffer.h -index ce75d7ab3a290..b4c562a024749 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_buffer.h +++ b/third_party/blink/renderer/modules/webaudio/audio_buffer.h @@ -115,6 +115,8 @@ class MODULES_EXPORT AudioBuffer final : public ScriptWrappable { @@ -133,7 +85,6 @@ index ce75d7ab3a290..b4c562a024749 100644 static DOMFloat32Array* CreateFloat32ArrayOrNull( uint32_t length, diff --git a/third_party/blink/renderer/modules/webaudio/audio_context.cc b/third_party/blink/renderer/modules/webaudio/audio_context.cc -index 4dedc0b91be74..46c31a4d55c5e 100644 --- a/third_party/blink/renderer/modules/webaudio/audio_context.cc +++ b/third_party/blink/renderer/modules/webaudio/audio_context.cc @@ -11,6 +11,7 @@ @@ -156,7 +107,6 @@ index 4dedc0b91be74..46c31a4d55c5e 100644 double AudioContext::outputLatency() const { diff --git a/third_party/blink/renderer/modules/webaudio/base_audio_context.cc b/third_party/blink/renderer/modules/webaudio/base_audio_context.cc -index c9fa2fd3953b4..f744265cc7224 100644 --- a/third_party/blink/renderer/modules/webaudio/base_audio_context.cc +++ b/third_party/blink/renderer/modules/webaudio/base_audio_context.cc @@ -29,6 +29,7 @@ @@ -186,10 +136,9 @@ index c9fa2fd3953b4..f744265cc7224 100644 DCHECK(IsMainThread()); GraphAutoLocker locker(this); diff --git a/third_party/blink/renderer/modules/webaudio/base_audio_context.h b/third_party/blink/renderer/modules/webaudio/base_audio_context.h -index b3a041474b308..152a0ae4881f8 100644 --- a/third_party/blink/renderer/modules/webaudio/base_audio_context.h +++ b/third_party/blink/renderer/modules/webaudio/base_audio_context.h -@@ -338,6 +338,8 @@ class MODULES_EXPORT BaseAudioContext +@@ -339,6 +339,8 @@ class MODULES_EXPORT BaseAudioContext // if the execution context does not exist. bool CheckExecutionContextAndThrowIfNecessary(ExceptionState&); @@ -199,7 +148,6 @@ index b3a041474b308..152a0ae4881f8 100644 enum ContextType { kRealtimeContext, kOfflineContext }; diff --git a/third_party/blink/renderer/modules/webaudio/offline_audio_context.cc b/third_party/blink/renderer/modules/webaudio/offline_audio_context.cc -index f9d05fc50e89d..f7179f5c98dbd 100644 --- a/third_party/blink/renderer/modules/webaudio/offline_audio_context.cc +++ b/third_party/blink/renderer/modules/webaudio/offline_audio_context.cc @@ -368,6 +368,7 @@ void OfflineAudioContext::FireCompletionEvent() { @@ -211,7 +159,6 @@ index f9d05fc50e89d..f7179f5c98dbd 100644 // Call the offline rendering completion event listener and resolve the // promise too. diff --git a/third_party/blink/renderer/modules/webaudio/realtime_analyser.cc b/third_party/blink/renderer/modules/webaudio/realtime_analyser.cc -index 256ea358bc701..a0873c1aed599 100644 --- a/third_party/blink/renderer/modules/webaudio/realtime_analyser.cc +++ b/third_party/blink/renderer/modules/webaudio/realtime_analyser.cc @@ -29,6 +29,7 @@ @@ -256,6 +203,5 @@ index 256ea358bc701..a0873c1aed599 100644 } } } --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Battery-API-return-nothing.patch b/build/bromite_patches/Battery-API-return-nothing.patch index 2bd9dcde1962a2a19cb221b74d18cab97a9c38f7..0aac3bc2b60b3c092649d3acaee746ef72981b21 100644 --- a/build/bromite_patches/Battery-API-return-nothing.patch +++ b/build/bromite_patches/Battery-API-return-nothing.patch @@ -1,7 +1,6 @@ -From 6ecebf471ffe6ef16904021a199eb59c4c421efa Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Thu, 22 Mar 2018 22:11:57 +0100 -Subject: [PATCH 027/192] Battery API: return nothing +Subject: Battery API: return nothing Include @thestinger's fix for correct charging/unknown values @@ -11,7 +10,6 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/third_party/blink/renderer/modules/battery/battery_manager.cc b/third_party/blink/renderer/modules/battery/battery_manager.cc -index 05cbfd0b52ddc..60fd8093ca695 100644 --- a/third_party/blink/renderer/modules/battery/battery_manager.cc +++ b/third_party/blink/renderer/modules/battery/battery_manager.cc @@ -78,46 +78,28 @@ ScriptPromise BatteryManager::StartRequest(ScriptState* script_state) { @@ -65,6 +63,5 @@ index 05cbfd0b52ddc..60fd8093ca695 100644 } void BatteryManager::RegisterWithDispatcher() { --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Block-gateway-attacks-via-websockets.patch b/build/bromite_patches/Block-gateway-attacks-via-websockets.patch deleted file mode 100644 index 698a6a146165a060c3f2016d0f8abde517ed8e9b..0000000000000000000000000000000000000000 --- a/build/bromite_patches/Block-gateway-attacks-via-websockets.patch +++ /dev/null @@ -1,317 +0,0 @@ -From 51d8cd9c6f81b5bc866fd0908255837d5e3c3b4b Mon Sep 17 00:00:00 2001 -From: csagan5 <32685696+csagan5@users.noreply.github.com> -Date: Tue, 28 Jul 2020 12:28:58 +0200 -Subject: [PATCH 109/192] Block gateway attacks via websockets - -This approach is not comprehensive, see also: -* https://bugs.chromium.org/p/chromium/issues/detail?id=590714 - -License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html ---- - .../execution_context/execution_context.cc | 16 ++++++++++ - .../execution_context/execution_context.h | 1 + - .../renderer/core/loader/base_fetch_context.h | 1 + - .../core/loader/frame_fetch_context.cc | 20 ++++++++++++ - .../core/loader/frame_fetch_context.h | 1 + - .../core/loader/worker_fetch_context.cc | 21 +++++++++++++ - .../core/loader/worker_fetch_context.h | 1 + - .../core/workers/installed_scripts_manager.cc | 4 +-- - .../background_fetch_manager.cc | 31 +++++++++++++++++++ - .../websockets/websocket_channel_impl.cc | 5 +++ - .../modules/websockets/websocket_common.cc | 30 ++++++++++++++++++ - .../modules/websockets/websocket_common.h | 4 +++ - 12 files changed, 133 insertions(+), 2 deletions(-) - -diff --git a/third_party/blink/renderer/core/execution_context/execution_context.cc b/third_party/blink/renderer/core/execution_context/execution_context.cc -index 1bc4805ab9da9..8f50f8feef79f 100644 ---- a/third_party/blink/renderer/core/execution_context/execution_context.cc -+++ b/third_party/blink/renderer/core/execution_context/execution_context.cc -@@ -736,4 +736,20 @@ void ExecutionContext::WriteIntoTrace( - proto->set_world_type(GetWorldType(*this)); - } - -+String ExecutionContext::addressSpaceForBindings() const { -+ switch (AddressSpace()) { -+ case network::mojom::IPAddressSpace::kPublic: -+ case network::mojom::IPAddressSpace::kUnknown: -+ return "public"; -+ -+ case network::mojom::IPAddressSpace::kPrivate: -+ return "private"; -+ -+ case network::mojom::IPAddressSpace::kLocal: -+ return "local"; -+ } -+ NOTREACHED(); -+ return "public"; -+} -+ - } // namespace blink -diff --git a/third_party/blink/renderer/core/execution_context/execution_context.h b/third_party/blink/renderer/core/execution_context/execution_context.h -index 180cda4e10fc4..8d38f4c1b5f3b 100644 ---- a/third_party/blink/renderer/core/execution_context/execution_context.h -+++ b/third_party/blink/renderer/core/execution_context/execution_context.h -@@ -398,6 +398,7 @@ class CORE_EXPORT ExecutionContext : public Supplementable, - void SetAddressSpace(network::mojom::blink::IPAddressSpace ip_address_space); - - HeapObserverSet& ContextLifecycleObserverSet(); -+ String addressSpaceForBindings() const; - unsigned ContextLifecycleStateObserverCountForTesting() const; - - // Implementation of WindowOrWorkerGlobalScope.crossOriginIsolated. -diff --git a/third_party/blink/renderer/core/loader/base_fetch_context.h b/third_party/blink/renderer/core/loader/base_fetch_context.h -index 1479573dbc605..0bcf66f467af2 100644 ---- a/third_party/blink/renderer/core/loader/base_fetch_context.h -+++ b/third_party/blink/renderer/core/loader/base_fetch_context.h -@@ -88,6 +88,7 @@ class CORE_EXPORT BaseFetchContext : public FetchContext { - - virtual SubresourceFilter* GetSubresourceFilter() const = 0; - virtual bool ShouldBlockWebSocketByMixedContentCheck(const KURL&) const = 0; -+ virtual bool ShouldBlockGateWayAttacks(network::mojom::IPAddressSpace requestor_space, const KURL&) const = 0; - virtual std::unique_ptr - CreateWebSocketHandshakeThrottle() = 0; - -diff --git a/third_party/blink/renderer/core/loader/frame_fetch_context.cc b/third_party/blink/renderer/core/loader/frame_fetch_context.cc -index 7d3adaa1f95fa..4168b49e6ac32 100644 ---- a/third_party/blink/renderer/core/loader/frame_fetch_context.cc -+++ b/third_party/blink/renderer/core/loader/frame_fetch_context.cc -@@ -591,6 +591,26 @@ bool FrameFetchContext::ShouldBlockRequestByInspector(const KURL& url) const { - return should_block_request; - } - -+bool FrameFetchContext::ShouldBlockGateWayAttacks(network::mojom::IPAddressSpace requestor_space, const KURL& request_url) const { -+ // TODO(mkwst): This only checks explicit IP addresses. We'll have to move -+ // all this up to //net and //content in order to have any real impact on -+ // gateway attacks. That turns out to be a TON of work (crbug.com/378566). -+ if (requestor_space == network::mojom::IPAddressSpace::kUnknown) -+ requestor_space = network::mojom::IPAddressSpace::kPublic; -+ network::mojom::IPAddressSpace target_space = -+ network::mojom::IPAddressSpace::kPublic; -+ if (network_utils::IsReservedIPAddress(request_url.Host())) -+ target_space = network::mojom::IPAddressSpace::kPrivate; -+ if (SecurityOrigin::Create(request_url)->IsLocalhost()) -+ target_space = network::mojom::IPAddressSpace::kLocal; -+ -+ bool is_external_request = requestor_space > target_space; -+ if (is_external_request) -+ return true; -+ -+ return false; -+} -+ - void FrameFetchContext::DispatchDidBlockRequest( - const ResourceRequest& resource_request, - const ResourceLoaderOptions& options, -diff --git a/third_party/blink/renderer/core/loader/frame_fetch_context.h b/third_party/blink/renderer/core/loader/frame_fetch_context.h -index 6bf0e35ad2a1d..d211d25696602 100644 ---- a/third_party/blink/renderer/core/loader/frame_fetch_context.h -+++ b/third_party/blink/renderer/core/loader/frame_fetch_context.h -@@ -175,6 +175,7 @@ class CORE_EXPORT FrameFetchContext final : public BaseFetchContext, - bool ShouldBlockWebSocketByMixedContentCheck(const KURL&) const override; - std::unique_ptr CreateWebSocketHandshakeThrottle() - override; -+ bool ShouldBlockGateWayAttacks(network::mojom::IPAddressSpace requestor_space, const KURL&) const override; - bool ShouldBlockFetchByMixedContentCheck( - mojom::blink::RequestContextType request_context, - network::mojom::blink::IPAddressSpace target_address_space, -diff --git a/third_party/blink/renderer/core/loader/worker_fetch_context.cc b/third_party/blink/renderer/core/loader/worker_fetch_context.cc -index 1f2ae8311b78a..06b92a8b1118d 100644 ---- a/third_party/blink/renderer/core/loader/worker_fetch_context.cc -+++ b/third_party/blink/renderer/core/loader/worker_fetch_context.cc -@@ -25,6 +25,7 @@ - #include "third_party/blink/renderer/platform/loader/fetch/url_loader/url_loader_factory.h" - #include "third_party/blink/renderer/platform/loader/fetch/worker_resource_timing_notifier.h" - #include "third_party/blink/renderer/platform/network/network_state_notifier.h" -+#include "third_party/blink/renderer/platform/network/network_utils.h" - #include "third_party/blink/renderer/platform/runtime_enabled_features.h" - #include "third_party/blink/renderer/platform/scheduler/public/virtual_time_controller.h" - #include "third_party/blink/renderer/platform/supplementable.h" -@@ -94,6 +95,26 @@ bool WorkerFetchContext::ShouldBlockRequestByInspector(const KURL& url) const { - return should_block_request; - } - -+bool WorkerFetchContext::ShouldBlockGateWayAttacks(network::mojom::IPAddressSpace requestor_space, const KURL& request_url) const { -+ // TODO(mkwst): This only checks explicit IP addresses. We'll have to move -+ // all this up to //net and //content in order to have any real impact on -+ // gateway attacks. That turns out to be a TON of work (crbug.com/378566). -+ if (requestor_space == network::mojom::IPAddressSpace::kUnknown) -+ requestor_space = network::mojom::IPAddressSpace::kPublic; -+ network::mojom::IPAddressSpace target_space = -+ network::mojom::IPAddressSpace::kPublic; -+ if (network_utils::IsReservedIPAddress(request_url.Host())) -+ target_space = network::mojom::IPAddressSpace::kPrivate; -+ if (SecurityOrigin::Create(request_url)->IsLocalhost()) -+ target_space = network::mojom::IPAddressSpace::kLocal; -+ -+ bool is_external_request = requestor_space > target_space; -+ if (is_external_request) -+ return true; -+ -+ return false; -+} -+ - void WorkerFetchContext::DispatchDidBlockRequest( - const ResourceRequest& resource_request, - const ResourceLoaderOptions& options, -diff --git a/third_party/blink/renderer/core/loader/worker_fetch_context.h b/third_party/blink/renderer/core/loader/worker_fetch_context.h -index 098cd9c783ec6..e4031b1005fbe 100644 ---- a/third_party/blink/renderer/core/loader/worker_fetch_context.h -+++ b/third_party/blink/renderer/core/loader/worker_fetch_context.h -@@ -63,6 +63,7 @@ class WorkerFetchContext final : public BaseFetchContext { - bool ShouldBlockWebSocketByMixedContentCheck(const KURL&) const override; - std::unique_ptr CreateWebSocketHandshakeThrottle() - override; -+ bool ShouldBlockGateWayAttacks(network::mojom::IPAddressSpace requestor_space, const KURL&) const override; - bool ShouldBlockFetchByMixedContentCheck( - mojom::blink::RequestContextType request_context, - network::mojom::blink::IPAddressSpace target_address_space, -diff --git a/third_party/blink/renderer/core/workers/installed_scripts_manager.cc b/third_party/blink/renderer/core/workers/installed_scripts_manager.cc -index 2a978cb476740..fe67745d54ccd 100644 ---- a/third_party/blink/renderer/core/workers/installed_scripts_manager.cc -+++ b/third_party/blink/renderer/core/workers/installed_scripts_manager.cc -@@ -33,9 +33,9 @@ InstalledScriptsManager::ScriptData::ScriptData( - // place so that this is shareable out of worker code. - response_address_space_ = network::mojom::IPAddressSpace::kPublic; - if (network_utils::IsReservedIPAddress(script_url_.Host())) -- response_address_space_ = network::mojom::IPAddressSpace::kLocal; -+ response_address_space_ = network::mojom::IPAddressSpace::kPrivate; - if (SecurityOrigin::Create(script_url_)->IsLocalhost()) -- response_address_space_ = network::mojom::IPAddressSpace::kLoopback; -+ response_address_space_ = network::mojom::IPAddressSpace::kLocal; - } - - ContentSecurityPolicyResponseHeaders -diff --git a/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.cc b/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.cc -index b8aff17d259ca..c25135fcb18b5 100644 ---- a/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.cc -+++ b/third_party/blink/renderer/modules/background_fetch/background_fetch_manager.cc -@@ -101,6 +101,30 @@ bool ShouldBlockDanglingMarkup(const KURL& request_url) { - request_url.ProtocolIsInHTTPFamily(); - } - -+bool ShouldBlockGateWayAttacks(ExecutionContext* execution_context, -+ const KURL& request_url) { -+ network::mojom::IPAddressSpace requestor_space = -+ execution_context->AddressSpace(); -+ if (requestor_space == network::mojom::IPAddressSpace::kUnknown) -+ requestor_space = network::mojom::IPAddressSpace::kPublic; -+ -+ // TODO(mkwst): This only checks explicit IP addresses. We'll have to move -+ // all this up to //net and //content in order to have any real impact on -+ // gateway attacks. That turns out to be a TON of work (crbug.com/378566). -+ network::mojom::IPAddressSpace target_space = -+ network::mojom::IPAddressSpace::kPublic; -+ if (network_utils::IsReservedIPAddress(request_url.Host())) -+ target_space = network::mojom::IPAddressSpace::kPrivate; -+ if (SecurityOrigin::Create(request_url)->IsLocalhost()) -+ target_space = network::mojom::IPAddressSpace::kLocal; -+ -+ bool is_external_request = requestor_space > target_space; -+ if (is_external_request) -+ return true; -+ -+ return false; -+} -+ - scoped_refptr ExtractBlobHandle( - Request* request, - ExceptionState& exception_state) { -@@ -187,6 +211,13 @@ ScriptPromise BackgroundFetchManager::fetch( - exception_state); - } - -+ if (ShouldBlockGateWayAttacks(execution_context, request_url)) { -+ return RejectWithTypeError(script_state, request_url, -+ "Requestor IP address space doesn't match the " -+ "target address space.", -+ exception_state); -+ } -+ - if (ShouldBlockPort(request_url)) { - return RejectWithTypeError(script_state, request_url, - "that port is not allowed", exception_state); -diff --git a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc -index 98a78f1a7b6a5..40b01a00c8904 100644 ---- a/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc -+++ b/third_party/blink/renderer/modules/websockets/websocket_channel_impl.cc -@@ -275,6 +275,11 @@ bool WebSocketChannelImpl::Connect(const KURL& url, const String& protocol) { - return false; - } - -+ if (GetBaseFetchContext()->ShouldBlockGateWayAttacks(execution_context_->AddressSpace(), url)) { -+ has_initiated_opening_handshake_ = false; -+ return false; -+ } -+ - if (auto* scheduler = execution_context_->GetScheduler()) { - // Two features are registered here: - // - `kWebSocket`: a non-sticky feature that will disable BFCache for any -diff --git a/third_party/blink/renderer/modules/websockets/websocket_common.cc b/third_party/blink/renderer/modules/websockets/websocket_common.cc -index 9e543e41518ff..086628ea10ff5 100644 ---- a/third_party/blink/renderer/modules/websockets/websocket_common.cc -+++ b/third_party/blink/renderer/modules/websockets/websocket_common.cc -@@ -125,9 +125,39 @@ WebSocketCommon::ConnectResult WebSocketCommon::Connect( - return ConnectResult::kException; - } - -+ network::mojom::IPAddressSpace requestor_space = -+ execution_context->AddressSpace(); -+ if (ShouldBlockGateWayAttacks(requestor_space, url_)) { -+ state_ = kClosed; -+ exception_state.ThrowSecurityError( -+ "Access to address of '" + url_.Host() + -+ "' is not allowed from current address space."); -+ return ConnectResult::kException; -+ } -+ - return ConnectResult::kSuccess; - } - -+bool WebSocketCommon::ShouldBlockGateWayAttacks(network::mojom::IPAddressSpace requestor_space, const KURL& request_url) const { -+ // TODO(mkwst): This only checks explicit IP addresses. We'll have to move -+ // all this up to //net and //content in order to have any real impact on -+ // gateway attacks. That turns out to be a TON of work (crbug.com/378566). -+ if (requestor_space == network::mojom::IPAddressSpace::kUnknown) -+ requestor_space = network::mojom::IPAddressSpace::kPublic; -+ network::mojom::IPAddressSpace target_space = -+ network::mojom::IPAddressSpace::kPublic; -+ if (network_utils::IsReservedIPAddress(request_url.Host())) -+ target_space = network::mojom::IPAddressSpace::kPrivate; -+ if (SecurityOrigin::Create(request_url)->IsLocalhost()) -+ target_space = network::mojom::IPAddressSpace::kLocal; -+ -+ bool is_external_request = requestor_space > target_space; -+ if (is_external_request) -+ return true; -+ -+ return false; -+} -+ - void WebSocketCommon::CloseInternal(int code, - const String& reason, - WebSocketChannel* channel, -diff --git a/third_party/blink/renderer/modules/websockets/websocket_common.h b/third_party/blink/renderer/modules/websockets/websocket_common.h -index ed3d0daade26f..7f0cdf10d9732 100644 ---- a/third_party/blink/renderer/modules/websockets/websocket_common.h -+++ b/third_party/blink/renderer/modules/websockets/websocket_common.h -@@ -7,6 +7,8 @@ - #ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBSOCKETS_WEBSOCKET_COMMON_H_ - #define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBSOCKETS_WEBSOCKET_COMMON_H_ - -+#include "services/network/public/mojom/ip_address_space.mojom.h" -+#include "third_party/blink/renderer/platform/network/network_utils.h" - #include "third_party/blink/renderer/modules/modules_export.h" - #include "third_party/blink/renderer/platform/weborigin/kurl.h" - #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" -@@ -54,6 +56,8 @@ class MODULES_EXPORT WebSocketCommon { - void SetState(State state) { state_ = state; } - const KURL& Url() const { return url_; } - -+ bool ShouldBlockGateWayAttacks(network::mojom::IPAddressSpace requestor_space, const KURL& url) const; -+ - // The following methods are public for testing. - - // Returns true if |protocol| is a valid WebSocket subprotocol name. --- -2.34.1 - diff --git a/build/bromite_patches/Block-qjz9zk-or-trk-requests.patch b/build/bromite_patches/Block-qjz9zk-or-trk-requests.patch index 5823dc524fc15d74908000ffeceb83b9b806dd44..12fa309a5ee15dcff2ecc94c1968e73b1addc296 100644 --- a/build/bromite_patches/Block-qjz9zk-or-trk-requests.patch +++ b/build/bromite_patches/Block-qjz9zk-or-trk-requests.patch @@ -1,7 +1,6 @@ -From e5fe5907c98ff8fce9462716ce9edb40f1e00938 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Wed, 30 Oct 2019 11:50:13 +0100 -Subject: [PATCH 115/192] Block 'qjz9zk' or 'trk:' requests +Subject: Block 'qjz9zk' or 'trk:' requests An info bar is displayed unless the --disable-trkbar command-line flag or the chrome://flag option is used. This patch is based on Iridium's 'net: add "trk:" scheme and help identify URLs being retrieved' @@ -27,7 +26,6 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html create mode 100644 net/url_request/trk_protocol_handler.h diff --git a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc -index 4c88614c68c25..e4366ea4d0902 100644 --- a/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc +++ b/chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.cc @@ -58,6 +58,7 @@ ChromeAutocompleteSchemeClassifier::GetInputTypeForScheme( @@ -39,7 +37,6 @@ index 4c88614c68c25..e4366ea4d0902 100644 base::EqualsCaseInsensitiveASCII(scheme, url::kDataScheme))) { return metrics::OmniboxInputType::URL; diff --git a/chrome/browser/history/history_utils.cc b/chrome/browser/history/history_utils.cc -index 6da2d4cc0e48b..753f92da2e7be 100644 --- a/chrome/browser/history/history_utils.cc +++ b/chrome/browser/history/history_utils.cc @@ -22,6 +22,7 @@ bool CanAddURLToHistory(const GURL& url) { @@ -51,7 +48,6 @@ index 6da2d4cc0e48b..753f92da2e7be 100644 url.SchemeIs(chrome::kChromeSearchScheme) || url.SchemeIs(dom_distiller::kDomDistillerScheme)) diff --git a/chrome/browser/ui/singleton_tabs.cc b/chrome/browser/ui/singleton_tabs.cc -index 544b7d815220c..8287f30c76e2b 100644 --- a/chrome/browser/ui/singleton_tabs.cc +++ b/chrome/browser/ui/singleton_tabs.cc @@ -174,6 +174,11 @@ int GetIndexOfExistingTab(Browser* browser, const NavigateParams& params) { @@ -67,7 +63,6 @@ index 544b7d815220c..8287f30c76e2b 100644 content::BrowserURLHandler::GetInstance()->RewriteURLIfNecessary( &rewritten_tab_url, browser->profile()); diff --git a/components/omnibox/browser/autocomplete_input.cc b/components/omnibox/browser/autocomplete_input.cc -index 3900b74d4b95c..8d23a6ed73c1e 100644 --- a/components/omnibox/browser/autocomplete_input.cc +++ b/components/omnibox/browser/autocomplete_input.cc @@ -90,10 +90,15 @@ void OffsetComponentsExcludingScheme(url::Parsed* parts, int offset) { @@ -97,7 +92,6 @@ index 3900b74d4b95c..8d23a6ed73c1e 100644 // Obtain the URL prefixed by view-source or blob and parse it. std::u16string real_url(text.substr(after_scheme_and_colon)); diff --git a/components/url_formatter/url_fixer.cc b/components/url_formatter/url_fixer.cc -index d44b4cee79157..3db922698161e 100644 --- a/components/url_formatter/url_fixer.cc +++ b/components/url_formatter/url_fixer.cc @@ -563,6 +563,10 @@ GURL FixupURL(const std::string& text, const std::string& desired_tld) { @@ -112,10 +106,9 @@ index d44b4cee79157..3db922698161e 100644 if (scheme == url::kFileScheme) return GURL(parts.scheme.is_valid() ? text : FixupPath(text)); diff --git a/content/browser/child_process_security_policy_impl.cc b/content/browser/child_process_security_policy_impl.cc -index ccc2e7da62b79..d83cffabe575e 100644 --- a/content/browser/child_process_security_policy_impl.cc +++ b/content/browser/child_process_security_policy_impl.cc -@@ -823,6 +823,7 @@ ChildProcessSecurityPolicyImpl::ChildProcessSecurityPolicyImpl() +@@ -829,6 +829,7 @@ ChildProcessSecurityPolicyImpl::ChildProcessSecurityPolicyImpl() RegisterPseudoScheme(url::kJavaScriptScheme); RegisterPseudoScheme(kViewSourceScheme); RegisterPseudoScheme(kGoogleChromeScheme); @@ -124,7 +117,6 @@ index ccc2e7da62b79..d83cffabe575e 100644 ChildProcessSecurityPolicyImpl::~ChildProcessSecurityPolicyImpl() { diff --git a/net/BUILD.gn b/net/BUILD.gn -index 8883c27b66b2a..bc87e0f8f0361 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn @@ -1056,6 +1056,8 @@ component("net") { @@ -138,7 +130,6 @@ index 8883c27b66b2a..bc87e0f8f0361 100644 "url_request/url_request_job.h", diff --git a/net/url_request/trk_protocol_handler.cc b/net/url_request/trk_protocol_handler.cc new file mode 100644 -index 0000000000000..e32409c333a5e --- /dev/null +++ b/net/url_request/trk_protocol_handler.cc @@ -0,0 +1,25 @@ @@ -169,7 +160,6 @@ index 0000000000000..e32409c333a5e +} // namespace net diff --git a/net/url_request/trk_protocol_handler.h b/net/url_request/trk_protocol_handler.h new file mode 100644 -index 0000000000000..b37fe2def5c6d --- /dev/null +++ b/net/url_request/trk_protocol_handler.h @@ -0,0 +1,30 @@ @@ -204,7 +194,6 @@ index 0000000000000..b37fe2def5c6d + +#endif // NET_URL_REQUEST_TRK_PROTOCOL_HANDLER_H_ diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc -index 655d9ebcd3928..572f9e62e94f7 100644 --- a/net/url_request/url_request.cc +++ b/net/url_request/url_request.cc @@ -13,6 +13,7 @@ @@ -237,7 +226,6 @@ index 655d9ebcd3928..572f9e62e94f7 100644 net_log_.BeginEvent(NetLogEventType::REQUEST_ALIVE, [&] { return NetLogURLRequestConstructorParams(url, priority_, diff --git a/net/url_request/url_request_context_builder.cc b/net/url_request/url_request_context_builder.cc -index 9f4ed67802f46..d7bbc87ea0213 100644 --- a/net/url_request/url_request_context_builder.cc +++ b/net/url_request/url_request_context_builder.cc @@ -48,6 +48,7 @@ @@ -248,7 +236,7 @@ index 9f4ed67802f46..d7bbc87ea0213 100644 #include "net/url_request/url_request_context.h" #include "net/url_request/url_request_job_factory.h" #include "net/url_request/url_request_throttler_manager.h" -@@ -573,6 +574,8 @@ std::unique_ptr URLRequestContextBuilder::Build() { +@@ -574,6 +575,8 @@ std::unique_ptr URLRequestContextBuilder::Build() { job_factory->SetProtocolHandler(scheme_handler.first, std::move(scheme_handler.second)); } @@ -258,7 +246,6 @@ index 9f4ed67802f46..d7bbc87ea0213 100644 context->set_job_factory(std::move(job_factory)); diff --git a/url/url_constants.cc b/url/url_constants.cc -index 850a31ce22de6..b65df785d593b 100644 --- a/url/url_constants.cc +++ b/url/url_constants.cc @@ -29,6 +29,7 @@ const char16_t kDataScheme16[] = u"data"; @@ -270,7 +257,6 @@ index 850a31ce22de6..b65df785d593b 100644 const char kFtpScheme[] = "ftp"; const char16_t kFtpScheme16[] = u"ftp"; diff --git a/url/url_constants.h b/url/url_constants.h -index 5eda4e89f2582..6ba533af6d0b6 100644 --- a/url/url_constants.h +++ b/url/url_constants.h @@ -33,6 +33,7 @@ COMPONENT_EXPORT(URL) extern const char16_t kContentIDScheme16[]; @@ -282,7 +268,6 @@ index 5eda4e89f2582..6ba533af6d0b6 100644 COMPONENT_EXPORT(URL) extern const char kFileSystemScheme[]; COMPONENT_EXPORT(URL) extern const char16_t kFileSystemScheme16[]; diff --git a/url/url_util.cc b/url/url_util.cc -index 001c50e72fd24..685526881e955 100644 --- a/url/url_util.cc +++ b/url/url_util.cc @@ -46,6 +46,7 @@ struct SchemeRegistry { @@ -301,6 +286,5 @@ index 001c50e72fd24..685526881e955 100644 }; // Schemes that can be sent CORS requests. --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Bookmarks-select-all-menu-entry.patch b/build/bromite_patches/Bookmarks-select-all-menu-entry.patch index 6879966b77cf02778c5f89db52dc5c82a6ac5c27..06152d26a21b017e6d3f0b446a128650644d92b1 100644 --- a/build/bromite_patches/Bookmarks-select-all-menu-entry.patch +++ b/build/bromite_patches/Bookmarks-select-all-menu-entry.patch @@ -1,7 +1,6 @@ -From 572f7fe604a0804eba8e087ef2e545a623b2e599 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sat, 9 Apr 2022 23:01:55 +0200 -Subject: [PATCH 062/192] Bookmarks select all menu entry +Subject: Bookmarks select all menu entry License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- @@ -12,7 +11,6 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html 4 files changed, 32 insertions(+) diff --git a/chrome/android/java/res/menu/bookmark_toolbar_menu.xml b/chrome/android/java/res/menu/bookmark_toolbar_menu.xml -index bb414a0d4069d..06e8b38817949 100644 --- a/chrome/android/java/res/menu/bookmark_toolbar_menu.xml +++ b/chrome/android/java/res/menu/bookmark_toolbar_menu.xml @@ -23,6 +23,13 @@ found in the LICENSE file. @@ -30,10 +28,9 @@ index bb414a0d4069d..06e8b38817949 100644 android:id="@+id/import_menu_id" android:icon="@drawable/ic_folder_blue_24dp" diff --git a/chrome/android/java/res/menu/bookmark_toolbar_menu_improved.xml b/chrome/android/java/res/menu/bookmark_toolbar_menu_improved.xml -index 2c4f201c08aa3..7626a5cea2658 100644 --- a/chrome/android/java/res/menu/bookmark_toolbar_menu_improved.xml +++ b/chrome/android/java/res/menu/bookmark_toolbar_menu_improved.xml -@@ -49,6 +49,13 @@ found in the LICENSE file. +@@ -51,6 +51,13 @@ found in the LICENSE file. android:title="@string/create_new_folder" app:showAsAction="ifRoom" app:iconTint="@color/default_icon_color_secondary_tint_list" /> @@ -48,7 +45,6 @@ index 2c4f201c08aa3..7626a5cea2658 100644 android:id="@+id/import_menu_id" android:icon="@drawable/ic_folder_blue_24dp" diff --git a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbar.java b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbar.java -index 3dbea0829516f..a37c03b4a1a79 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbar.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/bookmarks/BookmarkToolbar.java @@ -27,6 +27,8 @@ import org.chromium.components.browser_ui.widget.selectable_list.SelectionDelega @@ -60,7 +56,7 @@ index 3dbea0829516f..a37c03b4a1a79 100644 /** * Main toolbar of bookmark UI. It is responsible for displaying title and buttons * associated with the current context. -@@ -167,6 +169,7 @@ public class BookmarkToolbar extends SelectableListToolbar +@@ -183,6 +185,7 @@ public class BookmarkToolbar extends SelectableListToolbar void setCurrentFolder(BookmarkId folder) { mCurrentFolder = mBookmarkModel.getBookmarkById(folder); @@ -68,7 +64,7 @@ index 3dbea0829516f..a37c03b4a1a79 100644 getMenu().findItem(R.id.import_menu_id).setVisible(true); getMenu().findItem(R.id.export_menu_id).setVisible(true); } -@@ -195,6 +198,17 @@ public class BookmarkToolbar extends SelectableListToolbar +@@ -211,6 +214,17 @@ public class BookmarkToolbar extends SelectableListToolbar mExportBookmarkRunnable.run(); return true; } @@ -86,7 +82,7 @@ index 3dbea0829516f..a37c03b4a1a79 100644 return mMenuIdClickedFunction.apply(menuItem.getItemId()); } -@@ -217,6 +231,7 @@ public class BookmarkToolbar extends SelectableListToolbar +@@ -233,6 +247,7 @@ public class BookmarkToolbar extends SelectableListToolbar getMenu().findItem(R.id.import_menu_id).setVisible(mCurrentFolder != null); getMenu().findItem(R.id.export_menu_id).setVisible(mCurrentFolder != null); @@ -95,7 +91,6 @@ index 3dbea0829516f..a37c03b4a1a79 100644 // SelectableListToolbar will show/hide the entire group. setSearchButtonVisible(mSearchButtonVisible); diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd -index bf095f7de2c72..aa35bda9b1066 100644 --- a/chrome/browser/ui/android/strings/android_chrome_strings.grd +++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd @@ -245,6 +245,9 @@ CHAR_LIMIT guidelines: @@ -108,6 +103,5 @@ index bf095f7de2c72..aa35bda9b1066 100644 Import --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Bromite-auto-updater.patch b/build/bromite_patches/Bromite-auto-updater.patch deleted file mode 100644 index 0497a8331e14770c83afe0cf9553d5acc305447b..0000000000000000000000000000000000000000 --- a/build/bromite_patches/Bromite-auto-updater.patch +++ /dev/null @@ -1,1653 +0,0 @@ -From 160b7e30a26384fb69283ae95b91e7238d2d1c3c Mon Sep 17 00:00:00 2001 -From: uazo -Date: Thu, 7 Oct 2021 14:27:12 +0000 -Subject: [PATCH 092/192] Bromite auto updater - -Enable checking for new versions, with notifications and proxy support. -Restore InlineUpdateFlow feature. -Some parts authored by csagan5. - -License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html ---- - .../java/templates/BuildConfig.template | 2 + - build/config/android/rules.gni | 3 + - chrome/android/chrome_java_sources.gni | 3 + - .../java/res/xml/about_chrome_preferences.xml | 5 + - .../about_settings/AboutChromeSettings.java | 28 +- - .../chrome/browser/omaha/OmahaBase.java | 57 +++- - .../chrome/browser/omaha/UpdateConfigs.java | 30 +- - .../browser/omaha/UpdateMenuItemHelper.java | 82 +++++- - .../browser/omaha/UpdateStatusProvider.java | 161 ++++++++--- - .../browser/omaha/VersionNumberGetter.java | 3 +- - .../inline/BromiteInlineUpdateController.java | 272 ++++++++++++++++++ - .../omaha/inline/InlineUpdateController.java | 51 ++++ - .../inline/InlineUpdateControllerFactory.java | 21 ++ - chrome/browser/endpoint_fetcher/BUILD.gn | 2 + - .../endpoint_fetcher_android.cc | 50 ++++ - .../endpoint_fetcher/EndpointFetcher.java | 26 +- - .../EndpointHeaderResponse.java | 31 ++ - .../flags/android/chrome_feature_list.cc | 5 + - .../flags/android/chrome_feature_list.h | 1 + - .../browser/flags/ChromeFeatureList.java | 1 + - .../strings/android_chrome_strings.grd | 23 +- - .../endpoint_fetcher/endpoint_fetcher.cc | 103 ++++++- - .../endpoint_fetcher/endpoint_fetcher.h | 23 +- - 23 files changed, 933 insertions(+), 50 deletions(-) - create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/BromiteInlineUpdateController.java - create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateController.java - create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateControllerFactory.java - create mode 100644 chrome/browser/endpoint_fetcher/java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointHeaderResponse.java - -diff --git a/build/android/java/templates/BuildConfig.template b/build/android/java/templates/BuildConfig.template -index cfecb6fefdcba..f6521f42246d4 100644 ---- a/build/android/java/templates/BuildConfig.template -+++ b/build/android/java/templates/BuildConfig.template -@@ -92,4 +92,6 @@ public class BuildConfig { - #else - public static MAYBE_FINAL boolean IS_FOR_TEST MAYBE_FALSE; - #endif -+ -+ public static MAYBE_FINAL String BUILD_TARGET_CPU = _BUILD_TARGET_CPU; - } -diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni -index 758dbe2a66cbc..aea13f388bb36 100644 ---- a/build/config/android/rules.gni -+++ b/build/config/android/rules.gni -@@ -2144,6 +2144,9 @@ if (enable_java_templates && is_android) { - if (defined(testonly) && testonly) { - defines += [ "_IS_FOR_TEST" ] - } -+ -+ # add arch to org.chromium.build.BuildConfig -+ defines += [ "_BUILD_TARGET_CPU=\"${target_cpu}\"" ] - } - } - -diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni -index 4f5cf7b9337c0..f927e1a14b0c1 100644 ---- a/chrome/android/chrome_java_sources.gni -+++ b/chrome/android/chrome_java_sources.gni -@@ -858,6 +858,9 @@ chrome_java_sources = [ - "java/src/org/chromium/chrome/browser/omaha/UpdateConfigs.java", - "java/src/org/chromium/chrome/browser/omaha/UpdateMenuItemHelper.java", - "java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java", -+ "java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateController.java", -+ "java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateControllerFactory.java", -+ "java/src/org/chromium/chrome/browser/omaha/inline/BromiteInlineUpdateController.java", - "java/src/org/chromium/chrome/browser/omaha/VersionNumberGetter.java", - "java/src/org/chromium/chrome/browser/omaha/metrics/HistogramUtils.java", - "java/src/org/chromium/chrome/browser/omaha/metrics/TrackingProvider.java", -diff --git a/chrome/android/java/res/xml/about_chrome_preferences.xml b/chrome/android/java/res/xml/about_chrome_preferences.xml -index fb1dfed23052b..f055e0e91e4bd 100644 ---- a/chrome/android/java/res/xml/about_chrome_preferences.xml -+++ b/chrome/android/java/res/xml/about_chrome_preferences.xml -@@ -9,6 +9,11 @@ found in the LICENSE file. - -+ - -diff --git a/chrome/android/java/src/org/chromium/chrome/browser/about_settings/AboutChromeSettings.java b/chrome/android/java/src/org/chromium/chrome/browser/about_settings/AboutChromeSettings.java -index f59f62fdf971b..5da0608895710 100644 ---- a/chrome/android/java/src/org/chromium/chrome/browser/about_settings/AboutChromeSettings.java -+++ b/chrome/android/java/src/org/chromium/chrome/browser/about_settings/AboutChromeSettings.java -@@ -21,14 +21,20 @@ import org.chromium.ui.widget.Toast; - - import java.util.Calendar; - -+import android.content.SharedPreferences; -+import org.chromium.chrome.browser.omaha.OmahaBase; -+import org.chromium.components.browser_ui.settings.ChromeSwitchPreference; -+ - /** - * Settings fragment that displays information about Chrome. - */ - public class AboutChromeSettings -- extends PreferenceFragmentCompat implements Preference.OnPreferenceClickListener { -+ extends PreferenceFragmentCompat implements Preference.OnPreferenceClickListener, -+ Preference.OnPreferenceChangeListener { - private static final int TAPS_FOR_DEVELOPER_SETTINGS = 7; - - private static final String PREF_APPLICATION_VERSION = "application_version"; -+ private static final String PREF_ALLOW_INLINE_UPDATE = "allow_inline_update"; // switch preference - private static final String PREF_OS_VERSION = "os_version"; - private static final String PREF_LEGAL_INFORMATION = "legal_information"; - -@@ -59,6 +65,13 @@ public class AboutChromeSettings - p = findPreference(PREF_LEGAL_INFORMATION); - int currentYear = Calendar.getInstance().get(Calendar.YEAR); - p.setSummary(getString(R.string.legal_information_summary, currentYear)); -+ -+ ChromeSwitchPreference allowInlineUpdate = -+ (ChromeSwitchPreference) findPreference(PREF_ALLOW_INLINE_UPDATE); -+ allowInlineUpdate.setChecked( -+ OmahaBase.getSharedPreferences() -+ .getBoolean(OmahaBase.PREF_ALLOW_INLINE_UPDATE, false)); -+ allowInlineUpdate.setOnPreferenceChangeListener(this); - } - - /** -@@ -122,4 +135,17 @@ public class AboutChromeSettings - } - return true; - } -+ -+ @Override -+ public boolean onPreferenceChange(Preference preference, Object newValue) { -+ String key = preference.getKey(); -+ if (PREF_ALLOW_INLINE_UPDATE.equals(key)) { -+ SharedPreferences.Editor sharedPreferenceEditor = OmahaBase.getSharedPreferences().edit(); -+ sharedPreferenceEditor.putBoolean(OmahaBase.PREF_ALLOW_INLINE_UPDATE, (boolean) newValue); -+ sharedPreferenceEditor.apply(); -+ -+ OmahaBase.resetUpdatePrefs(); -+ } -+ return true; -+ } - } -diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/OmahaBase.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/OmahaBase.java -index 33e232ec8bdda..2e24639a03af2 100644 ---- a/chrome/android/java/src/org/chromium/chrome/browser/omaha/OmahaBase.java -+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/OmahaBase.java -@@ -33,6 +33,8 @@ import java.net.HttpURLConnection; - import java.net.URL; - import java.util.Date; - -+import org.chromium.build.BuildConfig; -+ - /** - * Keeps tabs on the current state of Chrome, tracking if and when a request should be sent to the - * Omaha Server. -@@ -99,7 +101,10 @@ public class OmahaBase { - static final String PREF_TIMESTAMP_FOR_NEW_REQUEST = "timestampForNewRequest"; - static final String PREF_TIMESTAMP_FOR_NEXT_POST_ATTEMPT = "timestampForNextPostAttempt"; - static final String PREF_TIMESTAMP_OF_INSTALL = "timestampOfInstall"; -- static final String PREF_TIMESTAMP_OF_REQUEST = "timestampOfRequest"; -+ public static final String PREF_TIMESTAMP_OF_REQUEST = "timestampOfRequest"; -+ public static final String PREF_LATEST_MODIFIED_VERSION = "latestModifiedVersion"; -+ public static final String PREF_LATEST_UPSTREAM_VERSION = "latestUpstreamVersion"; -+ public static final String PREF_ALLOW_INLINE_UPDATE = "allowInlineUpdate"; - - private static final int UNKNOWN_DATE = -2; - -@@ -157,7 +162,8 @@ public class OmahaBase { - } - - static boolean isDisabled() { -- return sDisabledForTesting; -+ // do not enable version control via Omaha Update Server -+ return true; - } - - /** -@@ -567,6 +573,10 @@ public class OmahaBase { - /** Sends the request to the server and returns the response. */ - static String sendRequestToServer(HttpURLConnection urlConnection, String request) - throws RequestFailureException { -+ if ((true)) { -+ throw new RequestFailureException("Requests to Omaha server are forbidden.", -+ RequestFailureException.ERROR_CONNECTIVITY); -+ } - try { - OutputStream out = new BufferedOutputStream(urlConnection.getOutputStream()); - OutputStreamWriter writer = new OutputStreamWriter(out); -@@ -637,4 +647,47 @@ public class OmahaBase { - // updateStatus is only used for the on-demand check. - null); - } -+ -+ public static boolean isNewVersionAvailableByVersion(VersionNumber latestVersion) { -+ VersionNumber mCurrentProductVersion = VersionNumber.fromString(VersionInfo.getProductVersion()); -+ if (mCurrentProductVersion == null) { -+ Log.e(TAG, "BromiteUpdater: current product version is null"); -+ return false; -+ } -+ -+ Log.i(TAG, "BromiteUpdater: currentProductVersion=%s, latestVersion=%s", -+ mCurrentProductVersion.toString(), latestVersion.toString()); -+ -+ return mCurrentProductVersion.isSmallerThan(latestVersion); -+ } -+ -+ public static void updateLastPushedTimeStamp(long timeMillis) { -+ SharedPreferences preferences = OmahaBase.getSharedPreferences(); -+ SharedPreferences.Editor editor = preferences.edit(); -+ editor.putLong(OmahaBase.PREF_TIMESTAMP_OF_REQUEST, timeMillis); -+ editor.apply(); -+ } -+ -+ public static void setLatestModifiedVersion(String version) { -+ SharedPreferences preferences = OmahaBase.getSharedPreferences(); -+ SharedPreferences.Editor editor = preferences.edit(); -+ editor.putString(OmahaBase.PREF_LATEST_MODIFIED_VERSION, version); -+ editor.apply(); -+ } -+ -+ public static void setLatestUpstreamVersion(String version) { -+ SharedPreferences preferences = OmahaBase.getSharedPreferences(); -+ SharedPreferences.Editor editor = preferences.edit(); -+ editor.putString(OmahaBase.PREF_LATEST_UPSTREAM_VERSION, version); -+ editor.apply(); -+ } -+ -+ public static void resetUpdatePrefs() { -+ SharedPreferences preferences = OmahaBase.getSharedPreferences(); -+ SharedPreferences.Editor editor = preferences.edit(); -+ editor.putLong(OmahaBase.PREF_TIMESTAMP_OF_REQUEST, 0); -+ editor.putString(OmahaBase.PREF_LATEST_MODIFIED_VERSION, ""); -+ editor.putString(OmahaBase.PREF_LATEST_UPSTREAM_VERSION, ""); -+ editor.apply(); -+ } - } -diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateConfigs.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateConfigs.java -index b7296bac5b9e3..dd7d998373355 100644 ---- a/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateConfigs.java -+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateConfigs.java -@@ -11,6 +11,7 @@ import androidx.annotation.IntDef; - import androidx.annotation.Nullable; - - import org.chromium.base.CommandLine; -+import org.chromium.chrome.browser.flags.ChromeFeatureList; - import org.chromium.chrome.browser.flags.ChromeSwitches; - import org.chromium.chrome.browser.omaha.UpdateStatusProvider.UpdateState; - import org.chromium.components.variations.VariationsAssociatedData; -@@ -36,10 +37,12 @@ public class UpdateConfigs { - private static final String UPDATE_AVAILABLE_SWITCH_VALUE = "update_available"; - private static final String UNSUPPORTED_OS_VERSION_SWITCH_VALUE = "unsupported_os_version"; - -+ private static final long DEFAULT_UPDATE_NOTIFICATION_INTERVAL = 3 * DateUtils.DAY_IN_MILLIS; - private static final long DEFAULT_UPDATE_ATTRIBUTION_WINDOW_MS = 2 * DateUtils.DAY_IN_MILLIS; - - /** Possible update flow configurations. */ -- @IntDef({UpdateFlowConfiguration.NEVER_SHOW, UpdateFlowConfiguration.INTENT_ONLY}) -+ @IntDef({UpdateFlowConfiguration.NEVER_SHOW, UpdateFlowConfiguration.INTENT_ONLY, -+ UpdateFlowConfiguration.INLINE_ONLY}) - @Retention(RetentionPolicy.SOURCE) - public @interface UpdateFlowConfiguration { - /** Turns off all update indicators. */ -@@ -49,6 +52,12 @@ public class UpdateConfigs { - * Requires Omaha to say an update is available, and only ever Intents out to Play Store. - */ - int INTENT_ONLY = 2; -+ -+ /** -+ * Inline updates that contact Bromite official GitHub repository to say whether an update is available. -+ * Only ever uses the inline update flow. -+ */ -+ int INLINE_ONLY = 3; - } - - /** -@@ -123,6 +132,13 @@ public class UpdateConfigs { - return DEFAULT_UPDATE_ATTRIBUTION_WINDOW_MS; - } - -+ /** -+ * @return A time interval for scheduling update notification. Unit: mills. -+ */ -+ public static long getUpdateNotificationInterval() { -+ return DEFAULT_UPDATE_NOTIFICATION_INTERVAL; -+ } -+ - /** - * Gets a String VariationsAssociatedData parameter. Also checks for a command-line switch - * with the same name, for easy local testing. -@@ -137,4 +153,14 @@ public class UpdateConfigs { - } - return value; - } --} -\ No newline at end of file -+ -+ @UpdateFlowConfiguration -+ public static int getConfiguration() { -+ if (!ChromeFeatureList.isEnabled(ChromeFeatureList.INLINE_UPDATE_FLOW)) { -+ // Always use the the old flow if the inline update flow feature is not enabled. -+ return UpdateFlowConfiguration.INLINE_ONLY; -+ } -+ -+ return UpdateFlowConfiguration.NEVER_SHOW; -+ } -+} -diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateMenuItemHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateMenuItemHelper.java -index 55588e6b4375b..1e7f44b34affe 100644 ---- a/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateMenuItemHelper.java -+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateMenuItemHelper.java -@@ -12,6 +12,7 @@ import android.view.Choreographer; - - import androidx.annotation.NonNull; - import androidx.annotation.Nullable; -+import androidx.annotation.StringRes; - - import org.chromium.base.BuildInfo; - import org.chromium.base.Callback; -@@ -135,8 +136,21 @@ public class UpdateMenuItemHelper { - Log.e(TAG, "Failed to launch Activity for: %s", mStatus.updateUrl); - } - break; -+ case UpdateState.VULNERABLE_VERSION: -+ // Intentional fall through. -+ case UpdateState.INLINE_UPDATE_AVAILABLE: -+ UpdateStatusProvider.getInstance().startInlineUpdate(activity); -+ break; -+ case UpdateState.INLINE_UPDATE_READY: -+ UpdateStatusProvider.getInstance().finishInlineUpdate(); -+ break; -+ case UpdateState.INLINE_UPDATE_FAILED: -+ UpdateStatusProvider.getInstance().retryInlineUpdate(activity); -+ break; - case UpdateState.UNSUPPORTED_OS_VERSION: - // Intentional fall through. -+ case UpdateState.INLINE_UPDATE_DOWNLOADING: -+ // Intentional fall through. - default: - return; - } -@@ -182,7 +196,7 @@ public class UpdateMenuItemHelper { - - mMenuUiState = new MenuUiState(); - switch (mStatus.updateState) { -- case UpdateState.UPDATE_AVAILABLE: -+ case UpdateState.UPDATE_AVAILABLE: // this is not used in Bromite - // The badge is hidden if the update menu item has been clicked until there is an - // even newer version of Chrome available. - showBadge |= !TextUtils.equals( -@@ -237,6 +251,72 @@ public class UpdateMenuItemHelper { - mMenuUiState.itemState.icon = R.drawable.ic_error_24dp_filled; - mMenuUiState.itemState.enabled = false; - break; -+ case UpdateState.VULNERABLE_VERSION: -+ // Intentional fall through. -+ case UpdateState.INLINE_UPDATE_AVAILABLE: -+ // The badge is hidden if the update menu item has been clicked until there is an -+ // even newer version of Chrome available. -+ @StringRes int defaultUpdateSummary = R.string.menu_update_summary_default; -+ if (mStatus.updateState == UpdateState.VULNERABLE_VERSION) { -+ // always show badge in case of vulnerable version -+ showBadge = true; -+ mMenuUiState.buttonState = new MenuButtonState(); -+ mMenuUiState.buttonState.menuContentDescription = R.string.accessibility_toolbar_btn_menu_update; -+ mMenuUiState.buttonState.darkBadgeIcon = -+ R.drawable.ic_error_grey800_24dp_filled; -+ mMenuUiState.buttonState.lightBadgeIcon = R.drawable.ic_error_white_24dp_filled; -+ mMenuUiState.buttonState.adaptiveBadgeIcon = R.drawable.ic_error_24dp_filled; -+ defaultUpdateSummary = R.string.menu_update_summary_vulnerable; -+ } else { -+ showBadge |= !TextUtils.equals( -+ getPrefService().getString( -+ Pref.LATEST_VERSION_WHEN_CLICKED_UPDATE_MENU_ITEM), -+ mStatus.latestUnsupportedVersion); -+ if (showBadge) { -+ mMenuUiState.buttonState = new MenuButtonState(); -+ mMenuUiState.buttonState.menuContentDescription = R.string.accessibility_toolbar_btn_menu_update; -+ mMenuUiState.buttonState.darkBadgeIcon = R.drawable.badge_update_dark; -+ mMenuUiState.buttonState.lightBadgeIcon = R.drawable.badge_update_light; -+ mMenuUiState.buttonState.adaptiveBadgeIcon = R.drawable.badge_update; -+ } -+ } -+ -+ mMenuUiState.itemState = new MenuItemState(); -+ mMenuUiState.itemState.title = R.string.menu_update; -+ mMenuUiState.itemState.titleColorId = R.color.default_text_color_blue_dark; -+ mMenuUiState.itemState.summary = UpdateConfigs.getCustomSummary(); -+ if (TextUtils.isEmpty(mMenuUiState.itemState.summary)) { -+ mMenuUiState.itemState.summary = -+ resources.getString(defaultUpdateSummary); -+ } -+ mMenuUiState.itemState.icon = R.drawable.ic_history_googblue_24dp; -+ mMenuUiState.itemState.iconTintId = R.color.default_icon_color_blue_light; -+ mMenuUiState.itemState.enabled = true; -+ break; -+ case UpdateState.INLINE_UPDATE_DOWNLOADING: -+ mMenuUiState.itemState = new MenuItemState(); -+ mMenuUiState.itemState.title = R.string.menu_inline_update_downloading; -+ mMenuUiState.itemState.titleColorId = R.color.default_text_color_secondary_dark; -+ break; -+ case UpdateState.INLINE_UPDATE_READY: -+ mMenuUiState.itemState = new MenuItemState(); -+ mMenuUiState.itemState.title = R.string.menu_inline_update_ready; -+ mMenuUiState.itemState.titleColorId = R.color.default_text_color_blue_dark; -+ mMenuUiState.itemState.summary = -+ resources.getString(R.string.menu_inline_update_ready_summary); -+ mMenuUiState.itemState.icon = R.drawable.infobar_chrome; -+ mMenuUiState.itemState.iconTintId = R.color.default_icon_color_blue_light; -+ mMenuUiState.itemState.enabled = true; -+ break; -+ case UpdateState.INLINE_UPDATE_FAILED: -+ mMenuUiState.itemState = new MenuItemState(); -+ mMenuUiState.itemState.title = R.string.menu_inline_update_failed; -+ mMenuUiState.itemState.titleColorId = R.color.default_text_color_blue_dark; -+ mMenuUiState.itemState.summary = resources.getString(R.string.try_again); -+ mMenuUiState.itemState.icon = R.drawable.ic_history_googblue_24dp; -+ mMenuUiState.itemState.iconTintId = R.color.default_icon_color_blue_light; -+ mMenuUiState.itemState.enabled = true; -+ break; - case UpdateState.NONE: - // Intentional fall through. - default: -diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java -index 10f69e965845d..27c75c368a446 100644 ---- a/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java -+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/UpdateStatusProvider.java -@@ -4,6 +4,7 @@ - - package org.chromium.chrome.browser.omaha; - -+import android.app.Activity; - import android.content.ActivityNotFoundException; - import android.content.Context; - import android.content.Intent; -@@ -15,7 +16,11 @@ import android.text.TextUtils; - import androidx.annotation.IntDef; - import androidx.annotation.NonNull; - import androidx.annotation.Nullable; -+import androidx.annotation.VisibleForTesting; - -+import org.chromium.base.ActivityState; -+import org.chromium.base.ApplicationStatus; -+import org.chromium.base.ApplicationStatus.ActivityStateListener; - import org.chromium.base.BuildInfo; - import org.chromium.base.Callback; - import org.chromium.base.ObserverList; -@@ -25,6 +30,10 @@ import org.chromium.base.task.AsyncTask; - import org.chromium.base.task.AsyncTask.Status; - import org.chromium.base.task.PostTask; - import org.chromium.base.task.TaskTraits; -+import org.chromium.chrome.browser.app.ChromeActivity; -+import org.chromium.chrome.browser.omaha.inline.BromiteInlineUpdateController; -+import org.chromium.chrome.browser.omaha.inline.InlineUpdateController; -+import org.chromium.chrome.browser.omaha.inline.InlineUpdateControllerFactory; - import org.chromium.chrome.browser.omaha.metrics.UpdateSuccessMetrics; - import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; - import org.chromium.chrome.browser.preferences.SharedPreferencesManager; -@@ -34,30 +43,37 @@ import java.io.File; - import java.lang.annotation.Retention; - import java.lang.annotation.RetentionPolicy; - -+import org.chromium.base.Log; -+import android.content.SharedPreferences; -+import android.os.Build; -+import org.chromium.build.BuildConfig; -+ - /** - * Provides the current update state for Chrome. This update state is asynchronously determined and - * can change as Chrome runs. - * - * For manually testing this functionality, see {@link UpdateConfigs}. - */ --public class UpdateStatusProvider { -+public class UpdateStatusProvider implements ActivityStateListener { - /** - * Possible update states. - * Treat this as append only as it is used by UMA. - */ -- @IntDef({UpdateState.NONE, UpdateState.UPDATE_AVAILABLE, UpdateState.UNSUPPORTED_OS_VERSION}) -+ @IntDef({UpdateState.NONE, UpdateState.UPDATE_AVAILABLE, UpdateState.UNSUPPORTED_OS_VERSION, -+ UpdateState.INLINE_UPDATE_AVAILABLE, UpdateState.INLINE_UPDATE_DOWNLOADING, -+ UpdateState.INLINE_UPDATE_READY, UpdateState.INLINE_UPDATE_FAILED, UpdateState.VULNERABLE_VERSION}) - @Retention(RetentionPolicy.SOURCE) - public @interface UpdateState { - int NONE = 0; - int UPDATE_AVAILABLE = 1; - int UNSUPPORTED_OS_VERSION = 2; -- // Inline updates are deprecated. -- // int INLINE_UPDATE_AVAILABLE = 3; -- // int INLINE_UPDATE_DOWNLOADING = 4; -- // int INLINE_UPDATE_READY = 5; -- // int INLINE_UPDATE_FAILED = 6; -+ int INLINE_UPDATE_AVAILABLE = 3; -+ int INLINE_UPDATE_DOWNLOADING = 4; -+ int INLINE_UPDATE_READY = 5; -+ int INLINE_UPDATE_FAILED = 6; -+ int VULNERABLE_VERSION = 7; - -- int NUM_ENTRIES = 7; -+ int NUM_ENTRIES = 8; - } - - /** A set of properties that represent the current update state for Chrome. */ -@@ -91,6 +107,12 @@ public class UpdateStatusProvider { - */ - private boolean mIsSimulated; - -+ /** -+ * Whether or not we are currently trying to simulate an inline flow. Used to allow -+ * overriding Omaha update state, which usually supersedes inline update states. -+ */ -+ private boolean mIsInlineSimulated; -+ - public UpdateStatus() {} - - UpdateStatus(UpdateStatus other) { -@@ -99,11 +121,13 @@ public class UpdateStatusProvider { - latestVersion = other.latestVersion; - latestUnsupportedVersion = other.latestUnsupportedVersion; - mIsSimulated = other.mIsSimulated; -+ mIsInlineSimulated = other.mIsInlineSimulated; - } - } - - private final ObserverList> mObservers = new ObserverList<>(); - -+ private final InlineUpdateController mInlineController; - private final UpdateQuery mOmahaQuery; - private final UpdateSuccessMetrics mMetrics; - private @Nullable UpdateStatus mStatus; -@@ -171,6 +195,30 @@ public class UpdateStatusProvider { - pingObservers(); - } - -+ /** -+ * Starts the inline update process, if possible. -+ * @param activity An {@link Activity} that will be used to interact with Play. -+ */ -+ public void startInlineUpdate(Activity activity) { -+ if (mStatus == null || (mStatus.updateState != UpdateState.INLINE_UPDATE_AVAILABLE && mStatus.updateState != UpdateState.VULNERABLE_VERSION)) return; -+ mInlineController.startUpdate(activity); -+ } -+ -+ /** -+ * Retries the inline update process, if possible. -+ * @param activity An {@link Activity} that will be used to interact with Play. -+ */ -+ public void retryInlineUpdate(Activity activity) { -+ if (mStatus == null || (mStatus.updateState != UpdateState.INLINE_UPDATE_AVAILABLE && mStatus.updateState != UpdateState.VULNERABLE_VERSION)) return; -+ mInlineController.startUpdate(activity); -+ } -+ -+ /** Finishes the inline update process, which may involve restarting the app. */ -+ public void finishInlineUpdate() { -+ if (mStatus == null || mStatus.updateState != UpdateState.INLINE_UPDATE_READY) return; -+ mInlineController.completeUpdate(); -+ } -+ - /** - * Starts the intent update process, if possible - * @param context An {@link Context} that will be used to fire off the update intent. -@@ -178,12 +226,11 @@ public class UpdateStatusProvider { - * @return Whether or not the update intent was sent and had a valid handler. - */ - public boolean startIntentUpdate(Context context, boolean newTask) { -+ // currently not used in Bromite - if (mStatus == null || mStatus.updateState != UpdateState.UPDATE_AVAILABLE) return false; - if (TextUtils.isEmpty(mStatus.updateUrl)) return false; - - try { -- mMetrics.startUpdate(); -- - Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(mStatus.updateUrl)); - if (newTask) intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - context.startActivity(intent); -@@ -194,9 +241,29 @@ public class UpdateStatusProvider { - return true; - } - -+ // ApplicationStateListener implementation. -+ @Override -+ public void onActivityStateChange(Activity changedActivity, @ActivityState int newState) { -+ boolean hasActiveActivity = false; -+ -+ for (Activity activity : ApplicationStatus.getRunningActivities()) { -+ if (activity == null || !(activity instanceof ChromeActivity)) continue; -+ -+ hasActiveActivity |= -+ ApplicationStatus.getStateForActivity(activity) == ActivityState.RESUMED; -+ if (hasActiveActivity) break; -+ } -+ -+ mInlineController.setEnabled(hasActiveActivity); -+ } -+ - private UpdateStatusProvider() { -+ mInlineController = InlineUpdateControllerFactory.create(this::resolveStatus); - mOmahaQuery = new UpdateQuery(this::resolveStatus); - mMetrics = new UpdateSuccessMetrics(); -+ -+ // Note that as a singleton this class never unregisters. -+ ApplicationStatus.registerStateListenerForAllActivities(this); - } - - private void pingObservers() { -@@ -204,19 +271,36 @@ public class UpdateStatusProvider { - } - - private void resolveStatus() { -- if (mOmahaQuery.getStatus() != Status.FINISHED) { -+ if (mOmahaQuery.getStatus() != Status.FINISHED || mInlineController.getStatus() == null) { - return; - } - - // We pull the Omaha result once as it will never change. - if (mStatus == null) mStatus = new UpdateStatus(mOmahaQuery.getResult()); - -- if (!mStatus.mIsSimulated) { -- mStatus.updateState = mOmahaQuery.getResult().updateState; -+ if (mStatus.mIsSimulated) { // used only during tests -+ if (mStatus.mIsInlineSimulated) { -+ @UpdateState -+ int inlineState = mInlineController.getStatus(); -+ String updateUrl = mInlineController.getUpdateUrl(); -+ -+ if (inlineState == UpdateState.NONE) { -+ mStatus.updateState = mOmahaQuery.getResult().updateState; -+ } else { -+ mStatus.updateState = inlineState; -+ mStatus.updateUrl = updateUrl; -+ } -+ } -+ } else { -+ // used by Bromite to resolve update status -+ // ignores Omaha status -+ @UpdateState -+ int inlineState = mInlineController.getStatus(); -+ mStatus.updateState = inlineState; -+ mStatus.updateUrl = mInlineController.getUpdateUrl(); - } - - if (!mRecordedInitialStatus) { -- mMetrics.analyzeFirstStatus(); - mRecordedInitialStatus = true; - } - -@@ -228,6 +312,7 @@ public class UpdateStatusProvider { - } - - private static final class UpdateQuery extends AsyncTask { -+ static final String TAG = "UpdateStatusProvider"; - private final Runnable mCallback; - - private @Nullable UpdateStatus mStatus; -@@ -244,7 +329,7 @@ public class UpdateStatusProvider { - protected UpdateStatus doInBackground() { - UpdateStatus testStatus = getTestStatus(); - if (testStatus != null) return testStatus; -- return getRealStatus(); -+ return getActualStatus(); - } - - @Override -@@ -263,6 +348,8 @@ public class UpdateStatusProvider { - status.mIsSimulated = true; - status.updateState = forcedUpdateState; - -+ status.mIsInlineSimulated = forcedUpdateState == UpdateState.INLINE_UPDATE_AVAILABLE; -+ - // Push custom configurations for certain update states. - switch (forcedUpdateState) { - case UpdateState.UPDATE_AVAILABLE: -@@ -279,27 +366,33 @@ public class UpdateStatusProvider { - return status; - } - -- private UpdateStatus getRealStatus() { -+ private UpdateStatus getActualStatus() { - UpdateStatus status = new UpdateStatus(); - -- if (VersionNumberGetter.isNewerVersionAvailable()) { -- status.updateUrl = MarketURLGetter.getMarketUrl(); -- status.latestVersion = VersionNumberGetter.getInstance().getLatestKnownVersion(); -- -- boolean allowedToUpdate = checkForSufficientStorage() -- && PackageUtils.isPackageInstalled( -- GooglePlayServicesUtil.GOOGLE_PLAY_STORE_PACKAGE); -- status.updateState = -- allowedToUpdate ? UpdateState.UPDATE_AVAILABLE : UpdateState.NONE; -- -- SharedPreferencesManager.getInstance().removeKey( -- ChromePreferenceKeys.LATEST_UNSUPPORTED_VERSION); -- } else if (!VersionNumberGetter.isCurrentOsVersionSupported()) { -- status.updateState = UpdateState.UNSUPPORTED_OS_VERSION; -- status.latestUnsupportedVersion = SharedPreferencesManager.getInstance().readString( -- ChromePreferenceKeys.LATEST_UNSUPPORTED_VERSION, null); -- } else { -- status.updateState = UpdateState.NONE; -+ SharedPreferences preferences = OmahaBase.getSharedPreferences(); -+ status.latestVersion = preferences.getString(OmahaBase.PREF_LATEST_MODIFIED_VERSION, ""); -+ -+ status.updateState = UpdateState.NONE; -+ if (status.latestVersion != null && status.latestVersion.length() != 0) { -+ VersionNumber latestVersion = VersionNumber.fromString(status.latestVersion); -+ if (latestVersion == null) { -+ Log.e(TAG, "BromiteUpdater: stored latest version '%s' is invalid", status.latestVersion); -+ } else if (OmahaBase.isNewVersionAvailableByVersion(latestVersion)) { -+ status.updateState = UpdateState.INLINE_UPDATE_AVAILABLE; -+ status.updateUrl = BromiteInlineUpdateController.getDownloadUrl(); -+ return status; -+ } -+ String latestUpstreamVersion = preferences.getString(OmahaBase.PREF_LATEST_UPSTREAM_VERSION, ""); -+ if (latestUpstreamVersion != null && latestUpstreamVersion.length() != 0) { -+ VersionNumber upstreamVersion = VersionNumber.fromString(latestUpstreamVersion); -+ if (upstreamVersion == null) { -+ Log.e(TAG, "BromiteUpdater: stored latest upstream version '%s' is invalid", latestUpstreamVersion); -+ } else if (OmahaBase.isNewVersionAvailableByVersion(upstreamVersion)) { -+ status.updateUrl = BromiteInlineUpdateController.VULNERABLE_VERSION_DOC_URL; -+ status.updateState = UpdateState.VULNERABLE_VERSION; -+ return status; -+ } -+ } - } - - return status; -diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/VersionNumberGetter.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/VersionNumberGetter.java -index 90cfcd7661c43..9451d364347f8 100644 ---- a/chrome/android/java/src/org/chromium/chrome/browser/omaha/VersionNumberGetter.java -+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/VersionNumberGetter.java -@@ -50,7 +50,8 @@ public class VersionNumberGetter { - private static VersionNumberGetter sInstanceForTests; - - /** If false, OmahaClient will never report that a newer version is available. */ -- private static boolean sEnableUpdateDetection = true; -+ // it must be false to disable version control via Omaha server -+ private static boolean sEnableUpdateDetection = false; - - protected VersionNumberGetter() { } - -diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/BromiteInlineUpdateController.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/BromiteInlineUpdateController.java -new file mode 100644 -index 0000000000000..90692d394ebe9 ---- /dev/null -+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/BromiteInlineUpdateController.java -@@ -0,0 +1,272 @@ -+// Copyright 2021 The Ungoogled Chromium Authors. All rights reserved. -+// -+// This file is part of Ungoogled Chromium Android. -+// -+// Ungoogled Chromium Android is free software: you can redistribute it -+// and/or modify it under the terms of the GNU General Public License as -+// published by the Free Software Foundation, either version 3 of the -+// License, or any later version. -+// -+// Ungoogled Chromium Android is distributed in the hope that it will be -+// useful, but WITHOUT ANY WARRANTY; without even the implied warranty -+// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+// GNU General Public License for more details. -+// -+// You should have received a copy of the GNU General Public License -+// along with Ungoogled Chromium Android. If not, -+// see . -+ -+package org.chromium.chrome.browser.omaha.inline; -+ -+import static org.chromium.chrome.browser.omaha.UpdateConfigs.getUpdateNotificationInterval; -+ -+import android.app.Activity; -+import android.content.SharedPreferences; -+import android.os.Build; -+import android.text.format.DateUtils; -+import org.chromium.build.BuildConfig; -+ -+import androidx.annotation.Nullable; -+ -+import org.chromium.base.Callback; -+import org.chromium.base.Log; -+import org.chromium.base.task.AsyncTask; -+import org.chromium.base.task.PostTask; -+import org.chromium.base.task.TaskTraits; -+import org.chromium.chrome.browser.app.ChromeActivity; -+import org.chromium.chrome.browser.omaha.OmahaBase; -+import org.chromium.chrome.browser.omaha.UpdateConfigs; -+import org.chromium.chrome.browser.omaha.UpdateStatusProvider; -+import org.chromium.chrome.browser.profiles.Profile; -+import org.chromium.chrome.browser.tab.TabLaunchType; -+import org.chromium.chrome.browser.tabmodel.TabCreator; -+import org.chromium.content_public.browser.LoadUrlParams; -+import org.chromium.ui.base.PageTransition; -+import org.chromium.net.NetworkTrafficAnnotationTag; -+ -+import java.io.BufferedReader; -+import java.io.IOException; -+import java.io.InputStreamReader; -+import java.io.InputStream; -+import java.net.MalformedURLException; -+import java.net.URL; -+import java.net.HttpURLConnection; -+import java.util.regex.Pattern; -+ -+import org.chromium.chrome.browser.endpoint_fetcher.EndpointFetcher; -+import org.chromium.chrome.browser.endpoint_fetcher.EndpointResponse; -+import org.chromium.chrome.browser.omaha.VersionNumber; -+ -+public class BromiteInlineUpdateController implements InlineUpdateController { -+ -+ private static final String TAG = "BromiteInlineUpdateController"; -+ private final String REDIRECT_URL_PREFIX = "https://github.com/bromite/bromite/releases/download/"; -+ private static final String UPDATE_VERSION_URL = "https://github.com/bromite/bromite/releases/latest/download/"; -+ private final String UPSTREAM_VERSION_URL = "https://www.bromite.org/upstream.txt"; -+ public static final String VULNERABLE_VERSION_DOC_URL = "https://www.bromite.org/vulnerable-version"; -+ -+ public static String getDownloadUrl() { -+ return UPDATE_VERSION_URL + BuildConfig.BUILD_TARGET_CPU + "_ChromePublic.apk"; -+ } -+ -+ private static final NetworkTrafficAnnotationTag TRAFFIC_ANNOTATION = -+ NetworkTrafficAnnotationTag.createComplete("bromite_inline_update_controller", -+ "semantics {" -+ + " sender: 'Bromite Inline Update (Android)'" -+ + " description:" -+ + " 'Check for update'" -+ + " trigger: 'This request is made once, on first run'" -+ + " data: 'None.'" -+ + " destination: OTHER" -+ + " internal {" -+ + " contacts {" -+ + " email: 'uazo@users.noreply.github.com'" -+ + " }" -+ + " contacts {" -+ + " email: 'uazo@users.noreply.github.com'" -+ + " }" -+ + " }" -+ + " user_data {" -+ + " type: NONE" -+ + " }" -+ + " last_reviewed: '2023-01-01'" -+ + "}" -+ + "policy {" -+ + " cookies_allowed: NO" -+ + " setting: 'Can be disabled in Settings.'" -+ + " policy_exception_justification: 'Not implemented.'" -+ + "}"); -+ -+ private boolean mEnabled = true; -+ private Runnable mCallback; -+ private @Nullable @UpdateStatusProvider.UpdateState Integer mUpdateState = -+ UpdateStatusProvider.UpdateState.NONE; -+ private String mUpdateUrl = ""; -+ -+ BromiteInlineUpdateController(Runnable callback) { -+ mCallback = callback; -+ } -+ -+ @Override -+ public void setEnabled(boolean enabled) { -+ if (mEnabled == enabled) return; -+ -+ mEnabled = enabled; -+ // check for an update when state changes -+ if (mEnabled) pullCurrentState(); -+ } -+ -+ @Override -+ public @Nullable @UpdateStatusProvider.UpdateState Integer getStatus() { -+ if (mEnabled) pullCurrentState(); -+ return mUpdateState; -+ } -+ -+ @Override -+ public String getUpdateUrl() { -+ // relies on a prior call to getStatus() to have state and URL correctly pulled -+ return mUpdateUrl; -+ } -+ -+ @Override -+ public void startUpdate(Activity activity) { -+ assert ChromeActivity.class.isInstance(activity); -+ ChromeActivity thisActivity = (ChromeActivity) activity; -+ // Always open in new incognito tab -+ TabCreator tabCreator = thisActivity.getTabCreator(true); -+ tabCreator.createNewTab(new LoadUrlParams(mUpdateUrl, PageTransition.AUTO_BOOKMARK), -+ TabLaunchType.FROM_LINK, thisActivity.getActivityTab()); -+ } -+ -+ @Override -+ public void completeUpdate() { -+ } -+ -+ private void pullCurrentState() { -+ if (OmahaBase.getSharedPreferences() -+ .getBoolean(OmahaBase.PREF_ALLOW_INLINE_UPDATE, false) == false) { -+ Log.i(TAG, "BromiteUpdater: disabled by user"); -+ return; -+ } -+ -+ // do not pull state if there is already a state set -+ if (mUpdateState != UpdateStatusProvider.UpdateState.NONE) -+ return; -+ -+ if (shallUpdate() == false) -+ return; -+ -+ switch (mUpdateState) { -+ case UpdateStatusProvider.UpdateState.INLINE_UPDATE_AVAILABLE: -+ break; -+ case UpdateStatusProvider.UpdateState.NONE: -+ OmahaBase.resetUpdatePrefs(); -+ checkLatestVersion((latestVersion) -> { -+ if (latestVersion == null) return; -+ -+ if (OmahaBase.isNewVersionAvailableByVersion(latestVersion)) { -+ postStatus(UpdateStatusProvider.UpdateState.INLINE_UPDATE_AVAILABLE, getDownloadUrl()); -+ } else { -+ checkLatestUpstreamVersion((latestUpstreamVersion) -> { -+ if (latestUpstreamVersion == null) return; -+ if (OmahaBase.isNewVersionAvailableByVersion(latestUpstreamVersion)) { -+ postStatus(UpdateStatusProvider.UpdateState.VULNERABLE_VERSION, VULNERABLE_VERSION_DOC_URL); -+ } -+ }); -+ } -+ }); -+ break; -+ case UpdateStatusProvider.UpdateState.INLINE_UPDATE_READY: -+ // Intentional fall through. -+ case UpdateStatusProvider.UpdateState.INLINE_UPDATE_FAILED: -+ // Intentional fall through. -+ case UpdateStatusProvider.UpdateState.INLINE_UPDATE_DOWNLOADING: -+ // Intentional fall through. -+ case UpdateStatusProvider.UpdateState.UNSUPPORTED_OS_VERSION: -+ // Intentional fall through. -+ case UpdateStatusProvider.UpdateState.VULNERABLE_VERSION: -+ // Intentional fall through. -+ default: -+ return; -+ } -+ } -+ -+ private boolean shallUpdate() { -+ long currentTime = System.currentTimeMillis(); -+ SharedPreferences preferences = OmahaBase.getSharedPreferences(); -+ long lastPushedTimeStamp = preferences.getLong(OmahaBase.PREF_TIMESTAMP_OF_REQUEST, 0); -+ return currentTime - lastPushedTimeStamp >= getUpdateNotificationInterval(); -+ } -+ -+ private void checkLatestVersion(final Callback callback) { -+ assert UPDATE_VERSION_URL != null; -+ -+ String urlToCheck = getDownloadUrl(); -+ Log.i(TAG, "BromiteUpdater: fetching with HEAD '%s'", urlToCheck); -+ -+ EndpointFetcher.nativeHeadWithNoAuth( -+ (endpointResponse) -> { -+ boolean versionFound = false; -+ String redirectURL = endpointResponse.getRedirectUrl(); -+ if (redirectURL != null) { -+ Log.i(TAG, "BromiteUpdater: obtained response '%s' and redirect URL '%s'", endpointResponse.getResponseString(), redirectURL); -+ if (redirectURL.indexOf(REDIRECT_URL_PREFIX) == 0) { -+ redirectURL = redirectURL.substring(REDIRECT_URL_PREFIX.length()); -+ String[] parts = redirectURL.split(Pattern.quote("/")); -+ if (parts.length > 0) { -+ VersionNumber version = VersionNumber.fromString(parts[0]); -+ if (version != null) { -+ versionFound = true; -+ OmahaBase.setLatestModifiedVersion(parts[0]); -+ callback.onResult(version); -+ return; -+ } -+ } -+ } -+ } -+ if (!versionFound) { -+ // retry after 1 hour -+ OmahaBase.updateLastPushedTimeStamp( -+ System.currentTimeMillis() - getUpdateNotificationInterval() - -+ DateUtils.HOUR_IN_MILLIS); -+ Log.e(TAG, "BromiteUpdater: failed, will retry in 1 hour"); -+ } -+ -+ callback.onResult(null); -+ }, -+ Profile.getLastUsedRegularProfile(), -+ urlToCheck, /*timeout*/5000, /*follow_redirect*/true, TRAFFIC_ANNOTATION); -+ } -+ -+ private void checkLatestUpstreamVersion(final Callback callback) { -+ Log.i(TAG, "BromiteUpdater: fetching with GET '%s'", UPSTREAM_VERSION_URL); -+ -+ EndpointFetcher.nativeFetchWithNoAuth( -+ (endpointResponse) -> { -+ String response = endpointResponse.getResponseString().trim(); -+ Log.i(TAG, "BromiteUpdater: obtained upstream version update response '%s'", response); -+ VersionNumber version = VersionNumber.fromString(response); -+ if (version != null) { -+ OmahaBase.updateLastPushedTimeStamp(System.currentTimeMillis()); -+ OmahaBase.setLatestUpstreamVersion(response); -+ callback.onResult(version); -+ return; -+ } -+ // retry after 1 hour -+ OmahaBase.updateLastPushedTimeStamp( -+ System.currentTimeMillis() - getUpdateNotificationInterval() - -+ DateUtils.HOUR_IN_MILLIS); -+ Log.e(TAG, "BromiteUpdater: failed to fetch upstream version, will retry in 1 hour"); -+ -+ callback.onResult(null); -+ }, -+ Profile.getLastUsedRegularProfile(), -+ UPSTREAM_VERSION_URL, /*timeout*/5000, /*follow_redirect*/false, TRAFFIC_ANNOTATION); -+ } -+ -+ private void postStatus(@UpdateStatusProvider.UpdateState int status, String updateUrl) { -+ mUpdateState = status; -+ mUpdateUrl = updateUrl; -+ PostTask.postTask(TaskTraits.UI_DEFAULT, mCallback); -+ } -+} -diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateController.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateController.java -new file mode 100644 -index 0000000000000..260e5f1225f6f ---- /dev/null -+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateController.java -@@ -0,0 +1,51 @@ -+// Copyright 2019 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.chrome.browser.omaha.inline; -+ -+import android.app.Activity; -+import android.content.Intent; -+ -+import androidx.annotation.Nullable; -+ -+import org.chromium.chrome.browser.omaha.UpdateStatusProvider; -+ -+/** -+ * Helper for gluing interactions with the Play store's AppUpdateManager with Chrome. This -+ * involves hooking up to Play as a listener for install state changes, should only happen if we are -+ * in the foreground. -+ */ -+public interface InlineUpdateController { -+ /** -+ * Enables or disables the controller. It will trigger an update check when previously disabled. -+ * @param enabled true iff the controller should be enabled. -+ */ -+ void setEnabled(boolean enabled); -+ -+ /** -+ * @return The current state of the inline update process. May be {@code null} if the state -+ * hasn't been determined yet. -+ */ -+ @Nullable -+ @UpdateStatusProvider.UpdateState -+ Integer getStatus(); -+ -+ /** -+ * @return The current update URL for the inline update process. May be an empty string if the state -+ * hasn't been determined yet or if state does not specify one. -+ */ -+ String getUpdateUrl(); -+ -+ /** -+ * Starts the update, if possible. This will send an {@link Intent} out to play, which may -+ * cause Chrome to move to the background. -+ * @param activity The {@link Activity} to use to interact with Play. -+ */ -+ void startUpdate(Activity activity); -+ -+ /** -+ * Completes the Play installation process, if possible. This may cause Chrome to restart. -+ */ -+ void completeUpdate(); -+} -diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateControllerFactory.java b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateControllerFactory.java -new file mode 100644 -index 0000000000000..de41882343e21 ---- /dev/null -+++ b/chrome/android/java/src/org/chromium/chrome/browser/omaha/inline/InlineUpdateControllerFactory.java -@@ -0,0 +1,21 @@ -+// Copyright 2019 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.chrome.browser.omaha.inline; -+ -+import org.chromium.base.ContextUtils; -+import org.chromium.chrome.browser.flags.ChromeFeatureList; -+import org.chromium.chrome.browser.omaha.UpdateConfigs; -+ -+/** -+ * A factory that creates an {@link InlineUpdateController} instance. -+ */ -+public class InlineUpdateControllerFactory { -+ /** -+ * @return A new {@link InlineUpdateController}. -+ */ -+ public static InlineUpdateController create(Runnable callback) { -+ return new BromiteInlineUpdateController(callback); -+ } -+} -diff --git a/chrome/browser/endpoint_fetcher/BUILD.gn b/chrome/browser/endpoint_fetcher/BUILD.gn -index f263a5c38edc5..03707c32d2e91 100644 ---- a/chrome/browser/endpoint_fetcher/BUILD.gn -+++ b/chrome/browser/endpoint_fetcher/BUILD.gn -@@ -18,6 +18,7 @@ android_library("java") { - sources = [ - "java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointFetcher.java", - "java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointResponse.java", -+ "java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointHeaderResponse.java", - ] - } - -@@ -25,5 +26,6 @@ generate_jni("jni_headers") { - sources = [ - "java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointFetcher.java", - "java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointResponse.java", -+ "java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointHeaderResponse.java", - ] - } -diff --git a/chrome/browser/endpoint_fetcher/endpoint_fetcher_android.cc b/chrome/browser/endpoint_fetcher/endpoint_fetcher_android.cc -index a6c7802b3e15b..e33f87ba0aae0 100644 ---- a/chrome/browser/endpoint_fetcher/endpoint_fetcher_android.cc -+++ b/chrome/browser/endpoint_fetcher/endpoint_fetcher_android.cc -@@ -9,6 +9,7 @@ - #include "base/android/jni_string.h" - #include "chrome/browser/endpoint_fetcher/jni_headers/EndpointFetcher_jni.h" - #include "chrome/browser/endpoint_fetcher/jni_headers/EndpointResponse_jni.h" -+#include "chrome/browser/endpoint_fetcher/jni_headers/EndpointHeaderResponse_jni.h" - #include "chrome/browser/profiles/profile_android.h" - #include "chrome/browser/signin/identity_manager_factory.h" - #include "chrome/common/channel_info.h" -@@ -31,6 +32,24 @@ static void OnEndpointFetcherComplete( - base::android::AttachCurrentThread(), - std::move(endpoint_response->response)))); - } -+ -+static void OnEndpointFetcherHeadComplete( -+ const base::android::JavaRef& jcaller, -+ // Passing the endpoint_fetcher ensures the endpoint_fetcher's -+ // lifetime extends to the callback and is not destroyed -+ // prematurely (which would result in cancellation of the request). -+ std::unique_ptr endpoint_fetcher, -+ std::unique_ptr endpoint_response) { -+ base::android::RunObjectCallbackAndroid( -+ jcaller, Java_EndpointHeaderResponse_createEndpointResponse( -+ base::android::AttachCurrentThread(), -+ base::android::ConvertUTF8ToJavaString( -+ base::android::AttachCurrentThread(), -+ std::move(endpoint_response->response)), -+ base::android::ConvertUTF8ToJavaString( -+ base::android::AttachCurrentThread(), -+ std::move(endpoint_response->redirect_url)))); -+} - } // namespace - - // TODO(crbug.com/1077537) Create a KeyProvider so -@@ -113,6 +132,7 @@ static void JNI_EndpointFetcher_NativeFetchWithNoAuth( - JNIEnv* env, - const base::android::JavaParamRef& jprofile, - const base::android::JavaParamRef& jurl, -+ jlong jtimeout, jboolean intercept_redirect, - jint jannotation_hash_code, - const base::android::JavaParamRef& jcallback) { - auto endpoint_fetcher = std::make_unique( -@@ -120,6 +140,9 @@ static void JNI_EndpointFetcher_NativeFetchWithNoAuth( - ->GetDefaultStoragePartition() - ->GetURLLoaderFactoryForBrowserProcess(), - GURL(base::android::ConvertJavaStringToUTF8(env, jurl)), -+ "GET", -+ jtimeout, -+ intercept_redirect, - net::NetworkTrafficAnnotationTag::FromJavaAnnotation( - jannotation_hash_code)); - auto* const endpoint_fetcher_ptr = endpoint_fetcher.get(); -@@ -131,3 +154,30 @@ static void JNI_EndpointFetcher_NativeFetchWithNoAuth( - std::move(endpoint_fetcher)), - nullptr); - } -+ -+static void JNI_EndpointFetcher_NativeHeadWithNoAuth( -+ JNIEnv* env, -+ const base::android::JavaParamRef& jprofile, -+ const base::android::JavaParamRef& jurl, -+ jlong jtimeout, jboolean intercept_redirect, -+ jint jannotation_hash_code, -+ const base::android::JavaParamRef& jcallback) { -+ auto endpoint_fetcher = std::make_unique( -+ ProfileAndroid::FromProfileAndroid(jprofile) -+ ->GetDefaultStoragePartition() -+ ->GetURLLoaderFactoryForBrowserProcess(), -+ GURL(base::android::ConvertJavaStringToUTF8(env, jurl)), -+ "HEAD", -+ jtimeout, -+ intercept_redirect, -+ net::NetworkTrafficAnnotationTag::FromJavaAnnotation( -+ jannotation_hash_code)); -+ auto* const endpoint_fetcher_ptr = endpoint_fetcher.get(); -+ endpoint_fetcher_ptr->PerformRequest( -+ base::BindOnce(&OnEndpointFetcherHeadComplete, -+ base::android::ScopedJavaGlobalRef(jcallback), -+ // unique_ptr endpoint_fetcher is passed until the callback -+ // to ensure its lifetime across the request. -+ std::move(endpoint_fetcher)), -+ nullptr); -+} -diff --git a/chrome/browser/endpoint_fetcher/java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointFetcher.java b/chrome/browser/endpoint_fetcher/java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointFetcher.java -index c28fc4d9793b4..435ecf26fd1be 100644 ---- a/chrome/browser/endpoint_fetcher/java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointFetcher.java -+++ b/chrome/browser/endpoint_fetcher/java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointFetcher.java -@@ -70,6 +70,24 @@ public final class EndpointFetcher { - postData, timeout, headers, annotation.getHashCode(), callback); - } - -+ @MainThread -+ public static void nativeHeadWithNoAuth( -+ Callback callback, Profile profile, -+ String url, long timeout, boolean allow_redirect, -+ NetworkTrafficAnnotationTag annotation) { -+ EndpointFetcherJni.get().nativeHeadWithNoAuth( -+ profile, url, timeout, allow_redirect, annotation.getHashCode(), callback); -+ } -+ -+ @MainThread -+ public static void nativeFetchWithNoAuth( -+ Callback callback, Profile profile, -+ String url, long timeout, boolean allow_redirect, -+ NetworkTrafficAnnotationTag annotation) { -+ EndpointFetcherJni.get().nativeFetchWithNoAuth( -+ profile, url, timeout, allow_redirect, annotation.getHashCode(), callback); -+ } -+ - @NativeMethods - public interface Natives { - void nativeFetchOAuth(Profile profile, String oathConsumerName, String url, -@@ -78,7 +96,13 @@ public final class EndpointFetcher { - void nativeFetchChromeAPIKey(Profile profile, String url, String httpsMethod, - String contentType, String postData, long timeout, String[] headers, - int annotationHashCode, Callback callback); -- void nativeFetchWithNoAuth(Profile profile, String url, int annotationHashCode, -+ void nativeFetchWithNoAuth( -+ Profile profile, String url, long timeout, boolean allow_redirect, -+ int annotationHashCode, - Callback callback); -+ void nativeHeadWithNoAuth( -+ Profile profile, String url, long timeout, boolean allow_redirect, -+ int annotationHashCode, -+ Callback callback); - } - } -diff --git a/chrome/browser/endpoint_fetcher/java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointHeaderResponse.java b/chrome/browser/endpoint_fetcher/java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointHeaderResponse.java -new file mode 100644 -index 0000000000000..a7bd35381ccd1 ---- /dev/null -+++ b/chrome/browser/endpoint_fetcher/java/src/org/chromium/chrome/browser/endpoint_fetcher/EndpointHeaderResponse.java -@@ -0,0 +1,31 @@ -+// Copyright 2019 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.chrome.browser.endpoint_fetcher; -+ -+import org.chromium.base.annotations.CalledByNative; -+ -+public class EndpointHeaderResponse { -+ private final String mResponseString; -+ private final String mRedirectUrl; -+ -+ public EndpointHeaderResponse(String responseString, String redirectUrl) { -+ mResponseString = responseString; -+ mRedirectUrl = redirectUrl; -+ } -+ -+ public String getResponseString() { -+ return mResponseString; -+ } -+ -+ public String getRedirectUrl() { -+ return mRedirectUrl; -+ } -+ -+ @CalledByNative -+ private static EndpointHeaderResponse createEndpointResponse( -+ String response, String redirectUrl) { -+ return new EndpointHeaderResponse(response, redirectUrl); -+ } -+} -diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc -index db4d5e5031e64..26ad6f888a5e3 100644 ---- a/chrome/browser/flags/android/chrome_feature_list.cc -+++ b/chrome/browser/flags/android/chrome_feature_list.cc -@@ -252,6 +252,7 @@ const base::Feature* const kFeaturesExposedToJava[] = { - &kNotificationPermissionBottomSheet, - &kPageAnnotationsService, - &kPreconnectOnTabCreation, -+ &kInlineUpdateFlow, - &kBookmarksImprovedSaveFlow, - &kBookmarksRefresh, - &kOmahaMinSdkVersionAndroid, -@@ -687,6 +688,10 @@ BASE_FEATURE(kContextMenuTranslateWithGoogleLens, - "ContextMenuTranslateWithGoogleLens", - base::FEATURE_DISABLED_BY_DEFAULT); - -+BASE_FEATURE(kInlineUpdateFlow, -+ "InlineUpdateFlow", -+ base::FEATURE_ENABLED_BY_DEFAULT); -+ - BASE_FEATURE(kLensCameraAssistedSearch, - "LensCameraAssistedSearch", - base::FEATURE_ENABLED_BY_DEFAULT); -diff --git a/chrome/browser/flags/android/chrome_feature_list.h b/chrome/browser/flags/android/chrome_feature_list.h -index b9f8bb074b60f..120623eb985aa 100644 ---- a/chrome/browser/flags/android/chrome_feature_list.h -+++ b/chrome/browser/flags/android/chrome_feature_list.h -@@ -105,6 +105,7 @@ BASE_DECLARE_FEATURE(kFoldableJankFix); - BASE_DECLARE_FEATURE(kGridTabSwitcherLandscapeAspectRatioPhones); - BASE_DECLARE_FEATURE(kImprovedIncognitoScreenshot); - BASE_DECLARE_FEATURE(kIncognitoReauthenticationForAndroid); -+BASE_DECLARE_FEATURE(kInlineUpdateFlow); - BASE_DECLARE_FEATURE(kIncognitoScreenshot); - BASE_DECLARE_FEATURE(kInfobarScrollOptimization); - BASE_DECLARE_FEATURE(kImprovedA2HS); -diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java -index 8817964921a27..c287e9b0bf4b8 100644 ---- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java -+++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java -@@ -291,6 +291,7 @@ public abstract class ChromeFeatureList { - "IncognitoReauthenticationForAndroid"; - public static final String INCOGNITO_SCREENSHOT = "IncognitoScreenshot"; - public static final String INFOBAR_SCROLL_OPTIMIZATION = "InfobarScrollOptimization"; -+ public static final String INLINE_UPDATE_FLOW = "InlineUpdateFlow"; - public static final String INSTALLABLE_AMBIENT_BADGE_INFOBAR = "InstallableAmbientBadgeInfoBar"; - public static final String INSTALLABLE_AMBIENT_BADGE_MESSAGE = "InstallableAmbientBadgeMessage"; - public static final String INSTANCE_SWITCHER = "InstanceSwitcher"; -diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd -index 578abb03eb258..c004ab5d7a186 100644 ---- a/chrome/browser/ui/android/strings/android_chrome_strings.grd -+++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd -@@ -2106,6 +2106,12 @@ Your Google account may have other forms of browsing history like searches and a - - Chrome updates are no longer supported for this version of Android - -+ -+ Allow checking for updates -+ -+ -+ Notify about new releases by periodically checking for their availability -+ - - - -@@ -3722,7 +3728,10 @@ To change this setting, <resetlink>reset sync

- -- Update Chrome -+ Update Bromite -+ -+ -+ Update not available. Read more - - - Newer version is available -@@ -3733,6 +3742,18 @@ To change this setting, <resetlink>reset sync

- Android version is unsupported - -+ -+ Downloading… -+ -+ -+ Couldn’t download -+ -+ -+ Update ready -+ -+ -+ Restart Bromite -+ - - New window - -diff --git a/components/endpoint_fetcher/endpoint_fetcher.cc b/components/endpoint_fetcher/endpoint_fetcher.cc -index 9ce615ea489f0..6fa68a102c1f2 100644 ---- a/components/endpoint_fetcher/endpoint_fetcher.cc -+++ b/components/endpoint_fetcher/endpoint_fetcher.cc -@@ -18,6 +18,11 @@ - #include "services/network/public/cpp/simple_url_loader.h" - #include "services/network/public/mojom/url_response_head.mojom.h" - -+// used for the Bromite customization -+#include "net/base/load_flags.h" -+#include "net/http/http_status_code.h" -+#include "services/network/public/cpp/resource_request.h" -+ - namespace { - const char kContentTypeKey[] = "Content-Type"; - const char kDeveloperKey[] = "X-Developer-Key"; -@@ -64,6 +69,7 @@ EndpointFetcher::EndpointFetcher( - http_method_(http_method), - content_type_(content_type), - timeout_ms_(timeout_ms), -+ intercept_redirect_(false), - post_data_(post_data), - headers_(headers), - annotation_tag_(annotation_tag), -@@ -82,6 +88,7 @@ EndpointFetcher::EndpointFetcher( - http_method_("GET"), - content_type_(std::string()), - timeout_ms_(0), -+ intercept_redirect_(false), - post_data_(std::string()), - annotation_tag_(annotation_tag), - url_loader_factory_(url_loader_factory), -@@ -107,6 +114,7 @@ EndpointFetcher::EndpointFetcher( - http_method_(http_method), - content_type_(content_type), - timeout_ms_(timeout_ms), -+ intercept_redirect_(false), - post_data_(post_data), - annotation_tag_(annotation_tag), - url_loader_factory_(url_loader_factory), -@@ -134,6 +142,7 @@ EndpointFetcher::EndpointFetcher( - http_method_(http_method), - content_type_(content_type), - timeout_ms_(timeout_ms), -+ intercept_redirect_(false), - post_data_(post_data), - headers_(headers), - cors_exempt_headers_(cors_exempt_headers), -@@ -146,11 +155,29 @@ EndpointFetcher::EndpointFetcher( - EndpointFetcher::EndpointFetcher( - const net::NetworkTrafficAnnotationTag& annotation_tag) - : timeout_ms_(kDefaultTimeOutMs), -+ intercept_redirect_(false), - annotation_tag_(annotation_tag), - identity_manager_(nullptr), - consent_level_(absl::nullopt), - sanitize_response_(true) {} - -+// constructor used by Bromite -+EndpointFetcher::EndpointFetcher( -+ const scoped_refptr& url_loader_factory, -+ const GURL& url, -+ const std::string& http_method, -+ int64_t timeout_ms, -+ const bool intercept_redirect, -+ const net::NetworkTrafficAnnotationTag& annotation_tag) -+ : url_(url), -+ http_method_(http_method), -+ timeout_ms_(timeout_ms), -+ intercept_redirect_(intercept_redirect), -+ annotation_tag_(annotation_tag), -+ url_loader_factory_(url_loader_factory), -+ identity_manager_(nullptr), -+ sanitize_response_(false) {} -+ - EndpointFetcher::~EndpointFetcher() = default; - - void EndpointFetcher::Fetch(EndpointFetcherCallback endpoint_fetcher_callback) { -@@ -209,6 +236,8 @@ void EndpointFetcher::PerformRequest( - resource_request->method = http_method_; - resource_request->url = url_; - resource_request->credentials_mode = network::mojom::CredentialsMode::kOmit; -+ resource_request->load_flags = net::LOAD_BYPASS_CACHE | net::LOAD_DISABLE_CACHE -+ | net::LOAD_DO_NOT_SAVE_COOKIES; - if (base::EqualsCaseInsensitiveASCII(http_method_, "POST")) { - resource_request->headers.SetHeader(kContentTypeKey, content_type_); - } -@@ -239,25 +268,52 @@ void EndpointFetcher::PerformRequest( - default: - break; - } -+ -+ if (intercept_redirect_ == true) { -+ // will need manual mode to capture the landing page URL -+ resource_request->redirect_mode = network::mojom::RedirectMode::kManual; // default is kFollow -+ } -+ - // TODO(crbug.com/997018) Make simple_url_loader_ local variable passed to - // callback - simple_url_loader_ = network::SimpleURLLoader::Create( - std::move(resource_request), annotation_tag_); -+ simple_url_loader_->SetTimeoutDuration(base::Milliseconds(timeout_ms_)); -+ simple_url_loader_->SetAllowHttpErrorResults(true); -+ -+ if (!response_) { -+ //RFC: what is this for? -+ response_ = std::make_unique(); -+ } -+ if (intercept_redirect_ == true) { -+ // use a callback to capture landing page URL -+ simple_url_loader_->SetOnRedirectCallback(base::BindRepeating( -+ &EndpointFetcher::OnSimpleLoaderRedirect, base::Unretained(this))); -+ } - - if (base::EqualsCaseInsensitiveASCII(http_method_, "POST")) { - simple_url_loader_->AttachStringForUpload(post_data_, content_type_); - } - simple_url_loader_->SetRetryOptions(kNumRetries, - network::SimpleURLLoader::RETRY_ON_5XX); -- simple_url_loader_->SetTimeoutDuration(base::Milliseconds(timeout_ms_)); -- simple_url_loader_->SetAllowHttpErrorResults(true); -- network::SimpleURLLoader::BodyAsStringCallback body_as_string_callback = -+ -+ LOG(INFO) << "performing " << http_method_ << " request to " << url_; -+ if (base::EqualsCaseInsensitiveASCII(http_method_, "HEAD")) { -+ endpoint_fetcher_callback_ = std::move(endpoint_fetcher_callback); -+ -+ simple_url_loader_->DownloadHeadersOnly( -+ url_loader_factory_.get(), -+ base::BindOnce(&EndpointFetcher::OnURLLoadComplete, -+ base::Unretained(this))); -+ } else { -+ network::SimpleURLLoader::BodyAsStringCallback body_as_string_callback = - base::BindOnce(&EndpointFetcher::OnResponseFetched, - weak_ptr_factory_.GetWeakPtr(), - std::move(endpoint_fetcher_callback)); -- simple_url_loader_->DownloadToString( -- url_loader_factory_.get(), std::move(body_as_string_callback), -- network::SimpleURLLoader::kMaxBoundedStringDownloadSize); -+ simple_url_loader_->DownloadToString( -+ url_loader_factory_.get(), std::move(body_as_string_callback), -+ network::SimpleURLLoader::kMaxBoundedStringDownloadSize); -+ } - } - - void EndpointFetcher::OnResponseFetched( -@@ -336,3 +392,38 @@ void EndpointFetcher::OnSanitizationResult( - std::string EndpointFetcher::GetUrlForTesting() { - return url_.spec(); - } -+ -+void EndpointFetcher::OnSimpleLoaderRedirect( -+ const GURL& url_before_redirect, -+ const net::RedirectInfo& redirect_info, -+ const network::mojom::URLResponseHead& response_head, -+ std::vector* removed_headers) { -+ url_ = redirect_info.new_url; -+ if (response_->redirect_url.empty()) { -+ response_->redirect_url = url_.spec(); -+ response_->response = std::to_string(redirect_info.status_code); -+ } else { -+ LOG(INFO) << "BromiteUpdater: redirect URL is not empty, status code is " << redirect_info.status_code; -+ } -+ -+ std::move(endpoint_fetcher_callback_).Run(std::move(response_)); -+} -+ -+void EndpointFetcher::OnURLLoadComplete( -+ scoped_refptr headers) { -+ if (!endpoint_fetcher_callback_) -+ return; -+ -+ if (headers) { -+ if (response_->redirect_url.empty()) { -+ std::string location; -+ if (simple_url_loader_->ResponseInfo()->headers->IsRedirect(&location)) { -+ response_->redirect_url = location; -+ } -+ } -+ } -+ -+ std::string net_error = net::ErrorToString(simple_url_loader_->NetError()); -+ response_->response = net_error; -+ std::move(endpoint_fetcher_callback_).Run(std::move(response_)); -+} -diff --git a/components/endpoint_fetcher/endpoint_fetcher.h b/components/endpoint_fetcher/endpoint_fetcher.h -index 1b31130514f6b..2e5738e03d6a4 100644 ---- a/components/endpoint_fetcher/endpoint_fetcher.h -+++ b/components/endpoint_fetcher/endpoint_fetcher.h -@@ -17,6 +17,8 @@ - #include "net/traffic_annotation/network_traffic_annotation.h" - #include "services/data_decoder/public/cpp/json_sanitizer.h" - #include "third_party/abseil-cpp/absl/types/optional.h" -+#include "services/network/public/cpp/resource_request.h" -+#include "services/network/public/mojom/url_response_head.mojom.h" - - namespace network { - struct ResourceRequest; -@@ -39,6 +41,8 @@ enum class FetchErrorType { - - struct EndpointResponse { - std::string response; -+ long last_modified; -+ std::string redirect_url; - int http_status_code{-1}; - absl::optional error_type; - }; -@@ -92,6 +96,14 @@ class EndpointFetcher { - const GURL& url, - const net::NetworkTrafficAnnotationTag& annotation_tag); - -+ // Constructor if no authentication is needed, with timeout -+ EndpointFetcher(const scoped_refptr& url_loader_factory, -+ const GURL& url, -+ const std::string& http_method, -+ int64_t timeout_ms, -+ const bool intercept_redirect, -+ const net::NetworkTrafficAnnotationTag& annotation_tag); -+ - // Used for tests. Can be used if caller constructs their own - // url_loader_factory and identity_manager. - EndpointFetcher( -@@ -147,6 +159,11 @@ class EndpointFetcher { - void OnSanitizationResult(std::unique_ptr response, - EndpointFetcherCallback endpoint_fetcher_callback, - data_decoder::JsonSanitizer::Result result); -+ void OnURLLoadComplete(scoped_refptr headers); -+ void OnSimpleLoaderRedirect(const GURL& url_before_redirect, -+ const net::RedirectInfo& redirect_info, -+ const network::mojom::URLResponseHead& response_head, -+ std::vector* removed_headers); - - enum AuthType { CHROME_API_KEY, OAUTH, NO_AUTH }; - AuthType auth_type_; -@@ -154,10 +171,11 @@ class EndpointFetcher { - // Members set in constructor to be passed to network::ResourceRequest or - // network::SimpleURLLoader. - const std::string oauth_consumer_name_; -- const GURL url_; -+ GURL url_; - const std::string http_method_; - const std::string content_type_; - int64_t timeout_ms_; -+ const bool intercept_redirect_; - const std::string post_data_; - const std::vector headers_; - const std::vector cors_exempt_headers_; -@@ -181,6 +199,9 @@ class EndpointFetcher { - access_token_fetcher_; - std::unique_ptr simple_url_loader_; - -+ EndpointFetcherCallback endpoint_fetcher_callback_; -+ std::unique_ptr response_; -+ - base::WeakPtrFactory weak_ptr_factory_{this}; - }; - --- -2.34.1 - diff --git a/build/bromite_patches/Bromite-package-name.patch b/build/bromite_patches/Bromite-package-name.patch index 06de7bd07c08249811101aa836689c56e9998a3f..0c339f28b6dc662dc8e35b165538f9c6ce3a6e8a 100644 --- a/build/bromite_patches/Bromite-package-name.patch +++ b/build/bromite_patches/Bromite-package-name.patch @@ -1,7 +1,6 @@ -From 393b0ea90845d4f46fb38b6c148ae1ebd3cd3b38 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sat, 8 Jan 2022 19:42:34 +0100 -Subject: [PATCH 023/192] Bromite package name +Subject: Bromite package name License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html --- @@ -9,10 +8,9 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chrome/android/chrome_public_apk_tmpl.gni b/chrome/android/chrome_public_apk_tmpl.gni -index 7d37081a3f317..8a9c993297776 100644 --- a/chrome/android/chrome_public_apk_tmpl.gni +++ b/chrome/android/chrome_public_apk_tmpl.gni -@@ -27,7 +27,7 @@ declare_args() { +@@ -26,7 +26,7 @@ declare_args() { # WebView providers which declare one of a handful of package names. See # https://chromium.googlesource.com/chromium/src/+/HEAD/android_webview/docs/build-instructions.md#Changing-package-name # for details. @@ -21,6 +19,5 @@ index 7d37081a3f317..8a9c993297776 100644 if (use_stable_package_name_for_trichrome) { chrome_public_manifest_package += ".stable" } else if (android_channel != "default" && android_channel != "stable") { --- -2.34.1 - +-- +2.25.1 diff --git a/build/bromite_patches/Bromite-subresource-adblocker.patch b/build/bromite_patches/Bromite-subresource-adblocker.patch index ea852c6198e4416d858dc3a58fcfe5045357ca18..b503443dd15f05f461c8d3c8c101f0290d606a3e 100644 --- a/build/bromite_patches/Bromite-subresource-adblocker.patch +++ b/build/bromite_patches/Bromite-subresource-adblocker.patch @@ -1,7 +1,6 @@ -From 2daee8165ff498b1ae5cc4a43e46e6d206a6fa82 Mon Sep 17 00:00:00 2001 From: csagan5 <32685696+csagan5@users.noreply.github.com> Date: Sat, 14 Sep 2019 10:20:08 +0200 -Subject: [PATCH] Bromite subresource adblocker +Subject: Bromite subresource adblocker Add option to configure the ad blocker filters URL Disable look-alike, metrics, ablation and navigation throttles @@ -30,8 +29,9 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html 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 + + 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 + @@ -51,22 +51,24 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../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 +- - 39 files changed, 1188 insertions(+), 135 deletions(-) + .../Bromite-subresource-adblocker.inc | 3 + + 40 files changed, 1208 insertions(+), 129 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 + create mode 100644 cromite_flags/third_party/blink/common/features_cc/Bromite-subresource-adblocker.inc diff --git a/chrome/android/BUILD.gn b/chrome/android/BUILD.gn -index d33a3a3d25d8b..9e5ef08571855 100644 --- a/chrome/android/BUILD.gn +++ b/chrome/android/BUILD.gn -@@ -293,6 +293,7 @@ if (current_toolchain == default_toolchain) { +@@ -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", @@ -75,10 +77,9 @@ index d33a3a3d25d8b..9e5ef08571855 100644 "//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 -index 25dd9bddf366d..e47f8cb9f6ff6 100644 --- a/chrome/android/chrome_java_resources.gni +++ b/chrome/android/chrome_java_resources.gni -@@ -460,6 +460,7 @@ chrome_java_resources = [ +@@ -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", @@ -86,7 +87,7 @@ index 25dd9bddf366d..e47f8cb9f6ff6 100644 "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", -@@ -656,6 +657,7 @@ chrome_java_resources = [ +@@ -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", @@ -95,10 +96,9 @@ index 25dd9bddf366d..e47f8cb9f6ff6 100644 "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 -index c7972b041e693..4f5cf7b9337c0 100644 --- a/chrome/android/chrome_java_sources.gni +++ b/chrome/android/chrome_java_sources.gni -@@ -946,6 +946,8 @@ chrome_java_sources = [ +@@ -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", @@ -106,10 +106,9 @@ index c7972b041e693..4f5cf7b9337c0 100644 + "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", + "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 -index 0000000000000..aced0dbca5a2b --- /dev/null +++ b/chrome/android/java/res/layout/adblock_editor.xml @@ -0,0 +1,67 @@ @@ -181,7 +180,6 @@ index 0000000000000..aced0dbca5a2b + + diff --git a/chrome/android/java/res/values/styles.xml b/chrome/android/java/res/values/styles.xml -index d130751c57765..d189cd1fcfba5 100644 --- 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. @@ -210,7 +208,6 @@ index d130751c57765..d189cd1fcfba5 100644 -- -diff --git a/chrome/browser/resources/downloads/icons.html b/chrome/browser/resources/downloads/icons.html -index 5315618cea58c..584e51cf493c1 100644 ---- a/chrome/browser/resources/downloads/icons.html -+++ b/chrome/browser/resources/downloads/icons.html -@@ -3,7 +3,7 @@ - - - - -diff --git a/chrome/browser/resources/gaia_auth_host/authenticator.js b/chrome/browser/resources/gaia_auth_host/authenticator.js -index 9e241bd997d9a..7200af4193781 100644 ---- a/chrome/browser/resources/gaia_auth_host/authenticator.js -+++ b/chrome/browser/resources/gaia_auth_host/authenticator.js -@@ -768,7 +768,7 @@ export class Authenticator extends EventTarget { - url = appendParam( - url, 'continue', - data.gaiaUrl + 'programmatic_auth_chromeos?hl=' + data.hl + -- '&scope=https%3A%2F%2Fwww.google.com%2Faccounts%2FOAuthLogin&' + -+ '&scope=https%3A%2F%2Fwww.9oo91e.qjz9zk%2Faccounts%2FOAuthLogin&' + - 'client_id=' + encodeURIComponent(data.clientId) + - '&access_type=offline'); - -diff --git a/chrome/browser/resources/gaia_auth_host/saml_password_attributes.js b/chrome/browser/resources/gaia_auth_host/saml_password_attributes.js -index 59811ef53aa4a..ea9bacc1baf23 100644 ---- a/chrome/browser/resources/gaia_auth_host/saml_password_attributes.js -+++ b/chrome/browser/resources/gaia_auth_host/saml_password_attributes.js -@@ -17,7 +17,7 @@ import {decodeTimestamp} from './saml_timestamps.js'; - const MAX_SANE_XML_LENGTH = 50 * 1024; // 50 KB - - /** @const @private {string} Schema name prefix. */ -- const SCHEMA_NAME_PREFIX = 'http://schemas.google.com/saml/2019/'; -+ const SCHEMA_NAME_PREFIX = 'http://schemas.9oo91e.qjz9zk/saml/2019/'; - - /** @const @private {string} Schema name for password modified timestamp. */ - const PASSWORD_MODIFIED_TIMESTAMP = 'passwordmodifiedtimestamp'; -diff --git a/chrome/browser/resources/hangout_services/manifest.json b/chrome/browser/resources/hangout_services/manifest.json -index 788275469b586..bceaaae958834 100644 ---- a/chrome/browser/resources/hangout_services/manifest.json -+++ b/chrome/browser/resources/hangout_services/manifest.json -@@ -9,7 +9,7 @@ - "manifest_version": 2, - "externally_connectable": { - "matches": [ -- "https://*.google.com/*" -+ "https://*.9oo91e.qjz9zk/*" - ] - }, - "background": { -diff --git a/chrome/browser/resources/inspect/inspect.html b/chrome/browser/resources/inspect/inspect.html -index a1a0f3e4b826f..f8ba1cb5eb674 100644 ---- a/chrome/browser/resources/inspect/inspect.html -+++ b/chrome/browser/resources/inspect/inspect.html -@@ -46,7 +46,7 @@ found in the LICENSE file. - -

- -@@ -102,7 +102,7 @@ found in the LICENSE file. -
- Define the listening port on your device that maps to a port accessible - from your development machine. -- Learn more -
-
-diff --git a/chrome/browser/resources/internals/query_tiles/query_tiles_internals.html b/chrome/browser/resources/internals/query_tiles/query_tiles_internals.html -index 948d73cd807ac..4eb7f3d5f0fa6 100644 ---- a/chrome/browser/resources/internals/query_tiles/query_tiles_internals.html -+++ b/chrome/browser/resources/internals/query_tiles/query_tiles_internals.html -@@ -24,7 +24,7 @@ -

Server address

-
- -- -+ - - - -diff --git a/chrome/browser/resources/media/mei_preload/manifest.json b/chrome/browser/resources/media/mei_preload/manifest.json -index 1b4fa8a1e63eb..549b53788a027 100644 ---- a/chrome/browser/resources/media/mei_preload/manifest.json -+++ b/chrome/browser/resources/media/mei_preload/manifest.json -@@ -3,6 +3,6 @@ - "icons": {}, - "version": "1.0.7.1652906823", - "manifest_version": 2, -- "update_url": "https://clients2.google.com/service/update2/crx", -+ "update_url": "https://clients2.9oo91e.qjz9zk/service/update2/crx", - "description": "Contains preloaded data for Media Engagement" - } -diff --git a/chrome/browser/resources/nearby_share/shared/nearby_shared_icons.html b/chrome/browser/resources/nearby_share/shared/nearby_shared_icons.html -index 4f5d7a7c0cb7f..b7d113ebba365 100644 ---- a/chrome/browser/resources/nearby_share/shared/nearby_shared_icons.html -+++ b/chrome/browser/resources/nearby_share/shared/nearby_shared_icons.html -@@ -2,7 +2,7 @@ - - - - - -@@ -47,7 +47,7 @@ - - - - -diff --git a/chrome/browser/resources/nearby_share/shared/nearby_shared_share_type_icons.html b/chrome/browser/resources/nearby_share/shared/nearby_shared_share_type_icons.html -index 97fbfd0d2d2a8..0e9a2967b8ece 100644 ---- a/chrome/browser/resources/nearby_share/shared/nearby_shared_share_type_icons.html -+++ b/chrome/browser/resources/nearby_share/shared/nearby_shared_share_type_icons.html -@@ -2,7 +2,7 @@ - - - - - -diff --git a/chrome/browser/resources/net_internals/index.html b/chrome/browser/resources/net_internals/index.html -index 1fb63739664d9..51425cea9a76d 100644 ---- a/chrome/browser/resources/net_internals/index.html -+++ b/chrome/browser/resources/net_internals/index.html -@@ -21,7 +21,7 @@ found in the LICENSE file. -
-
- The net-internals events viewer and related functionality has been removed. -- Please use chrome://net-export to save netlogs and the external netlog_viewer to view them. -+ Please use chrome://net-export to save netlogs and the external netlog_viewer to view them. -
- -
-@@ -73,8 +73,8 @@ found in the LICENSE file. -
- HSTS is HTTP Strict Transport Security: a way for sites to elect to - always use HTTPS. See -- -- https://www.chromium.org/hsts. PKP is Public Key Pinning: Chrome -+ -+ https://www.ch40m1um.qjz9zk/hsts. PKP is Public Key Pinning: Chrome - "pins" certain public keys for certain sites in official builds.
- -

Add HSTS domain

-diff --git a/chrome/browser/resources/network_speech_synthesis/manifest.json b/chrome/browser/resources/network_speech_synthesis/manifest.json -index e4835edb53168..835db49f4f262 100644 ---- a/chrome/browser/resources/network_speech_synthesis/manifest.json -+++ b/chrome/browser/resources/network_speech_synthesis/manifest.json -@@ -10,7 +10,7 @@ - "permissions": [ - "systemPrivate", - "ttsEngine", -- "https://www.google.com/" -+ "https://www.9oo91e.qjz9zk/" - ], - "tts_engine": { - "voices": [ -diff --git a/chrome/browser/resources/network_speech_synthesis/tts_extension.js b/chrome/browser/resources/network_speech_synthesis/tts_extension.js -index 813e6afb81420..ffc1608591533 100644 ---- a/chrome/browser/resources/network_speech_synthesis/tts_extension.js -+++ b/chrome/browser/resources/network_speech_synthesis/tts_extension.js -@@ -30,7 +30,7 @@ TtsExtension.prototype = { - * @const - * @private - */ -- SPEECH_SERVER_URL_: 'https://www.google.com/speech-api/v2/synthesize?' + -+ SPEECH_SERVER_URL_: 'https://www.9oo91e.qjz9zk/speech-api/v2/synthesize?' + - 'enc=mpeg&client=chromium', - - /** -diff --git a/chrome/browser/resources/new_tab_page/modules/photos/module.html b/chrome/browser/resources/new_tab_page/modules/photos/module.html -index bee0651bf7f4f..b2f3d9db15003 100644 ---- a/chrome/browser/resources/new_tab_page/modules/photos/module.html -+++ b/chrome/browser/resources/new_tab_page/modules/photos/module.html -@@ -569,7 +569,7 @@ - - -