final version

This commit is contained in:
Carmelo Messina
2023-06-20 12:33:44 +02:00
parent 617ea58d20
commit ab5e89c104
11 changed files with 360 additions and 613 deletions
+13 -17
View File
@@ -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
@@ -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; }
@@ -1,11 +1,11 @@
From: uazo <uazo@users.noreply.github.com>
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(),
@@ -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
+3 -46
View File
@@ -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(),
@@ -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;
}
+3 -46
View File
@@ -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(),
+160 -442
View File
@@ -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" />
+
+</LinearLayout>
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!
<org.chromium.components.browser_ui.settings.ChromeBasePreference
android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
android:key="javascript" />
+ <!-- Timezone Override -->
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
+ android:key="timezone_override"
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings" />
<!-- Popups -->
<org.chromium.components.browser_ui.settings.ChromeBasePreference
android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
diff --git a/components/browser_ui/site_settings/android/java/res/xml/website_preferences.xml b/components/browser_ui/site_settings/android/java/res/xml/website_preferences.xml
--- a/components/browser_ui/site_settings/android/java/res/xml/website_preferences.xml
+++ b/components/browser_ui/site_settings/android/java/res/xml/website_preferences.xml
@@ -14,6 +14,12 @@ found in the LICENSE file.
<org.chromium.components.browser_ui.settings.TextMessagePreference
android:key="info_text"/>
+ <!-- A text message describing timeoverride settings. -->
+ <org.chromium.components.browser_ui.settings.TextMessagePreference
+ android:key="timeoverride_info_text"
+ android:summary="@string/website_settings_timeoverride_info"/>
+
+
<!-- A common binary toggle, only shown for specific categories that allow
turning default values for that category on/off.-->
<org.chromium.components.browser_ui.settings.ChromeSwitchPreference
@@ -30,6 +36,10 @@ found in the LICENSE file.
<!-- A three state toggle for third-party cookies preferences, only shown for the ThirdPartyCookies category. -->
<org.chromium.components.browser_ui.site_settings.TriStateCookieSettingsPreference
android:key="tri_state_cookie_toggle" />
+ <!-- A specific state toggle for time override preferences, only shown for the TimeOverride category. -->
+ <org.chromium.components.browser_ui.site_settings.TimezoneOverrideSiteSettingsPreference
+ android:key="timeoverride_state_toggle" />
+
<!-- A checkbox for enabling a quiet ui for notification prompts. Only shown in the Notifications category. -->
<org.chromium.components.browser_ui.settings.ChromeBaseCheckBoxPreference
android:key="notifications_quiet_ui"
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/ContentSettingsResources.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/ContentSettingsResources.java
--- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/ContentSettingsResources.java
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/ContentSettingsResources.java
@@ -302,6 +302,12 @@ public class ContentSettingsResources {
R.string.vr_permission_title, ContentSettingValues.ASK,
ContentSettingValues.BLOCK, R.string.website_settings_category_vr_ask,
R.string.website_settings_category_vr_blocked);
+
+ case ContentSettingsType.TIMEZONE_OVERRIDE:
+ return new ResourceItem(R.drawable.web_asset, R.string.timezone_override_permission_title,
+ ContentSettingValues.ALLOW, ContentSettingValues.BLOCK,
+ R.string.website_settings_category_timezone_override_custom,
+ R.string.website_settings_category_timezone_override_random);
}
ResourceItem ri = BromiteCustomContentSettingImpl.getResourceItem(contentType);
if (ri != null) return ri;
@@ -471,6 +477,18 @@ public class ContentSettingsResources {
}
public static int getCategorySummary(int contentType, @Nullable @ContentSettingValues int value) {
+ if (contentType == ContentSettingsType.TIMEZONE_OVERRIDE) {
+ 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;
+ }
+ }
int result = BromiteCustomContentSettingImpl.getCategorySummary(contentType, value);
if (result != 0) return result;
return getCategorySummary(value);
@@ -493,6 +511,9 @@ public class ContentSettingsResources {
*/
public static int getSiteSummary(@ContentSettingValues @Nullable Integer value,
@ContentSettingsType int contentSettingsType) {
+ if (contentSettingsType == ContentSettingsType.TIMEZONE_OVERRIDE)
+ return getCategorySummary(contentSettingsType, value);
+
switch (value) {
case ContentSettingValues.ALLOW:
return contentSettingsType == ContentSettingsType.REQUEST_DESKTOP_SITE
@@ -620,6 +641,13 @@ public class ContentSettingsResources {
R.string.website_settings_category_protected_content_blocked};
return descriptionIDs;
}
+ else if (contentType == ContentSettingsType.TIMEZONE_OVERRIDE) {
+ 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;
+ }
assert false;
return null;
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleCategorySettings.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleCategorySettings.java
--- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleCategorySettings.java
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleCategorySettings.java
@@ -85,6 +85,10 @@ import org.chromium.ui.widget.Toast;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import android.app.Activity;
+import android.content.Intent;
+import org.chromium.components.browser_ui.site_settings.TimezoneOverrideSiteSettingsPreference;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -196,6 +200,7 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
public static final String TRI_STATE_TOGGLE_KEY = "tri_state_toggle";
public static final String TRI_STATE_COOKIE_TOGGLE = "tri_state_cookie_toggle";
public static final String FOUR_STATE_COOKIE_TOGGLE_KEY = "four_state_cookie_toggle";
+ public static final String TIMEOVERRIDE_STATE_TOGGLE_KEY = "timeoverride_state_toggle";
// Keys for category-specific preferences (toggle, link, button etc.), dynamically shown.
public static final String NOTIFICATIONS_VIBRATE_TOGGLE_KEY = "notifications_vibrate";
@@ -214,6 +219,7 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
"anti_abuse_things_to_consider_header";
public static final String ANTI_ABUSE_THINGS_TO_CONSIDER_SECTION_ONE =
"anti_abuse_things_to_consider_section_one";
+ public static final String TIMEOVERRIDE_INFO_TEXT = "timeoverride_info_text";
// Keys for Allowed/Blocked preference groups/headers.
public static final String ALLOWED_GROUP = "allowed_group";
@@ -310,7 +316,11 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
return BromiteCustomContentSettingImpl.isOnBlockList(contentSetting, website, contentSetting);
}
if (contentSetting != null) {
- return ContentSettingValues.BLOCK == contentSetting;
+ if (mCategory.getContentSettingsType() == SiteSettingsCategory.Type.TIMEZONE_OVERRIDE) {
+ return ContentSettingValues.ALLOW != contentSetting;
+ } else {
+ return ContentSettingValues.BLOCK == contentSetting;
+ }
}
return false;
}
@@ -492,7 +502,8 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
if (queryHasChanged) getInfoForOrigins();
});
- if (getSiteSettingsDelegate().isHelpAndFeedbackEnabled()) {
+ if (getSiteSettingsDelegate().isHelpAndFeedbackEnabled() ||
+ mCategory.getType() == SiteSettingsCategory.Type.TIMEZONE_OVERRIDE) {
MenuItem help = menu.add(
Menu.NONE, R.id.menu_id_site_settings_help, Menu.NONE, R.string.menu_help);
help.setIcon(TraceEventVectorDrawableCompat.create(
@@ -503,7 +514,10 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId() == R.id.menu_id_site_settings_help) {
- if (mCategory.getType() == SiteSettingsCategory.Type.PROTECTED_MEDIA) {
+ if (mCategory.getType() == SiteSettingsCategory.Type.TIMEZONE_OVERRIDE) {
+ getSiteSettingsDelegate()
+ .launchTimeZoneOverrideHelpAndFeedbackActivity(getActivity());
+ } else if (mCategory.getType() == SiteSettingsCategory.Type.PROTECTED_MEDIA) {
getSiteSettingsDelegate().launchProtectedContentHelpAndFeedbackActivity(
getActivity());
} else {
@@ -610,6 +624,12 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
WebsitePreferenceBridge.setDefaultContentSetting(
browserContextHandle, mCategory.getContentSettingsType(), setting);
getInfoForOrigins();
+ } else if (TIMEOVERRIDE_STATE_TOGGLE_KEY.equals(preference.getKey())) {
+ @ContentSettingValues
+ int setting = (int) newValue;
+ WebsitePreferenceBridge.setDefaultContentSetting(
+ browserContextHandle, ContentSettingsType.TIMEZONE_OVERRIDE, setting);
+ getInfoForOrigins();
} else if (FOUR_STATE_COOKIE_TOGGLE_KEY.equals(preference.getKey())) {
setCookieSettingsPreference((CookieSettingsState) newValue);
getInfoForOrigins();
@@ -796,6 +816,12 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
? R.string.website_settings_blocked_group_heading_request_desktop_site
: R.string.website_settings_allowed_group_heading_request_desktop_site;
break;
+ case SiteSettingsCategory.Type.TIMEZONE_OVERRIDE:
+ resource = WebsitePreferenceBridge.isCategoryEnabled(
+ browserContextHandle, ContentSettingsType.TIMEZONE_OVERRIDE)
+ ? R.string.website_settings_category_timezone_override_allowed
+ : R.string.website_settings_category_timezone_override_allowed;
+ break;
}
if (resource == 0)
resource = BromiteCustomContentSettingImpl.getAddExceptionDialogMessage(mCategory);
@@ -917,6 +943,9 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
case SiteSettingsCategory.Type.THIRD_PARTY_COOKIES:
allowSpecifyingExceptions = getCookieControlsMode() != CookieControlsMode.OFF;
break;
+ case SiteSettingsCategory.Type.TIMEZONE_OVERRIDE:
+ allowSpecifyingExceptions = true;
+ break;
default:
break;
}
@@ -1138,6 +1167,9 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
PreferenceGroup blockedGroup = screen.findPreference(BLOCKED_GROUP);
PreferenceGroup managedGroup = screen.findPreference(MANAGED_GROUP);
boolean permissionBlockedByOs = mCategory.showPermissionBlockedMessage(getContext());
+ TimezoneOverrideSiteSettingsPreference timeOverrideStatePreference =
+ (TimezoneOverrideSiteSettingsPreference) screen.findPreference(
+ TIMEOVERRIDE_STATE_TOGGLE_KEY);
if (mGlobalToggleLayout != GlobalToggleLayout.BINARY_TOGGLE) {
screen.removePreference(binaryToggle);
@@ -1151,11 +1183,18 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
if (mGlobalToggleLayout != GlobalToggleLayout.FOUR_STATE_COOKIE_TOGGLE) {
screen.removePreference(fourStateCookieToggle);
}
+ if (contentType != SiteSettingsCategory.Type.TIMEZONE_OVERRIDE) {
+ screen.removePreference(screen.findPreference(TIMEOVERRIDE_INFO_TEXT));
+ }
switch (mGlobalToggleLayout) {
case GlobalToggleLayout.BINARY_TOGGLE:
configureBinaryToggle(binaryToggle, contentType);
break;
case GlobalToggleLayout.TRI_STATE_TOGGLE:
+ if (mCategory.getType() == SiteSettingsCategory.Type.TIMEZONE_OVERRIDE) {
+ configureTimeOverrideStateToggle(timeOverrideStatePreference);
+ break;
+ }
configureTriStateToggle(triStateToggle, contentType);
break;
case GlobalToggleLayout.TRI_STATE_COOKIE_TOGGLE:
@@ -1204,6 +1243,12 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
}
BromiteCustomContentSettingImpl.configureGlobalToggles(mCategory, screen);
+ if (mCategory.getType() == SiteSettingsCategory.Type.TIMEZONE_OVERRIDE) {
+ screen.removePreference(triStateToggle);
+ } else {
+ screen.removePreference(timeOverrideStatePreference);
+ }
+
if (permissionBlockedByOs) {
maybeShowOsWarning(screen);
@@ -1359,6 +1404,15 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
triStateToggle.initialize(contentType, setting, descriptionIds);
}
+ private void configureTimeOverrideStateToggle(
+ TimezoneOverrideSiteSettingsPreference timeOverrideStateToggle) {
+ timeOverrideStateToggle.setOnPreferenceChangeListener(this);
+ @ContentSettingValues
+ int setting = WebsitePreferenceBridge.getDefaultContentSetting(
+ getSiteSettingsDelegate().getBrowserContextHandle(), ContentSettingsType.TIMEZONE_OVERRIDE);
+ timeOverrideStateToggle.initialize(setting, getSiteSettingsDelegate().getBrowserContextHandle());
+ }
+
private void configureBinaryToggle(ChromeSwitchPreference binaryToggle, int contentType) {
binaryToggle.setOnPreferenceChangeListener(this);
binaryToggle.setTitle(
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
@@ -143,6 +143,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
return "popup_permission_list";
case ContentSettingsType.SOUND:
return "sound_permission_list";
+ case ContentSettingsType.TIMEZONE_OVERRIDE:
+ return "timezone_override_permission_list";
case ContentSettingsType.AR:
return "ar_permission_list";
case ContentSettingsType.MEDIASTREAM_CAMERA:
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettings.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettings.java
--- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettings.java
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettings.java
@@ -132,7 +132,7 @@ public class SiteSettings extends SiteSettingsPreferenceFragment
} else if (Type.AUTO_DARK_WEB_CONTENT == prefCategory) {
p.setSummary(ContentSettingsResources.getAutoDarkWebContentListSummary(checked));
} else if (requiresTriStateSetting) {
- p.setSummary(ContentSettingsResources.getCategorySummary(setting));
+ p.setSummary(ContentSettingsResources.getCategorySummary(contentType, setting));
} else {
p.setSummary(ContentSettingsResources.getCategorySummary(contentType, checked)); //
}
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsCategory.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsCategory.java
--- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsCategory.java
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsCategory.java
@@ -81,10 +81,11 @@ public class SiteSettingsCategory {
int THIRD_PARTY_COOKIES = 26;
int SITE_DATA = 27;
int ANTI_ABUSE = 28;
+ int TIMEZONE_OVERRIDE = 29;
/**
* Number of handled categories used for calculating array sizes.
*/
- int NUM_ENTRIES_CHROMIUM = 29;
+ int NUM_ENTRIES_CHROMIUM = 30;
}
private final BrowserContextHandle mBrowserContextHandle;
@@ -216,6 +217,8 @@ public class SiteSettingsCategory {
return ContentSettingsType.USB_GUARD;
case Type.VIRTUAL_REALITY:
return ContentSettingsType.VR;
+ case Type.TIMEZONE_OVERRIDE:
+ return ContentSettingsType.TIMEZONE_OVERRIDE;
case Type.ALL_SITES:
case Type.USE_STORAGE:
return ContentSettingsType.DEFAULT; // Conversion unavailable.
@@ -302,6 +305,8 @@ public class SiteSettingsCategory {
return "site_data";
case Type.THIRD_PARTY_COOKIES:
return "third_party_cookies";
+ case Type.TIMEZONE_OVERRIDE:
+ return "timezone_override";
default:
{
String value = BromiteCustomContentSettingImpl.getPreferenceKey(type);
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 launchTimeZoneOverrideHelpAndFeedbackActivity(Activity currentActivity);
+
/**
* 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/TimezoneOverrideSiteSettingsPreference.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/TimezoneOverrideSiteSettingsPreference.java
new file mode 100755
--- /dev/null
@@ -747,59 +376,10 @@ new file mode 100755
+ alertDialog.show();
+ }
+}
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/Website.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/Website.java
--- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/Website.java
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/Website.java
@@ -243,6 +243,17 @@ public final class Website implements WebsiteEntry {
} else {
RecordUserAction.record("SoundContentSetting.UnmuteBy.SiteSettings");
}
+ } else if (type == ContentSettingsType.TIMEZONE_OVERRIDE) {
+ // It is possible to set the permission without having an existing exception,
+ // because we can show the ALLOW state even when this permission is set to the
+ // default. In that case, just set an exception now to ALLOW to enable changing the
+ // permission.
+ if (exception == null) {
+ exception = new ContentSettingException(
+ ContentSettingsType.TIMEZONE_OVERRIDE, getAddress().getHost(), value, "",
+ /*isEmbargoed=*/false);
+ setContentSettingException(type, exception);
+ }
}
if (exception == null) {
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/WebsitePermissionsFetcher.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/WebsitePermissionsFetcher.java
--- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/WebsitePermissionsFetcher.java
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/WebsitePermissionsFetcher.java
@@ -75,6 +75,7 @@ public class WebsitePermissionsFetcher {
case ContentSettingsType.POPUPS:
case ContentSettingsType.REQUEST_DESKTOP_SITE:
case ContentSettingsType.SOUND:
+ case ContentSettingsType.TIMEZONE_OVERRIDE:
return WebsitePermissionsType.CONTENT_SETTING_EXCEPTION;
case ContentSettingsType.AR:
case ContentSettingsType.CLIPBOARD_READ_WRITE:
@@ -212,6 +213,7 @@ public class WebsitePermissionsFetcher {
for (@ContentSettingsType int type = 0; type < ContentSettingsType.NUM_TYPES_BROMITE; type++) {
addFetcherForContentSettingsType(queue, type);
}
+ queue.add(new ExceptionInfoFetcher(ContentSettingsType.TIMEZONE_OVERRIDE));
}
/**
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
--- 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
@@ -245,6 +245,8 @@ public class WebsitePreferenceBridge {
switch (contentSettingsType) {
case ContentSettingsType.PROTECTED_MEDIA_IDENTIFIER:
return true;
+ case ContentSettingsType.TIMEZONE_OVERRIDE:
+ return true;
default:
return BromiteCustomContentSettingImpl.requiresTriStateContentSetting(contentSettingsType);
}
@@ -384,6 +386,14 @@ public class WebsitePreferenceBridge {
@@ -384,6 +384,14 @@ public class WebsitePreferenceBridge {
return WebsitePreferenceBridgeJni.get().toHostOnlyPattern(pattern);
}
@@ -814,7 +394,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c
@NativeMethods
public interface Natives {
boolean isNotificationEmbargoedForOrigin(
@@ -448,5 +458,7 @@ public class WebsitePreferenceBridge {
@@ -448,5 +456,7 @@ public class WebsitePreferenceBridge {
boolean getLocationAllowedByPolicy(BrowserContextHandle browserContextHandle);
String toDomainWildcardPattern(String pattern);
String toHostOnlyPattern(String pattern);
@@ -822,6 +402,157 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c
+ void setCustomTimezone(BrowserContextHandle browserContextHandle, String custom_timezone);
}
}
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteTimezoneOverrideContentSetting.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteTimezoneOverrideContentSetting.java
new file mode 100644
--- /dev/null
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteTimezoneOverrideContentSetting.java
@@ -0,0 +1,146 @@
+/*
+ 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 <https://www.gnu.org/licenses/>.
+*/
+
+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
@@ -1,7 +1,8 @@
From: Your Name <you@example.com>
From: uazo <uazo@users.noreply.github.com>
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 ++++++
@@ -1,4 +1,4 @@
From: Your Name <you@example.com>
From: uazo <uazo@users.noreply.github.com>
Date: Fri, 9 Jun 2023 15:11:46 +0000
Subject: bromite build utils