From ab5e89c1049f231fef8f38fa480c3a05c41819e5 Mon Sep 17 00:00:00 2001 From: Carmelo Messina Date: Tue, 20 Jun 2023 12:33:44 +0200 Subject: [PATCH] final version --- build/bromite_patches_list.txt | 30 +- ...isable-speechSynthesis-getVoices-API.patch | 21 +- ....patch => Add-autoplay-site-setting.patch} | 23 +- .../Content-settings-infrastructure.patch | 186 +++++- build/patches/JIT-site-settings.patch | 49 +- ...tings-for-cookies-javascript-and-ads.patch | 8 +- build/patches/Site-setting-for-images.patch | 49 +- build/patches/Timezone-customization.patch | 602 +++++------------- ...=> Viewport-Protection-Site-Setting.patch} | 3 +- ...g.patch => Viewport-Protection-flag.patch} | 0 ...-utils.patch => bromite-build-utils.patch} | 2 +- 11 files changed, 360 insertions(+), 613 deletions(-) rename build/patches/{Revert-the-removal-of-an-option-to-block-autoplay.patch => Add-autoplay-site-setting.patch} (93%) rename build/patches/{00Viewport-Protection-Site-Setting.patch => Viewport-Protection-Site-Setting.patch} (99%) rename build/patches/{00Viewport-Protection-flag.patch => Viewport-Protection-flag.patch} (100%) rename build/patches/{00bromite-build-utils.patch => bromite-build-utils.patch} (99%) diff --git a/build/bromite_patches_list.txt b/build/bromite_patches_list.txt index f30c26b2..f98057fc 100644 --- a/build/bromite_patches_list.txt +++ b/build/bromite_patches_list.txt @@ -11,14 +11,7 @@ Remove-binary-blob-integrations.patch Remove-SMS-integration.patch Remove-voice-recognition-integration.patch Do-not-compile-QR-code-sharing.patch -Timezone-customization.patch -Revert-the-removal-of-an-option-to-block-autoplay.patch Add-support-for-ISupportHelpAndFeedback.patch -JIT-site-settings.patch -Site-setting-for-images.patch -Content-settings-infrastructure.patch -Add-webGL-site-setting.patch -Add-webRTC-site-settings.patch Switch-to-fstack-protector-strong.patch Enable-fwrapv-in-Clang-for-non-UBSan-builds.patch Bromite-package-name.patch @@ -100,7 +93,6 @@ Reduce-HTTP-headers-in-DoH-requests-to-bare-minimum.patch Revert-flags-remove-disable-pull-to-refresh-effect.patch Use-dummy-DFM-installer.patch Disable-feeds-support-by-default.patch -Show-site-settings-for-cookies-javascript-and-ads.patch Disable-DRM-media-origin-IDs-preprovisioning.patch Disable-smart-selection-by-default.patch Guard-for-user-agent-reduction.patch @@ -214,12 +206,6 @@ eyeo-beta-114.0.5735.53-v1-extension_api.patch 00WIN-ADDTO-Add-flag-to-disable-external-intent-re.patch 00WIN-ADDTO-Restore-Search-Ready-Omnibox-flag.patch 00WIN-ADDTO-Disable-requests-for-single-word-Omni.patch -00WIN-ADDTO-Revert-the-removal-to-block-autoplay.patch -00WIN-ADDTO-JIT-site-settings.patch -00WIN-ADDTO-Timezone-customization.patch -00WIN-ADDTO-Add-webGL-site-setting.patch -00WIN-ADDTO-Add-webRTC-site-settings.patch -00WIN-ADDTO-Content-settings-infrastructure.patch 00WIN-ADDTO-Logcat-crash-reports-UI.patch 00WIN-ADDTO-Add-AllowUserCertificates-flag.patch 00WIN-enable-pdf-plugin.patch @@ -239,8 +225,6 @@ eyeo-beta-114.0.5735.53-v1-extension_api.patch AudioBuffer-AnalyserNode-fp-mitigations.patch 00Disable-Component-Updates.patch 00add-browser-policy.patch -00Viewport-Protection-flag.patch -00Viewport-Protection-Site-Setting.patch 00Always-open-browser-controls-in-new-tab.patch 00Partitioning-all-cookies-by-top-frame-domain.patch 00Disable-FedCm.patch @@ -266,7 +250,6 @@ AudioBuffer-AnalyserNode-fp-mitigations.patch 00Remove-auth-header-upon-cross-origin-redirect.patch 00Clear-CORS-Preflight-Cache-on-clearing-data.patch 00Multi-Screen-Window-Placement-API-fix.patch -00Disable-speechSynthesis-getVoices-API.patch 00Remove-https-connection-from-chrome-discards.patch 00Add-a-flag-to-disable-GamePad-API.patch 00Disable-WebGPU.patch @@ -284,3 +267,16 @@ AudioBuffer-AnalyserNode-fp-mitigations.patch 00TEMP-Enable-MojoDirectSharedMemoryAndroid.patch 00v113-temp-fix-build.patch 00114-temp-disable-find-bad-constructs-external-repo.patch + +bromite-build-utils.patch +Content-settings-infrastructure.patch +Add-autoplay-site-setting.patch +Site-setting-for-images.patch +JIT-site-settings.patch +Add-webGL-site-setting.patch +Add-webRTC-site-settings.patch +Show-site-settings-for-cookies-javascript-and-ads.patch +Viewport-Protection-flag.patch +Viewport-Protection-Site-Setting.patch +Timezone-customization.patch +00Disable-speechSynthesis-getVoices-API.patch \ No newline at end of file diff --git a/build/patches/00Disable-speechSynthesis-getVoices-API.patch b/build/patches/00Disable-speechSynthesis-getVoices-API.patch index deeb98d2..eaf0fb27 100644 --- a/build/patches/00Disable-speechSynthesis-getVoices-API.patch +++ b/build/patches/00Disable-speechSynthesis-getVoices-API.patch @@ -6,20 +6,21 @@ Adds flag disable-speechsynthesis-voice-list to disable SpeechSynthesis.getVoices() call. If not active the user must also set the system timezone override to enable it. +Require: Timezone-customization.patch --- chrome/browser/about_flags.cc | 5 +++++ - .../renderer/content_settings_agent_impl.cc | 11 ++++++++++- + .../renderer/content_settings_agent_impl.cc | 9 ++++++++- .../renderer/content_settings_agent_impl.h | 2 ++ third_party/blink/common/features.cc | 4 ++++ third_party/blink/public/common/features.h | 2 ++ .../platform/web_content_settings_client.h | 2 ++ .../renderer/modules/speech/speech_synthesis.cc | 17 ++++++++++++++--- - 7 files changed, 39 insertions(+), 4 deletions(-) + 7 files changed, 37 insertions(+), 4 deletions(-) diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc -@@ -7221,6 +7221,11 @@ const FeatureEntry kFeatureEntries[] = { +@@ -7217,6 +7217,11 @@ const FeatureEntry kFeatureEntries[] = { flag_descriptions::kFileHandlingIconsDescription, kOsDesktop, FEATURE_VALUE_TYPE(blink::features::kFileHandlingIcons)}, @@ -34,24 +35,22 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc diff --git a/components/content_settings/renderer/content_settings_agent_impl.cc b/components/content_settings/renderer/content_settings_agent_impl.cc --- a/components/content_settings/renderer/content_settings_agent_impl.cc +++ b/components/content_settings/renderer/content_settings_agent_impl.cc -@@ -501,6 +501,16 @@ bool ContentSettingsAgentImpl::IsAllowlistedForContentSettings() const { +@@ -496,6 +496,14 @@ bool ContentSettingsAgentImpl::IsAllowlistedForContentSettings() const { return false; } +bool ContentSettingsAgentImpl::IsTimezoneChanged() { + if (!content_setting_rules_) + return false; -+ blink::WebLocalFrame* frame = render_frame()->GetWebFrame(); + // CONTENT_SETTING_ALLOW = use system time -+ return CONTENT_SETTING_ALLOW != GetContentSettingFromRules( -+ content_setting_rules_->timezone_override_rules, -+ url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL()); ++ return CONTENT_SETTING_ALLOW != GetContentSetting( ++ ContentSettingsType::TIMEZONE_OVERRIDE, CONTENT_SETTING_ALLOW); +} + bool ContentSettingsAgentImpl::UpdateOverrides() { // Evaluate the content setting rules ContentSetting setting = CONTENT_SETTING_ALLOW; -@@ -514,7 +524,6 @@ bool ContentSettingsAgentImpl::UpdateOverrides() { +@@ -506,7 +514,6 @@ bool ContentSettingsAgentImpl::UpdateOverrides() { } return UpdateTimeZoneOverride( setting, content_setting_rules_->timezone_override_value); @@ -62,7 +61,7 @@ diff --git a/components/content_settings/renderer/content_settings_agent_impl.cc diff --git a/components/content_settings/renderer/content_settings_agent_impl.h b/components/content_settings/renderer/content_settings_agent_impl.h --- a/components/content_settings/renderer/content_settings_agent_impl.h +++ b/components/content_settings/renderer/content_settings_agent_impl.h -@@ -116,6 +116,8 @@ class ContentSettingsAgentImpl +@@ -117,6 +117,8 @@ class ContentSettingsAgentImpl void SetRendererContentSettingRulesForTest( const RendererContentSettingRules& rules); @@ -100,7 +99,7 @@ diff --git a/third_party/blink/public/common/features.h b/third_party/blink/publ diff --git a/third_party/blink/public/platform/web_content_settings_client.h b/third_party/blink/public/platform/web_content_settings_client.h --- a/third_party/blink/public/platform/web_content_settings_client.h +++ b/third_party/blink/public/platform/web_content_settings_client.h -@@ -123,6 +123,8 @@ class WebContentSettingsClient { +@@ -119,6 +119,8 @@ class WebContentSettingsClient { // frame. virtual bool ShouldAutoupgradeMixedContent() { return true; } diff --git a/build/patches/Revert-the-removal-of-an-option-to-block-autoplay.patch b/build/patches/Add-autoplay-site-setting.patch similarity index 93% rename from build/patches/Revert-the-removal-of-an-option-to-block-autoplay.patch rename to build/patches/Add-autoplay-site-setting.patch index 46dc7fa1..a1ad7c95 100644 --- a/build/patches/Revert-the-removal-of-an-option-to-block-autoplay.patch +++ b/build/patches/Add-autoplay-site-setting.patch @@ -1,11 +1,11 @@ From: uazo Date: Sat, 7 Nov 2020 21:59:18 +0000 -Subject: Revert the removal of an option to block autoplay +Subject: Add autoplay site setting 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 +Require: Content-settings-infrastructure.patch --- - .../browser_ui/site_settings/android/BUILD.gn | 5 + .../res/drawable-hdpi/settings_autoplay.png | Bin 0 -> 456 bytes .../res/drawable-mdpi/settings_autoplay.png | Bin 0 -> 296 bytes .../res/drawable-xhdpi/settings_autoplay.png | Bin 0 -> 551 bytes @@ -17,7 +17,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../core/browser/content_settings_registry.cc | 2 +- .../core/html/media/autoplay_policy.cc | 14 +++ .../core/html/media/autoplay_policy.h | 4 + - 12 files changed, 150 insertions(+), 1 deletion(-) + 11 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-hdpi/settings_autoplay.png create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-mdpi/settings_autoplay.png create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-xhdpi/settings_autoplay.png @@ -27,21 +27,6 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html create mode 100644 components/browser_ui/strings/bromite_content_settings/autoplay.grdp create mode 100644 components/content_settings/core/browser/bromite_content_settings/autoplay.inc -diff --git a/components/browser_ui/site_settings/android/BUILD.gn b/components/browser_ui/site_settings/android/BUILD.gn ---- a/components/browser_ui/site_settings/android/BUILD.gn -+++ b/components/browser_ui/site_settings/android/BUILD.gn -@@ -208,6 +208,11 @@ android_resources("java_resources") { - "java/res/drawable-mdpi/ic_volume_up_grey600_24dp.png", - "java/res/drawable-mdpi/permission_background_sync.png", - "java/res/drawable-mdpi/permission_javascript.png", -+ "java/res/drawable-hdpi/settings_autoplay.png", -+ "java/res/drawable-xhdpi/settings_autoplay.png", -+ "java/res/drawable-xxhdpi/settings_autoplay.png", -+ "java/res/drawable-mdpi/settings_autoplay.png", -+ "java/res/drawable-xxxhdpi/settings_autoplay.png", - "java/res/drawable-mdpi/permission_popups.png", - "java/res/drawable-mdpi/permission_protected_media.png", - "java/res/drawable-mdpi/settings_sensors.png", diff --git a/components/browser_ui/site_settings/android/java/res/drawable-hdpi/settings_autoplay.png b/components/browser_ui/site_settings/android/java/res/drawable-hdpi/settings_autoplay.png new file mode 100644 index 0000000000000000000000000000000000000000..a8a9265f14cd8445ad1f55845099e60dc3c4edf1 @@ -202,7 +187,7 @@ new file mode 100644 + @Override + public ContentSettingsResources.ResourceItem getResourceItem() { + return new ContentSettingsResources.ResourceItem( -+ /*icon*/ R.drawable.web_asset, ++ /*icon*/ R.drawable.settings_autoplay, + /*title*/ R.string.autoplay_permission_title, + /*defaultEnabledValue*/ getDefaultEnabledValue(), + /*defaultDisabledValue*/ getDefaultDisabledValue(), diff --git a/build/patches/Content-settings-infrastructure.patch b/build/patches/Content-settings-infrastructure.patch index 1d6341e5..546d843d 100644 --- a/build/patches/Content-settings-infrastructure.patch +++ b/build/patches/Content-settings-infrastructure.patch @@ -9,7 +9,9 @@ See BromiteCustomContentSetting_README.md for more information. 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 +Require: bromite-build-utils.patch --- + .../ChromeSiteSettingsDelegate.java | 15 + .../installable/installed_webapp_bridge.cc | 2 +- .../settings/privacy_page/privacy_page.html | 1 + .../settings/privacy_page/privacy_page.ts | 44 ++- @@ -24,15 +26,16 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../views/page_info/page_info_view_factory.cc | 13 + .../settings_localized_strings_provider.cc | 39 +++ .../ui/webui/settings/site_settings_helper.cc | 33 +- - .../browser_ui/site_settings/android/BUILD.gn | 14 + - .../BromiteCustomContentSetting.java | 128 ++++++++ - .../BromiteCustomContentSettingImpl.java | 284 ++++++++++++++++++ - .../BromiteCustomContentSetting_README.md | 151 ++++++++++ + .../browser_ui/site_settings/android/BUILD.gn | 15 + + .../BromiteCustomContentSetting.java | 139 ++++++++ + .../BromiteCustomContentSettingImpl.java | 307 ++++++++++++++++++ + .../BromiteCustomContentSetting_README.md | 151 +++++++++ .../ContentSettingsResources.java | 14 +- - .../site_settings/SingleCategorySettings.java | 33 +- + .../site_settings/SingleCategorySettings.java | 42 ++- .../site_settings/SingleWebsiteSettings.java | 26 +- - .../site_settings/SiteSettings.java | 7 +- + .../site_settings/SiteSettings.java | 14 +- .../site_settings/SiteSettingsCategory.java | 18 +- + .../site_settings/SiteSettingsDelegate.java | 2 + .../TriStateSiteSettingsPreference.java | 13 +- .../browser_ui/site_settings/Website.java | 6 + .../WebsitePermissionsFetcher.java | 4 +- @@ -44,7 +47,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../bromite_content_settings/placeholder.txt | 1 + .../core/browser/content_settings_registry.cc | 3 + .../core/browser/content_settings_utils.cc | 12 + - .../core/browser/website_settings_info.h | 35 +++ + .../core/browser/website_settings_info.h | 35 ++ .../core/browser/website_settings_registry.cc | 6 + .../core/browser/website_settings_registry.h | 1 + .../content_settings/core/common/BUILD.gn | 6 + @@ -60,14 +63,15 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../renderer/content_settings_agent_impl.h | 5 + .../PageInfoPermissionsController.java | 9 + .../PermissionParamsListBuilder.java | 1 + - .../android/page_info_controller_android.cc | 18 ++ + .../android/page_info_controller_android.cc | 18 + components/page_info/page_info.cc | 22 +- - components/page_info/page_info_ui.cc | 18 ++ + components/page_info/page_info_ui.cc | 18 + components/site_settings_strings.grdp | 1 + .../platform/web_content_settings_client.h | 5 + .../execution_context/execution_context.cc | 16 + .../execution_context/execution_context.h | 5 + - 57 files changed, 1252 insertions(+), 38 deletions(-) + .../WebLayerSiteSettingsDelegate.java | 3 + + 60 files changed, 1320 insertions(+), 41 deletions(-) create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSetting.java create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSetting_README.md @@ -77,6 +81,38 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html create mode 100644 components/content_settings/core/browser/bromite_content_settings/placeholder.txt create mode 100644 components/content_settings/core/common/bromite_content_settings/placeholder.txt +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java +@@ -46,6 +46,10 @@ import org.chromium.url.GURL; + + import java.util.Set; + ++import android.content.Intent; ++import android.provider.Browser; ++import android.net.Uri; ++ + /** + * A SiteSettingsDelegate instance that contains Chrome-specific Site Settings logic. + */ +@@ -267,6 +271,17 @@ public class ChromeSiteSettingsDelegate implements SiteSettingsDelegate { + return PrivacySandboxBridge.getFirstPartySetOwner(memberOrigin); + } + ++ @Override ++ public void launchHelpAndFeedbackActivity(Activity currentActivity, String url) { ++ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); ++ // Let Chromium know that this intent is from Chromium, so that it does not close the app when ++ // the user presses 'back' button. ++ intent.putExtra(Browser.EXTRA_APPLICATION_ID, currentActivity.getPackageName()); ++ intent.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true); ++ intent.setPackage(currentActivity.getPackageName()); ++ currentActivity.startActivity(intent); ++ } ++ + @Override + public boolean canLaunchClearBrowsingDataDialog() { + return true; diff --git a/chrome/browser/installable/installed_webapp_bridge.cc b/chrome/browser/installable/installed_webapp_bridge.cc --- a/chrome/browser/installable/installed_webapp_bridge.cc +++ b/chrome/browser/installable/installed_webapp_bridge.cc @@ -579,11 +615,19 @@ diff --git a/components/browser_ui/site_settings/android/BUILD.gn b/components/b } android_library("javatests") { +@@ -182,6 +196,7 @@ robolectric_library("junit") { + } + + android_resources("java_resources") { ++ allow_missing_resources = true + sources = [ + "java/res/drawable-hdpi/ic_volume_up_grey600_24dp.png", + "java/res/drawable-hdpi/permission_background_sync.png", diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSetting.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSetting.java new file mode 100644 --- /dev/null +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSetting.java -@@ -0,0 +1,128 @@ +@@ -0,0 +1,139 @@ +/* + This file is part of Bromite. + @@ -696,6 +740,17 @@ new file mode 100644 + return null; + } + ++ public void configureGlobalToggles(SiteSettingsCategory category, SingleCategorySettings setting) { ++ } ++ ++ public boolean isHelpAndFeedbackEnabled() { ++ return false; ++ } ++ ++ public String getHelpAndFeedbackActivityUrl() { ++ return ""; ++ } ++ + public boolean requiresTriStateContentSetting() { + return false; + } @@ -716,7 +771,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c new file mode 100644 --- /dev/null +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java -@@ -0,0 +1,284 @@ +@@ -0,0 +1,307 @@ +/* + This file is part of Bromite. + @@ -938,7 +993,30 @@ new file mode 100644 + public static void onActivityCreated(SingleCategorySettings singleCategorySettings) { + } + -+ public static void configureGlobalToggles(SiteSettingsCategory category, PreferenceScreen preferences) { ++ public static void configureGlobalToggles(SiteSettingsCategory category, SingleCategorySettings setting) { ++ for (BromiteCustomContentSetting cs : mItemList) { ++ if (category.getType() == cs.getSiteSettingsCategory()) { ++ cs.configureGlobalToggles(category, setting); ++ } ++ } ++ } ++ ++ public static boolean isHelpAndFeedbackEnabled(SiteSettingsCategory category) { ++ for (BromiteCustomContentSetting cs : mItemList) { ++ if (category.getType() == cs.getSiteSettingsCategory()) { ++ return cs.isHelpAndFeedbackEnabled(); ++ } ++ } ++ return false; ++ } ++ ++ public static String getHelpAndFeedbackActivityUrl(SiteSettingsCategory category) { ++ for (BromiteCustomContentSetting cs : mItemList) { ++ if (category.getType() == cs.getSiteSettingsCategory()) { ++ return cs.getHelpAndFeedbackActivityUrl(); ++ } ++ } ++ return ""; + } + + public static ContentSettingException createCustomException(@ContentSettingsType int type, @@ -1231,7 +1309,29 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c configureGlobalToggles(); if (mCategory.getType() == SiteSettingsCategory.Type.REQUEST_DESKTOP_SITE) { RecordUserAction.record("DesktopSiteContentSetting.SettingsPage.Entered"); -@@ -571,6 +576,11 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment +@@ -487,7 +492,7 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment + if (queryHasChanged) getInfoForOrigins(); + }); + +- if (getSiteSettingsDelegate().isHelpAndFeedbackEnabled()) { ++ if (getSiteSettingsDelegate().isHelpAndFeedbackEnabled() && BromiteCustomContentSettingImpl.isHelpAndFeedbackEnabled(mCategory)) { + MenuItem help = menu.add( + Menu.NONE, R.id.menu_id_site_settings_help, Menu.NONE, R.string.menu_help); + help.setIcon(TraceEventVectorDrawableCompat.create( +@@ -498,6 +503,12 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment + @Override + public boolean onOptionsItemSelected(MenuItem item) { + if (item.getItemId() == R.id.menu_id_site_settings_help) { ++ String url = BromiteCustomContentSettingImpl.getHelpAndFeedbackActivityUrl(mCategory); ++ if (!url.equals("")) { ++ getSiteSettingsDelegate() ++ .launchHelpAndFeedbackActivity(getActivity(), url); ++ return true; ++ } + if (mCategory.getType() == SiteSettingsCategory.Type.PROTECTED_MEDIA) { + getSiteSettingsDelegate().launchProtectedContentHelpAndFeedbackActivity( + getActivity()); +@@ -571,6 +582,11 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment BrowserContextHandle browserContextHandle = getSiteSettingsDelegate().getBrowserContextHandle(); PrefService prefService = UserPrefs.get(browserContextHandle); @@ -1243,7 +1343,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c if (BINARY_TOGGLE_KEY.equals(preference.getKey())) { assert !mCategory.isManaged(); boolean toggleValue = (boolean) newValue; -@@ -787,6 +797,8 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment +@@ -787,6 +803,8 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment : R.string.website_settings_allowed_group_heading_request_desktop_site; break; } @@ -1252,7 +1352,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c assert resource > 0; return getString(resource); } -@@ -908,6 +920,8 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment +@@ -908,6 +926,8 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment default: break; } @@ -1261,16 +1361,17 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c if (allowSpecifyingExceptions) { getPreferenceScreen().addPreference(new AddExceptionPreference(getStyledContext(), ADD_EXCEPTION_KEY, getAddExceptionDialogMessage(), mCategory, this)); -@@ -1081,6 +1095,8 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment +@@ -1081,6 +1101,9 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment case GlobalToggleLayout.TRI_STATE_TOGGLE: TriStateSiteSettingsPreference triStateToggle = getPreferenceScreen().findPreference(TRI_STATE_TOGGLE_KEY); ++ if (triStateToggle == null) return true; + Boolean blocked = BromiteCustomContentSettingImpl.considerException(mCategory, triStateToggle.getCheckedSetting()); + if (blocked != null) return (boolean)blocked; return (triStateToggle.getCheckedSetting() == ContentSettingValues.BLOCK); case GlobalToggleLayout.FOUR_STATE_COOKIE_TOGGLE: FourStateCookieSettingsPreference fourStateCookieToggle = -@@ -1158,7 +1174,11 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment +@@ -1158,7 +1181,11 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment } else if (mCategory.getType() == SiteSettingsCategory.Type.THIRD_PARTY_COOKIES) { infoText.setSummary(R.string.website_settings_third_party_cookies_page_description); } else { @@ -1283,15 +1384,15 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c } // Hide the anti-abuse text preferences, as needed. -@@ -1182,6 +1202,7 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment +@@ -1182,6 +1209,7 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment screen.removePreference(antiAbuseThingsToConsiderHeader); screen.removePreference(antiAbuseThingsToConsiderSectionOne); } -+ BromiteCustomContentSettingImpl.configureGlobalToggles(mCategory, screen); ++ BromiteCustomContentSettingImpl.configureGlobalToggles(mCategory, this); if (permissionBlockedByOs) { maybeShowOsWarning(screen); -@@ -1335,7 +1356,7 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment +@@ -1335,7 +1363,7 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment getSiteSettingsDelegate().getBrowserContextHandle(), contentType); int[] descriptionIds = ContentSettingsResources.getTriStateSettingDescriptionIDs(contentType); @@ -1300,7 +1401,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c } private void configureBinaryToggle(ChromeSwitchPreference binaryToggle, int contentType) { -@@ -1439,6 +1460,14 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment +@@ -1439,6 +1467,14 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment @ContentSettingValues Integer value = site.getContentSetting(browserContextHandle, contentSettingsType); @@ -1427,12 +1528,20 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c Preference p = findPreference(prefCategory); int contentType = SiteSettingsCategory.contentSettingsType(prefCategory); // p can be null if the Preference was removed in configurePreferences. -@@ -133,7 +134,7 @@ public class SiteSettings extends SiteSettingsPreferenceFragment - } else if (requiresTriStateSetting) { - p.setSummary(ContentSettingsResources.getCategorySummary(setting)); +@@ -130,10 +131,13 @@ public class SiteSettings extends SiteSettingsPreferenceFragment + p.setSummary(ContentSettingsResources.getDesktopSiteListSummary(checked)); + } else if (Type.AUTO_DARK_WEB_CONTENT == prefCategory) { + p.setSummary(ContentSettingsResources.getAutoDarkWebContentListSummary(checked)); +- } else if (requiresTriStateSetting) { +- p.setSummary(ContentSettingsResources.getCategorySummary(setting)); } else { - p.setSummary(ContentSettingsResources.getCategorySummary(contentType, checked)); -+ p.setSummary(ContentSettingsResources.getCategorySummary(contentType, checked)); // ++ int summary = ContentSettingsResources.getCategorySummary(contentType, setting); ++ if (summary != 0) { ++ p.setSummary(summary); ++ } else { ++ p.setSummary(ContentSettingsResources.getCategorySummary(contentType, checked)); ++ } } if (prefCategory != Type.THIRD_PARTY_COOKIES) { @@ -1508,6 +1617,18 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c } } +diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsDelegate.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsDelegate.java +--- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsDelegate.java ++++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsDelegate.java +@@ -163,6 +163,8 @@ public interface SiteSettingsDelegate { + */ + String getFirstPartySetOwner(String memberOrigin); + ++ void launchHelpAndFeedbackActivity(Activity currentActivity, String url); ++ + /** + * Returns whether the current implementation of the delegate is able to launch the Clear + * Browsing Data dialog in Settings. diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/TriStateSiteSettingsPreference.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/TriStateSiteSettingsPreference.java --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/TriStateSiteSettingsPreference.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/TriStateSiteSettingsPreference.java @@ -2354,5 +2475,18 @@ diff --git a/third_party/blink/renderer/core/execution_context/execution_context enum ReasonForCallingCanExecuteScripts { kAboutToExecuteScript, +diff --git a/weblayer/browser/java/org/chromium/weblayer_private/settings/WebLayerSiteSettingsDelegate.java b/weblayer/browser/java/org/chromium/weblayer_private/settings/WebLayerSiteSettingsDelegate.java +--- a/weblayer/browser/java/org/chromium/weblayer_private/settings/WebLayerSiteSettingsDelegate.java ++++ b/weblayer/browser/java/org/chromium/weblayer_private/settings/WebLayerSiteSettingsDelegate.java +@@ -155,6 +155,9 @@ public class WebLayerSiteSettingsDelegate + @Override + public void dismissPrivacySandboxSnackbar() {} + ++ @Override ++ public void launchHelpAndFeedbackActivity(Activity currentActivity, String url) {} ++ + @Override + public boolean isFirstPartySetsDataAccessEnabled() { + return false; -- 2.25.1 diff --git a/build/patches/JIT-site-settings.patch b/build/patches/JIT-site-settings.patch index 6fcead8f..8e96a667 100644 --- a/build/patches/JIT-site-settings.patch +++ b/build/patches/JIT-site-settings.patch @@ -11,8 +11,8 @@ Without those features, the RenderProcess would be shared between all eTLD+1. note: needs SitePerProcess and StrictOriginIsolation flags enabled License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html +Require: Content-settings-infrastructure.patch --- - .../browser_ui/site_settings/android/BUILD.gn | 5 + .../permission_javascript_jit.png | Bin 0 -> 433 bytes .../permission_javascript_jit.png | Bin 0 -> 377 bytes .../permission_javascript_jit.png | Bin 0 -> 518 bytes @@ -22,7 +22,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../javascript_jit.grdp | 21 ++++ .../javascript_jit.inc | 13 +++ .../core/browser/content_settings_registry.cc | 2 +- - 10 files changed, 132 insertions(+), 1 deletion(-) + 9 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-hdpi/permission_javascript_jit.png create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-mdpi/permission_javascript_jit.png create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-xhdpi/permission_javascript_jit.png @@ -32,49 +32,6 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html create mode 100644 components/browser_ui/strings/bromite_content_settings/javascript_jit.grdp create mode 100644 components/content_settings/core/browser/bromite_content_settings/javascript_jit.inc -diff --git a/components/browser_ui/site_settings/android/BUILD.gn b/components/browser_ui/site_settings/android/BUILD.gn ---- a/components/browser_ui/site_settings/android/BUILD.gn -+++ b/components/browser_ui/site_settings/android/BUILD.gn -@@ -202,6 +202,7 @@ android_resources("java_resources") { - "java/res/drawable-hdpi/permission_background_sync.png", - "java/res/drawable-hdpi/permission_images.png", - "java/res/drawable-hdpi/permission_javascript.png", -+ "java/res/drawable-hdpi/permission_javascript_jit.png", - "java/res/drawable-hdpi/permission_popups.png", - "java/res/drawable-hdpi/permission_protected_media.png", - "java/res/drawable-hdpi/settings_sensors.png", -@@ -210,6 +211,7 @@ android_resources("java_resources") { - "java/res/drawable-mdpi/permission_background_sync.png", - "java/res/drawable-mdpi/permission_images.png", - "java/res/drawable-mdpi/permission_javascript.png", -+ "java/res/drawable-mdpi/permission_javascript_jit.png", - "java/res/drawable-hdpi/settings_autoplay.png", - "java/res/drawable-xhdpi/settings_autoplay.png", - "java/res/drawable-xxhdpi/settings_autoplay.png", -@@ -223,6 +225,7 @@ android_resources("java_resources") { - "java/res/drawable-xhdpi/permission_background_sync.png", - "java/res/drawable-xhdpi/permission_images.png", - "java/res/drawable-xhdpi/permission_javascript.png", -+ "java/res/drawable-xhdpi/permission_javascript_jit.png", - "java/res/drawable-xhdpi/permission_popups.png", - "java/res/drawable-xhdpi/permission_protected_media.png", - "java/res/drawable-xhdpi/settings_sensors.png", -@@ -231,6 +234,7 @@ android_resources("java_resources") { - "java/res/drawable-xxhdpi/permission_background_sync.png", - "java/res/drawable-xxhdpi/permission_images.png", - "java/res/drawable-xxhdpi/permission_javascript.png", -+ "java/res/drawable-xxhdpi/permission_javascript_jit.png", - "java/res/drawable-xxhdpi/permission_popups.png", - "java/res/drawable-xxhdpi/permission_protected_media.png", - "java/res/drawable-xxhdpi/settings_sensors.png", -@@ -239,6 +243,7 @@ android_resources("java_resources") { - "java/res/drawable-xxxhdpi/permission_background_sync.png", - "java/res/drawable-xxxhdpi/permission_images.png", - "java/res/drawable-xxxhdpi/permission_javascript.png", -+ "java/res/drawable-xxxhdpi/permission_javascript_jit.png", - "java/res/drawable-xxxhdpi/permission_popups.png", - "java/res/drawable-xxxhdpi/permission_protected_media.png", - "java/res/drawable-xxxhdpi/settings_sensors.png", diff --git a/components/browser_ui/site_settings/android/java/res/drawable-hdpi/permission_javascript_jit.png b/components/browser_ui/site_settings/android/java/res/drawable-hdpi/permission_javascript_jit.png new file mode 100644 index 0000000000000000000000000000000000000000..88f0ec11d6b186923ace473eb426f80341adc5f1 @@ -225,7 +182,7 @@ new file mode 100644 + @Override + public ContentSettingsResources.ResourceItem getResourceItem() { + return new ContentSettingsResources.ResourceItem( -+ /*icon*/ R.drawable.web_asset, ++ /*icon*/ R.drawable.permission_javascript_jit, + /*title*/ R.string.javascript_jit_permission_title, + /*defaultEnabledValue*/ getDefaultEnabledValue(), + /*defaultDisabledValue*/ getDefaultDisabledValue(), diff --git a/build/patches/Show-site-settings-for-cookies-javascript-and-ads.patch b/build/patches/Show-site-settings-for-cookies-javascript-and-ads.patch index ff04be6e..5d2ed815 100644 --- a/build/patches/Show-site-settings-for-cookies-javascript-and-ads.patch +++ b/build/patches/Show-site-settings-for-cookies-javascript-and-ads.patch @@ -13,7 +13,7 @@ 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/SingleWebsiteSettings.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleWebsiteSettings.java --- 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 -@@ -517,6 +517,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment +@@ -515,6 +515,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment setUpSoundPreference(preference); } else if (type == ContentSettingsType.JAVASCRIPT) { setUpJavascriptPreference(preference); @@ -22,7 +22,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c } else if (type == ContentSettingsType.GEOLOCATION) { setUpLocationPreference(preference); } else if (type == ContentSettingsType.NOTIFICATIONS) { -@@ -876,16 +878,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment +@@ -874,16 +876,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment private void setUpAdsInformationalBanner() { // Add the informational banner which shows at the top of the UI if ad blocking is // activated on this site. @@ -39,7 +39,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c } private SiteSettingsCategory getWarningCategory() { -@@ -1057,17 +1051,35 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment +@@ -1055,17 +1049,35 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment @Nullable Integer currentValue = mSite.getContentSetting(browserContextHandle, ContentSettingsType.JAVASCRIPT); @@ -81,7 +81,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c /** * Updates the ads list preference based on whether the site is a candidate for blocking. This * has some custom behavior. -@@ -1083,22 +1095,10 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment +@@ -1081,22 +1093,10 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment setupContentSettingsPreference(preference, null, false); return; } diff --git a/build/patches/Site-setting-for-images.patch b/build/patches/Site-setting-for-images.patch index c674c53e..87f894d2 100644 --- a/build/patches/Site-setting-for-images.patch +++ b/build/patches/Site-setting-for-images.patch @@ -4,8 +4,8 @@ Subject: Site setting for images 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 +Require: Content-settings-infrastructure.patch --- - .../browser_ui/site_settings/android/BUILD.gn | 5 + .../res/drawable-hdpi/permission_images.png | Bin 0 -> 257 bytes .../res/drawable-mdpi/permission_images.png | Bin 0 -> 186 bytes .../res/drawable-xhdpi/permission_images.png | Bin 0 -> 316 bytes @@ -16,7 +16,7 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../bromite_content_settings/images.inc | 7 ++ .../core/browser/content_settings_registry.cc | 2 +- .../core/browser/content_settings_utils.cc | 8 +- - 11 files changed, 130 insertions(+), 7 deletions(-) + 10 files changed, 125 insertions(+), 7 deletions(-) create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-hdpi/permission_images.png create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-mdpi/permission_images.png create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-xhdpi/permission_images.png @@ -26,49 +26,6 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html create mode 100644 components/browser_ui/strings/bromite_content_settings/images.grdp create mode 100644 components/content_settings/core/browser/bromite_content_settings/images.inc -diff --git a/components/browser_ui/site_settings/android/BUILD.gn b/components/browser_ui/site_settings/android/BUILD.gn ---- a/components/browser_ui/site_settings/android/BUILD.gn -+++ b/components/browser_ui/site_settings/android/BUILD.gn -@@ -200,6 +200,7 @@ android_resources("java_resources") { - sources = [ - "java/res/drawable-hdpi/ic_volume_up_grey600_24dp.png", - "java/res/drawable-hdpi/permission_background_sync.png", -+ "java/res/drawable-hdpi/permission_images.png", - "java/res/drawable-hdpi/permission_javascript.png", - "java/res/drawable-hdpi/permission_popups.png", - "java/res/drawable-hdpi/permission_protected_media.png", -@@ -207,6 +208,7 @@ android_resources("java_resources") { - "java/res/drawable-hdpi/web_asset.png", - "java/res/drawable-mdpi/ic_volume_up_grey600_24dp.png", - "java/res/drawable-mdpi/permission_background_sync.png", -+ "java/res/drawable-mdpi/permission_images.png", - "java/res/drawable-mdpi/permission_javascript.png", - "java/res/drawable-hdpi/settings_autoplay.png", - "java/res/drawable-xhdpi/settings_autoplay.png", -@@ -219,6 +221,7 @@ android_resources("java_resources") { - "java/res/drawable-mdpi/web_asset.png", - "java/res/drawable-xhdpi/ic_volume_up_grey600_24dp.png", - "java/res/drawable-xhdpi/permission_background_sync.png", -+ "java/res/drawable-xhdpi/permission_images.png", - "java/res/drawable-xhdpi/permission_javascript.png", - "java/res/drawable-xhdpi/permission_popups.png", - "java/res/drawable-xhdpi/permission_protected_media.png", -@@ -226,6 +229,7 @@ android_resources("java_resources") { - "java/res/drawable-xhdpi/web_asset.png", - "java/res/drawable-xxhdpi/ic_volume_up_grey600_24dp.png", - "java/res/drawable-xxhdpi/permission_background_sync.png", -+ "java/res/drawable-xxhdpi/permission_images.png", - "java/res/drawable-xxhdpi/permission_javascript.png", - "java/res/drawable-xxhdpi/permission_popups.png", - "java/res/drawable-xxhdpi/permission_protected_media.png", -@@ -233,6 +237,7 @@ android_resources("java_resources") { - "java/res/drawable-xxhdpi/web_asset.png", - "java/res/drawable-xxxhdpi/ic_volume_up_grey600_24dp.png", - "java/res/drawable-xxxhdpi/permission_background_sync.png", -+ "java/res/drawable-xxxhdpi/permission_images.png", - "java/res/drawable-xxxhdpi/permission_javascript.png", - "java/res/drawable-xxxhdpi/permission_popups.png", - "java/res/drawable-xxxhdpi/permission_protected_media.png", diff --git a/components/browser_ui/site_settings/android/java/res/drawable-hdpi/permission_images.png b/components/browser_ui/site_settings/android/java/res/drawable-hdpi/permission_images.png new file mode 100644 index 0000000000000000000000000000000000000000..cafee5acf2299e534676a15fb029192e066551c9 @@ -203,7 +160,7 @@ new file mode 100644 + @Override + public ContentSettingsResources.ResourceItem getResourceItem() { + return new ContentSettingsResources.ResourceItem( -+ /*icon*/ R.drawable.web_asset, ++ /*icon*/ R.drawable.permission_images, + /*title*/ R.string.images_permission_title, + /*defaultEnabledValue*/ getDefaultEnabledValue(), + /*defaultDisabledValue*/ getDefaultDisabledValue(), diff --git a/build/patches/Timezone-customization.patch b/build/patches/Timezone-customization.patch index 9c94cfd9..798e86d4 100644 --- a/build/patches/Timezone-customization.patch +++ b/build/patches/Timezone-customization.patch @@ -8,23 +8,14 @@ See also: https://github.com/bromite/bromite/wiki/TimezoneOverride 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 +Require: Content-settings-infrastructure.patch --- - .../ChromeSiteSettingsDelegate.java | 16 ++ .../browser_ui/site_settings/android/BUILD.gn | 3 + .../res/layout/time_zone_select_dialog.xml | 36 ++++ ...ezoneoverride_site_settings_preference.xml | 68 ++++++ - .../res/xml/site_settings_preferences.xml | 4 + - .../java/res/xml/website_preferences.xml | 10 + - .../ContentSettingsResources.java | 28 +++ - .../site_settings/SingleCategorySettings.java | 60 +++++- - .../site_settings/SingleWebsiteSettings.java | 2 + - .../site_settings/SiteSettings.java | 2 +- - .../site_settings/SiteSettingsCategory.java | 7 +- - .../site_settings/SiteSettingsDelegate.java | 2 + ...imezoneOverrideSiteSettingsPreference.java | 194 ++++++++++++++++++ - .../browser_ui/site_settings/Website.java | 11 + - .../WebsitePermissionsFetcher.java | 2 + - .../WebsitePreferenceBridge.java | 12 ++ + .../WebsitePreferenceBridge.java | 10 + + ...BromiteTimezoneOverrideContentSetting.java | 146 +++++++++++++ .../android/website_preference_bridge.cc | 16 ++ .../bromite_content_settings/timezone.grdp | 39 ++++ .../timezone_override.inc | 24 +++ @@ -42,48 +33,15 @@ License: GPL-3.0-only - https://spdx.org/licenses/GPL-3.0-only.html .../content_settings/core/common/pref_names.h | 2 + .../renderer/content_settings_agent_impl.cc | 80 ++++++++ .../renderer/content_settings_agent_impl.h | 11 + - .../WebLayerSiteSettingsDelegate.java | 3 + - 34 files changed, 677 insertions(+), 6 deletions(-) + 23 files changed, 679 insertions(+), 1 deletion(-) create mode 100755 components/browser_ui/site_settings/android/java/res/layout/time_zone_select_dialog.xml create mode 100755 components/browser_ui/site_settings/android/java/res/layout/timezoneoverride_site_settings_preference.xml create mode 100755 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/TimezoneOverrideSiteSettingsPreference.java + create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteTimezoneOverrideContentSetting.java create mode 100644 components/browser_ui/strings/bromite_content_settings/timezone.grdp create mode 100644 components/content_settings/core/browser/bromite_content_settings/timezone_override.inc create mode 100644 components/content_settings/core/common/bromite_content_settings/TIMEZONE.inc -diff --git a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java ---- a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java -+++ b/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java -@@ -46,6 +46,10 @@ import org.chromium.url.GURL; - - import java.util.Set; - -+import android.content.Intent; -+import android.provider.Browser; -+import android.net.Uri; -+ - /** - * A SiteSettingsDelegate instance that contains Chrome-specific Site Settings logic. - */ -@@ -267,6 +271,18 @@ public class ChromeSiteSettingsDelegate implements SiteSettingsDelegate { - return PrivacySandboxBridge.getFirstPartySetOwner(memberOrigin); - } - -+ // open wiki page for documentation about the timezone override feature -+ @Override -+ public void launchTimeZoneOverrideHelpAndFeedbackActivity(Activity currentActivity) { -+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/bromite/bromite/wiki/TimezoneOverride")); -+ // Let Chromium know that this intent is from Chromium, so that it does not close the app when -+ // the user presses 'back' button. -+ intent.putExtra(Browser.EXTRA_APPLICATION_ID, currentActivity.getPackageName()); -+ intent.putExtra(Browser.EXTRA_CREATE_NEW_TAB, true); -+ intent.setPackage(currentActivity.getPackageName()); -+ currentActivity.startActivity(intent); -+ } -+ - @Override - public boolean canLaunchClearBrowsingDataDialog() { - return true; diff --git a/components/browser_ui/site_settings/android/BUILD.gn b/components/browser_ui/site_settings/android/BUILD.gn --- a/components/browser_ui/site_settings/android/BUILD.gn +++ b/components/browser_ui/site_settings/android/BUILD.gn @@ -95,7 +53,7 @@ diff --git a/components/browser_ui/site_settings/android/BUILD.gn b/components/b ] annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ] resources_package = "org.chromium.components.browser_ui.site_settings" -@@ -262,6 +263,8 @@ android_resources("java_resources") { +@@ -263,6 +264,8 @@ android_resources("java_resources") { "java/res/xml/site_settings_preferences.xml", "java/res/xml/site_settings_preferences_with_categories.xml", "java/res/xml/website_preferences.xml", @@ -219,335 +177,6 @@ new file mode 100755 + app:verticalInset="0dp" /> + + -diff --git a/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences.xml b/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences.xml ---- a/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences.xml -+++ b/components/browser_ui/site_settings/android/java/res/xml/site_settings_preferences.xml -@@ -47,6 +47,10 @@ Also add new settings to site_settings_preferences_with_categories.xml! - -+ -+ - - - -+ -+ -+ -+ - - - -+ -+ -+ - - . ++*/ ++ ++package org.chromium.components.browser_ui.site_settings.impl; ++ ++import org.chromium.components.browser_ui.site_settings.R; ++ ++import org.chromium.components.browser_ui.site_settings.BromiteCustomContentSetting; ++import org.chromium.components.browser_ui.site_settings.ContentSettingsResources; ++import org.chromium.components.browser_ui.site_settings.SingleCategorySettings; ++import org.chromium.components.browser_ui.site_settings.SiteSettingsCategory; ++import org.chromium.components.browser_ui.site_settings.TimezoneOverrideSiteSettingsPreference; ++import org.chromium.components.browser_ui.site_settings.WebsitePreferenceBridge; ++import org.chromium.components.content_settings.ContentSettingValues; ++import org.chromium.components.content_settings.ContentSettingsType; ++import org.chromium.content_public.browser.BrowserContextHandle; ++ ++import android.view.View; ++import androidx.annotation.Nullable; ++import androidx.preference.Preference; ++import androidx.preference.PreferenceScreen; ++ ++import java.util.ArrayList; ++ ++public class BromiteTimezoneOverrideContentSetting extends BromiteCustomContentSetting { ++ private static final String TIMEOVERRIDE_STATE_TOGGLE_KEY = "timeoverride_state_toggle"; ++ ++ public BromiteTimezoneOverrideContentSetting() { ++ super(/*contentSettingsType*/ ContentSettingsType.TIMEZONE_OVERRIDE, ++ /*defaultEnabledValue*/ ContentSettingValues.ALLOW, ++ /*defaultDisabledValue*/ ContentSettingValues.BLOCK, ++ /*allowException*/ true, ++ /*preferenceKey*/ "timezone_override", ++ /*profilePrefKey*/ "timezone_override_permission_list"); ++ } ++ ++ @Override ++ public ContentSettingsResources.ResourceItem getResourceItem() { ++ return new ContentSettingsResources.ResourceItem( ++ /*icon*/ R.drawable.web_asset, ++ /*title*/ R.string.timezone_override_permission_title, ++ /*defaultEnabledValue*/ getDefaultEnabledValue(), ++ /*defaultDisabledValue*/ getDefaultDisabledValue(), ++ /*enabledSummary*/ R.string.website_settings_category_timezone_override_custom, ++ /*disabledSummary*/ R.string.website_settings_category_timezone_override_random); ++ } ++ ++ @Override ++ public int getCategorySummary(@Nullable @ContentSettingValues int value) { ++ switch (value) { ++ case ContentSettingValues.ALLOW: ++ return R.string.website_settings_category_timezone_override_allowed; ++ case ContentSettingValues.ASK: ++ return R.string.website_settings_category_timezone_override_custom; ++ case ContentSettingValues.BLOCK: ++ return R.string.website_settings_category_timezone_override_random; ++ default: ++ return 0; ++ } ++ } ++ ++ @Override ++ public int[] getTriStateSettingDescriptionIDs() { ++ int[] descriptionIDs = { ++ R.string.website_settings_category_timezone_override_allowed, // ALLOWED ++ R.string.website_settings_category_timezone_override_custom, // ASK ++ R.string.website_settings_category_timezone_override_random}; // BLOCKED ++ return descriptionIDs; ++ } ++ ++ @Override ++ public int getCategoryDescription() { ++ return R.string.website_settings_timeoverride_info; ++ } ++ ++ @Override ++ public boolean requiresTriStateContentSetting() { ++ return true; ++ } ++ ++ @Override ++ public boolean showOnlyDescriptions() { ++ return true; ++ } ++ ++ @Override ++ public int getAddExceptionDialogMessage() { ++ return R.string.website_settings_category_timezone_override_allowed; ++ } ++ ++ @Override ++ public @Nullable Boolean considerException(SiteSettingsCategory category, @ContentSettingValues int value) { ++ return value != ContentSettingValues.ALLOW; ++ } ++ ++ @Override ++ public boolean isOnBlockList(@ContentSettingValues Integer contentSetting) { ++ return ContentSettingValues.ALLOW != contentSetting; ++ } ++ ++ @Override ++ public boolean isHelpAndFeedbackEnabled() { ++ return true; ++ } ++ ++ @Override ++ public String getHelpAndFeedbackActivityUrl() { ++ return "https://github.com/bromite/bromite/wiki/TimezoneOverride"; ++ } ++ ++ @Override ++ public void configureGlobalToggles(SiteSettingsCategory category, SingleCategorySettings setting) { ++ BrowserContextHandle browserContext = setting.getSiteSettingsDelegate().getBrowserContextHandle(); ++ PreferenceScreen screen = setting.getPreferenceScreen(); ++ ++ Preference triStateToggle = screen.findPreference( ++ SingleCategorySettings.TRI_STATE_TOGGLE_KEY); ++ int order = triStateToggle.getOrder(); ++ screen.removePreference(triStateToggle); ++ ++ TimezoneOverrideSiteSettingsPreference timeOverrideStatePreference = ++ new TimezoneOverrideSiteSettingsPreference(setting.getContext(), null); ++ screen.addPreference(timeOverrideStatePreference); ++ timeOverrideStatePreference.setOrder(order); ++ ++ timeOverrideStatePreference.setOnPreferenceChangeListener(setting); ++ @ContentSettingValues ++ int value = WebsitePreferenceBridge.getDefaultContentSetting( ++ browserContext, ContentSettingsType.TIMEZONE_OVERRIDE); ++ timeOverrideStatePreference.initialize(value, browserContext); ++ } ++} diff --git a/components/browser_ui/site_settings/android/website_preference_bridge.cc b/components/browser_ui/site_settings/android/website_preference_bridge.cc --- a/components/browser_ui/site_settings/android/website_preference_bridge.cc +++ b/components/browser_ui/site_settings/android/website_preference_bridge.cc @@ -980,7 +711,7 @@ diff --git a/components/content_settings/core/browser/content_settings_pref_prov diff --git a/components/content_settings/core/browser/content_settings_utils.cc b/components/content_settings/core/browser/content_settings_utils.cc --- a/components/content_settings/core/browser/content_settings_utils.cc +++ b/components/content_settings/core/browser/content_settings_utils.cc -@@ -165,6 +165,11 @@ void GetRendererContentSettingRules(const HostContentSettingsMap* map, +@@ -161,6 +161,11 @@ void GetRendererContentSettingRules(const HostContentSettingsMap* map, &(rules->script_rules)); map->GetSettingsForOneType(ContentSettingsType::POPUPS, &(rules->popup_redirect_rules)); @@ -1233,18 +964,5 @@ diff --git a/components/content_settings/renderer/content_settings_agent_impl.h }; } // namespace content_settings -diff --git a/weblayer/browser/java/org/chromium/weblayer_private/settings/WebLayerSiteSettingsDelegate.java b/weblayer/browser/java/org/chromium/weblayer_private/settings/WebLayerSiteSettingsDelegate.java ---- a/weblayer/browser/java/org/chromium/weblayer_private/settings/WebLayerSiteSettingsDelegate.java -+++ b/weblayer/browser/java/org/chromium/weblayer_private/settings/WebLayerSiteSettingsDelegate.java -@@ -155,6 +155,9 @@ public class WebLayerSiteSettingsDelegate - @Override - public void dismissPrivacySandboxSnackbar() {} - -+ @Override -+ public void launchTimeZoneOverrideHelpAndFeedbackActivity(Activity currentActivity) {} -+ - @Override - public boolean isFirstPartySetsDataAccessEnabled() { - return false; -- 2.25.1 diff --git a/build/patches/00Viewport-Protection-Site-Setting.patch b/build/patches/Viewport-Protection-Site-Setting.patch similarity index 99% rename from build/patches/00Viewport-Protection-Site-Setting.patch rename to build/patches/Viewport-Protection-Site-Setting.patch index d183cad0..9ed1060c 100644 --- a/build/patches/00Viewport-Protection-Site-Setting.patch +++ b/build/patches/Viewport-Protection-Site-Setting.patch @@ -1,7 +1,8 @@ -From: Your Name +From: uazo Date: Fri, 16 Jun 2023 15:56:35 +0000 Subject: Viewport Protection Site Setting +Require: Content-settings-infrastructure.patch --- .../impl/BromiteViewportContentSetting.java | 93 +++++++++++++++++++ .../bromite_content_settings/viewport.grdp | 27 ++++++ diff --git a/build/patches/00Viewport-Protection-flag.patch b/build/patches/Viewport-Protection-flag.patch similarity index 100% rename from build/patches/00Viewport-Protection-flag.patch rename to build/patches/Viewport-Protection-flag.patch diff --git a/build/patches/00bromite-build-utils.patch b/build/patches/bromite-build-utils.patch similarity index 99% rename from build/patches/00bromite-build-utils.patch rename to build/patches/bromite-build-utils.patch index 3111800d..e5d944ab 100644 --- a/build/patches/00bromite-build-utils.patch +++ b/build/patches/bromite-build-utils.patch @@ -1,4 +1,4 @@ -From: Your Name +From: uazo Date: Fri, 9 Jun 2023 15:11:46 +0000 Subject: bromite build utils