Merge pull request #59 from uazo/refactoring-site-settings-patches
Refactoring site settings patches
This commit is contained in:
@@ -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,649 +0,0 @@
|
||||
From: Your Name <you@example.com>
|
||||
Date: Tue, 20 Dec 2022 14:27:02 +0000
|
||||
Subject: Viewport Protection Site Setting
|
||||
|
||||
---
|
||||
chrome/app/settings_strings.grdp | 19 ++++
|
||||
chrome/browser/resources/settings/icons.html | 2 +
|
||||
.../settings/privacy_page/privacy_page.html | 22 +++++
|
||||
chrome/browser/resources/settings/route.ts | 1 +
|
||||
chrome/browser/resources/settings/router.ts | 1 +
|
||||
.../site_settings/category_default_setting.ts | 1 +
|
||||
.../settings/site_settings/constants.ts | 1 +
|
||||
.../settings_category_default_radio_group.ts | 1 +
|
||||
.../settings/site_settings/site_details.html | 5 ++
|
||||
.../site_settings_page/site_settings_page.ts | 9 ++
|
||||
.../site_settings_page_util.ts | 2 +
|
||||
.../views/page_info/page_info_view_factory.cc | 3 +
|
||||
.../settings_localized_strings_provider.cc | 7 ++
|
||||
.../ui/webui/settings/site_settings_helper.cc | 1 +
|
||||
.../browser_ui/site_settings/android/BUILD.gn | 3 +
|
||||
.../BromiteCustomContentSettingImpl.java | 1 +
|
||||
.../BromiteViewportContentSetting.java | 86 +++++++++++++++++++
|
||||
.../site_settings/SiteSettingsCategory.java | 5 +-
|
||||
.../strings/android/browser_ui_strings.grd | 1 +
|
||||
.../browser_ui/strings/android/viewport.grdp | 18 ++++
|
||||
components/components_strings.grd | 1 +
|
||||
.../core/browser/content_settings_registry.cc | 15 +++-
|
||||
.../core/browser/content_settings_utils.cc | 2 +
|
||||
.../core/common/content_settings.cc | 4 +-
|
||||
.../core/common/content_settings.h | 1 +
|
||||
.../core/common/content_settings.mojom | 1 +
|
||||
.../common/content_settings_mojom_traits.cc | 3 +-
|
||||
.../common/content_settings_mojom_traits.h | 5 ++
|
||||
.../core/common/content_settings_types.h | 2 +
|
||||
.../renderer/content_settings_agent_impl.cc | 9 ++
|
||||
.../renderer/content_settings_agent_impl.h | 1 +
|
||||
third_party/blink/common/features.cc | 2 +-
|
||||
.../platform/web_content_settings_client.h | 2 +
|
||||
.../renderer/core/frame/local_dom_window.cc | 1 +
|
||||
third_party/blink/renderer/core/page/page.cc | 2 +
|
||||
35 files changed, 234 insertions(+), 6 deletions(-)
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteViewportContentSetting.java
|
||||
create mode 100644 components/browser_ui/strings/android/viewport.grdp
|
||||
|
||||
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp
|
||||
--- a/chrome/app/settings_strings.grdp
|
||||
+++ b/chrome/app/settings_strings.grdp
|
||||
@@ -4424,6 +4424,25 @@
|
||||
Not allowed to use WebRTC
|
||||
</message>
|
||||
|
||||
+ <message name="IDS_SITE_SETTINGS_VIEWPORT_PROTECTION_TITLE" desc="Description of the viewport protection content setting page title.">
|
||||
+ Viewport Protection
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_DESCRIPTION" desc="Description of the viewport protection content setting.">
|
||||
+ Enable Viewport Protection
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_ALLOWED" desc="Label for the enabled option of the viewport protection setting.">
|
||||
+ Viewport Protection is enabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_BLOCKED" desc="Label for the disabled option of the viewport protection setting.">
|
||||
+ Viewport Protection is disabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_ALLOWED_EXCEPTIONS" desc="Label for the allowed exceptions site list of the viewport protection setting.">
|
||||
+ Allowed to use Viewport Protection
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the viewport protection setting.">
|
||||
+ Not allowed to use Viewport Protection
|
||||
+ </message>
|
||||
+
|
||||
<if expr="not is_chromeos">
|
||||
<!-- Import Settings Dialog -->
|
||||
<message name="IDS_SETTINGS_IMPORT_SETTINGS_TITLE" desc="Dialog title for import dialog.">
|
||||
diff --git a/chrome/browser/resources/settings/icons.html b/chrome/browser/resources/settings/icons.html
|
||||
--- a/chrome/browser/resources/settings/icons.html
|
||||
+++ b/chrome/browser/resources/settings/icons.html
|
||||
@@ -201,6 +201,8 @@ NOTE: Chrome OS icons go in ./chromeos/os_icons.html.
|
||||
<g id="webgl-off"><path d="M13.002 4.001H7.106L5.252 2.148c.232-.094.485-.147.75-.147h8l6 6v8.896l-2-2V9.001h-5v-5z" fill="#5F6368"></path><path d="M16.002 12.001h-.896l.896.896v-.896zM.6 3.45l1.414-1.414 19.94 19.94-1.414 1.414L.6 3.45zM3.986 20.01V6.84l2 2V20.01h11.172l1.765 1.766c-.28.15-.599.234-.937.234H5.976c-1.1 0-1.99-.9-1.99-2z" fill="#5F6368"></path><path d="M9.158 12.01H7.986v2h3.172l-2-2zM13.158 16.01H7.986v2h7.172l-2-2z" fill="#5F6368"></path></g>
|
||||
<g id="webrtc"><path d="M8 16h8v2H8v-2zm0-4h8v2H8v-2zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z" fill="#5F6368"></path></g>
|
||||
<g id="webrtc-off"><path d="M13.002 4.001H7.106L5.252 2.148c.232-.094.485-.147.75-.147h8l6 6v8.896l-2-2V9.001h-5v-5z" fill="#5F6368"></path><path d="M16.002 12.001h-.896l.896.896v-.896zM.6 3.45l1.414-1.414 19.94 19.94-1.414 1.414L.6 3.45zM3.986 20.01V6.84l2 2V20.01h11.172l1.765 1.766c-.28.15-.599.234-.937.234H5.976c-1.1 0-1.99-.9-1.99-2z" fill="#5F6368"></path><path d="M9.158 12.01H7.986v2h3.172l-2-2zM13.158 16.01H7.986v2h7.172l-2-2z" fill="#5F6368"></path></g>
|
||||
+ <g id="viewport-protection"><path d="M8 16h8v2H8v-2zm0-4h8v2H8v-2zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z" fill="#5F6368"></path></g>
|
||||
+ <g id="viewport-protection-off"><path d="M13.002 4.001H7.106L5.252 2.148c.232-.094.485-.147.75-.147h8l6 6v8.896l-2-2V9.001h-5v-5z" fill="#5F6368"></path><path d="M16.002 12.001h-.896l.896.896v-.896zM.6 3.45l1.414-1.414 19.94 19.94-1.414 1.414L.6 3.45zM3.986 20.01V6.84l2 2V20.01h11.172l1.765 1.766c-.28.15-.599.234-.937.234H5.976c-1.1 0-1.99-.9-1.99-2z" fill="#5F6368"></path><path d="M9.158 12.01H7.986v2h3.172l-2-2zM13.158 16.01H7.986v2h7.172l-2-2z" fill="#5F6368"></path></g>
|
||||
</defs>
|
||||
</svg>
|
||||
</iron-iconset-svg>
|
||||
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
--- a/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
+++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
@@ -1214,4 +1214,26 @@
|
||||
</category-setting-exceptions>
|
||||
</settings-subpage>
|
||||
</template>
|
||||
+ <template is="dom-if" route-path="/content/viewport-protection" no-search>
|
||||
+ <settings-subpage page-title="$i18n{siteSettingsViewportProtection}"
|
||||
+ search-label="$i18n{siteSettingsAllSitesSearch}"
|
||||
+ search-term="{{searchFilter_}}">
|
||||
+ <div class="content-settings-header secondary">
|
||||
+ $i18n{siteSettingsViewportProtectionDescription}
|
||||
+ </div>
|
||||
+ <settings-category-default-radio-group
|
||||
+ category="[[contentSettingsTypesEnum_.VIEWPORT]]"
|
||||
+ allow-option-label="$i18n{siteSettingsViewportProtectionAllowed}"
|
||||
+ allow-option-icon="settings:viewport-protection"
|
||||
+ block-option-label="$i18n{siteSettingsViewportProtectionBlocked}"
|
||||
+ block-option-icon="settings:viewport-protection-off">
|
||||
+ </settings-category-default-radio-group>
|
||||
+ <category-setting-exceptions
|
||||
+ category="[[contentSettingsTypesEnum_.VIEWPORT]]"
|
||||
+ block-header="$i18n{siteSettingsViewportProtectionBlockedExceptions}"
|
||||
+ allow-header="$i18n{siteSettingsViewportProtectionAllowedExceptions}"
|
||||
+ search-filter="[[searchFilter_]]">
|
||||
+ </category-setting-exceptions>
|
||||
+ </settings-subpage>
|
||||
+ </template>
|
||||
</settings-animated-pages>
|
||||
diff --git a/chrome/browser/resources/settings/route.ts b/chrome/browser/resources/settings/route.ts
|
||||
--- a/chrome/browser/resources/settings/route.ts
|
||||
+++ b/chrome/browser/resources/settings/route.ts
|
||||
@@ -127,6 +127,7 @@ function addPrivacyChildRoutes(r: Partial<SettingsRoutes>) {
|
||||
r.SITE_SETTINGS_TIMEZONE_OVERRIDE = r.SITE_SETTINGS.createChild('timezone-override');
|
||||
r.SITE_SETTINGS_WEBGL = r.SITE_SETTINGS.createChild('webgl');
|
||||
r.SITE_SETTINGS_WEBRTC = r.SITE_SETTINGS.createChild('webrtc');
|
||||
+ r.SITE_SETTINGS_VIEWPORT = r.SITE_SETTINGS.createChild('viewport-protection');
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/chrome/browser/resources/settings/router.ts b/chrome/browser/resources/settings/router.ts
|
||||
--- a/chrome/browser/resources/settings/router.ts
|
||||
+++ b/chrome/browser/resources/settings/router.ts
|
||||
@@ -109,6 +109,7 @@ export interface SettingsRoutes {
|
||||
SITE_SETTINGS_TIMEZONE_OVERRIDE: Route;
|
||||
SITE_SETTINGS_WEBGL: Route;
|
||||
SITE_SETTINGS_WEBRTC: Route;
|
||||
+ SITE_SETTINGS_VIEWPORT: Route;
|
||||
}
|
||||
|
||||
/** Class for navigable routes. */
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/category_default_setting.ts b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
@@ -200,6 +200,7 @@ export class CategoryDefaultSettingElement extends
|
||||
case ContentSettingsTypes.TIMEZONE_OVERRIDE:
|
||||
case ContentSettingsTypes.WEBGL:
|
||||
case ContentSettingsTypes.WEBRTC:
|
||||
+ case ContentSettingsTypes.VIEWPORT:
|
||||
// "Allowed" vs "Blocked".
|
||||
this.browserProxy.setDefaultValueForContentType(
|
||||
this.category,
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/constants.ts b/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
@@ -51,6 +51,7 @@ export enum ContentSettingsTypes {
|
||||
TIMEZONE_OVERRIDE = 'timezone-override',
|
||||
WEBGL = 'webgl',
|
||||
WEBRTC = 'webrtc',
|
||||
+ VIEWPORT = 'viewport',
|
||||
|
||||
// The following items are not in the C++ kContentSettingsTypeGroupNames, but
|
||||
// are used everywhere where ContentSettingsTypes is used in JS.
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
@@ -144,6 +144,7 @@ export class SettingsCategoryDefaultRadioGroupElement extends
|
||||
case ContentSettingsTypes.TIMEZONE_OVERRIDE:
|
||||
case ContentSettingsTypes.WEBGL:
|
||||
case ContentSettingsTypes.WEBRTC:
|
||||
+ case ContentSettingsTypes.VIEWPORT:
|
||||
// "Allowed" vs "Blocked".
|
||||
return ContentSetting.ALLOW;
|
||||
case ContentSettingsTypes.AR:
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/site_details.html b/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
--- a/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
+++ b/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
@@ -291,4 +291,9 @@
|
||||
icon="settings:webrtc"
|
||||
label="$i18n{siteSettingsWebRTC}">
|
||||
</site-details-permission>
|
||||
+ <site-details-permission
|
||||
+ category="[[contentSettingsTypesEnum_.VIEWPORT]]"
|
||||
+ icon="settings:viewport-protection"
|
||||
+ label="$i18n{siteSettingsViewportProtection}">
|
||||
+ </site-details-permission>
|
||||
</div>
|
||||
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
@@ -374,6 +374,14 @@ function getCategoryItemMap(): Map<ContentSettingsTypes, CategoryListItem> {
|
||||
enabledLabel: 'siteSettingsWebRTCAllowed',
|
||||
disabledLabel: 'siteSettingsWebRTCBlocked',
|
||||
},
|
||||
+ {
|
||||
+ route: routes.SITE_SETTINGS_VIEWPORT,
|
||||
+ id: Id.VIEWPORT,
|
||||
+ label: 'siteSettingsViewportProtection',
|
||||
+ icon: 'settings:viewport-protection',
|
||||
+ enabledLabel: 'siteSettingsViewportProtectionAllowed',
|
||||
+ disabledLabel: 'siteSettingsViewportProtectionBlocked',
|
||||
+ },
|
||||
];
|
||||
|
||||
categoryItemMap = new Map(categoryList.map(item => [item.id, item]));
|
||||
@@ -472,6 +480,7 @@ export class SettingsSiteSettingsPageElement extends
|
||||
Id.TIMEZONE_OVERRIDE,
|
||||
Id.WEBGL,
|
||||
Id.WEBRTC,
|
||||
+ Id.VIEWPORT,
|
||||
]),
|
||||
};
|
||||
},
|
||||
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
@@ -87,6 +87,8 @@ export function getLocalizationStringForContentType(
|
||||
return 'siteSettingsWebglMidSentence';
|
||||
case ContentSettingsTypes.WEBRTC:
|
||||
return 'siteSettingsWebRTCMidSentence';
|
||||
+ case ContentSettingsTypes.VIEWPORT:
|
||||
+ return 'siteSettingsViewportProtectionMidSentence';
|
||||
// The following members do not have a mid-sentence localization.
|
||||
case ContentSettingsTypes.ANTI_ABUSE:
|
||||
case ContentSettingsTypes.PDF_DOCUMENTS:
|
||||
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.cc b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
--- a/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
+++ b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
@@ -384,6 +384,9 @@ const ui::ImageModel PageInfoViewFactory::GetPermissionIcon(
|
||||
case ContentSettingsType::WEBRTC:
|
||||
icon = &vector_icons::kProtectedContentIcon;
|
||||
break;
|
||||
+ case ContentSettingsType::VIEWPORT:
|
||||
+ icon = &vector_icons::kProtectedContentIcon;
|
||||
+ break;
|
||||
default:
|
||||
// All other |ContentSettingsType|s do not have icons on desktop or are
|
||||
// not shown in the Page Info bubble.
|
||||
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
@@ -2555,6 +2555,13 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
|
||||
{"siteSettingsWebRTCAllowedExceptions",IDS_SETTINGS_SITE_SETTINGS_WEBRTC_ALLOWED_EXCEPTIONS},
|
||||
{"siteSettingsWebRTCBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_WEBRTC_BLOCKED_EXCEPTIONS},
|
||||
{"siteSettingsWebRTCMidSentence", IDS_SITE_SETTINGS_WEBRTC_TITLE},
|
||||
+ {"siteSettingsViewportProtection", IDS_SITE_SETTINGS_VIEWPORT_PROTECTION_TITLE},
|
||||
+ {"siteSettingsViewportProtectionDescription", IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_DESCRIPTION},
|
||||
+ {"siteSettingsViewportProtectionAllowed", IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_ALLOWED},
|
||||
+ {"siteSettingsViewportProtectionBlocked", IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_BLOCKED},
|
||||
+ {"siteSettingsViewportProtectionAllowedExceptions",IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_ALLOWED_EXCEPTIONS},
|
||||
+ {"siteSettingsViewportProtectionBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_BLOCKED_EXCEPTIONS},
|
||||
+ {"siteSettingsViewportProtectionMidSentence", IDS_SITE_SETTINGS_VIEWPORT_PROTECTION_TITLE},
|
||||
{"addSite", IDS_SETTINGS_ADD_SITE},
|
||||
{"addSiteTitle", IDS_SETTINGS_ADD_SITE_TITLE},
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
diff --git a/chrome/browser/ui/webui/settings/site_settings_helper.cc b/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
--- a/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
@@ -130,6 +130,7 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
|
||||
{ContentSettingsType::TIMEZONE_OVERRIDE, "timezone-override"},
|
||||
{ContentSettingsType::WEBGL, "webgl"},
|
||||
{ContentSettingsType::WEBRTC, "webrtc"},
|
||||
+ {ContentSettingsType::VIEWPORT, "viewport"},
|
||||
|
||||
// Add new content settings here if a corresponding Javascript string
|
||||
// representation for it is not required, for example if the content setting
|
||||
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
|
||||
@@ -112,6 +112,9 @@ android_library("java") {
|
||||
sources += [
|
||||
"java/src/org/chromium/components/browser_ui/site_settings/BromiteWebRTCContentSetting.java",
|
||||
]
|
||||
+ sources += [
|
||||
+ "java/src/org/chromium/components/browser_ui/site_settings/BromiteViewportContentSetting.java",
|
||||
+ ]
|
||||
annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
|
||||
resources_package = "org.chromium.components.browser_ui.site_settings"
|
||||
deps = [
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java
|
||||
--- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java
|
||||
@@ -45,6 +45,7 @@ public abstract class BromiteCustomContentSettingImpl {
|
||||
mItemList = new ArrayList<BromiteCustomContentSetting>();
|
||||
mItemList.add(new BromiteWebGLContentSetting());
|
||||
mItemList.add(new BromiteWebRTCContentSetting());
|
||||
+ mItemList.add(new BromiteViewportContentSetting());
|
||||
}
|
||||
|
||||
public static SiteSettingsCategory createFromType(
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteViewportContentSetting.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteViewportContentSetting.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteViewportContentSetting.java
|
||||
@@ -0,0 +1,86 @@
|
||||
+/*
|
||||
+ 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;
|
||||
+
|
||||
+import org.chromium.components.browser_ui.site_settings.ContentSettingsResources;
|
||||
+import org.chromium.components.browser_ui.site_settings.SiteSettingsCategory;
|
||||
+import org.chromium.components.content_settings.ContentSettingValues;
|
||||
+import org.chromium.components.content_settings.ContentSettingsType;
|
||||
+import org.chromium.content_public.browser.BrowserContextHandle;
|
||||
+
|
||||
+import androidx.annotation.Nullable;
|
||||
+import androidx.preference.Preference;
|
||||
+import androidx.preference.PreferenceScreen;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+
|
||||
+public class BromiteViewportContentSetting extends BromiteCustomContentSetting {
|
||||
+ public BromiteViewportContentSetting() {
|
||||
+ super(/*contentSettingsType*/ ContentSettingsType.VIEWPORT,
|
||||
+ /*siteSettingsCategory*/ SiteSettingsCategory.Type.VIEWPORT,
|
||||
+ /*defaultEnabledValue*/ ContentSettingValues.ALLOW,
|
||||
+ /*defaultDisabledValue*/ ContentSettingValues.BLOCK,
|
||||
+ /*allowException*/ true,
|
||||
+ /*preferenceKey*/ "viewport",
|
||||
+ /*profilePrefKey*/ "viewport");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ContentSettingsResources.ResourceItem getResourceItem() {
|
||||
+ return new ContentSettingsResources.ResourceItem(
|
||||
+ /*icon*/ R.drawable.web_asset,
|
||||
+ /*title*/ R.string.viewport_permission_title,
|
||||
+ /*defaultEnabledValue*/ getDefaultEnabledValue(),
|
||||
+ /*defaultDisabledValue*/ getDefaultDisabledValue(),
|
||||
+ /*enabledSummary*/ R.string.website_settings_category_viewport_enabled,
|
||||
+ /*disabledSummary*/ R.string.website_settings_category_viewport_disabled);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getCategorySummary(@Nullable @ContentSettingValues int value) {
|
||||
+ switch (value) {
|
||||
+ case ContentSettingValues.ALLOW:
|
||||
+ return R.string.website_settings_category_viewport_enabled;
|
||||
+ case ContentSettingValues.BLOCK:
|
||||
+ return R.string.website_settings_category_viewport_disabled;
|
||||
+ default:
|
||||
+ // this will cause a runtime exception
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean requiresTriStateContentSetting() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean showOnlyDescriptions() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getAddExceptionDialogMessage() {
|
||||
+ return R.string.website_settings_category_viewport_enabled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @Nullable Boolean considerException(SiteSettingsCategory category, @ContentSettingValues int value) {
|
||||
+ return value != ContentSettingValues.BLOCK;
|
||||
+ }
|
||||
+}
|
||||
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
|
||||
@@ -48,7 +48,7 @@ public class SiteSettingsCategory {
|
||||
Type.USE_STORAGE, Type.AUTO_DARK_WEB_CONTENT, Type.REQUEST_DESKTOP_SITE,
|
||||
Type.FEDERATED_IDENTITY_API, Type.THIRD_PARTY_COOKIES, Type.SITE_DATA, Type.ANTI_ABUSE,
|
||||
Type.TIMEZONE_OVERRIDE, Type.AUTOPLAY, Type.JAVASCRIPT_JIT, Type.IMAGES,
|
||||
- Type.NUM_ENTRIES, Type.WEBGL, Type.WEBRTC})
|
||||
+ Type.NUM_ENTRIES, Type.WEBGL, Type.WEBRTC, Type.VIEWPORT})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Type {
|
||||
// All updates here must also be reflected in {@link #preferenceKey(int)
|
||||
@@ -88,10 +88,11 @@ public class SiteSettingsCategory {
|
||||
int IMAGES = 32;
|
||||
int WEBGL = 33;
|
||||
int WEBRTC = 34;
|
||||
+ int VIEWPORT = 35;
|
||||
/**
|
||||
* Number of handled categories used for calculating array sizes.
|
||||
*/
|
||||
- int NUM_ENTRIES = 35;
|
||||
+ int NUM_ENTRIES = 36;
|
||||
}
|
||||
|
||||
private final BrowserContextHandle mBrowserContextHandle;
|
||||
diff --git a/components/browser_ui/strings/android/browser_ui_strings.grd b/components/browser_ui/strings/android/browser_ui_strings.grd
|
||||
--- a/components/browser_ui/strings/android/browser_ui_strings.grd
|
||||
+++ b/components/browser_ui/strings/android/browser_ui_strings.grd
|
||||
@@ -176,6 +176,7 @@
|
||||
<part file="site_settings.grdp" />
|
||||
<part file="webgl.grdp" />
|
||||
<part file="webrtc.grdp" />
|
||||
+ <part file="viewport.grdp" />
|
||||
|
||||
<message name="IDS_GOT_IT" desc="Button for the user to accept a disclosure/message" formatter_data="android_java">
|
||||
Got it
|
||||
diff --git a/components/browser_ui/strings/android/viewport.grdp b/components/browser_ui/strings/android/viewport.grdp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/strings/android/viewport.grdp
|
||||
@@ -0,0 +1,18 @@
|
||||
+<?xml version="1.0" encoding="utf-8"?>
|
||||
+<grit-part>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_VIEWPORT" desc="The label used for viewport size change site settings controls.">
|
||||
+ Viewport Size Protection
|
||||
+ </message>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_VIEWPORT_MID_SENTENCE" desc="The label used for viewport size change site settings controls when used mid-sentence.">
|
||||
+ Viewport Size Protection
|
||||
+ </message>
|
||||
+ <message name="IDS_VIEWPORT_PERMISSION_TITLE" desc="Title of the permission to use viewport size change [CHAR-LIMIT=32]">
|
||||
+ Viewport Size Protection
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_VIEWPORT_ENABLED" desc="Summary text explaining that viewport size change is full enabled.">
|
||||
+ Enabled
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_VIEWPORT_DISABLED" desc="Summary text explaining that viewport size change is full disabled.">
|
||||
+ Disabled
|
||||
+ </message>
|
||||
+</grit-part>
|
||||
diff --git a/components/components_strings.grd b/components/components_strings.grd
|
||||
--- a/components/components_strings.grd
|
||||
+++ b/components/components_strings.grd
|
||||
@@ -339,6 +339,7 @@
|
||||
|
||||
<part file="browser_ui/strings/android/webgl.grdp" />
|
||||
<part file="browser_ui/strings/android/webrtc.grdp" />
|
||||
+ <part file="browser_ui/strings/android/viewport.grdp" />
|
||||
<if expr="not is_ios">
|
||||
<part file="history_clusters_strings.grdp" />
|
||||
</if>
|
||||
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
--- a/components/content_settings/core/browser/content_settings_registry.cc
|
||||
+++ b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
@@ -627,12 +627,25 @@ void ContentSettingsRegistry::Init() {
|
||||
/*valid_settings=*/{CONTENT_SETTING_ALLOW,
|
||||
CONTENT_SETTING_BLOCK},
|
||||
WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
|
||||
- WebsiteSettingsRegistry::PLATFORM_ANDROID,
|
||||
+ WebsiteSettingsRegistry::ALL_PLATFORMS,
|
||||
ContentSettingsInfo::INHERIT_IN_INCOGNITO,
|
||||
ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS,
|
||||
/*show_into_info_page*/ true,
|
||||
/*permission_type_ui*/ IDS_SITE_SETTINGS_TYPE_WEBRTC,
|
||||
/*permission_type_ui_mid_sentence*/ IDS_SITE_SETTINGS_TYPE_WEBRTC_MID_SENTENCE);
|
||||
+
|
||||
+ Register(ContentSettingsType::VIEWPORT, "viewport", CONTENT_SETTING_ALLOW,
|
||||
+ WebsiteSettingsInfo::SYNCABLE,
|
||||
+ /*allowlisted_schemes=*/{},
|
||||
+ /*valid_settings=*/{CONTENT_SETTING_ALLOW,
|
||||
+ CONTENT_SETTING_BLOCK},
|
||||
+ WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
|
||||
+ WebsiteSettingsRegistry::ALL_PLATFORMS,
|
||||
+ ContentSettingsInfo::INHERIT_IN_INCOGNITO,
|
||||
+ ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS,
|
||||
+ /*show_into_info_page*/ true,
|
||||
+ /*permission_type_ui*/ IDS_SITE_SETTINGS_TYPE_VIEWPORT,
|
||||
+ /*permission_type_ui_mid_sentence*/ IDS_SITE_SETTINGS_TYPE_VIEWPORT_MID_SENTENCE);
|
||||
}
|
||||
|
||||
void ContentSettingsRegistry::Register(
|
||||
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
|
||||
@@ -162,6 +162,8 @@ void GetRendererContentSettingRules(const HostContentSettingsMap* map,
|
||||
&(rules->webgl_rules));
|
||||
map->GetSettingsForOneType(ContentSettingsType::WEBRTC,
|
||||
&(rules->webrtc_rules));
|
||||
+ map->GetSettingsForOneType(ContentSettingsType::VIEWPORT,
|
||||
+ &(rules->viewport_rules));
|
||||
}
|
||||
|
||||
bool IsMorePermissive(ContentSetting a, ContentSetting b) {
|
||||
diff --git a/components/content_settings/core/common/content_settings.cc b/components/content_settings/core/common/content_settings.cc
|
||||
--- a/components/content_settings/core/common/content_settings.cc
|
||||
+++ b/components/content_settings/core/common/content_settings.cc
|
||||
@@ -221,7 +221,8 @@ bool RendererContentSettingRules::IsRendererContentSetting(
|
||||
content_type == ContentSettingsType::AUTO_DARK_WEB_CONTENT ||
|
||||
content_type == ContentSettingsType::TIMEZONE_OVERRIDE ||
|
||||
content_type == ContentSettingsType::WEBGL ||
|
||||
- content_type == ContentSettingsType::WEBRTC;
|
||||
+ content_type == ContentSettingsType::WEBRTC ||
|
||||
+ content_type == ContentSettingsType::VIEWPORT;
|
||||
}
|
||||
|
||||
void RendererContentSettingRules::FilterRulesByOutermostMainFrameURL(
|
||||
@@ -235,6 +236,7 @@ void RendererContentSettingRules::FilterRulesByOutermostMainFrameURL(
|
||||
FilterRulesForType(autoplay_rules, outermost_main_frame_url);
|
||||
FilterRulesForType(webgl_rules, outermost_main_frame_url);
|
||||
FilterRulesForType(webrtc_rules, outermost_main_frame_url);
|
||||
+ FilterRulesForType(viewport_rules, outermost_main_frame_url);
|
||||
}
|
||||
|
||||
RendererContentSettingRules::RendererContentSettingRules() = default;
|
||||
diff --git a/components/content_settings/core/common/content_settings.h b/components/content_settings/core/common/content_settings.h
|
||||
--- a/components/content_settings/core/common/content_settings.h
|
||||
+++ b/components/content_settings/core/common/content_settings.h
|
||||
@@ -98,6 +98,7 @@ struct RendererContentSettingRules {
|
||||
std::string timezone_override_value;
|
||||
ContentSettingsForOneType webgl_rules;
|
||||
ContentSettingsForOneType webrtc_rules;
|
||||
+ ContentSettingsForOneType viewport_rules;
|
||||
};
|
||||
|
||||
namespace content_settings {
|
||||
diff --git a/components/content_settings/core/common/content_settings.mojom b/components/content_settings/core/common/content_settings.mojom
|
||||
--- a/components/content_settings/core/common/content_settings.mojom
|
||||
+++ b/components/content_settings/core/common/content_settings.mojom
|
||||
@@ -83,4 +83,5 @@ struct RendererContentSettingRules {
|
||||
string timezone_override_value;
|
||||
array<ContentSettingPatternSource> webgl_rules;
|
||||
array<ContentSettingPatternSource> webrtc_rules;
|
||||
+ array<ContentSettingPatternSource> viewport_rules;
|
||||
};
|
||||
diff --git a/components/content_settings/core/common/content_settings_mojom_traits.cc b/components/content_settings/core/common/content_settings_mojom_traits.cc
|
||||
--- a/components/content_settings/core/common/content_settings_mojom_traits.cc
|
||||
+++ b/components/content_settings/core/common/content_settings_mojom_traits.cc
|
||||
@@ -107,7 +107,8 @@ bool StructTraits<content_settings::mojom::RendererContentSettingRulesDataView,
|
||||
data.ReadTimezoneOverrideRules(&out->timezone_override_rules) &&
|
||||
data.ReadTimezoneOverrideValue(&out->timezone_override_value) &&
|
||||
data.ReadWebglRules(&out->webgl_rules) &&
|
||||
- data.ReadWebrtcRules(&out->webrtc_rules);
|
||||
+ data.ReadWebrtcRules(&out->webrtc_rules) &&
|
||||
+ data.ReadViewportRules(&out->viewport_rules);
|
||||
}
|
||||
|
||||
} // namespace mojo
|
||||
diff --git a/components/content_settings/core/common/content_settings_mojom_traits.h b/components/content_settings/core/common/content_settings_mojom_traits.h
|
||||
--- a/components/content_settings/core/common/content_settings_mojom_traits.h
|
||||
+++ b/components/content_settings/core/common/content_settings_mojom_traits.h
|
||||
@@ -175,6 +175,11 @@ struct StructTraits<
|
||||
return r.webrtc_rules;
|
||||
}
|
||||
|
||||
+ static const std::vector<ContentSettingPatternSource>& viewport_rules(
|
||||
+ const RendererContentSettingRules& r) {
|
||||
+ return r.viewport_rules;
|
||||
+ }
|
||||
+
|
||||
static bool Read(
|
||||
content_settings::mojom::RendererContentSettingRulesDataView data,
|
||||
RendererContentSettingRules* out);
|
||||
diff --git a/components/content_settings/core/common/content_settings_types.h b/components/content_settings/core/common/content_settings_types.h
|
||||
--- a/components/content_settings/core/common/content_settings_types.h
|
||||
+++ b/components/content_settings/core/common/content_settings_types.h
|
||||
@@ -281,6 +281,8 @@ enum class ContentSettingsType : int32_t {
|
||||
|
||||
WEBRTC,
|
||||
|
||||
+ VIEWPORT,
|
||||
+
|
||||
// Setting to indicate whether browser should allow signing into a website via
|
||||
// the browser FedCM API.
|
||||
FEDERATED_IDENTITY_API,
|
||||
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
|
||||
@@ -459,6 +459,15 @@ bool ContentSettingsAgentImpl::AllowWebRTC(bool enabled_per_settings) {
|
||||
url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL());
|
||||
}
|
||||
|
||||
+bool ContentSettingsAgentImpl::AllowViewportChange(bool enabled_per_settings) {
|
||||
+ if (!content_setting_rules_)
|
||||
+ return false;
|
||||
+ blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
|
||||
+ return CONTENT_SETTING_ALLOW == GetContentSettingFromRules(
|
||||
+ content_setting_rules_->viewport_rules,
|
||||
+ url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL());
|
||||
+}
|
||||
+
|
||||
bool ContentSettingsAgentImpl::IsAllowlistedForContentSettings() const {
|
||||
if (should_allowlist_)
|
||||
return true;
|
||||
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
|
||||
@@ -101,6 +101,7 @@ class ContentSettingsAgentImpl
|
||||
bool ShouldAutoupgradeMixedContent() override;
|
||||
bool AllowWebgl(bool enabled_per_settings) override;
|
||||
bool AllowWebRTC(bool enabled_per_settings) override;
|
||||
+ bool AllowViewportChange(bool enabled_per_settings) override;
|
||||
|
||||
bool allow_running_insecure_content() const {
|
||||
return allow_running_insecure_content_;
|
||||
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc
|
||||
--- a/third_party/blink/common/features.cc
|
||||
+++ b/third_party/blink/common/features.cc
|
||||
@@ -222,7 +222,7 @@ BASE_FEATURE(kPath2DPaintCache,
|
||||
|
||||
BASE_FEATURE(kViewportProtection,
|
||||
"ViewportProtection",
|
||||
- base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
+ base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
BASE_FEATURE(kPrivacySandboxAdsAPIs,
|
||||
"PrivacySandboxAdsAPIs", // disabled by default
|
||||
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
|
||||
@@ -103,6 +103,8 @@ class WebContentSettingsClient {
|
||||
|
||||
virtual bool AllowWebRTC(bool default_value) { return default_value; }
|
||||
|
||||
+ virtual bool AllowViewportChange(bool default_value) { return default_value; }
|
||||
+
|
||||
// Reports that passive mixed content was found at the provided URL.
|
||||
virtual void PassiveInsecureContentFound(const WebURL&) {}
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
@@ -2322,6 +2322,7 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
||||
// var w = window.open()
|
||||
// var not_emulated_screen_info = w.screen
|
||||
bool protection_enabled = base::FeatureList::IsEnabled(features::kViewportProtection);
|
||||
+ protection_enabled |= GetFrame()->GetContentSettingsClient()->AllowViewportChange(false);
|
||||
result.frame->GetPage()->CalculateEmulatedScreenSetting(
|
||||
To<LocalFrame>(result.frame),
|
||||
/*force*/ protection_enabled);
|
||||
diff --git a/third_party/blink/renderer/core/page/page.cc b/third_party/blink/renderer/core/page/page.cc
|
||||
--- a/third_party/blink/renderer/core/page/page.cc
|
||||
+++ b/third_party/blink/renderer/core/page/page.cc
|
||||
@@ -884,6 +884,8 @@ void Page::UpdateAcceleratedCompositingSettings() {
|
||||
|
||||
void Page::CalculateEmulatedScreenSetting(LocalFrame* frame, bool force) {
|
||||
bool isEnabled = base::FeatureList::IsEnabled(features::kViewportProtection);
|
||||
+ blink::WebContentSettingsClient* settings = frame->GetContentSettingsClient();
|
||||
+ isEnabled |= (settings && settings->AllowViewportChange(false));
|
||||
if (isEnabled || force) {
|
||||
// this is the maximum (and minimum) value which in percentage
|
||||
// corresponds to +- 0.03%
|
||||
--
|
||||
2.25.1
|
||||
@@ -1,254 +0,0 @@
|
||||
From: Your Name <you@example.com>
|
||||
Date: Thu, 13 Oct 2022 08:12:18 +0000
|
||||
Subject: WIN ADDTO Add webGL site setting
|
||||
|
||||
---
|
||||
chrome/app/settings_strings.grdp | 19 ++++++++++++++++
|
||||
chrome/browser/resources/settings/icons.html | 2 ++
|
||||
.../settings/privacy_page/privacy_page.html | 22 +++++++++++++++++++
|
||||
chrome/browser/resources/settings/route.ts | 1 +
|
||||
chrome/browser/resources/settings/router.ts | 1 +
|
||||
.../site_settings/category_default_setting.ts | 1 +
|
||||
.../settings/site_settings/constants.ts | 1 +
|
||||
.../settings_category_default_radio_group.ts | 1 +
|
||||
.../settings/site_settings/site_details.html | 5 +++++
|
||||
.../site_settings_page/site_settings_page.ts | 9 ++++++++
|
||||
.../site_settings_page_util.ts | 2 ++
|
||||
.../views/page_info/page_info_view_factory.cc | 3 +++
|
||||
.../settings_localized_strings_provider.cc | 7 ++++++
|
||||
.../ui/webui/settings/site_settings_helper.cc | 1 +
|
||||
.../core/browser/content_settings_registry.cc | 2 +-
|
||||
15 files changed, 76 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp
|
||||
--- a/chrome/app/settings_strings.grdp
|
||||
+++ b/chrome/app/settings_strings.grdp
|
||||
@@ -4386,6 +4386,25 @@
|
||||
Random Timezone override
|
||||
</message>
|
||||
|
||||
+ <message name="IDS_SITE_SETTINGS_WEBGL_TITLE" desc="Description of the webgl content setting page title.">
|
||||
+ Webgl
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBGL_DESCRIPTION" desc="Description of the webgl content setting.">
|
||||
+ Enable Webgl
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBGL_ALLOWED" desc="Label for the enabled option of the Webgl setting.">
|
||||
+ Webgl is enabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBGL_BLOCKED" desc="Label for the disabled option of the Webgl setting.">
|
||||
+ Webgl is disabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBGL_ALLOWED_EXCEPTIONS" desc="Label for the allowed exceptions site list of the webgl setting.">
|
||||
+ Allowed to use webgl
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBGL_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the webgl setting.">
|
||||
+ Not allowed to use webgl
|
||||
+ </message>
|
||||
+
|
||||
<if expr="not is_chromeos">
|
||||
<!-- Import Settings Dialog -->
|
||||
<message name="IDS_SETTINGS_IMPORT_SETTINGS_TITLE" desc="Dialog title for import dialog.">
|
||||
diff --git a/chrome/browser/resources/settings/icons.html b/chrome/browser/resources/settings/icons.html
|
||||
--- a/chrome/browser/resources/settings/icons.html
|
||||
+++ b/chrome/browser/resources/settings/icons.html
|
||||
@@ -197,6 +197,8 @@ NOTE: Chrome OS icons go in ./chromeos/os_icons.html.
|
||||
<g id="javascript-jit-off"><path d="M19.17,12l-4.58-4.59L16,6l6,6l-3.59,3.59L17,14.17L19.17,12z M1.39,4.22l4.19,4.19L2,12l6,6l1.41-1.41L4.83,12L7,9.83 l12.78,12.78l1.41-1.41L2.81,2.81L1.39,4.22z"></path></g>
|
||||
<g id="timezone-override"><path d="M21.72 11.33l-6.644-7.035a.97.97 0 0 0-1.38-.01l-1.67 1.72-1.617-1.712a.97.97 0 0 0-1.38-.01l-6.737 6.935c-.187.191-.29.447-.292.719-.002.272.099.529.28.722l6.644 7.034a.949.949 0 0 0 1.38.011l1.671-1.718 1.615 1.71a.949.949 0 0 0 1.381.01l6.74-6.935a1.054 1.054 0 0 0 .01-1.44zM6.947 12.464l3.657 3.785-.974.98-5.273-5.456 5.349-5.378.929.962-3.677 3.7a.998.998 0 0 0-.292.702 1 1 0 0 0 .28.705zm7.35 4.768l-.931-.963 3.68-3.7a1.012 1.012 0 0 0 .007-1.407l-3.656-3.784.974-.98 5.273 5.456-5.348 5.378z"></path></g>
|
||||
<g id="timezone-override-off"><path d="M7.95,5.12l0.73-0.8C8.88,4.11,9.15,4,9.42,4c0.27,0,0.54,0.11,0.74,0.32L12,6.34l1.85-2.01C14.04,4.11,14.31,4,14.58,4 c0.27,0,0.54,0.11,0.74,0.32l6.42,7c0.35,0.38,0.35,0.97,0,1.35l-2.98,3.25l-1.42-1.42l2.3-2.51l-5.06-5.52l-1.23,1.34l3.21,3.51 c0.35,0.38,0.35,0.97,0,1.35l-0.51,0.56L7.95,5.12z M19.78,22.61l-3.73-3.73l-0.73,0.8c-0.2,0.22-0.47,0.32-0.74,0.32 c-0.27,0-0.54-0.11-0.74-0.32L12,17.66l-1.85,2.01C9.96,19.89,9.69,20,9.42,20c-0.27,0-0.54-0.11-0.74-0.32l-6.42-7 c-0.35-0.38-0.35-0.97,0-1.35l2.98-3.25L1.39,4.22l1.41-1.41l18.38,18.38L19.78,22.61z M10.64,16.18l-3.21-3.51 c-0.35-0.38-0.35-0.97,0-1.35l0.51-0.56L6.66,9.49L4.36,12l5.06,5.52L10.64,16.18z"></path></g>
|
||||
+ <g id="webgl"><path d="M8 16h8v2H8v-2zm0-4h8v2H8v-2zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z" fill="#5F6368"></path></g>
|
||||
+ <g id="webgl-off"><path d="M13.002 4.001H7.106L5.252 2.148c.232-.094.485-.147.75-.147h8l6 6v8.896l-2-2V9.001h-5v-5z" fill="#5F6368"></path><path d="M16.002 12.001h-.896l.896.896v-.896zM.6 3.45l1.414-1.414 19.94 19.94-1.414 1.414L.6 3.45zM3.986 20.01V6.84l2 2V20.01h11.172l1.765 1.766c-.28.15-.599.234-.937.234H5.976c-1.1 0-1.99-.9-1.99-2z" fill="#5F6368"></path><path d="M9.158 12.01H7.986v2h3.172l-2-2zM13.158 16.01H7.986v2h7.172l-2-2z" fill="#5F6368"></path></g>
|
||||
</defs>
|
||||
</svg>
|
||||
</iron-iconset-svg>
|
||||
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
--- a/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
+++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
@@ -1170,4 +1170,26 @@
|
||||
</category-setting-exceptions>
|
||||
</settings-subpage>
|
||||
</template>
|
||||
+ <template is="dom-if" route-path="/content/webgl" no-search>
|
||||
+ <settings-subpage page-title="$i18n{siteSettingsWebgl}"
|
||||
+ search-label="$i18n{siteSettingsAllSitesSearch}"
|
||||
+ search-term="{{searchFilter_}}">
|
||||
+ <div class="content-settings-header secondary">
|
||||
+ $i18n{siteSettingsWebglDescription}
|
||||
+ </div>
|
||||
+ <settings-category-default-radio-group
|
||||
+ category="[[contentSettingsTypesEnum_.WEBGL]]"
|
||||
+ allow-option-label="$i18n{siteSettingsWebglAllowed}"
|
||||
+ allow-option-icon="settings:webgl"
|
||||
+ block-option-label="$i18n{siteSettingsWebglBlocked}"
|
||||
+ block-option-icon="settings:webgl-off">
|
||||
+ </settings-category-default-radio-group>
|
||||
+ <category-setting-exceptions
|
||||
+ category="[[contentSettingsTypesEnum_.WEBGL]]"
|
||||
+ block-header="$i18n{siteSettingsWebglBlockedExceptions}"
|
||||
+ allow-header="$i18n{siteSettingsWebglAllowedExceptions}"
|
||||
+ search-filter="[[searchFilter_]]">
|
||||
+ </category-setting-exceptions>
|
||||
+ </settings-subpage>
|
||||
+ </template>
|
||||
</settings-animated-pages>
|
||||
diff --git a/chrome/browser/resources/settings/route.ts b/chrome/browser/resources/settings/route.ts
|
||||
--- a/chrome/browser/resources/settings/route.ts
|
||||
+++ b/chrome/browser/resources/settings/route.ts
|
||||
@@ -125,6 +125,7 @@ function addPrivacyChildRoutes(r: Partial<SettingsRoutes>) {
|
||||
r.SITE_SETTINGS_AUTOPLAY = r.SITE_SETTINGS.createChild('autoplay');
|
||||
r.SITE_SETTINGS_JAVASCRIPT_JIT = r.SITE_SETTINGS.createChild('javascript-jit');
|
||||
r.SITE_SETTINGS_TIMEZONE_OVERRIDE = r.SITE_SETTINGS.createChild('timezone-override');
|
||||
+ r.SITE_SETTINGS_WEBGL = r.SITE_SETTINGS.createChild('webgl');
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/chrome/browser/resources/settings/router.ts b/chrome/browser/resources/settings/router.ts
|
||||
--- a/chrome/browser/resources/settings/router.ts
|
||||
+++ b/chrome/browser/resources/settings/router.ts
|
||||
@@ -107,6 +107,7 @@ export interface SettingsRoutes {
|
||||
SITE_SETTINGS_AUTOPLAY: Route;
|
||||
SITE_SETTINGS_JAVASCRIPT_JIT: Route;
|
||||
SITE_SETTINGS_TIMEZONE_OVERRIDE: Route;
|
||||
+ SITE_SETTINGS_WEBGL: Route;
|
||||
}
|
||||
|
||||
/** Class for navigable routes. */
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/category_default_setting.ts b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
@@ -198,6 +198,7 @@ export class CategoryDefaultSettingElement extends
|
||||
case ContentSettingsTypes.AUTOPLAY:
|
||||
case ContentSettingsTypes.JAVASCRIPT_JIT:
|
||||
case ContentSettingsTypes.TIMEZONE_OVERRIDE:
|
||||
+ case ContentSettingsTypes.WEBGL:
|
||||
// "Allowed" vs "Blocked".
|
||||
this.browserProxy.setDefaultValueForContentType(
|
||||
this.category,
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/constants.ts b/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
@@ -49,6 +49,7 @@ export enum ContentSettingsTypes {
|
||||
AUTOPLAY = 'autoplay',
|
||||
JAVASCRIPT_JIT = 'javascript-jit',
|
||||
TIMEZONE_OVERRIDE = 'timezone-override',
|
||||
+ WEBGL = 'webgl',
|
||||
|
||||
// The following items are not in the C++ kContentSettingsTypeGroupNames, but
|
||||
// are used everywhere where ContentSettingsTypes is used in JS.
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
@@ -142,6 +142,7 @@ export class SettingsCategoryDefaultRadioGroupElement extends
|
||||
case ContentSettingsTypes.AUTOPLAY:
|
||||
case ContentSettingsTypes.JAVASCRIPT_JIT:
|
||||
case ContentSettingsTypes.TIMEZONE_OVERRIDE:
|
||||
+ case ContentSettingsTypes.WEBGL:
|
||||
// "Allowed" vs "Blocked".
|
||||
return ContentSetting.ALLOW;
|
||||
case ContentSettingsTypes.AR:
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/site_details.html b/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
--- a/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
+++ b/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
@@ -281,4 +281,9 @@
|
||||
icon="settings:timezone-override"
|
||||
label="$i18n{siteSettingsTimezoneOverride}">
|
||||
</site-details-permission>
|
||||
+ <site-details-permission
|
||||
+ category="[[contentSettingsTypesEnum_.WEBGL]]"
|
||||
+ icon="settings:webgl"
|
||||
+ label="$i18n{siteSettingsWebgl}">
|
||||
+ </site-details-permission>
|
||||
</div>
|
||||
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
@@ -358,6 +358,14 @@ function getCategoryItemMap(): Map<ContentSettingsTypes, CategoryListItem> {
|
||||
enabledLabel: 'siteSettingsTimezoneOverrideAllowed',
|
||||
disabledLabel: 'siteSettingsTimezoneOverrideBlocked',
|
||||
},
|
||||
+ {
|
||||
+ route: routes.SITE_SETTINGS_WEBGL,
|
||||
+ id: Id.WEBGL,
|
||||
+ label: 'siteSettingsWebgl',
|
||||
+ icon: 'settings:webgl',
|
||||
+ enabledLabel: 'siteSettingsWebglAllowed',
|
||||
+ disabledLabel: 'siteSettingsWebglBlocked',
|
||||
+ },
|
||||
];
|
||||
|
||||
categoryItemMap = new Map(categoryList.map(item => [item.id, item]));
|
||||
@@ -454,6 +462,7 @@ export class SettingsSiteSettingsPageElement extends
|
||||
Id.AUTOPLAY,
|
||||
Id.JAVASCRIPT_JIT,
|
||||
Id.TIMEZONE_OVERRIDE,
|
||||
+ Id.WEBGL,
|
||||
]),
|
||||
};
|
||||
},
|
||||
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
@@ -83,6 +83,8 @@ export function getLocalizationStringForContentType(
|
||||
return 'siteSettingsJavascriptJITMidSentence';
|
||||
case ContentSettingsTypes.TIMEZONE_OVERRIDE:
|
||||
return 'siteSettingsTimezoneOverrideMidSentence';
|
||||
+ case ContentSettingsTypes.WEBGL:
|
||||
+ return 'siteSettingsWebglMidSentence';
|
||||
// The following members do not have a mid-sentence localization.
|
||||
case ContentSettingsTypes.ANTI_ABUSE:
|
||||
case ContentSettingsTypes.PDF_DOCUMENTS:
|
||||
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.cc b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
--- a/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
+++ b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
@@ -378,6 +378,9 @@ const ui::ImageModel PageInfoViewFactory::GetPermissionIcon(
|
||||
case ContentSettingsType::TIMEZONE_OVERRIDE:
|
||||
icon = &vector_icons::kAccountCircleIcon;
|
||||
break;
|
||||
+ case ContentSettingsType::WEBGL:
|
||||
+ icon = &vector_icons::kProtectedContentIcon;
|
||||
+ break;
|
||||
default:
|
||||
// All other |ContentSettingsType|s do not have icons on desktop or are
|
||||
// not shown in the Page Info bubble.
|
||||
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
@@ -2541,6 +2541,13 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
|
||||
{"siteSettingsTimezoneOverrideAllowedExceptions",IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_ALLOWED_EXCEPTIONS},
|
||||
{"siteSettingsTimezoneOverrideBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_BLOCKED_EXCEPTIONS},
|
||||
{"siteSettingsTimezoneOverrideMidSentence", IDS_SITE_SETTINGS_TIMEZONE_OVERRIDE_TITLE},
|
||||
+ {"siteSettingsWebgl", IDS_SITE_SETTINGS_WEBGL_TITLE},
|
||||
+ {"siteSettingsWebglDescription", IDS_SETTINGS_SITE_SETTINGS_WEBGL_DESCRIPTION},
|
||||
+ {"siteSettingsWebglAllowed", IDS_SETTINGS_SITE_SETTINGS_WEBGL_ALLOWED},
|
||||
+ {"siteSettingsWebglBlocked", IDS_SETTINGS_SITE_SETTINGS_WEBGL_BLOCKED},
|
||||
+ {"siteSettingsWebglAllowedExceptions",IDS_SETTINGS_SITE_SETTINGS_WEBGL_ALLOWED_EXCEPTIONS},
|
||||
+ {"siteSettingsWebglBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_WEBGL_BLOCKED_EXCEPTIONS},
|
||||
+ {"siteSettingsWebglMidSentence", IDS_SITE_SETTINGS_WEBGL_TITLE},
|
||||
{"addSite", IDS_SETTINGS_ADD_SITE},
|
||||
{"addSiteTitle", IDS_SETTINGS_ADD_SITE_TITLE},
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
diff --git a/chrome/browser/ui/webui/settings/site_settings_helper.cc b/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
--- a/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
@@ -128,6 +128,7 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
|
||||
{ContentSettingsType::AUTOPLAY, "autoplay"},
|
||||
{ContentSettingsType::JAVASCRIPT_JIT, "javascript-jit"},
|
||||
{ContentSettingsType::TIMEZONE_OVERRIDE, "timezone-override"},
|
||||
+ {ContentSettingsType::WEBGL, "webgl"},
|
||||
|
||||
// Add new content settings here if a corresponding Javascript string
|
||||
// representation for it is not required, for example if the content setting
|
||||
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
--- a/components/content_settings/core/browser/content_settings_registry.cc
|
||||
+++ b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
@@ -614,7 +614,7 @@ void ContentSettingsRegistry::Init() {
|
||||
/*valid_settings=*/{CONTENT_SETTING_ALLOW,
|
||||
CONTENT_SETTING_BLOCK},
|
||||
WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
|
||||
- WebsiteSettingsRegistry::PLATFORM_ANDROID,
|
||||
+ WebsiteSettingsRegistry::ALL_PLATFORMS,
|
||||
ContentSettingsInfo::INHERIT_IN_INCOGNITO,
|
||||
ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS,
|
||||
/*show_into_info_page*/ true,
|
||||
--
|
||||
2.25.1
|
||||
@@ -1,241 +0,0 @@
|
||||
From: Your Name <you@example.com>
|
||||
Date: Thu, 13 Oct 2022 08:52:11 +0000
|
||||
Subject: WIN ADDTO Add webRTC site settings
|
||||
|
||||
---
|
||||
chrome/app/settings_strings.grdp | 19 ++++++++++++++++
|
||||
chrome/browser/resources/settings/icons.html | 2 ++
|
||||
.../settings/privacy_page/privacy_page.html | 22 +++++++++++++++++++
|
||||
chrome/browser/resources/settings/route.ts | 1 +
|
||||
chrome/browser/resources/settings/router.ts | 1 +
|
||||
.../site_settings/category_default_setting.ts | 1 +
|
||||
.../settings/site_settings/constants.ts | 1 +
|
||||
.../settings_category_default_radio_group.ts | 1 +
|
||||
.../settings/site_settings/site_details.html | 5 +++++
|
||||
.../site_settings_page/site_settings_page.ts | 9 ++++++++
|
||||
.../site_settings_page_util.ts | 2 ++
|
||||
.../views/page_info/page_info_view_factory.cc | 3 +++
|
||||
.../settings_localized_strings_provider.cc | 7 ++++++
|
||||
.../ui/webui/settings/site_settings_helper.cc | 1 +
|
||||
14 files changed, 75 insertions(+)
|
||||
|
||||
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp
|
||||
--- a/chrome/app/settings_strings.grdp
|
||||
+++ b/chrome/app/settings_strings.grdp
|
||||
@@ -4405,6 +4405,25 @@
|
||||
Not allowed to use webgl
|
||||
</message>
|
||||
|
||||
+ <message name="IDS_SITE_SETTINGS_WEBRTC_TITLE" desc="Description of the WebRTC content setting page title.">
|
||||
+ WebRTC
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBRTC_DESCRIPTION" desc="Description of the WebRTC content setting.">
|
||||
+ Enable WebRTC
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBRTC_ALLOWED" desc="Label for the enabled option of the WebRTC setting.">
|
||||
+ WebRTC is enabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBRTC_BLOCKED" desc="Label for the disabled option of the WebRTC setting.">
|
||||
+ WebRTC is disabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBRTC_ALLOWED_EXCEPTIONS" desc="Label for the allowed exceptions site list of the WebRTC setting.">
|
||||
+ Allowed to use WebRTC
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBRTC_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the WebRTC setting.">
|
||||
+ Not allowed to use WebRTC
|
||||
+ </message>
|
||||
+
|
||||
<if expr="not is_chromeos">
|
||||
<!-- Import Settings Dialog -->
|
||||
<message name="IDS_SETTINGS_IMPORT_SETTINGS_TITLE" desc="Dialog title for import dialog.">
|
||||
diff --git a/chrome/browser/resources/settings/icons.html b/chrome/browser/resources/settings/icons.html
|
||||
--- a/chrome/browser/resources/settings/icons.html
|
||||
+++ b/chrome/browser/resources/settings/icons.html
|
||||
@@ -199,6 +199,8 @@ NOTE: Chrome OS icons go in ./chromeos/os_icons.html.
|
||||
<g id="timezone-override-off"><path d="M7.95,5.12l0.73-0.8C8.88,4.11,9.15,4,9.42,4c0.27,0,0.54,0.11,0.74,0.32L12,6.34l1.85-2.01C14.04,4.11,14.31,4,14.58,4 c0.27,0,0.54,0.11,0.74,0.32l6.42,7c0.35,0.38,0.35,0.97,0,1.35l-2.98,3.25l-1.42-1.42l2.3-2.51l-5.06-5.52l-1.23,1.34l3.21,3.51 c0.35,0.38,0.35,0.97,0,1.35l-0.51,0.56L7.95,5.12z M19.78,22.61l-3.73-3.73l-0.73,0.8c-0.2,0.22-0.47,0.32-0.74,0.32 c-0.27,0-0.54-0.11-0.74-0.32L12,17.66l-1.85,2.01C9.96,19.89,9.69,20,9.42,20c-0.27,0-0.54-0.11-0.74-0.32l-6.42-7 c-0.35-0.38-0.35-0.97,0-1.35l2.98-3.25L1.39,4.22l1.41-1.41l18.38,18.38L19.78,22.61z M10.64,16.18l-3.21-3.51 c-0.35-0.38-0.35-0.97,0-1.35l0.51-0.56L6.66,9.49L4.36,12l5.06,5.52L10.64,16.18z"></path></g>
|
||||
<g id="webgl"><path d="M8 16h8v2H8v-2zm0-4h8v2H8v-2zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z" fill="#5F6368"></path></g>
|
||||
<g id="webgl-off"><path d="M13.002 4.001H7.106L5.252 2.148c.232-.094.485-.147.75-.147h8l6 6v8.896l-2-2V9.001h-5v-5z" fill="#5F6368"></path><path d="M16.002 12.001h-.896l.896.896v-.896zM.6 3.45l1.414-1.414 19.94 19.94-1.414 1.414L.6 3.45zM3.986 20.01V6.84l2 2V20.01h11.172l1.765 1.766c-.28.15-.599.234-.937.234H5.976c-1.1 0-1.99-.9-1.99-2z" fill="#5F6368"></path><path d="M9.158 12.01H7.986v2h3.172l-2-2zM13.158 16.01H7.986v2h7.172l-2-2z" fill="#5F6368"></path></g>
|
||||
+ <g id="webrtc"><path d="M8 16h8v2H8v-2zm0-4h8v2H8v-2zm6-10H6c-1.1 0-2 .9-2 2v16c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm4 18H6V4h7v5h5v11z" fill="#5F6368"></path></g>
|
||||
+ <g id="webrtc-off"><path d="M13.002 4.001H7.106L5.252 2.148c.232-.094.485-.147.75-.147h8l6 6v8.896l-2-2V9.001h-5v-5z" fill="#5F6368"></path><path d="M16.002 12.001h-.896l.896.896v-.896zM.6 3.45l1.414-1.414 19.94 19.94-1.414 1.414L.6 3.45zM3.986 20.01V6.84l2 2V20.01h11.172l1.765 1.766c-.28.15-.599.234-.937.234H5.976c-1.1 0-1.99-.9-1.99-2z" fill="#5F6368"></path><path d="M9.158 12.01H7.986v2h3.172l-2-2zM13.158 16.01H7.986v2h7.172l-2-2z" fill="#5F6368"></path></g>
|
||||
</defs>
|
||||
</svg>
|
||||
</iron-iconset-svg>
|
||||
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
--- a/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
+++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
@@ -1192,4 +1192,26 @@
|
||||
</category-setting-exceptions>
|
||||
</settings-subpage>
|
||||
</template>
|
||||
+ <template is="dom-if" route-path="/content/webrtc" no-search>
|
||||
+ <settings-subpage page-title="$i18n{siteSettingsWebRTC}"
|
||||
+ search-label="$i18n{siteSettingsAllSitesSearch}"
|
||||
+ search-term="{{searchFilter_}}">
|
||||
+ <div class="content-settings-header secondary">
|
||||
+ $i18n{siteSettingsWebRTCDescription}
|
||||
+ </div>
|
||||
+ <settings-category-default-radio-group
|
||||
+ category="[[contentSettingsTypesEnum_.WEBRTC]]"
|
||||
+ allow-option-label="$i18n{siteSettingsWebRTCAllowed}"
|
||||
+ allow-option-icon="settings:webrtc"
|
||||
+ block-option-label="$i18n{siteSettingsWebRTCBlocked}"
|
||||
+ block-option-icon="settings:webrtc-off">
|
||||
+ </settings-category-default-radio-group>
|
||||
+ <category-setting-exceptions
|
||||
+ category="[[contentSettingsTypesEnum_.WEBRTC]]"
|
||||
+ block-header="$i18n{siteSettingsWebRTCBlockedExceptions}"
|
||||
+ allow-header="$i18n{siteSettingsWebRTCAllowedExceptions}"
|
||||
+ search-filter="[[searchFilter_]]">
|
||||
+ </category-setting-exceptions>
|
||||
+ </settings-subpage>
|
||||
+ </template>
|
||||
</settings-animated-pages>
|
||||
diff --git a/chrome/browser/resources/settings/route.ts b/chrome/browser/resources/settings/route.ts
|
||||
--- a/chrome/browser/resources/settings/route.ts
|
||||
+++ b/chrome/browser/resources/settings/route.ts
|
||||
@@ -126,6 +126,7 @@ function addPrivacyChildRoutes(r: Partial<SettingsRoutes>) {
|
||||
r.SITE_SETTINGS_JAVASCRIPT_JIT = r.SITE_SETTINGS.createChild('javascript-jit');
|
||||
r.SITE_SETTINGS_TIMEZONE_OVERRIDE = r.SITE_SETTINGS.createChild('timezone-override');
|
||||
r.SITE_SETTINGS_WEBGL = r.SITE_SETTINGS.createChild('webgl');
|
||||
+ r.SITE_SETTINGS_WEBRTC = r.SITE_SETTINGS.createChild('webrtc');
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/chrome/browser/resources/settings/router.ts b/chrome/browser/resources/settings/router.ts
|
||||
--- a/chrome/browser/resources/settings/router.ts
|
||||
+++ b/chrome/browser/resources/settings/router.ts
|
||||
@@ -108,6 +108,7 @@ export interface SettingsRoutes {
|
||||
SITE_SETTINGS_JAVASCRIPT_JIT: Route;
|
||||
SITE_SETTINGS_TIMEZONE_OVERRIDE: Route;
|
||||
SITE_SETTINGS_WEBGL: Route;
|
||||
+ SITE_SETTINGS_WEBRTC: Route;
|
||||
}
|
||||
|
||||
/** Class for navigable routes. */
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/category_default_setting.ts b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
@@ -199,6 +199,7 @@ export class CategoryDefaultSettingElement extends
|
||||
case ContentSettingsTypes.JAVASCRIPT_JIT:
|
||||
case ContentSettingsTypes.TIMEZONE_OVERRIDE:
|
||||
case ContentSettingsTypes.WEBGL:
|
||||
+ case ContentSettingsTypes.WEBRTC:
|
||||
// "Allowed" vs "Blocked".
|
||||
this.browserProxy.setDefaultValueForContentType(
|
||||
this.category,
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/constants.ts b/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
@@ -50,6 +50,7 @@ export enum ContentSettingsTypes {
|
||||
JAVASCRIPT_JIT = 'javascript-jit',
|
||||
TIMEZONE_OVERRIDE = 'timezone-override',
|
||||
WEBGL = 'webgl',
|
||||
+ WEBRTC = 'webrtc',
|
||||
|
||||
// The following items are not in the C++ kContentSettingsTypeGroupNames, but
|
||||
// are used everywhere where ContentSettingsTypes is used in JS.
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
@@ -143,6 +143,7 @@ export class SettingsCategoryDefaultRadioGroupElement extends
|
||||
case ContentSettingsTypes.JAVASCRIPT_JIT:
|
||||
case ContentSettingsTypes.TIMEZONE_OVERRIDE:
|
||||
case ContentSettingsTypes.WEBGL:
|
||||
+ case ContentSettingsTypes.WEBRTC:
|
||||
// "Allowed" vs "Blocked".
|
||||
return ContentSetting.ALLOW;
|
||||
case ContentSettingsTypes.AR:
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/site_details.html b/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
--- a/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
+++ b/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
@@ -286,4 +286,9 @@
|
||||
icon="settings:webgl"
|
||||
label="$i18n{siteSettingsWebgl}">
|
||||
</site-details-permission>
|
||||
+ <site-details-permission
|
||||
+ category="[[contentSettingsTypesEnum_.WEBRTC]]"
|
||||
+ icon="settings:webrtc"
|
||||
+ label="$i18n{siteSettingsWebRTC}">
|
||||
+ </site-details-permission>
|
||||
</div>
|
||||
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
@@ -366,6 +366,14 @@ function getCategoryItemMap(): Map<ContentSettingsTypes, CategoryListItem> {
|
||||
enabledLabel: 'siteSettingsWebglAllowed',
|
||||
disabledLabel: 'siteSettingsWebglBlocked',
|
||||
},
|
||||
+ {
|
||||
+ route: routes.SITE_SETTINGS_WEBRTC,
|
||||
+ id: Id.WEBRTC,
|
||||
+ label: 'siteSettingsWebRTC',
|
||||
+ icon: 'settings:webrtc',
|
||||
+ enabledLabel: 'siteSettingsWebRTCAllowed',
|
||||
+ disabledLabel: 'siteSettingsWebRTCBlocked',
|
||||
+ },
|
||||
];
|
||||
|
||||
categoryItemMap = new Map(categoryList.map(item => [item.id, item]));
|
||||
@@ -463,6 +471,7 @@ export class SettingsSiteSettingsPageElement extends
|
||||
Id.JAVASCRIPT_JIT,
|
||||
Id.TIMEZONE_OVERRIDE,
|
||||
Id.WEBGL,
|
||||
+ Id.WEBRTC,
|
||||
]),
|
||||
};
|
||||
},
|
||||
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
@@ -85,6 +85,8 @@ export function getLocalizationStringForContentType(
|
||||
return 'siteSettingsTimezoneOverrideMidSentence';
|
||||
case ContentSettingsTypes.WEBGL:
|
||||
return 'siteSettingsWebglMidSentence';
|
||||
+ case ContentSettingsTypes.WEBRTC:
|
||||
+ return 'siteSettingsWebRTCMidSentence';
|
||||
// The following members do not have a mid-sentence localization.
|
||||
case ContentSettingsTypes.ANTI_ABUSE:
|
||||
case ContentSettingsTypes.PDF_DOCUMENTS:
|
||||
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.cc b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
--- a/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
+++ b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
@@ -381,6 +381,9 @@ const ui::ImageModel PageInfoViewFactory::GetPermissionIcon(
|
||||
case ContentSettingsType::WEBGL:
|
||||
icon = &vector_icons::kProtectedContentIcon;
|
||||
break;
|
||||
+ case ContentSettingsType::WEBRTC:
|
||||
+ icon = &vector_icons::kProtectedContentIcon;
|
||||
+ break;
|
||||
default:
|
||||
// All other |ContentSettingsType|s do not have icons on desktop or are
|
||||
// not shown in the Page Info bubble.
|
||||
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
@@ -2548,6 +2548,13 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
|
||||
{"siteSettingsWebglAllowedExceptions",IDS_SETTINGS_SITE_SETTINGS_WEBGL_ALLOWED_EXCEPTIONS},
|
||||
{"siteSettingsWebglBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_WEBGL_BLOCKED_EXCEPTIONS},
|
||||
{"siteSettingsWebglMidSentence", IDS_SITE_SETTINGS_WEBGL_TITLE},
|
||||
+ {"siteSettingsWebRTC", IDS_SITE_SETTINGS_WEBRTC_TITLE},
|
||||
+ {"siteSettingsWebRTCDescription", IDS_SETTINGS_SITE_SETTINGS_WEBRTC_DESCRIPTION},
|
||||
+ {"siteSettingsWebRTCAllowed", IDS_SETTINGS_SITE_SETTINGS_WEBRTC_ALLOWED},
|
||||
+ {"siteSettingsWebRTCBlocked", IDS_SETTINGS_SITE_SETTINGS_WEBRTC_BLOCKED},
|
||||
+ {"siteSettingsWebRTCAllowedExceptions",IDS_SETTINGS_SITE_SETTINGS_WEBRTC_ALLOWED_EXCEPTIONS},
|
||||
+ {"siteSettingsWebRTCBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_WEBRTC_BLOCKED_EXCEPTIONS},
|
||||
+ {"siteSettingsWebRTCMidSentence", IDS_SITE_SETTINGS_WEBRTC_TITLE},
|
||||
{"addSite", IDS_SETTINGS_ADD_SITE},
|
||||
{"addSiteTitle", IDS_SETTINGS_ADD_SITE_TITLE},
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
diff --git a/chrome/browser/ui/webui/settings/site_settings_helper.cc b/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
--- a/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
@@ -129,6 +129,7 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
|
||||
{ContentSettingsType::JAVASCRIPT_JIT, "javascript-jit"},
|
||||
{ContentSettingsType::TIMEZONE_OVERRIDE, "timezone-override"},
|
||||
{ContentSettingsType::WEBGL, "webgl"},
|
||||
+ {ContentSettingsType::WEBRTC, "webrtc"},
|
||||
|
||||
// Add new content settings here if a corresponding Javascript string
|
||||
// representation for it is not required, for example if the content setting
|
||||
--
|
||||
2.25.1
|
||||
@@ -1,21 +0,0 @@
|
||||
From: Your Name <you@example.com>
|
||||
Date: Thu, 13 Oct 2022 10:26:13 +0000
|
||||
Subject: WIN ADDTO Content settings infrastructure
|
||||
|
||||
---
|
||||
components/content_settings/core/common/content_settings.cc | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/components/content_settings/core/common/content_settings.cc b/components/content_settings/core/common/content_settings.cc
|
||||
--- a/components/content_settings/core/common/content_settings.cc
|
||||
+++ b/components/content_settings/core/common/content_settings.cc
|
||||
@@ -143,6 +143,7 @@ ContentSetting IntToContentSetting(int content_setting) {
|
||||
int ContentSettingTypeToHistogramValue(ContentSettingsType content_setting,
|
||||
size_t* num_values) {
|
||||
*num_values = std::size(kHistogramValue);
|
||||
+ if ((true)) return 0;
|
||||
|
||||
// Verify the array is sorted by enum type and contains all values.
|
||||
DCHECK(std::is_sorted(std::begin(kHistogramValue), std::end(kHistogramValue),
|
||||
--
|
||||
2.25.1
|
||||
@@ -1,271 +0,0 @@
|
||||
From: Your Name <you@example.com>
|
||||
Date: Wed, 12 Oct 2022 14:03:37 +0000
|
||||
Subject: WIN ADDTO JIT site settings
|
||||
|
||||
---
|
||||
chrome/app/settings_strings.grdp | 19 ++++++++++++++++
|
||||
chrome/browser/resources/settings/icons.html | 2 ++
|
||||
.../settings/privacy_page/privacy_page.html | 22 +++++++++++++++++++
|
||||
chrome/browser/resources/settings/route.ts | 1 +
|
||||
chrome/browser/resources/settings/router.ts | 1 +
|
||||
.../site_settings/category_default_setting.ts | 1 +
|
||||
.../settings/site_settings/constants.ts | 1 +
|
||||
.../settings_category_default_radio_group.ts | 1 +
|
||||
.../settings/site_settings/site_details.html | 5 +++++
|
||||
.../site_settings_page/site_settings_page.ts | 9 ++++++++
|
||||
.../site_settings_page_util.ts | 2 ++
|
||||
.../views/page_info/page_info_view_factory.cc | 3 +++
|
||||
.../settings_localized_strings_provider.cc | 7 ++++++
|
||||
.../ui/webui/settings/site_settings_helper.cc | 3 ++-
|
||||
.../core/browser/content_settings_registry.cc | 3 ++-
|
||||
15 files changed, 78 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp
|
||||
--- a/chrome/app/settings_strings.grdp
|
||||
+++ b/chrome/app/settings_strings.grdp
|
||||
@@ -4348,6 +4348,25 @@
|
||||
Not allowed to autoplay
|
||||
</message>
|
||||
|
||||
+ <message name="IDS_SITE_SETTINGS_JAVASCRIPT_JIT_TITLE" desc="Description of the Javascript JIT content setting page title.">
|
||||
+ Javascript JIT
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_DESCRIPTION" desc="Description of the Javascript JIT content setting.">
|
||||
+ Enable the JIT compiler in V8
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_ALLOWED" desc="Label for the enabled option of the Javascript JIT setting.">
|
||||
+ Javascript JIT is enabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_BLOCKED" desc="Label for the disabled option of the Javascript JIT setting.">
|
||||
+ Javascript JIT is disabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_ALLOWED_EXCEPTIONS" desc="Label for the allowed exceptions site list of the Javascript JIT setting.">
|
||||
+ Allowed to Javascript JIT
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the Javascript JIT setting.">
|
||||
+ Not allowed to Javascript JIT
|
||||
+ </message>
|
||||
+
|
||||
<if expr="not is_chromeos">
|
||||
<!-- Import Settings Dialog -->
|
||||
<message name="IDS_SETTINGS_IMPORT_SETTINGS_TITLE" desc="Dialog title for import dialog.">
|
||||
diff --git a/chrome/browser/resources/settings/icons.html b/chrome/browser/resources/settings/icons.html
|
||||
--- a/chrome/browser/resources/settings/icons.html
|
||||
+++ b/chrome/browser/resources/settings/icons.html
|
||||
@@ -193,6 +193,8 @@ NOTE: Chrome OS icons go in ./chromeos/os_icons.html.
|
||||
<g id="feedback" viewBox="0 0 24 24"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H5.17l-.59.59-.58.58V4h16v12zm-9-4h2v2h-2zm0-6h2v4h-2z"></path></g>
|
||||
<g id="autoplay"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"></path></g>
|
||||
<g id="autoplay-off"><path d="M16.25,13.42C16.4,12.97,16.5,12.5,16.5,12c0-1.77-1.02-3.29-2.5-4.03v3.2L16.25,13.42z"></path><path d="M19,12c0,1.21-0.31,2.34-0.85,3.32l1.46,1.46C20.48,15.39,21,13.76,21,12c0-4.28-2.99-7.86-7-8.77v2.06 C16.89,6.15,19,8.83,19,12z"></path><path d="M2.81,2.81L1.39,4.22L6.17,9H3v6h4l5,5v-5.17l3.32,3.32c-0.42,0.23-0.85,0.43-1.32,0.56v2.06c1-0.23,1.94-0.62,2.79-1.15 l2.99,2.99l1.41-1.41L2.81,2.81z"></path><polygon points="12,9.17 12,4 9.41,6.59"></polygon></g>
|
||||
+ <g id="javascript-jit"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"></path></g>
|
||||
+ <g id="javascript-jit-off"><path d="M19.17,12l-4.58-4.59L16,6l6,6l-3.59,3.59L17,14.17L19.17,12z M1.39,4.22l4.19,4.19L2,12l6,6l1.41-1.41L4.83,12L7,9.83 l12.78,12.78l1.41-1.41L2.81,2.81L1.39,4.22z"></path></g>
|
||||
</defs>
|
||||
</svg>
|
||||
</iron-iconset-svg>
|
||||
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
--- a/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
+++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
@@ -1126,4 +1126,26 @@
|
||||
</category-setting-exceptions>
|
||||
</settings-subpage>
|
||||
</template>
|
||||
+ <template is="dom-if" route-path="/content/javascript-jit" no-search>
|
||||
+ <settings-subpage page-title="$i18n{siteSettingsJavascriptJIT}"
|
||||
+ search-label="$i18n{siteSettingsAllSitesSearch}"
|
||||
+ search-term="{{searchFilter_}}">
|
||||
+ <div class="content-settings-header secondary">
|
||||
+ $i18n{siteSettingsJavascriptJITDescription}
|
||||
+ </div>
|
||||
+ <settings-category-default-radio-group
|
||||
+ category="[[contentSettingsTypesEnum_.JAVASCRIPT_JIT]]"
|
||||
+ allow-option-label="$i18n{siteSettingsJavascriptJITAllowed}"
|
||||
+ allow-option-icon="settings:javascript-jit"
|
||||
+ block-option-label="$i18n{siteSettingsJavascriptJITBlocked}"
|
||||
+ block-option-icon="settings:javascript-jit-off">
|
||||
+ </settings-category-default-radio-group>
|
||||
+ <category-setting-exceptions
|
||||
+ category="[[contentSettingsTypesEnum_.JAVASCRIPT_JIT]]"
|
||||
+ block-header="$i18n{siteSettingsJavascriptJITBlockedExceptions}"
|
||||
+ allow-header="$i18n{siteSettingsJavascriptJITAllowedExceptions}"
|
||||
+ search-filter="[[searchFilter_]]">
|
||||
+ </category-setting-exceptions>
|
||||
+ </settings-subpage>
|
||||
+ </template>
|
||||
</settings-animated-pages>
|
||||
diff --git a/chrome/browser/resources/settings/route.ts b/chrome/browser/resources/settings/route.ts
|
||||
--- a/chrome/browser/resources/settings/route.ts
|
||||
+++ b/chrome/browser/resources/settings/route.ts
|
||||
@@ -123,6 +123,7 @@ function addPrivacyChildRoutes(r: Partial<SettingsRoutes>) {
|
||||
r.SITE_SETTINGS_FILE_SYSTEM_WRITE = r.SITE_SETTINGS.createChild('filesystem');
|
||||
r.SITE_SETTINGS_LOCAL_FONTS = r.SITE_SETTINGS.createChild('localFonts');
|
||||
r.SITE_SETTINGS_AUTOPLAY = r.SITE_SETTINGS.createChild('autoplay');
|
||||
+ r.SITE_SETTINGS_JAVASCRIPT_JIT = r.SITE_SETTINGS.createChild('javascript-jit');
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/chrome/browser/resources/settings/router.ts b/chrome/browser/resources/settings/router.ts
|
||||
--- a/chrome/browser/resources/settings/router.ts
|
||||
+++ b/chrome/browser/resources/settings/router.ts
|
||||
@@ -105,6 +105,7 @@ export interface SettingsRoutes {
|
||||
SYSTEM: Route;
|
||||
TRIGGERED_RESET_DIALOG: Route;
|
||||
SITE_SETTINGS_AUTOPLAY: Route;
|
||||
+ SITE_SETTINGS_JAVASCRIPT_JIT: Route;
|
||||
}
|
||||
|
||||
/** Class for navigable routes. */
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/category_default_setting.ts b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
@@ -196,6 +196,7 @@ export class CategoryDefaultSettingElement extends
|
||||
case ContentSettingsTypes.SENSORS:
|
||||
case ContentSettingsTypes.SOUND:
|
||||
case ContentSettingsTypes.AUTOPLAY:
|
||||
+ case ContentSettingsTypes.JAVASCRIPT_JIT:
|
||||
// "Allowed" vs "Blocked".
|
||||
this.browserProxy.setDefaultValueForContentType(
|
||||
this.category,
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/constants.ts b/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
@@ -47,6 +47,7 @@ export enum ContentSettingsTypes {
|
||||
WINDOW_MANAGEMENT = 'window-placement',
|
||||
ZOOM_LEVELS = 'zoom-levels',
|
||||
AUTOPLAY = 'autoplay',
|
||||
+ JAVASCRIPT_JIT = 'javascript-jit',
|
||||
|
||||
// The following items are not in the C++ kContentSettingsTypeGroupNames, but
|
||||
// are used everywhere where ContentSettingsTypes is used in JS.
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
@@ -140,6 +140,7 @@ export class SettingsCategoryDefaultRadioGroupElement extends
|
||||
case ContentSettingsTypes.SENSORS:
|
||||
case ContentSettingsTypes.SOUND:
|
||||
case ContentSettingsTypes.AUTOPLAY:
|
||||
+ case ContentSettingsTypes.JAVASCRIPT_JIT:
|
||||
// "Allowed" vs "Blocked".
|
||||
return ContentSetting.ALLOW;
|
||||
case ContentSettingsTypes.AR:
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/site_details.html b/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
--- a/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
+++ b/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
@@ -271,4 +271,9 @@
|
||||
icon="settings:federated-identity-api"
|
||||
label="$i18n{siteSettingsFederatedIdentityApi}">
|
||||
</site-details-permission>
|
||||
+ <site-details-permission
|
||||
+ category="[[contentSettingsTypesEnum_.JAVASCRIPT_JIT]]"
|
||||
+ icon="settings:javascript-jit"
|
||||
+ label="$i18n{siteSettingsJavascriptJIT}">
|
||||
+ </site-details-permission>
|
||||
</div>
|
||||
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
@@ -342,6 +342,14 @@ function getCategoryItemMap(): Map<ContentSettingsTypes, CategoryListItem> {
|
||||
enabledLabel: 'siteSettingsAutoplayAllowed',
|
||||
disabledLabel: 'siteSettingsAutoplayBlocked',
|
||||
},
|
||||
+ {
|
||||
+ route: routes.SITE_SETTINGS_JAVASCRIPT_JIT,
|
||||
+ id: Id.JAVASCRIPT_JIT,
|
||||
+ label: 'siteSettingsJavascriptJIT',
|
||||
+ icon: 'settings:javascript-jit',
|
||||
+ enabledLabel: 'siteSettingsJavascriptJITAllowed',
|
||||
+ disabledLabel: 'siteSettingsJavascriptJITBlocked',
|
||||
+ },
|
||||
];
|
||||
|
||||
categoryItemMap = new Map(categoryList.map(item => [item.id, item]));
|
||||
@@ -436,6 +444,7 @@ export class SettingsSiteSettingsPageElement extends
|
||||
Id.ANTI_ABUSE,
|
||||
Id.SITE_DATA,
|
||||
Id.AUTOPLAY,
|
||||
+ Id.JAVASCRIPT_JIT,
|
||||
]),
|
||||
};
|
||||
},
|
||||
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
@@ -79,6 +79,8 @@ export function getLocalizationStringForContentType(
|
||||
return 'siteSettingsZoomLevelsMidSentence';
|
||||
case ContentSettingsTypes.AUTOPLAY:
|
||||
return 'siteSettingsAutoplayMidSentence';
|
||||
+ case ContentSettingsTypes.JAVASCRIPT_JIT:
|
||||
+ return 'siteSettingsJavascriptJITMidSentence';
|
||||
// The following members do not have a mid-sentence localization.
|
||||
case ContentSettingsTypes.ANTI_ABUSE:
|
||||
case ContentSettingsTypes.PDF_DOCUMENTS:
|
||||
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.cc b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
--- a/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
+++ b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
@@ -372,6 +372,9 @@ const ui::ImageModel PageInfoViewFactory::GetPermissionIcon(
|
||||
case ContentSettingsType::AUTOPLAY:
|
||||
icon = &vector_icons::kProtectedContentIcon;
|
||||
break;
|
||||
+ case ContentSettingsType::JAVASCRIPT_JIT:
|
||||
+ icon = &vector_icons::kCodeIcon;
|
||||
+ break;
|
||||
default:
|
||||
// All other |ContentSettingsType|s do not have icons on desktop or are
|
||||
// not shown in the Page Info bubble.
|
||||
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
@@ -2527,6 +2527,13 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
|
||||
{"siteSettingsAutoplayAllowedExceptions",IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_ALLOWED_EXCEPTIONS},
|
||||
{"siteSettingsAutoplayBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_BLOCKED_EXCEPTIONS},
|
||||
{"siteSettingsAutoplayMidSentence", IDS_SITE_SETTINGS_TYPE_AUTOPLAY},
|
||||
+ {"siteSettingsJavascriptJIT", IDS_SITE_SETTINGS_JAVASCRIPT_JIT_TITLE},
|
||||
+ {"siteSettingsJavascriptJITDescription", IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_DESCRIPTION},
|
||||
+ {"siteSettingsJavascriptJITAllowed", IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_ALLOWED},
|
||||
+ {"siteSettingsJavascriptJITBlocked", IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_BLOCKED},
|
||||
+ {"siteSettingsJavascriptJITAllowedExceptions",IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_ALLOWED_EXCEPTIONS},
|
||||
+ {"siteSettingsJavascriptJITBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_BLOCKED_EXCEPTIONS},
|
||||
+ {"siteSettingsJavascriptJITMidSentence", IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT},
|
||||
{"addSite", IDS_SETTINGS_ADD_SITE},
|
||||
{"addSiteTitle", IDS_SETTINGS_ADD_SITE_TITLE},
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
diff --git a/chrome/browser/ui/webui/settings/site_settings_helper.cc b/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
--- a/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
@@ -126,6 +126,7 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
|
||||
"private-network-devices-data"},
|
||||
{ContentSettingsType::ANTI_ABUSE, "anti-abuse"},
|
||||
{ContentSettingsType::AUTOPLAY, "autoplay"},
|
||||
+ {ContentSettingsType::JAVASCRIPT_JIT, "javascript-jit"},
|
||||
|
||||
// Add new content settings here if a corresponding Javascript string
|
||||
// representation for it is not required, for example if the content setting
|
||||
@@ -162,7 +163,6 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
|
||||
{ContentSettingsType::FILE_SYSTEM_LAST_PICKED_DIRECTORY, nullptr},
|
||||
{ContentSettingsType::DISPLAY_CAPTURE, nullptr},
|
||||
{ContentSettingsType::FEDERATED_IDENTITY_SHARING, nullptr},
|
||||
- {ContentSettingsType::JAVASCRIPT_JIT, nullptr},
|
||||
{ContentSettingsType::HTTP_ALLOWED, nullptr},
|
||||
{ContentSettingsType::HTTPS_ENFORCED, nullptr},
|
||||
{ContentSettingsType::FORMFILL_METADATA, nullptr},
|
||||
@@ -536,6 +536,7 @@ const std::vector<ContentSettingsType>& GetVisiblePermissionCategories() {
|
||||
}
|
||||
|
||||
base_types->push_back(ContentSettingsType::AUTOPLAY);
|
||||
+ base_types->push_back(ContentSettingsType::JAVASCRIPT_JIT);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
--- a/components/content_settings/core/browser/content_settings_registry.cc
|
||||
+++ b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
@@ -511,7 +511,8 @@ void ContentSettingsRegistry::Init() {
|
||||
ContentSettingsInfo::EXCEPTIONS_ON_SECURE_ORIGINS_ONLY);
|
||||
|
||||
Register(ContentSettingsType::JAVASCRIPT_JIT, "javascript-jit",
|
||||
- CONTENT_SETTING_BLOCK, WebsiteSettingsInfo::UNSYNCABLE,
|
||||
+ CONTENT_SETTING_BLOCK,
|
||||
+ WebsiteSettingsInfo::UNSYNCABLE,
|
||||
/*allowlisted_schemes=*/{},
|
||||
/*valid_settings=*/{CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK},
|
||||
WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
|
||||
--
|
||||
2.25.1
|
||||
@@ -1,258 +0,0 @@
|
||||
From: Your Name <you@example.com>
|
||||
Date: Wed, 12 Oct 2022 12:49:31 +0000
|
||||
Subject: WIN ADDTO Revert the removal to block autoplay
|
||||
|
||||
---
|
||||
chrome/app/settings_strings.grdp | 19 ++++++++++++++++
|
||||
chrome/browser/resources/settings/icons.html | 2 ++
|
||||
.../settings/privacy_page/privacy_page.html | 22 +++++++++++++++++++
|
||||
chrome/browser/resources/settings/route.ts | 1 +
|
||||
chrome/browser/resources/settings/router.ts | 1 +
|
||||
.../site_settings/category_default_setting.ts | 1 +
|
||||
.../settings/site_settings/constants.ts | 1 +
|
||||
.../settings_category_default_radio_group.ts | 1 +
|
||||
.../settings/site_settings/site_details.html | 5 +++++
|
||||
.../site_settings_page/site_settings_page.ts | 9 ++++++++
|
||||
.../site_settings_page_util.ts | 2 ++
|
||||
.../views/page_info/page_info_view_factory.cc | 3 +++
|
||||
.../settings_localized_strings_provider.cc | 7 ++++++
|
||||
.../ui/webui/settings/site_settings_helper.cc | 4 +++-
|
||||
14 files changed, 77 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp
|
||||
--- a/chrome/app/settings_strings.grdp
|
||||
+++ b/chrome/app/settings_strings.grdp
|
||||
@@ -4329,6 +4329,25 @@
|
||||
Control how your browsing history is used to personalize Search and more
|
||||
</message>
|
||||
|
||||
+ <message name="IDS_SITE_SETTINGS_AUTOPLAY_TITLE" desc="Description of the autoplay content setting page title.">
|
||||
+ Autoplay
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_DESCRIPTION" desc="Description of the autoplay content setting.">
|
||||
+ Allow automatic start of video contents
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_ALLOWED" desc="Label for the enabled option of the autoplay setting.">
|
||||
+ Autoplay is enabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_BLOCKED" desc="Label for the disabled option of the autoplay setting.">
|
||||
+ Autoplay is disabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_ALLOWED_EXCEPTIONS" desc="Label for the allowed exceptions site list of the autoplay setting.">
|
||||
+ Allowed to autoplay
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the autoplay setting.">
|
||||
+ Not allowed to autoplay
|
||||
+ </message>
|
||||
+
|
||||
<if expr="not is_chromeos">
|
||||
<!-- Import Settings Dialog -->
|
||||
<message name="IDS_SETTINGS_IMPORT_SETTINGS_TITLE" desc="Dialog title for import dialog.">
|
||||
diff --git a/chrome/browser/resources/settings/icons.html b/chrome/browser/resources/settings/icons.html
|
||||
--- a/chrome/browser/resources/settings/icons.html
|
||||
+++ b/chrome/browser/resources/settings/icons.html
|
||||
@@ -191,6 +191,8 @@ NOTE: Chrome OS icons go in ./chromeos/os_icons.html.
|
||||
<g id="file-handling-off"><path d="M13.002 4.001H7.106L5.252 2.148c.232-.094.485-.147.75-.147h8l6 6v8.896l-2-2V9.001h-5v-5z" fill="#5F6368"></path><path d="M16.002 12.001h-.896l.896.896v-.896zM.6 3.45l1.414-1.414 19.94 19.94-1.414 1.414L.6 3.45zM3.986 20.01V6.84l2 2V20.01h11.172l1.765 1.766c-.28.15-.599.234-.937.234H5.976c-1.1 0-1.99-.9-1.99-2z" fill="#5F6368"></path><path d="M9.158 12.01H7.986v2h3.172l-2-2zM13.158 16.01H7.986v2h7.172l-2-2z" fill="#5F6368"></path></g>
|
||||
<g id="performance"><path d="M0 0h24v24H0z" fill="none"></path><path d="m20.38 8.57-1.23 1.85a8 8 0 0 1-.22 7.58H5.07A8 8 0 0 1 15.58 6.85l1.85-1.23A10 10 0 0 0 3.35 19a2 2 0 0 0 1.72 1h13.85a2 2 0 0 0 1.74-1 10 10 0 0 0-.27-10.44zm-9.79 6.84a2 2 0 0 0 2.83 0l5.66-8.49-8.49 5.66a2 2 0 0 0 0 2.83z"></path></g>
|
||||
<g id="feedback" viewBox="0 0 24 24"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H5.17l-.59.59-.58.58V4h16v12zm-9-4h2v2h-2zm0-6h2v4h-2z"></path></g>
|
||||
+ <g id="autoplay"><path d="M3 9v6h4l5 5V4L7 9H3zm13.5 3c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"></path></g>
|
||||
+ <g id="autoplay-off"><path d="M16.25,13.42C16.4,12.97,16.5,12.5,16.5,12c0-1.77-1.02-3.29-2.5-4.03v3.2L16.25,13.42z"></path><path d="M19,12c0,1.21-0.31,2.34-0.85,3.32l1.46,1.46C20.48,15.39,21,13.76,21,12c0-4.28-2.99-7.86-7-8.77v2.06 C16.89,6.15,19,8.83,19,12z"></path><path d="M2.81,2.81L1.39,4.22L6.17,9H3v6h4l5,5v-5.17l3.32,3.32c-0.42,0.23-0.85,0.43-1.32,0.56v2.06c1-0.23,1.94-0.62,2.79-1.15 l2.99,2.99l1.41-1.41L2.81,2.81z"></path><polygon points="12,9.17 12,4 9.41,6.59"></polygon></g>
|
||||
</defs>
|
||||
</svg>
|
||||
</iron-iconset-svg>
|
||||
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
--- a/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
+++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
@@ -1104,4 +1104,26 @@
|
||||
</category-setting-exceptions>
|
||||
</settings-subpage>
|
||||
</template>
|
||||
+ <template is="dom-if" route-path="/content/autoplay" no-search>
|
||||
+ <settings-subpage page-title="$i18n{siteSettingsAutoplay}"
|
||||
+ search-label="$i18n{siteSettingsAllSitesSearch}"
|
||||
+ search-term="{{searchFilter_}}">
|
||||
+ <div class="content-settings-header secondary">
|
||||
+ $i18n{siteSettingsAutoplayDescription}
|
||||
+ </div>
|
||||
+ <settings-category-default-radio-group
|
||||
+ category="[[contentSettingsTypesEnum_.AUTOPLAY]]"
|
||||
+ allow-option-label="$i18n{siteSettingsAutoplayAllowed}"
|
||||
+ allow-option-icon="settings:autoplay"
|
||||
+ block-option-label="$i18n{siteSettingsAutoplayBlocked}"
|
||||
+ block-option-icon="settings:autoplay-off">
|
||||
+ </settings-category-default-radio-group>
|
||||
+ <category-setting-exceptions
|
||||
+ category="[[contentSettingsTypesEnum_.AUTOPLAY]]"
|
||||
+ block-header="$i18n{siteSettingsAutoplayBlockedExceptions}"
|
||||
+ allow-header="$i18n{siteSettingsAutoplayAllowedExceptions}"
|
||||
+ search-filter="[[searchFilter_]]">
|
||||
+ </category-setting-exceptions>
|
||||
+ </settings-subpage>
|
||||
+ </template>
|
||||
</settings-animated-pages>
|
||||
diff --git a/chrome/browser/resources/settings/route.ts b/chrome/browser/resources/settings/route.ts
|
||||
--- a/chrome/browser/resources/settings/route.ts
|
||||
+++ b/chrome/browser/resources/settings/route.ts
|
||||
@@ -122,6 +122,7 @@ function addPrivacyChildRoutes(r: Partial<SettingsRoutes>) {
|
||||
r.SITE_SETTINGS.createChild('windowManagement');
|
||||
r.SITE_SETTINGS_FILE_SYSTEM_WRITE = r.SITE_SETTINGS.createChild('filesystem');
|
||||
r.SITE_SETTINGS_LOCAL_FONTS = r.SITE_SETTINGS.createChild('localFonts');
|
||||
+ r.SITE_SETTINGS_AUTOPLAY = r.SITE_SETTINGS.createChild('autoplay');
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/chrome/browser/resources/settings/router.ts b/chrome/browser/resources/settings/router.ts
|
||||
--- a/chrome/browser/resources/settings/router.ts
|
||||
+++ b/chrome/browser/resources/settings/router.ts
|
||||
@@ -104,6 +104,7 @@ export interface SettingsRoutes {
|
||||
SYNC_ADVANCED: Route;
|
||||
SYSTEM: Route;
|
||||
TRIGGERED_RESET_DIALOG: Route;
|
||||
+ SITE_SETTINGS_AUTOPLAY: Route;
|
||||
}
|
||||
|
||||
/** Class for navigable routes. */
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/category_default_setting.ts b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
@@ -195,6 +195,7 @@ export class CategoryDefaultSettingElement extends
|
||||
case ContentSettingsTypes.PROTOCOL_HANDLERS:
|
||||
case ContentSettingsTypes.SENSORS:
|
||||
case ContentSettingsTypes.SOUND:
|
||||
+ case ContentSettingsTypes.AUTOPLAY:
|
||||
// "Allowed" vs "Blocked".
|
||||
this.browserProxy.setDefaultValueForContentType(
|
||||
this.category,
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/constants.ts b/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
@@ -46,6 +46,7 @@ export enum ContentSettingsTypes {
|
||||
VR = 'vr',
|
||||
WINDOW_MANAGEMENT = 'window-placement',
|
||||
ZOOM_LEVELS = 'zoom-levels',
|
||||
+ AUTOPLAY = 'autoplay',
|
||||
|
||||
// The following items are not in the C++ kContentSettingsTypeGroupNames, but
|
||||
// are used everywhere where ContentSettingsTypes is used in JS.
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
@@ -139,6 +139,7 @@ export class SettingsCategoryDefaultRadioGroupElement extends
|
||||
case ContentSettingsTypes.PROTOCOL_HANDLERS:
|
||||
case ContentSettingsTypes.SENSORS:
|
||||
case ContentSettingsTypes.SOUND:
|
||||
+ case ContentSettingsTypes.AUTOPLAY:
|
||||
// "Allowed" vs "Blocked".
|
||||
return ContentSetting.ALLOW;
|
||||
case ContentSettingsTypes.AR:
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/site_details.html b/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
--- a/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
+++ b/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
@@ -266,4 +266,9 @@
|
||||
category="[[contentSettingsTypesEnum_.LOCAL_FONTS]]"
|
||||
icon="settings:local-fonts" label="$i18n{fonts}">
|
||||
</site-details-permission>
|
||||
+ <site-details-permission
|
||||
+ category="[[contentSettingsTypesEnum_.AUTOPLAY]]"
|
||||
+ icon="settings:federated-identity-api"
|
||||
+ label="$i18n{siteSettingsFederatedIdentityApi}">
|
||||
+ </site-details-permission>
|
||||
</div>
|
||||
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
@@ -334,6 +334,14 @@ function getCategoryItemMap(): Map<ContentSettingsTypes, CategoryListItem> {
|
||||
label: 'siteSettingsZoomLevels',
|
||||
icon: 'settings:zoom-in',
|
||||
},
|
||||
+ {
|
||||
+ route: routes.SITE_SETTINGS_AUTOPLAY,
|
||||
+ id: Id.AUTOPLAY,
|
||||
+ label: 'siteSettingsAutoplay',
|
||||
+ icon: 'settings:autoplay',
|
||||
+ enabledLabel: 'siteSettingsAutoplayAllowed',
|
||||
+ disabledLabel: 'siteSettingsAutoplayBlocked',
|
||||
+ },
|
||||
];
|
||||
|
||||
categoryItemMap = new Map(categoryList.map(item => [item.id, item]));
|
||||
@@ -427,6 +435,7 @@ export class SettingsSiteSettingsPageElement extends
|
||||
Id.FEDERATED_IDENTITY_API,
|
||||
Id.ANTI_ABUSE,
|
||||
Id.SITE_DATA,
|
||||
+ Id.AUTOPLAY,
|
||||
]),
|
||||
};
|
||||
},
|
||||
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
@@ -77,6 +77,8 @@ export function getLocalizationStringForContentType(
|
||||
return 'siteSettingsWindowManagementMidSentence';
|
||||
case ContentSettingsTypes.ZOOM_LEVELS:
|
||||
return 'siteSettingsZoomLevelsMidSentence';
|
||||
+ case ContentSettingsTypes.AUTOPLAY:
|
||||
+ return 'siteSettingsAutoplayMidSentence';
|
||||
// The following members do not have a mid-sentence localization.
|
||||
case ContentSettingsTypes.ANTI_ABUSE:
|
||||
case ContentSettingsTypes.PDF_DOCUMENTS:
|
||||
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.cc b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
--- a/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
+++ b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
@@ -369,6 +369,9 @@ const ui::ImageModel PageInfoViewFactory::GetPermissionIcon(
|
||||
case ContentSettingsType::IDLE_DETECTION:
|
||||
icon = &vector_icons::kDevicesIcon;
|
||||
break;
|
||||
+ case ContentSettingsType::AUTOPLAY:
|
||||
+ icon = &vector_icons::kProtectedContentIcon;
|
||||
+ break;
|
||||
default:
|
||||
// All other |ContentSettingsType|s do not have icons on desktop or are
|
||||
// not shown in the Page Info bubble.
|
||||
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
@@ -2520,6 +2520,13 @@ void AddSearchEnginesStrings(content::WebUIDataSource* html_source) {
|
||||
void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
|
||||
Profile* profile) {
|
||||
static constexpr webui::LocalizedString kLocalizedStrings[] = {
|
||||
+ {"siteSettingsAutoplay", IDS_SITE_SETTINGS_AUTOPLAY_TITLE},
|
||||
+ {"siteSettingsAutoplayDescription", IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_DESCRIPTION},
|
||||
+ {"siteSettingsAutoplayAllowed", IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_ALLOWED},
|
||||
+ {"siteSettingsAutoplayBlocked", IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_BLOCKED},
|
||||
+ {"siteSettingsAutoplayAllowedExceptions",IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_ALLOWED_EXCEPTIONS},
|
||||
+ {"siteSettingsAutoplayBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_BLOCKED_EXCEPTIONS},
|
||||
+ {"siteSettingsAutoplayMidSentence", IDS_SITE_SETTINGS_TYPE_AUTOPLAY},
|
||||
{"addSite", IDS_SETTINGS_ADD_SITE},
|
||||
{"addSiteTitle", IDS_SETTINGS_ADD_SITE_TITLE},
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
diff --git a/chrome/browser/ui/webui/settings/site_settings_helper.cc b/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
--- a/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
@@ -125,6 +125,7 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
|
||||
{ContentSettingsType::PRIVATE_NETWORK_CHOOSER_DATA,
|
||||
"private-network-devices-data"},
|
||||
{ContentSettingsType::ANTI_ABUSE, "anti-abuse"},
|
||||
+ {ContentSettingsType::AUTOPLAY, "autoplay"},
|
||||
|
||||
// Add new content settings here if a corresponding Javascript string
|
||||
// representation for it is not required, for example if the content setting
|
||||
@@ -136,7 +137,6 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
|
||||
{ContentSettingsType::APP_BANNER, nullptr},
|
||||
{ContentSettingsType::SITE_ENGAGEMENT, nullptr},
|
||||
{ContentSettingsType::DURABLE_STORAGE, nullptr},
|
||||
- {ContentSettingsType::AUTOPLAY, nullptr},
|
||||
{ContentSettingsType::IMPORTANT_SITE_INFO, nullptr},
|
||||
{ContentSettingsType::PERMISSION_AUTOBLOCKER_DATA, nullptr},
|
||||
{ContentSettingsType::ADS_DATA, nullptr},
|
||||
@@ -535,6 +535,8 @@ const std::vector<ContentSettingsType>& GetVisiblePermissionCategories() {
|
||||
base_types->push_back(ContentSettingsType::PRIVATE_NETWORK_GUARD);
|
||||
}
|
||||
|
||||
+ base_types->push_back(ContentSettingsType::AUTOPLAY);
|
||||
+
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
@@ -1,254 +0,0 @@
|
||||
From: Your Name <you@example.com>
|
||||
Date: Wed, 12 Oct 2022 16:03:16 +0000
|
||||
Subject: WIN ADDTO Timezone customization
|
||||
|
||||
---
|
||||
chrome/app/settings_strings.grdp | 19 ++++++++++++++++
|
||||
chrome/browser/resources/settings/icons.html | 2 ++
|
||||
.../settings/privacy_page/privacy_page.html | 22 +++++++++++++++++++
|
||||
chrome/browser/resources/settings/route.ts | 1 +
|
||||
chrome/browser/resources/settings/router.ts | 1 +
|
||||
.../site_settings/category_default_setting.ts | 1 +
|
||||
.../settings/site_settings/constants.ts | 1 +
|
||||
.../settings_category_default_radio_group.ts | 1 +
|
||||
.../settings/site_settings/site_details.html | 5 +++++
|
||||
.../site_settings_page/site_settings_page.ts | 9 ++++++++
|
||||
.../site_settings_page_util.ts | 2 ++
|
||||
.../views/page_info/page_info_view_factory.cc | 3 +++
|
||||
.../settings_localized_strings_provider.cc | 7 ++++++
|
||||
.../ui/webui/settings/site_settings_helper.cc | 1 +
|
||||
.../core/browser/content_settings_registry.cc | 2 +-
|
||||
15 files changed, 76 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/chrome/app/settings_strings.grdp b/chrome/app/settings_strings.grdp
|
||||
--- a/chrome/app/settings_strings.grdp
|
||||
+++ b/chrome/app/settings_strings.grdp
|
||||
@@ -4367,6 +4367,25 @@
|
||||
Not allowed to Javascript JIT
|
||||
</message>
|
||||
|
||||
+ <message name="IDS_SITE_SETTINGS_TIMEZONE_OVERRIDE_TITLE" desc="Description of the timezone override content setting page title.">
|
||||
+ Timezone override
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_DESCRIPTION" desc="Description of the timezone override content setting.">
|
||||
+ Enable the Timezone override
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_ALLOWED" desc="Label for the enabled option of the timezone override setting.">
|
||||
+ System Timezone
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_BLOCKED" desc="Label for the disabled option of the timezone override setting.">
|
||||
+ Random Timezone
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_ALLOWED_EXCEPTIONS" desc="Label for the allowed exceptions site list of the timezone override setting.">
|
||||
+ System Timezone override
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the timezone override setting.">
|
||||
+ Random Timezone override
|
||||
+ </message>
|
||||
+
|
||||
<if expr="not is_chromeos">
|
||||
<!-- Import Settings Dialog -->
|
||||
<message name="IDS_SETTINGS_IMPORT_SETTINGS_TITLE" desc="Dialog title for import dialog.">
|
||||
diff --git a/chrome/browser/resources/settings/icons.html b/chrome/browser/resources/settings/icons.html
|
||||
--- a/chrome/browser/resources/settings/icons.html
|
||||
+++ b/chrome/browser/resources/settings/icons.html
|
||||
@@ -195,6 +195,8 @@ NOTE: Chrome OS icons go in ./chromeos/os_icons.html.
|
||||
<g id="autoplay-off"><path d="M16.25,13.42C16.4,12.97,16.5,12.5,16.5,12c0-1.77-1.02-3.29-2.5-4.03v3.2L16.25,13.42z"></path><path d="M19,12c0,1.21-0.31,2.34-0.85,3.32l1.46,1.46C20.48,15.39,21,13.76,21,12c0-4.28-2.99-7.86-7-8.77v2.06 C16.89,6.15,19,8.83,19,12z"></path><path d="M2.81,2.81L1.39,4.22L6.17,9H3v6h4l5,5v-5.17l3.32,3.32c-0.42,0.23-0.85,0.43-1.32,0.56v2.06c1-0.23,1.94-0.62,2.79-1.15 l2.99,2.99l1.41-1.41L2.81,2.81z"></path><polygon points="12,9.17 12,4 9.41,6.59"></polygon></g>
|
||||
<g id="javascript-jit"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"></path></g>
|
||||
<g id="javascript-jit-off"><path d="M19.17,12l-4.58-4.59L16,6l6,6l-3.59,3.59L17,14.17L19.17,12z M1.39,4.22l4.19,4.19L2,12l6,6l1.41-1.41L4.83,12L7,9.83 l12.78,12.78l1.41-1.41L2.81,2.81L1.39,4.22z"></path></g>
|
||||
+ <g id="timezone-override"><path d="M21.72 11.33l-6.644-7.035a.97.97 0 0 0-1.38-.01l-1.67 1.72-1.617-1.712a.97.97 0 0 0-1.38-.01l-6.737 6.935c-.187.191-.29.447-.292.719-.002.272.099.529.28.722l6.644 7.034a.949.949 0 0 0 1.38.011l1.671-1.718 1.615 1.71a.949.949 0 0 0 1.381.01l6.74-6.935a1.054 1.054 0 0 0 .01-1.44zM6.947 12.464l3.657 3.785-.974.98-5.273-5.456 5.349-5.378.929.962-3.677 3.7a.998.998 0 0 0-.292.702 1 1 0 0 0 .28.705zm7.35 4.768l-.931-.963 3.68-3.7a1.012 1.012 0 0 0 .007-1.407l-3.656-3.784.974-.98 5.273 5.456-5.348 5.378z"></path></g>
|
||||
+ <g id="timezone-override-off"><path d="M7.95,5.12l0.73-0.8C8.88,4.11,9.15,4,9.42,4c0.27,0,0.54,0.11,0.74,0.32L12,6.34l1.85-2.01C14.04,4.11,14.31,4,14.58,4 c0.27,0,0.54,0.11,0.74,0.32l6.42,7c0.35,0.38,0.35,0.97,0,1.35l-2.98,3.25l-1.42-1.42l2.3-2.51l-5.06-5.52l-1.23,1.34l3.21,3.51 c0.35,0.38,0.35,0.97,0,1.35l-0.51,0.56L7.95,5.12z M19.78,22.61l-3.73-3.73l-0.73,0.8c-0.2,0.22-0.47,0.32-0.74,0.32 c-0.27,0-0.54-0.11-0.74-0.32L12,17.66l-1.85,2.01C9.96,19.89,9.69,20,9.42,20c-0.27,0-0.54-0.11-0.74-0.32l-6.42-7 c-0.35-0.38-0.35-0.97,0-1.35l2.98-3.25L1.39,4.22l1.41-1.41l18.38,18.38L19.78,22.61z M10.64,16.18l-3.21-3.51 c-0.35-0.38-0.35-0.97,0-1.35l0.51-0.56L6.66,9.49L4.36,12l5.06,5.52L10.64,16.18z"></path></g>
|
||||
</defs>
|
||||
</svg>
|
||||
</iron-iconset-svg>
|
||||
diff --git a/chrome/browser/resources/settings/privacy_page/privacy_page.html b/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
--- a/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
+++ b/chrome/browser/resources/settings/privacy_page/privacy_page.html
|
||||
@@ -1148,4 +1148,26 @@
|
||||
</category-setting-exceptions>
|
||||
</settings-subpage>
|
||||
</template>
|
||||
+ <template is="dom-if" route-path="/content/timezone-override" no-search>
|
||||
+ <settings-subpage page-title="$i18n{siteSettingsTimezoneOverride}"
|
||||
+ search-label="$i18n{siteSettingsAllSitesSearch}"
|
||||
+ search-term="{{searchFilter_}}">
|
||||
+ <div class="content-settings-header secondary">
|
||||
+ $i18n{siteSettingsTimezoneOverrideDescription}
|
||||
+ </div>
|
||||
+ <settings-category-default-radio-group
|
||||
+ category="[[contentSettingsTypesEnum_.TIMEZONE_OVERRIDE]]"
|
||||
+ allow-option-label="$i18n{siteSettingsTimezoneOverrideAllowed}"
|
||||
+ allow-option-icon="settings:timezone-override"
|
||||
+ block-option-label="$i18n{siteSettingsTimezoneOverrideBlocked}"
|
||||
+ block-option-icon="settings:timezone-override-off">
|
||||
+ </settings-category-default-radio-group>
|
||||
+ <category-setting-exceptions
|
||||
+ category="[[contentSettingsTypesEnum_.TIMEZONE_OVERRIDE]]"
|
||||
+ block-header="$i18n{siteSettingsTimezoneOverrideBlockedExceptions}"
|
||||
+ allow-header="$i18n{siteSettingsTimezoneOverrideAllowedExceptions}"
|
||||
+ search-filter="[[searchFilter_]]">
|
||||
+ </category-setting-exceptions>
|
||||
+ </settings-subpage>
|
||||
+ </template>
|
||||
</settings-animated-pages>
|
||||
diff --git a/chrome/browser/resources/settings/route.ts b/chrome/browser/resources/settings/route.ts
|
||||
--- a/chrome/browser/resources/settings/route.ts
|
||||
+++ b/chrome/browser/resources/settings/route.ts
|
||||
@@ -124,6 +124,7 @@ function addPrivacyChildRoutes(r: Partial<SettingsRoutes>) {
|
||||
r.SITE_SETTINGS_LOCAL_FONTS = r.SITE_SETTINGS.createChild('localFonts');
|
||||
r.SITE_SETTINGS_AUTOPLAY = r.SITE_SETTINGS.createChild('autoplay');
|
||||
r.SITE_SETTINGS_JAVASCRIPT_JIT = r.SITE_SETTINGS.createChild('javascript-jit');
|
||||
+ r.SITE_SETTINGS_TIMEZONE_OVERRIDE = r.SITE_SETTINGS.createChild('timezone-override');
|
||||
}
|
||||
|
||||
/**
|
||||
diff --git a/chrome/browser/resources/settings/router.ts b/chrome/browser/resources/settings/router.ts
|
||||
--- a/chrome/browser/resources/settings/router.ts
|
||||
+++ b/chrome/browser/resources/settings/router.ts
|
||||
@@ -106,6 +106,7 @@ export interface SettingsRoutes {
|
||||
TRIGGERED_RESET_DIALOG: Route;
|
||||
SITE_SETTINGS_AUTOPLAY: Route;
|
||||
SITE_SETTINGS_JAVASCRIPT_JIT: Route;
|
||||
+ SITE_SETTINGS_TIMEZONE_OVERRIDE: Route;
|
||||
}
|
||||
|
||||
/** Class for navigable routes. */
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/category_default_setting.ts b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/category_default_setting.ts
|
||||
@@ -197,6 +197,7 @@ export class CategoryDefaultSettingElement extends
|
||||
case ContentSettingsTypes.SOUND:
|
||||
case ContentSettingsTypes.AUTOPLAY:
|
||||
case ContentSettingsTypes.JAVASCRIPT_JIT:
|
||||
+ case ContentSettingsTypes.TIMEZONE_OVERRIDE:
|
||||
// "Allowed" vs "Blocked".
|
||||
this.browserProxy.setDefaultValueForContentType(
|
||||
this.category,
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/constants.ts b/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/constants.ts
|
||||
@@ -48,6 +48,7 @@ export enum ContentSettingsTypes {
|
||||
ZOOM_LEVELS = 'zoom-levels',
|
||||
AUTOPLAY = 'autoplay',
|
||||
JAVASCRIPT_JIT = 'javascript-jit',
|
||||
+ TIMEZONE_OVERRIDE = 'timezone-override',
|
||||
|
||||
// The following items are not in the C++ kContentSettingsTypeGroupNames, but
|
||||
// are used everywhere where ContentSettingsTypes is used in JS.
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings/settings_category_default_radio_group.ts
|
||||
@@ -141,6 +141,7 @@ export class SettingsCategoryDefaultRadioGroupElement extends
|
||||
case ContentSettingsTypes.SOUND:
|
||||
case ContentSettingsTypes.AUTOPLAY:
|
||||
case ContentSettingsTypes.JAVASCRIPT_JIT:
|
||||
+ case ContentSettingsTypes.TIMEZONE_OVERRIDE:
|
||||
// "Allowed" vs "Blocked".
|
||||
return ContentSetting.ALLOW;
|
||||
case ContentSettingsTypes.AR:
|
||||
diff --git a/chrome/browser/resources/settings/site_settings/site_details.html b/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
--- a/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
+++ b/chrome/browser/resources/settings/site_settings/site_details.html
|
||||
@@ -276,4 +276,9 @@
|
||||
icon="settings:javascript-jit"
|
||||
label="$i18n{siteSettingsJavascriptJIT}">
|
||||
</site-details-permission>
|
||||
+ <site-details-permission
|
||||
+ category="[[contentSettingsTypesEnum_.TIMEZONE_OVERRIDE]]"
|
||||
+ icon="settings:timezone-override"
|
||||
+ label="$i18n{siteSettingsTimezoneOverride}">
|
||||
+ </site-details-permission>
|
||||
</div>
|
||||
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page.ts
|
||||
@@ -350,6 +350,14 @@ function getCategoryItemMap(): Map<ContentSettingsTypes, CategoryListItem> {
|
||||
enabledLabel: 'siteSettingsJavascriptJITAllowed',
|
||||
disabledLabel: 'siteSettingsJavascriptJITBlocked',
|
||||
},
|
||||
+ {
|
||||
+ route: routes.SITE_SETTINGS_TIMEZONE_OVERRIDE,
|
||||
+ id: Id.TIMEZONE_OVERRIDE,
|
||||
+ label: 'siteSettingsTimezoneOverride',
|
||||
+ icon: 'settings:timezone-override',
|
||||
+ enabledLabel: 'siteSettingsTimezoneOverrideAllowed',
|
||||
+ disabledLabel: 'siteSettingsTimezoneOverrideBlocked',
|
||||
+ },
|
||||
];
|
||||
|
||||
categoryItemMap = new Map(categoryList.map(item => [item.id, item]));
|
||||
@@ -445,6 +453,7 @@ export class SettingsSiteSettingsPageElement extends
|
||||
Id.SITE_DATA,
|
||||
Id.AUTOPLAY,
|
||||
Id.JAVASCRIPT_JIT,
|
||||
+ Id.TIMEZONE_OVERRIDE,
|
||||
]),
|
||||
};
|
||||
},
|
||||
diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
--- a/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
+++ b/chrome/browser/resources/settings/site_settings_page/site_settings_page_util.ts
|
||||
@@ -81,6 +81,8 @@ export function getLocalizationStringForContentType(
|
||||
return 'siteSettingsAutoplayMidSentence';
|
||||
case ContentSettingsTypes.JAVASCRIPT_JIT:
|
||||
return 'siteSettingsJavascriptJITMidSentence';
|
||||
+ case ContentSettingsTypes.TIMEZONE_OVERRIDE:
|
||||
+ return 'siteSettingsTimezoneOverrideMidSentence';
|
||||
// The following members do not have a mid-sentence localization.
|
||||
case ContentSettingsTypes.ANTI_ABUSE:
|
||||
case ContentSettingsTypes.PDF_DOCUMENTS:
|
||||
diff --git a/chrome/browser/ui/views/page_info/page_info_view_factory.cc b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
--- a/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
+++ b/chrome/browser/ui/views/page_info/page_info_view_factory.cc
|
||||
@@ -375,6 +375,9 @@ const ui::ImageModel PageInfoViewFactory::GetPermissionIcon(
|
||||
case ContentSettingsType::JAVASCRIPT_JIT:
|
||||
icon = &vector_icons::kCodeIcon;
|
||||
break;
|
||||
+ case ContentSettingsType::TIMEZONE_OVERRIDE:
|
||||
+ icon = &vector_icons::kAccountCircleIcon;
|
||||
+ break;
|
||||
default:
|
||||
// All other |ContentSettingsType|s do not have icons on desktop or are
|
||||
// not shown in the Page Info bubble.
|
||||
diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
--- a/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/settings_localized_strings_provider.cc
|
||||
@@ -2534,6 +2534,13 @@ void AddSiteSettingsStrings(content::WebUIDataSource* html_source,
|
||||
{"siteSettingsJavascriptJITAllowedExceptions",IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_ALLOWED_EXCEPTIONS},
|
||||
{"siteSettingsJavascriptJITBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_BLOCKED_EXCEPTIONS},
|
||||
{"siteSettingsJavascriptJITMidSentence", IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT},
|
||||
+ {"siteSettingsTimezoneOverride", IDS_SITE_SETTINGS_TIMEZONE_OVERRIDE_TITLE},
|
||||
+ {"siteSettingsTimezoneOverrideDescription", IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_DESCRIPTION},
|
||||
+ {"siteSettingsTimezoneOverrideAllowed", IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_ALLOWED},
|
||||
+ {"siteSettingsTimezoneOverrideBlocked", IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_BLOCKED},
|
||||
+ {"siteSettingsTimezoneOverrideAllowedExceptions",IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_ALLOWED_EXCEPTIONS},
|
||||
+ {"siteSettingsTimezoneOverrideBlockedExceptions", IDS_SETTINGS_SITE_SETTINGS_TIMEZONE_OVERRIDE_BLOCKED_EXCEPTIONS},
|
||||
+ {"siteSettingsTimezoneOverrideMidSentence", IDS_SITE_SETTINGS_TIMEZONE_OVERRIDE_TITLE},
|
||||
{"addSite", IDS_SETTINGS_ADD_SITE},
|
||||
{"addSiteTitle", IDS_SETTINGS_ADD_SITE_TITLE},
|
||||
#if BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
diff --git a/chrome/browser/ui/webui/settings/site_settings_helper.cc b/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
--- a/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
+++ b/chrome/browser/ui/webui/settings/site_settings_helper.cc
|
||||
@@ -127,6 +127,7 @@ const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = {
|
||||
{ContentSettingsType::ANTI_ABUSE, "anti-abuse"},
|
||||
{ContentSettingsType::AUTOPLAY, "autoplay"},
|
||||
{ContentSettingsType::JAVASCRIPT_JIT, "javascript-jit"},
|
||||
+ {ContentSettingsType::TIMEZONE_OVERRIDE, "timezone-override"},
|
||||
|
||||
// Add new content settings here if a corresponding Javascript string
|
||||
// representation for it is not required, for example if the content setting
|
||||
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
--- a/components/content_settings/core/browser/content_settings_registry.cc
|
||||
+++ b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
@@ -566,7 +566,7 @@ void ContentSettingsRegistry::Init() {
|
||||
CONTENT_SETTING_ASK, // custom timezone, default UTC
|
||||
CONTENT_SETTING_BLOCK}, // random
|
||||
WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
|
||||
- WebsiteSettingsRegistry::PLATFORM_ANDROID,
|
||||
+ WebsiteSettingsRegistry::ALL_PLATFORMS,
|
||||
ContentSettingsInfo::INHERIT_IN_INCOGNITO,
|
||||
ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS);
|
||||
|
||||
--
|
||||
2.25.1
|
||||
@@ -0,0 +1,344 @@
|
||||
From: uazo <uazo@users.noreply.github.com>
|
||||
Date: Sat, 7 Nov 2020 21:59:18 +0000
|
||||
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
|
||||
---
|
||||
.../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
|
||||
.../res/drawable-xxhdpi/settings_autoplay.png | Bin 0 -> 792 bytes
|
||||
.../drawable-xxxhdpi/settings_autoplay.png | Bin 0 -> 1064 bytes
|
||||
.../impl/BromiteAutoplayContentSetting.java | 92 ++++++++++++++++++
|
||||
.../bromite_content_settings/autoplay.grdp | 21 ++++
|
||||
.../bromite_content_settings/autoplay.inc | 13 +++
|
||||
.../core/browser/content_settings_registry.cc | 2 +-
|
||||
.../core/html/media/autoplay_policy.cc | 14 +++
|
||||
.../core/html/media/autoplay_policy.h | 4 +
|
||||
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
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-xxhdpi/settings_autoplay.png
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-xxxhdpi/settings_autoplay.png
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteAutoplayContentSetting.java
|
||||
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/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
|
||||
GIT binary patch
|
||||
literal 456
|
||||
zcmV;(0XP1MP)<h;3K|Lk000e1NJLTq001Na001Ni1ONa4O9@aD0004xNkl<Zcmd^>
|
||||
zv2MaJ5QYmZs7m@68Tt%)0T}7#GcJmh4B69}fh}W`x!sUhd4N1chpY%8u@-es;cQTy
|
||||
zGbWY1VQ**q%l&uuT^{am%=;qbIaI7>hvTfF;<*Ut{eMAbL!QB&HFUzBXR~2P41Zx8
|
||||
z)>!6-O>RP(9xN_j-$FSZiy-wPUj)-Jl(4<5Et;Mc!<K5}jwP!>dwn%v3G5VXX+fR6
|
||||
zfpz3x+Y|Y)K6`aNHVw{qdv4}^DAdl0F;g<cu%;M_QeJHg8RVIajV_AK%qV!0vEmv1
|
||||
z#vVbjZa-Q+lSd;emiMaVzX)Z*+nGY^7d%tYY9KFz2z6mO9x2+}RepX<5}`zKxo)iR
|
||||
zz{m)~NhMClXs`4GHM$vG2T_S4KzpqpIGl{BX8{q3sfX5s0TlVSK=Ataj-&0{v9#{N
|
||||
z{;&j_q`#yfB8jBm<%OhAge7edm84b@`b2QRo9WRKN#xNwD<h5zoBL8ri$BDs;tw$`
|
||||
y{$1Kp0i#npN<C~x1#L&}8>IV|-Tf!x{>CqV{oZM{Igf1s0000<MNUMnLSTY>m&@A#
|
||||
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
diff --git a/components/browser_ui/site_settings/android/java/res/drawable-mdpi/settings_autoplay.png b/components/browser_ui/site_settings/android/java/res/drawable-mdpi/settings_autoplay.png
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..49fa10d44f4007532d0d03d15fdcb1a715857e96
|
||||
GIT binary patch
|
||||
literal 296
|
||||
zcmV+@0oVSCP)<h;3K|Lk000e1NJLTq000;O000;W1ONa4N`Cco0002*Nkl<Zc-p;F
|
||||
zu?>ST5R5=Hk+X;yg9#|y{3AI^L4jN_0yR^lp<y0UAY}`bhK9U}6x+c{;s$?XpYHT`
|
||||
z_WQ8+DiaXc!3Y!8NIOv`U+9>_9hQ%}W9}t45w<H~z#4hQDkf8`VbB=1O|%hcI?jda
|
||||
zV;k+`LgB0>TQfw*%xg4TCAk}wycg<C;jW}mI*Sz_g!XRC-~-OCu{Db@O*?8?8^Rj&
|
||||
zS{^N1H6fiLjCAC#fRLNPkP|W*!URjjT!AiQtzvYZ{t%#iA(xXD1Xz-(u@oBGf2}Be
|
||||
u*BbnAfuj*Re80yVxjo)NA1L&T?!2C$I@?4>V>|Ky0000<MNUMnLSTX*1bI&Y
|
||||
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
diff --git a/components/browser_ui/site_settings/android/java/res/drawable-xhdpi/settings_autoplay.png b/components/browser_ui/site_settings/android/java/res/drawable-xhdpi/settings_autoplay.png
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5a4128a5e02949de754f9cab2635824eda8c539c
|
||||
GIT binary patch
|
||||
literal 551
|
||||
zcmV+?0@(eDP)<h;3K|Lk000e1NJLTq001xm001xu1ONa4{R=S+0005*Nkl<Zc-rk(
|
||||
zy>fy;5RRo0wX?Hwh9Zw(#Vgp}9uO@kj!GT?W_XdLp-A4qiidDg@B~=L$xN`2Fo6Ry
|
||||
zoC`9!!WnNX*>%6WZ+~v@;l6HTnG5Pb03nIUF_Q>F2&iK&{=v0ABR=d&Dwa&+>$CpO
|
||||
zN8o1rO<Uv$u0HDF9##;Ow3|Q-tE-%+18~W?=HLW7u&HLKOxcVLm1<yTUrsfUGq~xX
|
||||
zqx<cUyx0DE0A@`^cGeUaIn=iCwjFlbea(GBJf>jQOd%dgDu@oJ0JqvZU3NJ!T~_A+
|
||||
zw>7k!d)Tk%U1PSM!@i8g3Qx?K@4o3Chv27xSRb|1lL*LZCn{;7NuQNv<q5!Ftw$V!
|
||||
zc)av3R5$TCJ)+DZDSW^ao>676eW3vl6flwYSMx=l(G+1kL4+N%tlEhfAQy}(nDFWr
|
||||
zbXw{Z4tCiO1OTTBcDW68nyP>kgahDIfn8VxO;uQ6Yd8Q-71auD*mMx(DnrEqaH<To
|
||||
z&_)dhyat$p1K?CKh1bGGfX(<C05JbrZN`P>Q#wV`gM2wnZ5*JY22WGzg(js{SktOi
|
||||
z^lWxu_H1_Y+jaYe^U~wOk$z>$zx3sgE%FC1e02PlFgl8cUvcTd1Q~vNjPEQT-<g7p
|
||||
p?=l}ClAlmgAAvHTvG;Wo>j%AMEx!+_@2>y=002ovPDHLkV1fY;_gnw~
|
||||
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
diff --git a/components/browser_ui/site_settings/android/java/res/drawable-xxhdpi/settings_autoplay.png b/components/browser_ui/site_settings/android/java/res/drawable-xxhdpi/settings_autoplay.png
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7fceb8c2b546970a3720e8ab225799aa03895b7f
|
||||
GIT binary patch
|
||||
literal 792
|
||||
zcmV+z1LypSP)<h;3K|Lk000e1NJLTq002k;002k`1ONa4|Kxkj0008tNkl<ZcmeHN
|
||||
zv2Nl_5Kd(&P^2J2k<wEAFOV*wK{6%nd}~AH7AGB@E1m)cC{TL;PY?@4L47q{DkQ2)
|
||||
zgu;oFPN%!E!Ny}lw9<LD9oFB@H#0js!$l#56r!s*CDlL=Bg|=u6>VsP6)iEx2tCzs
|
||||
zN?!=Ys;Vvm+R!dxZSbnPR`u*)=$?G~q+QDONj}}54UDQIpq+dnupUkhrgMXd90~(9
|
||||
z>D-*sHYV1z%eSyr=BeO3;m5&Ge2@<pO;xiip5YmGMb*%ROFljhg4(L5++aL|o)4Xt
|
||||
z#%NjP*f=bsMdO23efEqzx#k+Py)EC-cdk<X`U-t|-#g6Ixz21IO!tgFux}-M*tcpx
|
||||
z+bE=rR*I5^H|s7_BE7>~l(<Z;9NA<MwvEhAv<UAec5h`y4E^$WnI||NFX<&hz9~zC
|
||||
z>oA;)6G#{m)`C=tNtmpB)?rp!gtK?*J1gwU@xCMXrLcRedOG_Aoa>~>!hiCJ<GzU?
|
||||
zU4g;RFi3>{ojT&^9q|2A6eswfXXRwNew}jUlw`DpvbTS<8sy~{`pMeAwZ6%yL!Xy$
|
||||
zN2*G=JTQ;lS${M|)Hzo?si<yxhaM+sazIk*Xq?iqof0qI(UJg?P=^+O4kR2zHF)`D
|
||||
zl|_IA)LCU-!l_0)@}9u|IUq50<g;J&;sK4Ankxn*pe__Vqj<GBGo&d7B%n^2OnV;x
|
||||
zfh7Y}69W=Zr)o@h8E>K0Up2cT1|*=)t}wk-{0CUjdxjX0fI83Mf&Ybo(3S(znzB<m
|
||||
z^)SCv%fntq6%#ah*z2DdwY@s>U#@89zg#sfKk^r7!;A&m>sd-zwDXs+niu)Z|Ao(>
|
||||
z;TfMn@`obY`5%hfKBYBiHdqh(w`25gSn1i))3E8OQ(Krf&Sz(7oX<QX`)FaR!DvC-
|
||||
z;R|!`ZTxsjnS4B@Ou=|cg8`miBTkKmz^eW)jLCUb2{*+b2?DrQRj0pNXexyiQpitx
|
||||
WnED%yq_MdG0000<MNUMnLSTZmtagO}
|
||||
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
diff --git a/components/browser_ui/site_settings/android/java/res/drawable-xxxhdpi/settings_autoplay.png b/components/browser_ui/site_settings/android/java/res/drawable-xxxhdpi/settings_autoplay.png
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..92a315bb00ac1f4dc675e894bf4af3ba7c68bf39
|
||||
GIT binary patch
|
||||
literal 1064
|
||||
zcmV+@1lRkCP)<h;3K|Lk000e1NJLTq003YB003YJ1ONa4NRhv@000B;Nkl<Zc-rk-
|
||||
zF-Rjp6x}q5UMCS0#3Pl(5mH&l%1Q;{uKI6w6G2RqfI_g2*e8Om;Gwl(ZGDB6<Z@mY
|
||||
z41!h)DtJW--GhTGoY}a$GqZ^U^QZnZ|INPr^Z%bejuk6btXQ$4Pc|mmBCFCqouNZL
|
||||
z+*6<WxThXEbVmEE$`&^!KcwMX<5*@*wCR=nknxH(Yhrn8{DYY8r>Mvd@I-#RfhTrA
|
||||
zML#uC<7*jKp)UCfqsuC_%t(wck71K;$=5J$u~{A)viWQYSLEv(xME8~Gk$Frr{wD&
|
||||
zI9;0^#@?^uf&63!9@uK4#y8Tm7iz{GPOt-V=gT=S+ekOkUbdWb=Rw%P3EhS2?={j1
|
||||
znNJh=@$S+WRQC#g>V2o{6{t=Z?|z3LG~wtMZ-y=hF8Pd>n~yV_n@0=J13_GRGrG;6
|
||||
z!}Wm09<l3XrRL0HmmUXf$+b79b@vCEkE8V|m6_M4a5NCYj5h8ElLt5Mf{yv!1>6J^
|
||||
zi6*pop5R{>=jCZ_r}{L`gMViY9x2#y;<%R48&%;r*r_TXTLH$uVB1MRu#FdSHKn7?
|
||||
z`-}(CeD>8zNbpUBfCq&DBPizKc3=Bf2#S%UBhDc1I|)nBzrdE{;{7Yp^VBj!$TQBx
|
||||
zU|S+zz^3T;B^;-eQx(qzY{qtLVzw3S*uwXXPwGdTn6<_H_N*cX4be2o$8UU5g&+nP
|
||||
ztP-!%(B(t6s4>q!uz#qm24H<k2=lrzDi~B0_J233?tcwcDq&ZkQ87A!4)}QA%f<zu
|
||||
zN+mDL=L_s0dX?>oQ*Am<Tmb4+LW?hjMXctzD}w*YO8`)&lA9OoSdl_b7mgzXK%Gi_
|
||||
z?u=G6wV#{`bvXd)RH8aJPdie9oUbr@1vvofRPqXZWjjJ~o-Oiq9zP`qK%Gi{imxNF
|
||||
z#ZV>GxMfcqM;3rOm2koVsD>M`&n>zm4?vwt*x~f|!wop&79@E9>Qn-8+GpV^zc}AJ
|
||||
zFAqSSO71+T*$FqG_g1BxlLw$qrE-qb>xHV|o^zsEc>wBE^0J)HeYgSrw<?XaJOFhn
|
||||
zHPW0;|APTQNjCuVDP;an+!=-&MJXXSYW_iHekj4JNd|K$X%6Ph52wvfXhcC<e@cl`
|
||||
zVkxC4tod=0da3dbmbI2u4)v8)uq;{FLQA%=g_7RFmf@vE<BPjPEU%+9qVl@=7aZzW
|
||||
zOoyYnVlw}dPjsfExn`|pg0EQ(zvwo+)xh{>55wDS3~zX{EoY-``m=49hBUsaw;r=*
|
||||
z+}2~(e82VBHh+(@{oX!+2n#ThdxByg0maD|^ghF~58(`dil|N~cLlAek3rFLSGLCO
|
||||
ib6hJ{tXQ#P#rX?0El=KlH_u1_0000<MNUMnLSTX(y!wd%
|
||||
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteAutoplayContentSetting.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteAutoplayContentSetting.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteAutoplayContentSetting.java
|
||||
@@ -0,0 +1,92 @@
|
||||
+/*
|
||||
+ 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.SiteSettingsCategory;
|
||||
+import org.chromium.components.content_settings.ContentSettingValues;
|
||||
+import org.chromium.components.content_settings.ContentSettingsType;
|
||||
+import org.chromium.content_public.browser.BrowserContextHandle;
|
||||
+
|
||||
+import androidx.annotation.Nullable;
|
||||
+import androidx.preference.Preference;
|
||||
+import androidx.preference.PreferenceScreen;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+
|
||||
+public class BromiteAutoplayContentSetting extends BromiteCustomContentSetting {
|
||||
+ public BromiteAutoplayContentSetting() {
|
||||
+ super(/*contentSettingsType*/ ContentSettingsType.AUTOPLAY,
|
||||
+ /*defaultEnabledValue*/ ContentSettingValues.ALLOW,
|
||||
+ /*defaultDisabledValue*/ ContentSettingValues.BLOCK,
|
||||
+ /*allowException*/ true,
|
||||
+ /*preferenceKey*/ "autoplay",
|
||||
+ /*profilePrefKey*/ "autoplay");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ContentSettingsResources.ResourceItem getResourceItem() {
|
||||
+ return new ContentSettingsResources.ResourceItem(
|
||||
+ /*icon*/ R.drawable.settings_autoplay,
|
||||
+ /*title*/ R.string.autoplay_permission_title,
|
||||
+ /*defaultEnabledValue*/ getDefaultEnabledValue(),
|
||||
+ /*defaultDisabledValue*/ getDefaultDisabledValue(),
|
||||
+ /*enabledSummary*/ R.string.website_settings_category_autoplay_enabled,
|
||||
+ /*disabledSummary*/ R.string.website_settings_category_autoplay_disabled);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getCategorySummary(@Nullable @ContentSettingValues int value) {
|
||||
+ switch (value) {
|
||||
+ case ContentSettingValues.ALLOW:
|
||||
+ return R.string.website_settings_category_autoplay_enabled;
|
||||
+ case ContentSettingValues.BLOCK:
|
||||
+ return R.string.website_settings_category_autoplay_disabled;
|
||||
+ default:
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getCategoryDescription() {
|
||||
+ return R.string.website_settings_add_site_description_autoplay;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean requiresTriStateContentSetting() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean showOnlyDescriptions() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getAddExceptionDialogMessage() {
|
||||
+ return R.string.website_settings_category_autoplay_enabled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @Nullable Boolean considerException(SiteSettingsCategory category, @ContentSettingValues int value) {
|
||||
+ return value != ContentSettingValues.BLOCK;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/components/browser_ui/strings/bromite_content_settings/autoplay.grdp b/components/browser_ui/strings/bromite_content_settings/autoplay.grdp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/strings/bromite_content_settings/autoplay.grdp
|
||||
@@ -0,0 +1,21 @@
|
||||
+<?xml version="1.0" encoding="utf-8"?>
|
||||
+<grit-part>
|
||||
+ <message name="IDS_AUTOPLAY_PERMISSION_TITLE" desc='Title for the Autoplay settings screen [CHAR-LIMIT=32]' formatter_data="android_java">
|
||||
+ Autoplay
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_ADD_SITE_DESCRIPTION_AUTOPLAY" desc="The description for the allow autoplay of muted videos for website dialog." formatter_data="android_java">
|
||||
+ Allow autoplay for a specific site.
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_AUTOPLAY_ENABLED" desc="Summary text explaining that sites are allowed to compile JavaScript in JIT mode." formatter_data="android_java">
|
||||
+ Allow sites to automatically play muted videos
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_AUTOPLAY_DISABLED" desc="Summary text explaining that sites are running JavaScript in JITless mode." formatter_data="android_java">
|
||||
+ Autoplay disabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_ALLOWED_EXCEPTIONS" desc="Label for the allowed exceptions site list of the autoplay setting.">
|
||||
+ Allowed to autoplay
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the autoplay setting.">
|
||||
+ Not allowed to autoplay
|
||||
+ </message>
|
||||
+</grit-part>
|
||||
diff --git a/components/content_settings/core/browser/bromite_content_settings/autoplay.inc b/components/content_settings/core/browser/bromite_content_settings/autoplay.inc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/content_settings/core/browser/bromite_content_settings/autoplay.inc
|
||||
@@ -0,0 +1,13 @@
|
||||
+ content_settings::WebsiteSettingsRegistry::GetInstance()
|
||||
+ ->GetMutable(ContentSettingsType::AUTOPLAY)
|
||||
+ ->set_show_into_info_page()
|
||||
+ .set_desktop_ui()
|
||||
+ .set_is_renderer_content_setting()
|
||||
+ .set_title_ui(IDS_AUTOPLAY_PERMISSION_TITLE)
|
||||
+ .set_description_ui(IDS_WEBSITE_SETTINGS_ADD_SITE_DESCRIPTION_AUTOPLAY)
|
||||
+ .set_allowed_ui(IDS_WEBSITE_SETTINGS_CATEGORY_AUTOPLAY_ENABLED)
|
||||
+ .set_blocked_ui(IDS_WEBSITE_SETTINGS_CATEGORY_AUTOPLAY_DISABLED)
|
||||
+ .set_allowed_exceptions_ui(IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_ALLOWED_EXCEPTIONS)
|
||||
+ .set_blocked_exceptions_ui(IDS_SETTINGS_SITE_SETTINGS_AUTOPLAY_BLOCKED_EXCEPTIONS)
|
||||
+ .set_mid_sentence_ui(IDS_AUTOPLAY_PERMISSION_TITLE);
|
||||
+
|
||||
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
--- a/components/content_settings/core/browser/content_settings_registry.cc
|
||||
+++ b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
@@ -237,7 +237,7 @@ void ContentSettingsRegistry::Init() {
|
||||
ContentSettingsInfo::INHERIT_IN_INCOGNITO,
|
||||
ContentSettingsInfo::EXCEPTIONS_ON_SECURE_ORIGINS_ONLY);
|
||||
|
||||
- Register(ContentSettingsType::AUTOPLAY, "autoplay", CONTENT_SETTING_ALLOW,
|
||||
+ Register(ContentSettingsType::AUTOPLAY, "autoplay", CONTENT_SETTING_BLOCK,
|
||||
WebsiteSettingsInfo::UNSYNCABLE, /*allowlisted_schemes=*/{},
|
||||
/*valid_settings=*/{CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK},
|
||||
WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
|
||||
diff --git a/third_party/blink/renderer/core/html/media/autoplay_policy.cc b/third_party/blink/renderer/core/html/media/autoplay_policy.cc
|
||||
--- a/third_party/blink/renderer/core/html/media/autoplay_policy.cc
|
||||
+++ b/third_party/blink/renderer/core/html/media/autoplay_policy.cc
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "third_party/blink/public/mojom/autoplay/autoplay.mojom-blink.h"
|
||||
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom-blink.h"
|
||||
#include "third_party/blink/public/mojom/webpreferences/web_preferences.mojom-blink.h"
|
||||
+#include "third_party/blink/public/platform/web_content_settings_client.h"
|
||||
#include "third_party/blink/public/platform/web_media_player.h"
|
||||
#include "third_party/blink/public/web/web_local_frame.h"
|
||||
#include "third_party/blink/public/web/web_local_frame_client.h"
|
||||
@@ -310,6 +311,8 @@ void AutoplayPolicy::TryUnlockingUserGesture() {
|
||||
}
|
||||
|
||||
bool AutoplayPolicy::IsGestureNeededForPlayback() const {
|
||||
+ if (!IsAutoplayAllowedPerSettings())
|
||||
+ return true;
|
||||
if (!IsLockedPendingUserGesture())
|
||||
return false;
|
||||
|
||||
@@ -408,6 +411,17 @@ void AutoplayPolicy::MaybeSetAutoplayInitiated() {
|
||||
}
|
||||
}
|
||||
|
||||
+bool AutoplayPolicy::IsAutoplayAllowedPerSettings() const {
|
||||
+ LocalFrame* frame = element_->GetDocument().GetFrame();
|
||||
+ if (!frame)
|
||||
+ return false;
|
||||
+ if (auto* settings_client = frame->GetContentSettingsClient()) {
|
||||
+ return settings_client->AllowContentSetting(
|
||||
+ ContentSettingsType::AUTOPLAY, /*default_value*/ false);
|
||||
+ }
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
bool AutoplayPolicy::ShouldAutoplay() {
|
||||
if (!element_->GetExecutionContext() ||
|
||||
element_->GetExecutionContext()->IsSandboxed(
|
||||
diff --git a/third_party/blink/renderer/core/html/media/autoplay_policy.h b/third_party/blink/renderer/core/html/media/autoplay_policy.h
|
||||
--- a/third_party/blink/renderer/core/html/media/autoplay_policy.h
|
||||
+++ b/third_party/blink/renderer/core/html/media/autoplay_policy.h
|
||||
@@ -133,6 +133,10 @@ class CORE_EXPORT AutoplayPolicy final
|
||||
// should use, if checking to see if an action is allowed.
|
||||
bool IsLockedPendingUserGesture() const;
|
||||
|
||||
+ // Return true if and only if the settings allow autoplay of media on this
|
||||
+ // frame.
|
||||
+ bool IsAutoplayAllowedPerSettings() const;
|
||||
+
|
||||
bool IsAutoplayingMutedInternal(bool muted) const;
|
||||
bool IsOrWillBeAutoplayingMutedInternal(bool muted) const;
|
||||
|
||||
--
|
||||
2.25.1
|
||||
@@ -9,61 +9,25 @@ Requires patch: Content-settings-infrastructure.patch
|
||||
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
|
||||
---
|
||||
.../browser_ui/site_settings/android/BUILD.gn | 3 +
|
||||
.../BromiteCustomContentSettingImpl.java | 1 +
|
||||
.../BromiteWebGLContentSetting.java | 85 +++++++++++++++++++
|
||||
.../site_settings/SiteSettingsCategory.java | 5 +-
|
||||
.../strings/android/browser_ui_strings.grd | 1 +
|
||||
.../browser_ui/strings/android/webgl.grdp | 18 ++++
|
||||
components/components_strings.grd | 1 +
|
||||
.../core/browser/content_settings_registry.cc | 13 +++
|
||||
.../core/browser/content_settings_utils.cc | 2 +
|
||||
.../core/common/content_settings.cc | 4 +-
|
||||
.../core/common/content_settings.h | 1 +
|
||||
.../core/common/content_settings.mojom | 1 +
|
||||
.../common/content_settings_mojom_traits.cc | 3 +-
|
||||
.../common/content_settings_mojom_traits.h | 5 ++
|
||||
.../core/common/content_settings_types.h | 2 +
|
||||
.../renderer/content_settings_agent_impl.cc | 9 ++
|
||||
.../renderer/content_settings_agent_impl.h | 1 +
|
||||
.../platform/web_content_settings_client.h | 2 +
|
||||
.../execution_context/execution_context.cc | 23 +++++
|
||||
.../execution_context/execution_context.h | 5 ++
|
||||
.../impl/BromiteWebGLContentSetting.java | 92 +++++++++++++++++++
|
||||
.../bromite_content_settings/webgl.grdp | 27 ++++++
|
||||
.../bromite_content_settings/webgl.inc | 23 +++++
|
||||
.../common/bromite_content_settings/WEBGL.inc | 1 +
|
||||
.../execution_context/execution_context.cc | 7 ++
|
||||
.../execution_context/execution_context.h | 2 +
|
||||
.../webgl/webgl_rendering_context_base.cc | 32 +++----
|
||||
.../webgl/webgl_rendering_context_base.h | 2 +
|
||||
22 files changed, 196 insertions(+), 23 deletions(-)
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteWebGLContentSetting.java
|
||||
create mode 100644 components/browser_ui/strings/android/webgl.grdp
|
||||
8 files changed, 167 insertions(+), 19 deletions(-)
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebGLContentSetting.java
|
||||
create mode 100644 components/browser_ui/strings/bromite_content_settings/webgl.grdp
|
||||
create mode 100644 components/content_settings/core/browser/bromite_content_settings/webgl.inc
|
||||
create mode 100644 components/content_settings/core/common/bromite_content_settings/WEBGL.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
|
||||
@@ -106,6 +106,9 @@ android_library("java") {
|
||||
"java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java",
|
||||
"java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSetting.java",
|
||||
]
|
||||
+ sources += [
|
||||
+ "java/src/org/chromium/components/browser_ui/site_settings/BromiteWebGLContentSetting.java",
|
||||
+ ]
|
||||
annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
|
||||
resources_package = "org.chromium.components.browser_ui.site_settings"
|
||||
deps = [
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java
|
||||
--- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java
|
||||
@@ -43,6 +43,7 @@ public abstract class BromiteCustomContentSettingImpl {
|
||||
|
||||
static {
|
||||
mItemList = new ArrayList<BromiteCustomContentSetting>();
|
||||
+ mItemList.add(new BromiteWebGLContentSetting());
|
||||
}
|
||||
|
||||
public static SiteSettingsCategory createFromType(
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteWebGLContentSetting.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteWebGLContentSetting.java
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebGLContentSetting.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebGLContentSetting.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteWebGLContentSetting.java
|
||||
@@ -0,0 +1,85 @@
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebGLContentSetting.java
|
||||
@@ -0,0 +1,92 @@
|
||||
+/*
|
||||
+ This file is part of Bromite.
|
||||
+
|
||||
@@ -81,8 +45,11 @@ new file mode 100644
|
||||
+ along with Bromite. If not, see <https://www.gnu.org/licenses/>.
|
||||
+*/
|
||||
+
|
||||
+package org.chromium.components.browser_ui.site_settings;
|
||||
+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.SiteSettingsCategory;
|
||||
+import org.chromium.components.content_settings.ContentSettingValues;
|
||||
@@ -98,7 +65,6 @@ new file mode 100644
|
||||
+public class BromiteWebGLContentSetting extends BromiteCustomContentSetting {
|
||||
+ public BromiteWebGLContentSetting() {
|
||||
+ super(/*contentSettingsType*/ ContentSettingsType.WEBGL,
|
||||
+ /*siteSettingsCategory*/ SiteSettingsCategory.Type.WEBGL,
|
||||
+ /*defaultEnabledValue*/ ContentSettingValues.ALLOW,
|
||||
+ /*defaultDisabledValue*/ ContentSettingValues.BLOCK,
|
||||
+ /*allowException*/ true,
|
||||
@@ -130,6 +96,11 @@ new file mode 100644
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getCategoryDescription() {
|
||||
+ return R.string.settings_site_settings_webgl_description;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean requiresTriStateContentSetting() {
|
||||
+ return false;
|
||||
+ }
|
||||
@@ -149,261 +120,83 @@ new file mode 100644
|
||||
+ return value != ContentSettingValues.BLOCK;
|
||||
+ }
|
||||
+}
|
||||
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
|
||||
@@ -48,7 +48,7 @@ public class SiteSettingsCategory {
|
||||
Type.USE_STORAGE, Type.AUTO_DARK_WEB_CONTENT, Type.REQUEST_DESKTOP_SITE,
|
||||
Type.FEDERATED_IDENTITY_API, Type.THIRD_PARTY_COOKIES, Type.SITE_DATA, Type.ANTI_ABUSE,
|
||||
Type.TIMEZONE_OVERRIDE, Type.AUTOPLAY, Type.JAVASCRIPT_JIT, Type.IMAGES,
|
||||
- Type.NUM_ENTRIES})
|
||||
+ Type.NUM_ENTRIES, Type.WEBGL})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Type {
|
||||
// All updates here must also be reflected in {@link #preferenceKey(int)
|
||||
@@ -86,10 +86,11 @@ public class SiteSettingsCategory {
|
||||
int AUTOPLAY = 30;
|
||||
int JAVASCRIPT_JIT = 31;
|
||||
int IMAGES = 32;
|
||||
+ int WEBGL = 33;
|
||||
/**
|
||||
* Number of handled categories used for calculating array sizes.
|
||||
*/
|
||||
- int NUM_ENTRIES = 33;
|
||||
+ int NUM_ENTRIES = 34;
|
||||
}
|
||||
|
||||
private final BrowserContextHandle mBrowserContextHandle;
|
||||
diff --git a/components/browser_ui/strings/android/browser_ui_strings.grd b/components/browser_ui/strings/android/browser_ui_strings.grd
|
||||
--- a/components/browser_ui/strings/android/browser_ui_strings.grd
|
||||
+++ b/components/browser_ui/strings/android/browser_ui_strings.grd
|
||||
@@ -174,6 +174,7 @@
|
||||
<release seq="1">
|
||||
<messages fallback_to_english="true">
|
||||
<part file="site_settings.grdp" />
|
||||
+ <part file="webgl.grdp" />
|
||||
|
||||
<message name="IDS_GOT_IT" desc="Button for the user to accept a disclosure/message" formatter_data="android_java">
|
||||
Got it
|
||||
diff --git a/components/browser_ui/strings/android/webgl.grdp b/components/browser_ui/strings/android/webgl.grdp
|
||||
diff --git a/components/browser_ui/strings/bromite_content_settings/webgl.grdp b/components/browser_ui/strings/bromite_content_settings/webgl.grdp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/strings/android/webgl.grdp
|
||||
@@ -0,0 +1,18 @@
|
||||
+++ b/components/browser_ui/strings/bromite_content_settings/webgl.grdp
|
||||
@@ -0,0 +1,27 @@
|
||||
+<?xml version="1.0" encoding="utf-8"?>
|
||||
+<grit-part>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_WEBGL" desc="The label used for webgl site settings controls.">
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_WEBGL" desc="The label used for webgl site settings controls." formatter_data="android_java">
|
||||
+ Webgl
|
||||
+ </message>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_WEBGL_MID_SENTENCE" desc="The label used for webgl site settings controls when used mid-sentence.">
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBGL_DESCRIPTION" desc="Description of the webgl content setting." formatter_data="android_java">
|
||||
+ Enable Webgl, a JavaScript API for rendering high-performance interactive 3D and 2D graphics
|
||||
+ </message>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_WEBGL_MID_SENTENCE" desc="The label used for webgl site settings controls when used mid-sentence." formatter_data="android_java">
|
||||
+ webgl
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBGL_PERMISSION_TITLE" desc="Title of the permission to use webgl [CHAR-LIMIT=32]">
|
||||
+ <message name="IDS_WEBGL_PERMISSION_TITLE" desc="Title of the permission to use webgl [CHAR-LIMIT=32]" formatter_data="android_java">
|
||||
+ Webgl
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_WEBGL_ENABLED" desc="Summary text explaining that webgl is full enabled.">
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_WEBGL_ENABLED" desc="Summary text explaining that webgl is full enabled." formatter_data="android_java">
|
||||
+ Enabled
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_WEBGL_DISABLED" desc="Summary text explaining that webgl is full disabled.">
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_WEBGL_DISABLED" desc="Summary text explaining that webgl is full disabled." formatter_data="android_java">
|
||||
+ Disabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBGL_ALLOWED_EXCEPTIONS" desc="Label for the allowed exceptions site list of the webgl setting.">
|
||||
+ Allowed to use webgl
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBGL_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the webgl setting.">
|
||||
+ Not allowed to use webgl
|
||||
+ </message>
|
||||
+</grit-part>
|
||||
diff --git a/components/components_strings.grd b/components/components_strings.grd
|
||||
--- a/components/components_strings.grd
|
||||
+++ b/components/components_strings.grd
|
||||
@@ -336,6 +336,7 @@
|
||||
<part file="version_ui_strings.grdp" />
|
||||
<part file="webapps_strings.grdp" />
|
||||
|
||||
+ <part file="browser_ui/strings/android/webgl.grdp" />
|
||||
<if expr="not is_ios">
|
||||
<part file="history_clusters_strings.grdp" />
|
||||
</if>
|
||||
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
--- a/components/content_settings/core/browser/content_settings_registry.cc
|
||||
+++ b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
@@ -606,6 +606,19 @@ void ContentSettingsRegistry::Init() {
|
||||
WebsiteSettingsRegistry::ALL_PLATFORMS,
|
||||
ContentSettingsInfo::INHERIT_IN_INCOGNITO,
|
||||
ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS);
|
||||
+
|
||||
diff --git a/components/content_settings/core/browser/bromite_content_settings/webgl.inc b/components/content_settings/core/browser/bromite_content_settings/webgl.inc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/content_settings/core/browser/bromite_content_settings/webgl.inc
|
||||
@@ -0,0 +1,23 @@
|
||||
+ Register(ContentSettingsType::WEBGL, "webgl", CONTENT_SETTING_BLOCK,
|
||||
+ WebsiteSettingsInfo::SYNCABLE,
|
||||
+ /*allowlisted_schemes=*/{},
|
||||
+ /*valid_settings=*/{CONTENT_SETTING_ALLOW,
|
||||
+ CONTENT_SETTING_BLOCK},
|
||||
+ WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
|
||||
+ WebsiteSettingsRegistry::PLATFORM_ANDROID,
|
||||
+ WebsiteSettingsRegistry::ALL_PLATFORMS,
|
||||
+ ContentSettingsInfo::INHERIT_IN_INCOGNITO,
|
||||
+ ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS,
|
||||
+ /*show_into_info_page*/ true,
|
||||
+ /*permission_type_ui*/ IDS_SITE_SETTINGS_TYPE_WEBGL,
|
||||
+ /*permission_type_ui_mid_sentence*/ IDS_SITE_SETTINGS_TYPE_WEBGL_MID_SENTENCE);
|
||||
}
|
||||
|
||||
void ContentSettingsRegistry::Register(
|
||||
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
|
||||
@@ -158,6 +158,8 @@ void GetRendererContentSettingRules(const HostContentSettingsMap* map,
|
||||
std::string timezone;
|
||||
map->GetTimezoneOverrideValue(timezone);
|
||||
rules->timezone_override_value = timezone;
|
||||
+ map->GetSettingsForOneType(ContentSettingsType::WEBGL,
|
||||
+ &(rules->webgl_rules));
|
||||
}
|
||||
|
||||
bool IsMorePermissive(ContentSetting a, ContentSetting b) {
|
||||
diff --git a/components/content_settings/core/common/content_settings.cc b/components/content_settings/core/common/content_settings.cc
|
||||
--- a/components/content_settings/core/common/content_settings.cc
|
||||
+++ b/components/content_settings/core/common/content_settings.cc
|
||||
@@ -218,7 +218,8 @@ bool RendererContentSettingRules::IsRendererContentSetting(
|
||||
content_type == ContentSettingsType::AUTOPLAY ||
|
||||
content_type == ContentSettingsType::MIXEDSCRIPT ||
|
||||
content_type == ContentSettingsType::AUTO_DARK_WEB_CONTENT ||
|
||||
- content_type == ContentSettingsType::TIMEZONE_OVERRIDE;
|
||||
+ content_type == ContentSettingsType::TIMEZONE_OVERRIDE ||
|
||||
+ content_type == ContentSettingsType::WEBGL;
|
||||
}
|
||||
|
||||
void RendererContentSettingRules::FilterRulesByOutermostMainFrameURL(
|
||||
@@ -230,6 +231,7 @@ void RendererContentSettingRules::FilterRulesByOutermostMainFrameURL(
|
||||
FilterRulesForType(auto_dark_content_rules, outermost_main_frame_url);
|
||||
FilterRulesForType(timezone_override_rules, outermost_main_frame_url);
|
||||
FilterRulesForType(autoplay_rules, outermost_main_frame_url);
|
||||
+ FilterRulesForType(webgl_rules, outermost_main_frame_url);
|
||||
}
|
||||
|
||||
RendererContentSettingRules::RendererContentSettingRules() = default;
|
||||
diff --git a/components/content_settings/core/common/content_settings.h b/components/content_settings/core/common/content_settings.h
|
||||
--- a/components/content_settings/core/common/content_settings.h
|
||||
+++ b/components/content_settings/core/common/content_settings.h
|
||||
@@ -96,6 +96,7 @@ struct RendererContentSettingRules {
|
||||
ContentSettingsForOneType auto_dark_content_rules;
|
||||
ContentSettingsForOneType timezone_override_rules;
|
||||
std::string timezone_override_value;
|
||||
+ ContentSettingsForOneType webgl_rules;
|
||||
};
|
||||
|
||||
namespace content_settings {
|
||||
diff --git a/components/content_settings/core/common/content_settings.mojom b/components/content_settings/core/common/content_settings.mojom
|
||||
--- a/components/content_settings/core/common/content_settings.mojom
|
||||
+++ b/components/content_settings/core/common/content_settings.mojom
|
||||
@@ -81,4 +81,5 @@ struct RendererContentSettingRules {
|
||||
array<ContentSettingPatternSource> auto_dark_content_rules;
|
||||
array<ContentSettingPatternSource> timezone_override_rules;
|
||||
string timezone_override_value;
|
||||
+ array<ContentSettingPatternSource> webgl_rules;
|
||||
};
|
||||
diff --git a/components/content_settings/core/common/content_settings_mojom_traits.cc b/components/content_settings/core/common/content_settings_mojom_traits.cc
|
||||
--- a/components/content_settings/core/common/content_settings_mojom_traits.cc
|
||||
+++ b/components/content_settings/core/common/content_settings_mojom_traits.cc
|
||||
@@ -105,7 +105,8 @@ bool StructTraits<content_settings::mojom::RendererContentSettingRulesDataView,
|
||||
data.ReadMixedContentRules(&out->mixed_content_rules) &&
|
||||
data.ReadAutoDarkContentRules(&out->auto_dark_content_rules) &&
|
||||
data.ReadTimezoneOverrideRules(&out->timezone_override_rules) &&
|
||||
- data.ReadTimezoneOverrideValue(&out->timezone_override_value);
|
||||
+ data.ReadTimezoneOverrideValue(&out->timezone_override_value) &&
|
||||
+ data.ReadWebglRules(&out->webgl_rules);
|
||||
}
|
||||
|
||||
} // namespace mojo
|
||||
diff --git a/components/content_settings/core/common/content_settings_mojom_traits.h b/components/content_settings/core/common/content_settings_mojom_traits.h
|
||||
--- a/components/content_settings/core/common/content_settings_mojom_traits.h
|
||||
+++ b/components/content_settings/core/common/content_settings_mojom_traits.h
|
||||
@@ -165,6 +165,11 @@ struct StructTraits<
|
||||
return r.timezone_override_value;
|
||||
}
|
||||
|
||||
+ static const std::vector<ContentSettingPatternSource>& webgl_rules(
|
||||
+ const RendererContentSettingRules& r) {
|
||||
+ return r.webgl_rules;
|
||||
+ }
|
||||
+ ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS);
|
||||
+
|
||||
static bool Read(
|
||||
content_settings::mojom::RendererContentSettingRulesDataView data,
|
||||
RendererContentSettingRules* out);
|
||||
diff --git a/components/content_settings/core/common/content_settings_types.h b/components/content_settings/core/common/content_settings_types.h
|
||||
--- a/components/content_settings/core/common/content_settings_types.h
|
||||
+++ b/components/content_settings/core/common/content_settings_types.h
|
||||
@@ -277,6 +277,8 @@ enum class ContentSettingsType : int32_t {
|
||||
// site instead of the mobile one.
|
||||
REQUEST_DESKTOP_SITE,
|
||||
|
||||
+ content_settings::WebsiteSettingsRegistry::GetInstance()
|
||||
+ ->GetMutable(ContentSettingsType::WEBGL)
|
||||
+ ->set_show_into_info_page()
|
||||
+ .set_desktop_ui()
|
||||
+ .set_is_renderer_content_setting()
|
||||
+ .set_title_ui(IDS_SITE_SETTINGS_TYPE_WEBGL)
|
||||
+ .set_description_ui(IDS_SETTINGS_SITE_SETTINGS_WEBGL_DESCRIPTION)
|
||||
+ .set_allowed_ui(IDS_WEBSITE_SETTINGS_CATEGORY_WEBGL_ENABLED)
|
||||
+ .set_blocked_ui(IDS_WEBSITE_SETTINGS_CATEGORY_WEBGL_DISABLED)
|
||||
+ .set_allowed_exceptions_ui(IDS_SETTINGS_SITE_SETTINGS_WEBGL_ALLOWED_EXCEPTIONS)
|
||||
+ .set_blocked_exceptions_ui(IDS_SETTINGS_SITE_SETTINGS_WEBGL_BLOCKED_EXCEPTIONS)
|
||||
+ .set_mid_sentence_ui(IDS_SITE_SETTINGS_TYPE_WEBGL);
|
||||
+
|
||||
diff --git a/components/content_settings/core/common/bromite_content_settings/WEBGL.inc b/components/content_settings/core/common/bromite_content_settings/WEBGL.inc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/content_settings/core/common/bromite_content_settings/WEBGL.inc
|
||||
@@ -0,0 +1 @@
|
||||
+ WEBGL,
|
||||
+
|
||||
// Setting to indicate whether browser should allow signing into a website via
|
||||
// the browser FedCM API.
|
||||
FEDERATED_IDENTITY_API,
|
||||
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
|
||||
@@ -441,6 +441,15 @@ void ContentSettingsAgentImpl::ClearBlockedContentSettings() {
|
||||
cached_script_permissions_.clear();
|
||||
}
|
||||
|
||||
+bool ContentSettingsAgentImpl::AllowWebgl(bool enabled_per_settings) {
|
||||
+ if (!content_setting_rules_)
|
||||
+ return false;
|
||||
+ blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
|
||||
+ return CONTENT_SETTING_ALLOW == GetContentSettingFromRules(
|
||||
+ content_setting_rules_->webgl_rules,
|
||||
+ url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL());
|
||||
+}
|
||||
+
|
||||
bool ContentSettingsAgentImpl::IsAllowlistedForContentSettings() const {
|
||||
if (should_allowlist_)
|
||||
return true;
|
||||
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
|
||||
@@ -99,6 +99,7 @@ class ContentSettingsAgentImpl
|
||||
bool AllowAutoplay(bool default_value) override;
|
||||
bool AllowPopupsAndRedirects(bool default_value) override;
|
||||
bool ShouldAutoupgradeMixedContent() override;
|
||||
+ bool AllowWebgl(bool enabled_per_settings) override;
|
||||
|
||||
bool allow_running_insecure_content() const {
|
||||
return allow_running_insecure_content_;
|
||||
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
|
||||
@@ -99,6 +99,8 @@ class WebContentSettingsClient {
|
||||
return default_value;
|
||||
}
|
||||
|
||||
+ virtual bool AllowWebgl(bool default_value) { return default_value; }
|
||||
+
|
||||
// Reports that passive mixed content was found at the provided URL.
|
||||
virtual void PassiveInsecureContentFound(const WebURL&) {}
|
||||
|
||||
diff --git a/third_party/blink/renderer/core/execution_context/execution_context.cc b/third_party/blink/renderer/core/execution_context/execution_context.cc
|
||||
--- a/third_party/blink/renderer/core/execution_context/execution_context.cc
|
||||
+++ b/third_party/blink/renderer/core/execution_context/execution_context.cc
|
||||
@@ -68,6 +68,29 @@
|
||||
@@ -84,6 +84,13 @@ blink::WebContentSettingsClient* GetContentSettingsClientFor(
|
||||
return settings;
|
||||
}
|
||||
|
||||
namespace blink {
|
||||
|
||||
+blink::WebContentSettingsClient* GetContentSettingsClientFor(
|
||||
+ ExecutionContext* context) {
|
||||
+ blink::WebContentSettingsClient* settings = nullptr;
|
||||
+ if (!context)
|
||||
+ return settings;
|
||||
+ if (auto* window = blink::DynamicTo<blink::LocalDOMWindow>(context)) {
|
||||
+ auto* frame = window->GetFrame();
|
||||
+ if (frame)
|
||||
+ settings = frame->GetContentSettingsClient();
|
||||
+ } else if (context->IsWorkerGlobalScope()) {
|
||||
+ settings =
|
||||
+ blink::To<blink::WorkerGlobalScope>(context)->ContentSettingsClient();
|
||||
+ }
|
||||
+ return settings;
|
||||
+}
|
||||
+
|
||||
+bool AllowWebgl(ExecutionContext* context) {
|
||||
+ blink::WebContentSettingsClient* settings = GetContentSettingsClientFor(context);
|
||||
+ if (settings)
|
||||
+ return settings->AllowWebgl(false);
|
||||
+ return settings->AllowContentSetting(ContentSettingsType::WEBGL, false);
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
@@ -413,21 +206,11 @@ diff --git a/third_party/blink/renderer/core/execution_context/execution_context
|
||||
diff --git a/third_party/blink/renderer/core/execution_context/execution_context.h b/third_party/blink/renderer/core/execution_context/execution_context.h
|
||||
--- a/third_party/blink/renderer/core/execution_context/execution_context.h
|
||||
+++ b/third_party/blink/renderer/core/execution_context/execution_context.h
|
||||
@@ -103,6 +103,7 @@ class SecurityOrigin;
|
||||
class ScriptState;
|
||||
class ScriptWrappable;
|
||||
class TrustedTypePolicyFactory;
|
||||
+class WebContentSettingsClient;
|
||||
|
||||
enum ReasonForCallingCanExecuteScripts {
|
||||
kAboutToExecuteScript,
|
||||
@@ -111,6 +112,10 @@ enum ReasonForCallingCanExecuteScripts {
|
||||
@@ -117,6 +117,8 @@ enum ReasonForCallingCanExecuteScripts {
|
||||
|
||||
enum ReferrerPolicySource { kPolicySourceHttpHeader, kPolicySourceMetaTag };
|
||||
|
||||
+CORE_EXPORT bool AllowWebgl(ExecutionContext* context);
|
||||
+CORE_EXPORT WebContentSettingsClient* GetContentSettingsClientFor(
|
||||
+ ExecutionContext* context);
|
||||
+
|
||||
// An environment in which script can execute. This class exposes the common
|
||||
// properties of script execution environments on the web (i.e, common between
|
||||
|
||||
@@ -7,58 +7,24 @@ Requires patch: Content-settings-infrastructure.patch
|
||||
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
|
||||
---
|
||||
.../browser_ui/site_settings/android/BUILD.gn | 3 +
|
||||
.../BromiteCustomContentSettingImpl.java | 1 +
|
||||
.../BromiteWebRTCContentSetting.java | 86 +++++++++++++++++++
|
||||
.../site_settings/SiteSettingsCategory.java | 5 +-
|
||||
.../strings/android/browser_ui_strings.grd | 1 +
|
||||
.../browser_ui/strings/android/webrtc.grdp | 18 ++++
|
||||
components/components_strings.grd | 1 +
|
||||
.../core/browser/content_settings_registry.cc | 13 +++
|
||||
.../core/browser/content_settings_utils.cc | 2 +
|
||||
.../core/common/content_settings.cc | 4 +-
|
||||
.../core/common/content_settings.h | 1 +
|
||||
.../core/common/content_settings.mojom | 1 +
|
||||
.../common/content_settings_mojom_traits.cc | 3 +-
|
||||
.../common/content_settings_mojom_traits.h | 5 ++
|
||||
.../core/common/content_settings_types.h | 2 +
|
||||
.../renderer/content_settings_agent_impl.cc | 9 ++
|
||||
.../renderer/content_settings_agent_impl.h | 1 +
|
||||
.../platform/web_content_settings_client.h | 2 +
|
||||
.../impl/BromiteWebRTCContentSetting.java | 93 +++++++++++++++++++
|
||||
.../bromite_content_settings/webrtc.grdp | 27 ++++++
|
||||
.../bromite_content_settings/webrtc.inc | 23 +++++
|
||||
.../bromite_content_settings/WEBRTC.inc | 1 +
|
||||
.../peer_connection_dependency_factory.cc | 6 ++
|
||||
19 files changed, 160 insertions(+), 4 deletions(-)
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteWebRTCContentSetting.java
|
||||
create mode 100644 components/browser_ui/strings/android/webrtc.grdp
|
||||
.../peerconnection/rtc_rtp_receiver.cc | 10 ++
|
||||
.../modules/peerconnection/rtc_rtp_sender.cc | 10 ++
|
||||
7 files changed, 170 insertions(+)
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebRTCContentSetting.java
|
||||
create mode 100644 components/browser_ui/strings/bromite_content_settings/webrtc.grdp
|
||||
create mode 100644 components/content_settings/core/browser/bromite_content_settings/webrtc.inc
|
||||
create mode 100644 components/content_settings/core/common/bromite_content_settings/WEBRTC.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
|
||||
@@ -109,6 +109,9 @@ android_library("java") {
|
||||
sources += [
|
||||
"java/src/org/chromium/components/browser_ui/site_settings/BromiteWebGLContentSetting.java",
|
||||
]
|
||||
+ sources += [
|
||||
+ "java/src/org/chromium/components/browser_ui/site_settings/BromiteWebRTCContentSetting.java",
|
||||
+ ]
|
||||
annotation_processor_deps = [ "//base/android/jni_generator:jni_processor" ]
|
||||
resources_package = "org.chromium.components.browser_ui.site_settings"
|
||||
deps = [
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java
|
||||
--- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java
|
||||
@@ -44,6 +44,7 @@ public abstract class BromiteCustomContentSettingImpl {
|
||||
static {
|
||||
mItemList = new ArrayList<BromiteCustomContentSetting>();
|
||||
mItemList.add(new BromiteWebGLContentSetting());
|
||||
+ mItemList.add(new BromiteWebRTCContentSetting());
|
||||
}
|
||||
|
||||
public static SiteSettingsCategory createFromType(
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteWebRTCContentSetting.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteWebRTCContentSetting.java
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebRTCContentSetting.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebRTCContentSetting.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteWebRTCContentSetting.java
|
||||
@@ -0,0 +1,86 @@
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteWebRTCContentSetting.java
|
||||
@@ -0,0 +1,93 @@
|
||||
+/*
|
||||
+ This file is part of Bromite.
|
||||
+
|
||||
@@ -76,8 +42,11 @@ new file mode 100644
|
||||
+ along with Bromite. If not, see <https://www.gnu.org/licenses/>.
|
||||
+*/
|
||||
+
|
||||
+package org.chromium.components.browser_ui.site_settings;
|
||||
+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.SiteSettingsCategory;
|
||||
+import org.chromium.components.content_settings.ContentSettingValues;
|
||||
@@ -93,7 +62,6 @@ new file mode 100644
|
||||
+public class BromiteWebRTCContentSetting extends BromiteCustomContentSetting {
|
||||
+ public BromiteWebRTCContentSetting() {
|
||||
+ super(/*contentSettingsType*/ ContentSettingsType.WEBRTC,
|
||||
+ /*siteSettingsCategory*/ SiteSettingsCategory.Type.WEBRTC,
|
||||
+ /*defaultEnabledValue*/ ContentSettingValues.ALLOW,
|
||||
+ /*defaultDisabledValue*/ ContentSettingValues.BLOCK,
|
||||
+ /*allowException*/ true,
|
||||
@@ -126,6 +94,11 @@ new file mode 100644
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getCategoryDescription() {
|
||||
+ return R.string.settings_site_settings_webrtc_description;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean requiresTriStateContentSetting() {
|
||||
+ return false;
|
||||
+ }
|
||||
@@ -145,234 +118,72 @@ new file mode 100644
|
||||
+ return value != ContentSettingValues.BLOCK;
|
||||
+ }
|
||||
+}
|
||||
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
|
||||
@@ -48,7 +48,7 @@ public class SiteSettingsCategory {
|
||||
Type.USE_STORAGE, Type.AUTO_DARK_WEB_CONTENT, Type.REQUEST_DESKTOP_SITE,
|
||||
Type.FEDERATED_IDENTITY_API, Type.THIRD_PARTY_COOKIES, Type.SITE_DATA, Type.ANTI_ABUSE,
|
||||
Type.TIMEZONE_OVERRIDE, Type.AUTOPLAY, Type.JAVASCRIPT_JIT, Type.IMAGES,
|
||||
- Type.NUM_ENTRIES, Type.WEBGL})
|
||||
+ Type.NUM_ENTRIES, Type.WEBGL, Type.WEBRTC})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Type {
|
||||
// All updates here must also be reflected in {@link #preferenceKey(int)
|
||||
@@ -87,10 +87,11 @@ public class SiteSettingsCategory {
|
||||
int JAVASCRIPT_JIT = 31;
|
||||
int IMAGES = 32;
|
||||
int WEBGL = 33;
|
||||
+ int WEBRTC = 34;
|
||||
/**
|
||||
* Number of handled categories used for calculating array sizes.
|
||||
*/
|
||||
- int NUM_ENTRIES = 34;
|
||||
+ int NUM_ENTRIES = 35;
|
||||
}
|
||||
|
||||
private final BrowserContextHandle mBrowserContextHandle;
|
||||
diff --git a/components/browser_ui/strings/android/browser_ui_strings.grd b/components/browser_ui/strings/android/browser_ui_strings.grd
|
||||
--- a/components/browser_ui/strings/android/browser_ui_strings.grd
|
||||
+++ b/components/browser_ui/strings/android/browser_ui_strings.grd
|
||||
@@ -175,6 +175,7 @@
|
||||
<messages fallback_to_english="true">
|
||||
<part file="site_settings.grdp" />
|
||||
<part file="webgl.grdp" />
|
||||
+ <part file="webrtc.grdp" />
|
||||
|
||||
<message name="IDS_GOT_IT" desc="Button for the user to accept a disclosure/message" formatter_data="android_java">
|
||||
Got it
|
||||
diff --git a/components/browser_ui/strings/android/webrtc.grdp b/components/browser_ui/strings/android/webrtc.grdp
|
||||
diff --git a/components/browser_ui/strings/bromite_content_settings/webrtc.grdp b/components/browser_ui/strings/bromite_content_settings/webrtc.grdp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/strings/android/webrtc.grdp
|
||||
@@ -0,0 +1,18 @@
|
||||
+++ b/components/browser_ui/strings/bromite_content_settings/webrtc.grdp
|
||||
@@ -0,0 +1,27 @@
|
||||
+<?xml version="1.0" encoding="utf-8"?>
|
||||
+<grit-part>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_WEBRTC" desc="The label used for webrtc site settings controls.">
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_WEBRTC" desc="The label used for webrtc site settings controls." formatter_data="android_java">
|
||||
+ WebRTC
|
||||
+ </message>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_WEBRTC_MID_SENTENCE" desc="The label used for webrtc site settings controls when used mid-sentence.">
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_WEBRTC_MID_SENTENCE" desc="The label used for webrtc site settings controls when used mid-sentence." formatter_data="android_java">
|
||||
+ webRTC
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBRTC_PERMISSION_TITLE" desc="Title of the permission to use webrtc [CHAR-LIMIT=32]">
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBRTC_DESCRIPTION" desc="Description of the WebRTC content setting." formatter_data="android_java">
|
||||
+ Enable WebRTC, a JavaScript API for real-time communication and direct peer-to-peer communication
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBRTC_PERMISSION_TITLE" desc="Title of the permission to use webrtc [CHAR-LIMIT=32]" formatter_data="android_java">
|
||||
+ WebRTC
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_WEBRTC_ENABLED" desc="Summary text explaining that webrtc is full enabled.">
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_WEBRTC_ENABLED" desc="Summary text explaining that webrtc is full enabled." formatter_data="android_java">
|
||||
+ Enabled
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_WEBRTC_DISABLED" desc="Summary text explaining that webrtc is full disabled.">
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_WEBRTC_DISABLED" desc="Summary text explaining that webrtc is full disabled." formatter_data="android_java">
|
||||
+ Disabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBRTC_ALLOWED_EXCEPTIONS" desc="Label for the allowed exceptions site list of the WebRTC setting.">
|
||||
+ Allowed to use WebRTC
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_WEBRTC_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the WebRTC setting.">
|
||||
+ Not allowed to use WebRTC
|
||||
+ </message>
|
||||
+</grit-part>
|
||||
diff --git a/components/components_strings.grd b/components/components_strings.grd
|
||||
--- a/components/components_strings.grd
|
||||
+++ b/components/components_strings.grd
|
||||
@@ -337,6 +337,7 @@
|
||||
<part file="webapps_strings.grdp" />
|
||||
|
||||
<part file="browser_ui/strings/android/webgl.grdp" />
|
||||
+ <part file="browser_ui/strings/android/webrtc.grdp" />
|
||||
<if expr="not is_ios">
|
||||
<part file="history_clusters_strings.grdp" />
|
||||
</if>
|
||||
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
--- a/components/content_settings/core/browser/content_settings_registry.cc
|
||||
+++ b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
@@ -619,6 +619,19 @@ void ContentSettingsRegistry::Init() {
|
||||
/*show_into_info_page*/ true,
|
||||
/*permission_type_ui*/ IDS_SITE_SETTINGS_TYPE_WEBGL,
|
||||
/*permission_type_ui_mid_sentence*/ IDS_SITE_SETTINGS_TYPE_WEBGL_MID_SENTENCE);
|
||||
+
|
||||
diff --git a/components/content_settings/core/browser/bromite_content_settings/webrtc.inc b/components/content_settings/core/browser/bromite_content_settings/webrtc.inc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/content_settings/core/browser/bromite_content_settings/webrtc.inc
|
||||
@@ -0,0 +1,23 @@
|
||||
+ Register(ContentSettingsType::WEBRTC, "webrtc", CONTENT_SETTING_BLOCK,
|
||||
+ WebsiteSettingsInfo::SYNCABLE,
|
||||
+ /*allowlisted_schemes=*/{},
|
||||
+ /*valid_settings=*/{CONTENT_SETTING_ALLOW,
|
||||
+ CONTENT_SETTING_BLOCK},
|
||||
+ WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
|
||||
+ WebsiteSettingsRegistry::PLATFORM_ANDROID,
|
||||
+ WebsiteSettingsRegistry::ALL_PLATFORMS,
|
||||
+ ContentSettingsInfo::INHERIT_IN_INCOGNITO,
|
||||
+ ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS,
|
||||
+ /*show_into_info_page*/ true,
|
||||
+ /*permission_type_ui*/ IDS_SITE_SETTINGS_TYPE_WEBRTC,
|
||||
+ /*permission_type_ui_mid_sentence*/ IDS_SITE_SETTINGS_TYPE_WEBRTC_MID_SENTENCE);
|
||||
}
|
||||
|
||||
void ContentSettingsRegistry::Register(
|
||||
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
|
||||
@@ -160,6 +160,8 @@ void GetRendererContentSettingRules(const HostContentSettingsMap* map,
|
||||
rules->timezone_override_value = timezone;
|
||||
map->GetSettingsForOneType(ContentSettingsType::WEBGL,
|
||||
&(rules->webgl_rules));
|
||||
+ map->GetSettingsForOneType(ContentSettingsType::WEBRTC,
|
||||
+ &(rules->webrtc_rules));
|
||||
}
|
||||
|
||||
bool IsMorePermissive(ContentSetting a, ContentSetting b) {
|
||||
diff --git a/components/content_settings/core/common/content_settings.cc b/components/content_settings/core/common/content_settings.cc
|
||||
--- a/components/content_settings/core/common/content_settings.cc
|
||||
+++ b/components/content_settings/core/common/content_settings.cc
|
||||
@@ -219,7 +219,8 @@ bool RendererContentSettingRules::IsRendererContentSetting(
|
||||
content_type == ContentSettingsType::MIXEDSCRIPT ||
|
||||
content_type == ContentSettingsType::AUTO_DARK_WEB_CONTENT ||
|
||||
content_type == ContentSettingsType::TIMEZONE_OVERRIDE ||
|
||||
- content_type == ContentSettingsType::WEBGL;
|
||||
+ content_type == ContentSettingsType::WEBGL ||
|
||||
+ content_type == ContentSettingsType::WEBRTC;
|
||||
}
|
||||
|
||||
void RendererContentSettingRules::FilterRulesByOutermostMainFrameURL(
|
||||
@@ -232,6 +233,7 @@ void RendererContentSettingRules::FilterRulesByOutermostMainFrameURL(
|
||||
FilterRulesForType(timezone_override_rules, outermost_main_frame_url);
|
||||
FilterRulesForType(autoplay_rules, outermost_main_frame_url);
|
||||
FilterRulesForType(webgl_rules, outermost_main_frame_url);
|
||||
+ FilterRulesForType(webrtc_rules, outermost_main_frame_url);
|
||||
}
|
||||
|
||||
RendererContentSettingRules::RendererContentSettingRules() = default;
|
||||
diff --git a/components/content_settings/core/common/content_settings.h b/components/content_settings/core/common/content_settings.h
|
||||
--- a/components/content_settings/core/common/content_settings.h
|
||||
+++ b/components/content_settings/core/common/content_settings.h
|
||||
@@ -97,6 +97,7 @@ struct RendererContentSettingRules {
|
||||
ContentSettingsForOneType timezone_override_rules;
|
||||
std::string timezone_override_value;
|
||||
ContentSettingsForOneType webgl_rules;
|
||||
+ ContentSettingsForOneType webrtc_rules;
|
||||
};
|
||||
|
||||
namespace content_settings {
|
||||
diff --git a/components/content_settings/core/common/content_settings.mojom b/components/content_settings/core/common/content_settings.mojom
|
||||
--- a/components/content_settings/core/common/content_settings.mojom
|
||||
+++ b/components/content_settings/core/common/content_settings.mojom
|
||||
@@ -82,4 +82,5 @@ struct RendererContentSettingRules {
|
||||
array<ContentSettingPatternSource> timezone_override_rules;
|
||||
string timezone_override_value;
|
||||
array<ContentSettingPatternSource> webgl_rules;
|
||||
+ array<ContentSettingPatternSource> webrtc_rules;
|
||||
};
|
||||
diff --git a/components/content_settings/core/common/content_settings_mojom_traits.cc b/components/content_settings/core/common/content_settings_mojom_traits.cc
|
||||
--- a/components/content_settings/core/common/content_settings_mojom_traits.cc
|
||||
+++ b/components/content_settings/core/common/content_settings_mojom_traits.cc
|
||||
@@ -106,7 +106,8 @@ bool StructTraits<content_settings::mojom::RendererContentSettingRulesDataView,
|
||||
data.ReadAutoDarkContentRules(&out->auto_dark_content_rules) &&
|
||||
data.ReadTimezoneOverrideRules(&out->timezone_override_rules) &&
|
||||
data.ReadTimezoneOverrideValue(&out->timezone_override_value) &&
|
||||
- data.ReadWebglRules(&out->webgl_rules);
|
||||
+ data.ReadWebglRules(&out->webgl_rules) &&
|
||||
+ data.ReadWebrtcRules(&out->webrtc_rules);
|
||||
}
|
||||
|
||||
} // namespace mojo
|
||||
diff --git a/components/content_settings/core/common/content_settings_mojom_traits.h b/components/content_settings/core/common/content_settings_mojom_traits.h
|
||||
--- a/components/content_settings/core/common/content_settings_mojom_traits.h
|
||||
+++ b/components/content_settings/core/common/content_settings_mojom_traits.h
|
||||
@@ -170,6 +170,11 @@ struct StructTraits<
|
||||
return r.webgl_rules;
|
||||
}
|
||||
|
||||
+ static const std::vector<ContentSettingPatternSource>& webrtc_rules(
|
||||
+ const RendererContentSettingRules& r) {
|
||||
+ return r.webrtc_rules;
|
||||
+ }
|
||||
+ ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS);
|
||||
+
|
||||
static bool Read(
|
||||
content_settings::mojom::RendererContentSettingRulesDataView data,
|
||||
RendererContentSettingRules* out);
|
||||
diff --git a/components/content_settings/core/common/content_settings_types.h b/components/content_settings/core/common/content_settings_types.h
|
||||
--- a/components/content_settings/core/common/content_settings_types.h
|
||||
+++ b/components/content_settings/core/common/content_settings_types.h
|
||||
@@ -279,6 +279,8 @@ enum class ContentSettingsType : int32_t {
|
||||
|
||||
WEBGL,
|
||||
|
||||
+ content_settings::WebsiteSettingsRegistry::GetInstance()
|
||||
+ ->GetMutable(ContentSettingsType::WEBRTC)
|
||||
+ ->set_show_into_info_page()
|
||||
+ .set_desktop_ui()
|
||||
+ .set_is_renderer_content_setting()
|
||||
+ .set_title_ui(IDS_SITE_SETTINGS_TYPE_WEBRTC)
|
||||
+ .set_description_ui(IDS_SETTINGS_SITE_SETTINGS_WEBRTC_DESCRIPTION)
|
||||
+ .set_allowed_ui(IDS_WEBSITE_SETTINGS_CATEGORY_WEBRTC_ENABLED)
|
||||
+ .set_blocked_ui(IDS_WEBSITE_SETTINGS_CATEGORY_WEBRTC_DISABLED)
|
||||
+ .set_allowed_exceptions_ui(IDS_SETTINGS_SITE_SETTINGS_WEBRTC_ALLOWED_EXCEPTIONS)
|
||||
+ .set_blocked_exceptions_ui(IDS_SETTINGS_SITE_SETTINGS_WEBRTC_BLOCKED_EXCEPTIONS)
|
||||
+ .set_mid_sentence_ui(IDS_SITE_SETTINGS_TYPE_WEBRTC_MID_SENTENCE);
|
||||
+
|
||||
diff --git a/components/content_settings/core/common/bromite_content_settings/WEBRTC.inc b/components/content_settings/core/common/bromite_content_settings/WEBRTC.inc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/content_settings/core/common/bromite_content_settings/WEBRTC.inc
|
||||
@@ -0,0 +1 @@
|
||||
+ WEBRTC,
|
||||
+
|
||||
// Setting to indicate whether browser should allow signing into a website via
|
||||
// the browser FedCM API.
|
||||
FEDERATED_IDENTITY_API,
|
||||
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
|
||||
@@ -450,6 +450,15 @@ bool ContentSettingsAgentImpl::AllowWebgl(bool enabled_per_settings) {
|
||||
url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL());
|
||||
}
|
||||
|
||||
+bool ContentSettingsAgentImpl::AllowWebRTC(bool enabled_per_settings) {
|
||||
+ if (!content_setting_rules_)
|
||||
+ return false;
|
||||
+ blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
|
||||
+ return CONTENT_SETTING_ALLOW == GetContentSettingFromRules(
|
||||
+ content_setting_rules_->webrtc_rules,
|
||||
+ url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL());
|
||||
+}
|
||||
+
|
||||
bool ContentSettingsAgentImpl::IsAllowlistedForContentSettings() const {
|
||||
if (should_allowlist_)
|
||||
return true;
|
||||
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
|
||||
@@ -100,6 +100,7 @@ class ContentSettingsAgentImpl
|
||||
bool AllowPopupsAndRedirects(bool default_value) override;
|
||||
bool ShouldAutoupgradeMixedContent() override;
|
||||
bool AllowWebgl(bool enabled_per_settings) override;
|
||||
+ bool AllowWebRTC(bool enabled_per_settings) override;
|
||||
|
||||
bool allow_running_insecure_content() const {
|
||||
return allow_running_insecure_content_;
|
||||
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
|
||||
@@ -101,6 +101,8 @@ class WebContentSettingsClient {
|
||||
|
||||
virtual bool AllowWebgl(bool default_value) { return default_value; }
|
||||
|
||||
+ virtual bool AllowWebRTC(bool default_value) { return default_value; }
|
||||
+
|
||||
// Reports that passive mixed content was found at the provided URL.
|
||||
virtual void PassiveInsecureContentFound(const WebURL&) {}
|
||||
|
||||
diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc
|
||||
--- a/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc
|
||||
+++ b/third_party/blink/renderer/modules/peerconnection/peer_connection_dependency_factory.cc
|
||||
@@ -384,17 +195,71 @@ diff --git a/third_party/blink/renderer/modules/peerconnection/peer_connection_d
|
||||
#include "third_party/blink/public/platform/web_url.h"
|
||||
#include "third_party/blink/public/web/modules/mediastream/media_stream_video_source.h"
|
||||
#include "third_party/blink/public/web/web_document.h"
|
||||
@@ -750,6 +751,11 @@ PeerConnectionDependencyFactory::CreatePortAllocator(
|
||||
@@ -752,6 +753,11 @@ PeerConnectionDependencyFactory::CreatePortAllocator(
|
||||
// origin.
|
||||
WebRTCIPHandlingPolicy policy =
|
||||
GetWebRTCIPHandlingPolicy(webrtc_ip_handling_policy);
|
||||
+ blink::WebContentSettingsClient* settings = web_frame->GetContentSettingsClient();
|
||||
+ if (settings && settings->AllowWebRTC(false)) {
|
||||
+ if (settings && settings->AllowContentSetting(ContentSettingsType::WEBRTC, false)) {
|
||||
+ policy = kDefault;
|
||||
+ }
|
||||
+
|
||||
switch (policy) {
|
||||
// TODO(guoweis): specify the flag of disabling local candidate
|
||||
// collection when webrtc is updated.
|
||||
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc
|
||||
--- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc
|
||||
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_receiver.cc
|
||||
@@ -11,6 +11,8 @@
|
||||
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h"
|
||||
#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"
|
||||
#include "third_party/blink/public/common/privacy_budget/identifiable_token_builder.h"
|
||||
+#include "third_party/blink/public/platform/web_content_settings_client.h"
|
||||
+#include "third_party/blink/public/web/web_local_frame.h"
|
||||
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
|
||||
#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_insertable_streams.h"
|
||||
#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_rtcp_parameters.h"
|
||||
@@ -256,6 +258,14 @@ RTCRtpCapabilities* RTCRtpReceiver::getCapabilities(ScriptState* state,
|
||||
if (kind != "audio" && kind != "video")
|
||||
return nullptr;
|
||||
|
||||
+ LocalDOMWindow* window = To<LocalDOMWindow>(ExecutionContext::From(state));
|
||||
+ auto* web_frame =
|
||||
+ static_cast<WebLocalFrame*>(WebFrame::FromCoreFrame(window->GetFrame()));
|
||||
+ blink::WebContentSettingsClient* settings = web_frame->GetContentSettingsClient();
|
||||
+ if (settings && !settings->AllowContentSetting(ContentSettingsType::WEBRTC, false)) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+
|
||||
RTCRtpCapabilities* capabilities = RTCRtpCapabilities::Create();
|
||||
capabilities->setCodecs(HeapVector<Member<RTCRtpCodecCapability>>());
|
||||
capabilities->setHeaderExtensions(
|
||||
diff --git a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc
|
||||
--- a/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc
|
||||
+++ b/third_party/blink/renderer/modules/peerconnection/rtc_rtp_sender.cc
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "third_party/blink/public/common/privacy_budget/identifiability_study_settings.h"
|
||||
#include "third_party/blink/public/common/privacy_budget/identifiable_surface.h"
|
||||
#include "third_party/blink/public/common/privacy_budget/identifiable_token_builder.h"
|
||||
+#include "third_party/blink/public/platform/web_content_settings_client.h"
|
||||
+#include "third_party/blink/public/web/web_local_frame.h"
|
||||
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
|
||||
#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_insertable_streams.h"
|
||||
#include "third_party/blink/renderer/bindings/modules/v8/v8_rtc_rtcp_parameters.h"
|
||||
@@ -941,6 +943,14 @@ RTCRtpCapabilities* RTCRtpSender::getCapabilities(ScriptState* state,
|
||||
if (kind != "audio" && kind != "video")
|
||||
return nullptr;
|
||||
|
||||
+ LocalDOMWindow* window = To<LocalDOMWindow>(ExecutionContext::From(state));
|
||||
+ auto* web_frame =
|
||||
+ static_cast<WebLocalFrame*>(WebFrame::FromCoreFrame(window->GetFrame()));
|
||||
+ blink::WebContentSettingsClient* settings = web_frame->GetContentSettingsClient();
|
||||
+ if (settings && !settings->AllowContentSetting(ContentSettingsType::WEBRTC, false)) {
|
||||
+ return nullptr;
|
||||
+ }
|
||||
+
|
||||
RTCRtpCapabilities* capabilities = RTCRtpCapabilities::Create();
|
||||
capabilities->setCodecs(HeapVector<Member<RTCRtpCodecCapability>>());
|
||||
capabilities->setHeaderExtensions(
|
||||
--
|
||||
2.25.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -11,77 +11,27 @@ 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
|
||||
.../permission_javascript_jit.png | Bin 0 -> 629 bytes
|
||||
.../permission_javascript_jit.png | Bin 0 -> 797 bytes
|
||||
.../res/xml/site_settings_preferences.xml | 4 ++++
|
||||
.../ContentSettingsResources.java | 7 ++++++
|
||||
.../site_settings/SingleCategorySettings.java | 9 ++++++++
|
||||
.../site_settings/SingleWebsiteSettings.java | 21 ++++++++++++++++++
|
||||
.../site_settings/SiteSettingsCategory.java | 9 ++++++--
|
||||
.../site_settings/SiteSettingsUtil.java | 1 +
|
||||
.../browser_ui/site_settings/Website.java | 7 ++++++
|
||||
.../android/website_preference_bridge.cc | 1 +
|
||||
.../strings/android/site_settings.grdp | 17 ++++++++++++++
|
||||
.../BromiteJavascriptJITContentSetting.java | 92 ++++++++++++++++++
|
||||
.../javascript_jit.grdp | 21 ++++
|
||||
.../javascript_jit.inc | 13 +++
|
||||
.../core/browser/content_settings_registry.cc | 2 +-
|
||||
.../android/page_info_controller_android.cc | 3 +++
|
||||
components/page_info/page_info.cc | 6 +++++
|
||||
components/page_info/page_info_ui.cc | 2 ++
|
||||
components/site_settings_strings.grdp | 6 +++++
|
||||
20 files changed, 97 insertions(+), 3 deletions(-)
|
||||
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
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-xxhdpi/permission_javascript_jit.png
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-xxxhdpi/permission_javascript_jit.png
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteJavascriptJITContentSetting.java
|
||||
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
|
||||
@@ -187,6 +187,7 @@ android_resources("java_resources") {
|
||||
"java/res/drawable-hdpi/ic_volume_up_grey600_24dp.png",
|
||||
"java/res/drawable-hdpi/permission_background_sync.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",
|
||||
@@ -194,6 +195,7 @@ 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-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",
|
||||
@@ -206,6 +208,7 @@ android_resources("java_resources") {
|
||||
"java/res/drawable-xhdpi/ic_volume_up_grey600_24dp.png",
|
||||
"java/res/drawable-xhdpi/permission_background_sync.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",
|
||||
@@ -213,6 +216,7 @@ android_resources("java_resources") {
|
||||
"java/res/drawable-xxhdpi/ic_volume_up_grey600_24dp.png",
|
||||
"java/res/drawable-xxhdpi/permission_background_sync.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",
|
||||
@@ -220,6 +224,7 @@ android_resources("java_resources") {
|
||||
"java/res/drawable-xxxhdpi/ic_volume_up_grey600_24dp.png",
|
||||
"java/res/drawable-xxxhdpi/permission_background_sync.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
|
||||
@@ -180,228 +130,151 @@ G2~7a)DNWn}
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
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
|
||||
@@ -43,6 +43,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="notifications" />
|
||||
+ <!-- JavaScript-JIT -->
|
||||
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
|
||||
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
|
||||
+ android:key="javascript_jit" />
|
||||
<!-- JavaScript -->
|
||||
<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/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
|
||||
@@ -218,6 +218,13 @@ public class ContentSettingsResources {
|
||||
ContentSettingValues.BLOCK,
|
||||
R.string.website_settings_category_javascript_allowed, 0);
|
||||
|
||||
+ case ContentSettingsType.JAVASCRIPT_JIT:
|
||||
+ return new ResourceItem(R.drawable.permission_javascript_jit,
|
||||
+ R.string.javascript_jit_permission_title, ContentSettingValues.ALLOW,
|
||||
+ ContentSettingValues.BLOCK,
|
||||
+ R.string.website_settings_category_javascript_jit_allowed,
|
||||
+ R.string.website_settings_category_javascript_jit_blocked);
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteJavascriptJITContentSetting.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteJavascriptJITContentSetting.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteJavascriptJITContentSetting.java
|
||||
@@ -0,0 +1,92 @@
|
||||
+/*
|
||||
+ This file is part of Bromite.
|
||||
+
|
||||
case ContentSettingsType.MEDIASTREAM_CAMERA:
|
||||
return new ResourceItem(R.drawable.gm_filled_videocam_24,
|
||||
R.string.website_settings_use_camera, ContentSettingValues.ASK,
|
||||
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
|
||||
@@ -779,6 +779,12 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
|
||||
? R.string.website_settings_add_site_description_sound_block
|
||||
: R.string.website_settings_add_site_description_sound_allow;
|
||||
break;
|
||||
+ case SiteSettingsCategory.Type.JAVASCRIPT_JIT:
|
||||
+ resource = WebsitePreferenceBridge.isCategoryEnabled(
|
||||
+ browserContextHandle, ContentSettingsType.JAVASCRIPT_JIT)
|
||||
+ ? R.string.website_settings_add_site_description_javascript_jit_block
|
||||
+ : R.string.website_settings_add_site_description_javascript_jit_allow;
|
||||
+ break;
|
||||
case SiteSettingsCategory.Type.COOKIES:
|
||||
resource = getCookieSettingsState() == CookieSettingsState.ALLOW
|
||||
? R.string.website_settings_add_site_description_cookies_block
|
||||
@@ -943,6 +949,9 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
|
||||
case SiteSettingsCategory.Type.AUTOPLAY:
|
||||
allowSpecifyingExceptions = true;
|
||||
break;
|
||||
+ case SiteSettingsCategory.Type.JAVASCRIPT_JIT:
|
||||
+ allowSpecifyingExceptions = true;
|
||||
+ break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
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
|
||||
@@ -139,6 +139,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
return "idle_detection_permission_list";
|
||||
case ContentSettingsType.JAVASCRIPT:
|
||||
return "javascript_permission_list";
|
||||
+ case ContentSettingsType.JAVASCRIPT_JIT:
|
||||
+ return "javascript_jit_permission_list";
|
||||
case ContentSettingsType.POPUPS:
|
||||
return "popup_permission_list";
|
||||
case ContentSettingsType.SOUND:
|
||||
@@ -520,6 +522,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
setUpJavascriptPreference(preference);
|
||||
} else if (type == ContentSettingsType.GEOLOCATION) {
|
||||
setUpLocationPreference(preference);
|
||||
+ } else if (type == ContentSettingsType.JAVASCRIPT_JIT) {
|
||||
+ setUpJavascriptJitPreference(preference);
|
||||
} else if (type == ContentSettingsType.NOTIFICATIONS) {
|
||||
setUpNotificationsPreference(preference, mSite.isEmbargoed(type));
|
||||
} else if (type == ContentSettingsType.REQUEST_DESKTOP_SITE) {
|
||||
@@ -1072,6 +1076,23 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
setupContentSettingsPreference(preference, currentValue, false /* isEmbargoed */);
|
||||
}
|
||||
|
||||
+ private void setUpJavascriptJitPreference(Preference preference) {
|
||||
+ BrowserContextHandle browserContextHandle =
|
||||
+ getSiteSettingsDelegate().getBrowserContextHandle();
|
||||
+ @ContentSettingValues
|
||||
+ @Nullable
|
||||
+ Integer currentValue =
|
||||
+ mSite.getContentSetting(browserContextHandle, ContentSettingsType.JAVASCRIPT_JIT);
|
||||
+ if (currentValue == null || currentValue == ContentSettingValues.DEFAULT) {
|
||||
+ currentValue = WebsitePreferenceBridge.isCategoryEnabled(
|
||||
+ browserContextHandle, ContentSettingsType.JAVASCRIPT_JIT)
|
||||
+ ? ContentSettingValues.ALLOW
|
||||
+ : ContentSettingValues.BLOCK;
|
||||
+ }
|
||||
+ // Not possible to embargo JAVASCRIPT_JIT.
|
||||
+ setupContentSettingsPreference(preference, currentValue, false /* isEmbargoed */);
|
||||
+ 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.SiteSettingsCategory;
|
||||
+import org.chromium.components.content_settings.ContentSettingValues;
|
||||
+import org.chromium.components.content_settings.ContentSettingsType;
|
||||
+import org.chromium.content_public.browser.BrowserContextHandle;
|
||||
+
|
||||
+import androidx.annotation.Nullable;
|
||||
+import androidx.preference.Preference;
|
||||
+import androidx.preference.PreferenceScreen;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+
|
||||
+public class BromiteJavascriptJITContentSetting extends BromiteCustomContentSetting {
|
||||
+ public BromiteJavascriptJITContentSetting() {
|
||||
+ super(/*contentSettingsType*/ ContentSettingsType.JAVASCRIPT_JIT,
|
||||
+ /*defaultEnabledValue*/ ContentSettingValues.ALLOW,
|
||||
+ /*defaultDisabledValue*/ ContentSettingValues.BLOCK,
|
||||
+ /*allowException*/ true,
|
||||
+ /*preferenceKey*/ "javascript_jit",
|
||||
+ /*profilePrefKey*/ "javascript_jit");
|
||||
+ }
|
||||
+
|
||||
/**
|
||||
* Updates the ads list preference based on whether the site is a candidate for blocking. This
|
||||
* has some custom behavior.
|
||||
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
|
||||
@@ -47,7 +47,7 @@ public class SiteSettingsCategory {
|
||||
Type.PROTECTED_MEDIA, Type.SENSORS, Type.SOUND, Type.USB, Type.VIRTUAL_REALITY,
|
||||
Type.USE_STORAGE, Type.AUTO_DARK_WEB_CONTENT, Type.REQUEST_DESKTOP_SITE,
|
||||
Type.FEDERATED_IDENTITY_API, Type.THIRD_PARTY_COOKIES, Type.SITE_DATA, Type.ANTI_ABUSE,
|
||||
- Type.TIMEZONE_OVERRIDE, Type.AUTOPLAY,
|
||||
+ Type.TIMEZONE_OVERRIDE, Type.AUTOPLAY, Type.JAVASCRIPT_JIT,
|
||||
Type.NUM_ENTRIES})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Type {
|
||||
@@ -84,10 +84,11 @@ public class SiteSettingsCategory {
|
||||
int ANTI_ABUSE = 28;
|
||||
int TIMEZONE_OVERRIDE = 29;
|
||||
int AUTOPLAY = 30;
|
||||
+ int JAVASCRIPT_JIT = 31;
|
||||
/**
|
||||
* Number of handled categories used for calculating array sizes.
|
||||
*/
|
||||
- int NUM_ENTRIES = 31;
|
||||
+ int NUM_ENTRIES = 32;
|
||||
}
|
||||
|
||||
private final BrowserContextHandle mBrowserContextHandle;
|
||||
@@ -198,6 +199,8 @@ public class SiteSettingsCategory {
|
||||
return ContentSettingsType.IDLE_DETECTION;
|
||||
case Type.JAVASCRIPT:
|
||||
return ContentSettingsType.JAVASCRIPT;
|
||||
+ case Type.JAVASCRIPT_JIT:
|
||||
+ return ContentSettingsType.JAVASCRIPT_JIT;
|
||||
case Type.MICROPHONE:
|
||||
return ContentSettingsType.MEDIASTREAM_MIC;
|
||||
case Type.NFC:
|
||||
@@ -285,6 +288,8 @@ public class SiteSettingsCategory {
|
||||
return "javascript";
|
||||
case Type.MICROPHONE:
|
||||
return "microphone";
|
||||
+ case Type.JAVASCRIPT_JIT:
|
||||
+ return "javascript_jit";
|
||||
case Type.NFC:
|
||||
return "nfc";
|
||||
case Type.NOTIFICATIONS:
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsUtil.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsUtil.java
|
||||
--- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsUtil.java
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsUtil.java
|
||||
@@ -26,6 +26,7 @@ public class SiteSettingsUtil {
|
||||
ContentSettingsType.MEDIASTREAM_MIC,
|
||||
ContentSettingsType.NOTIFICATIONS,
|
||||
ContentSettingsType.JAVASCRIPT,
|
||||
+ ContentSettingsType.JAVASCRIPT_JIT,
|
||||
ContentSettingsType.POPUPS,
|
||||
ContentSettingsType.ADS,
|
||||
ContentSettingsType.BACKGROUND_SYNC,
|
||||
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
|
||||
@@ -230,6 +230,13 @@ public final class Website implements WebsiteEntry {
|
||||
} else {
|
||||
RecordUserAction.record("JavascriptContentSetting.DisableBy.SiteSettings");
|
||||
}
|
||||
+ } else if (type == ContentSettingsType.JAVASCRIPT_JIT) {
|
||||
+ if (exception == null) {
|
||||
+ exception = new ContentSettingException(
|
||||
+ ContentSettingsType.JAVASCRIPT_JIT, getAddress().getHost(), value, "",
|
||||
+ /*isEmbargoed=*/false);
|
||||
+ setContentSettingException(type, exception);
|
||||
+ }
|
||||
} else if (type == ContentSettingsType.AUTOPLAY) {
|
||||
// It is possible to set the permission without having an existing exception,
|
||||
// because we always show the autoplay permission in Site Settings.
|
||||
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
|
||||
@@ -823,6 +823,7 @@ static void JNI_WebsitePreferenceBridge_SetContentSettingEnabled(
|
||||
case ContentSettingsType::COOKIES:
|
||||
case ContentSettingsType::FEDERATED_IDENTITY_API:
|
||||
case ContentSettingsType::JAVASCRIPT:
|
||||
+ case ContentSettingsType::JAVASCRIPT_JIT:
|
||||
case ContentSettingsType::POPUPS:
|
||||
case ContentSettingsType::REQUEST_DESKTOP_SITE:
|
||||
case ContentSettingsType::SENSORS:
|
||||
diff --git a/components/browser_ui/strings/android/site_settings.grdp b/components/browser_ui/strings/android/site_settings.grdp
|
||||
--- a/components/browser_ui/strings/android/site_settings.grdp
|
||||
+++ b/components/browser_ui/strings/android/site_settings.grdp
|
||||
@@ -79,6 +79,9 @@
|
||||
<message name="IDS_JAVASCRIPT_PERMISSION_TITLE" desc="Title of the permission to run javascript [CHAR_LIMIT=32]">
|
||||
JavaScript
|
||||
</message>
|
||||
+ <message name="IDS_JAVASCRIPT_JIT_PERMISSION_TITLE" desc="Title of the permission to run javascript [CHAR_LIMIT=32]">
|
||||
+ @Override
|
||||
+ public ContentSettingsResources.ResourceItem getResourceItem() {
|
||||
+ return new ContentSettingsResources.ResourceItem(
|
||||
+ /*icon*/ R.drawable.permission_javascript_jit,
|
||||
+ /*title*/ R.string.javascript_jit_permission_title,
|
||||
+ /*defaultEnabledValue*/ getDefaultEnabledValue(),
|
||||
+ /*defaultDisabledValue*/ getDefaultDisabledValue(),
|
||||
+ /*enabledSummary*/ R.string.website_settings_category_javascript_jit_enabled,
|
||||
+ /*disabledSummary*/ R.string.website_settings_category_javascript_jit_disabled);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getCategorySummary(@Nullable @ContentSettingValues int value) {
|
||||
+ switch (value) {
|
||||
+ case ContentSettingValues.ALLOW:
|
||||
+ return R.string.website_settings_category_javascript_jit_enabled;
|
||||
+ case ContentSettingValues.BLOCK:
|
||||
+ return R.string.website_settings_category_javascript_jit_disabled;
|
||||
+ default:
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getCategoryDescription() {
|
||||
+ return R.string.settings_site_settings_javascript_jit_description;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean requiresTriStateContentSetting() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean showOnlyDescriptions() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getAddExceptionDialogMessage() {
|
||||
+ return R.string.website_settings_category_javascript_jit_enabled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @Nullable Boolean considerException(SiteSettingsCategory category, @ContentSettingValues int value) {
|
||||
+ return value != ContentSettingValues.BLOCK;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/components/browser_ui/strings/bromite_content_settings/javascript_jit.grdp b/components/browser_ui/strings/bromite_content_settings/javascript_jit.grdp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/strings/bromite_content_settings/javascript_jit.grdp
|
||||
@@ -0,0 +1,21 @@
|
||||
+<?xml version="1.0" encoding="utf-8"?>
|
||||
+<grit-part>
|
||||
+ <message name="IDS_JAVASCRIPT_JIT_PERMISSION_TITLE" desc="Title of the permission to run javascript [CHAR_LIMIT=32]" formatter_data="android_java">
|
||||
+ JavaScript JIT
|
||||
+ </message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_DEVICE_LOCATION" desc="Title for Location settings, which control which websites can access your location." meaning="Geolocation">
|
||||
Location
|
||||
</message>
|
||||
@@ -658,6 +661,20 @@
|
||||
Block JavaScript for a specific site.
|
||||
</message>
|
||||
|
||||
+ <!-- JavaScript JIT -->
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_JAVASCRIPT_JIT_ALLOWED" desc="Summary text explaining that sites are allowed to compile JavaScript in JIT mode.">
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_DESCRIPTION" desc="Description of the Javascript JIT content setting." formatter_data="android_java">
|
||||
+ Enable the JIT compiler and WebAssembly support in V8
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_JAVASCRIPT_JIT_ENABLED" desc="Summary text explaining that sites are allowed to compile JavaScript in JIT mode." formatter_data="android_java">
|
||||
+ Allow JIT and WebAssembly on a specific site.
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_JAVASCRIPT_JIT_DISABLED" desc="Summary text explaining that sites are running JavaScript in JITless mode." formatter_data="android_java">
|
||||
+ Block JIT and WebAssembly on a specific site.
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_ADD_SITE_DESCRIPTION_JAVASCRIPT_JIT_ALLOW" desc="The description for the allow Javascript JIT for website dialog." formatter_data="android_java">
|
||||
+ Allow sites to use just-in-time compilation; more performant but a constant source of security vulnerabilities.
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_JAVASCRIPT_JIT_BLOCKED" desc="Summary text explaining that sites are running JavaScript in JITless mode.">
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_ADD_SITE_DESCRIPTION_JAVASCRIPT_JIT_BLOCK" desc="The description for the block Javascript JIT for website dialog." formatter_data="android_java">
|
||||
+ Block sites from using just-in-time compilation, using only interpreted JavaScript; less performant but more secure against security vulnerabilities.
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_ADD_SITE_DESCRIPTION_JAVASCRIPT_JIT_ALLOW" desc="The description for the allow Javascript JIT for website dialog.">
|
||||
+ Allow JIT on a specific site.
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_ADD_SITE_DESCRIPTION_JAVASCRIPT_JIT_BLOCK" desc="The description for the block Javascript JIT for website dialog.">
|
||||
+ Block JIT on a specific site.
|
||||
+ </message>
|
||||
+</grit-part>
|
||||
diff --git a/components/content_settings/core/browser/bromite_content_settings/javascript_jit.inc b/components/content_settings/core/browser/bromite_content_settings/javascript_jit.inc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/content_settings/core/browser/bromite_content_settings/javascript_jit.inc
|
||||
@@ -0,0 +1,13 @@
|
||||
+ content_settings::WebsiteSettingsRegistry::GetInstance()
|
||||
+ ->GetMutable(ContentSettingsType::JAVASCRIPT_JIT)
|
||||
+ ->set_show_into_info_page()
|
||||
+ .set_desktop_ui()
|
||||
+ .set_is_renderer_content_setting()
|
||||
+ .set_title_ui(IDS_JAVASCRIPT_JIT_PERMISSION_TITLE)
|
||||
+ .set_description_ui(IDS_SETTINGS_SITE_SETTINGS_JAVASCRIPT_JIT_DESCRIPTION)
|
||||
+ .set_allowed_ui(IDS_WEBSITE_SETTINGS_CATEGORY_JAVASCRIPT_JIT_ENABLED)
|
||||
+ .set_blocked_ui(IDS_WEBSITE_SETTINGS_CATEGORY_JAVASCRIPT_JIT_DISABLED)
|
||||
+ .set_allowed_exceptions_ui(IDS_WEBSITE_SETTINGS_ADD_SITE_DESCRIPTION_JAVASCRIPT_JIT_ALLOW)
|
||||
+ .set_blocked_exceptions_ui(IDS_WEBSITE_SETTINGS_ADD_SITE_DESCRIPTION_JAVASCRIPT_JIT_BLOCK)
|
||||
+ .set_mid_sentence_ui(IDS_JAVASCRIPT_JIT_PERMISSION_TITLE);
|
||||
+
|
||||
<!-- Location -->
|
||||
|
||||
<message name="IDS_WEBSITE_SETTINGS_CATEGORY_LOCATION_ASK" desc="Summary text explaining that sites need to ask for permission before knowing location and that it is the recommended setting.">
|
||||
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
--- a/components/content_settings/core/browser/content_settings_registry.cc
|
||||
+++ b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
@@ -508,7 +508,7 @@ void ContentSettingsRegistry::Init() {
|
||||
@@ -509,7 +509,7 @@ void ContentSettingsRegistry::Init() {
|
||||
ContentSettingsInfo::EXCEPTIONS_ON_SECURE_ORIGINS_ONLY);
|
||||
|
||||
Register(ContentSettingsType::JAVASCRIPT_JIT, "javascript-jit",
|
||||
@@ -410,76 +283,5 @@ diff --git a/components/content_settings/core/browser/content_settings_registry.
|
||||
/*allowlisted_schemes=*/{},
|
||||
/*valid_settings=*/{CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK},
|
||||
WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
|
||||
diff --git a/components/page_info/android/page_info_controller_android.cc b/components/page_info/android/page_info_controller_android.cc
|
||||
--- a/components/page_info/android/page_info_controller_android.cc
|
||||
+++ b/components/page_info/android/page_info_controller_android.cc
|
||||
@@ -134,6 +134,7 @@ void PageInfoControllerAndroid::SetPermissionInfo(
|
||||
permissions_to_display.push_back(ContentSettingsType::IDLE_DETECTION);
|
||||
permissions_to_display.push_back(ContentSettingsType::IMAGES);
|
||||
permissions_to_display.push_back(ContentSettingsType::JAVASCRIPT);
|
||||
+ permissions_to_display.push_back(ContentSettingsType::JAVASCRIPT_JIT);
|
||||
permissions_to_display.push_back(ContentSettingsType::POPUPS);
|
||||
permissions_to_display.push_back(ContentSettingsType::ADS);
|
||||
permissions_to_display.push_back(
|
||||
@@ -217,6 +218,8 @@ absl::optional<ContentSetting> PageInfoControllerAndroid::GetSettingToDisplay(
|
||||
// The javascript content setting should show up if it is blocked globally
|
||||
// to give users an easy way to create exceptions.
|
||||
return permission.default_setting;
|
||||
+ } else if (permission.type == ContentSettingsType::JAVASCRIPT_JIT) {
|
||||
+ return permission.default_setting;
|
||||
} else if (permission.type == ContentSettingsType::SOUND) {
|
||||
// The sound content setting should always show up when the tab has played
|
||||
// audio since last navigation.
|
||||
diff --git a/components/page_info/page_info.cc b/components/page_info/page_info.cc
|
||||
--- a/components/page_info/page_info.cc
|
||||
+++ b/components/page_info/page_info.cc
|
||||
@@ -130,6 +130,7 @@ ContentSettingsType kPermissionType[] = {
|
||||
ContentSettingsType::AR,
|
||||
ContentSettingsType::IDLE_DETECTION,
|
||||
ContentSettingsType::FEDERATED_IDENTITY_API,
|
||||
+ ContentSettingsType::JAVASCRIPT_JIT,
|
||||
};
|
||||
|
||||
// Determines whether to show permission |type| in the Page Info UI. Only
|
||||
@@ -163,6 +164,11 @@ bool ShouldShowPermission(const PageInfo::PermissionInfo& info,
|
||||
return true;
|
||||
}
|
||||
|
||||
+ // Always show JIT settings UI when when it has a site-specific override.
|
||||
+ if (info.type == ContentSettingsType::JAVASCRIPT_JIT) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
const bool is_incognito = web_contents->GetBrowserContext()->IsOffTheRecord();
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
// Special geolocation DSE settings apply only on Android, so make sure it
|
||||
diff --git a/components/page_info/page_info_ui.cc b/components/page_info/page_info_ui.cc
|
||||
--- a/components/page_info/page_info_ui.cc
|
||||
+++ b/components/page_info/page_info_ui.cc
|
||||
@@ -137,6 +137,8 @@ base::span<const PageInfoUI::PermissionUIInfo> GetContentSettingsUIInfo() {
|
||||
IDS_SITE_SETTINGS_TYPE_COOKIES_MID_SENTENCE},
|
||||
{ContentSettingsType::JAVASCRIPT, IDS_SITE_SETTINGS_TYPE_JAVASCRIPT,
|
||||
IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_MID_SENTENCE},
|
||||
+ {ContentSettingsType::JAVASCRIPT_JIT, IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT,
|
||||
+ IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT_MID_SENTENCE},
|
||||
{ContentSettingsType::POPUPS, IDS_SITE_SETTINGS_TYPE_POPUPS_REDIRECTS,
|
||||
IDS_SITE_SETTINGS_TYPE_POPUPS_REDIRECTS_MID_SENTENCE},
|
||||
{ContentSettingsType::GEOLOCATION, IDS_SITE_SETTINGS_TYPE_LOCATION,
|
||||
diff --git a/components/site_settings_strings.grdp b/components/site_settings_strings.grdp
|
||||
--- a/components/site_settings_strings.grdp
|
||||
+++ b/components/site_settings_strings.grdp
|
||||
@@ -82,6 +82,12 @@
|
||||
<message name="IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_MID_SENTENCE" desc="The label used for JavaScript site settings controls when used mid-sentence.">
|
||||
javascript
|
||||
</message>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT" desc="The label used for JavaScript JIT site settings controls.">
|
||||
+ JavaScript JIT
|
||||
+ </message>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_JAVASCRIPT_JIT_MID_SENTENCE" desc="The label used for JavaScript JIT site settings controls when used mid-sentence.">
|
||||
+ javascript JIT
|
||||
+ </message>
|
||||
<message name="IDS_SITE_SETTINGS_TYPE_LOCATION" desc="The label used for geolocation site settings controls." meaning="Geolocation">
|
||||
Location
|
||||
</message>
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -1,618 +0,0 @@
|
||||
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
|
||||
|
||||
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
|
||||
---
|
||||
.../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
|
||||
.../res/drawable-xxhdpi/settings_autoplay.png | Bin 0 -> 792 bytes
|
||||
.../drawable-xxxhdpi/settings_autoplay.png | Bin 0 -> 1064 bytes
|
||||
.../res/xml/site_settings_preferences.xml | 4 ++++
|
||||
.../ContentSettingsResources.java | 5 +++-
|
||||
.../site_settings/SingleCategorySettings.java | 9 +++++++
|
||||
.../site_settings/SingleWebsiteSettings.java | 22 ++++++++++++++++++
|
||||
.../site_settings/SiteSettingsCategory.java | 9 +++++--
|
||||
.../browser_ui/site_settings/Website.java | 9 +++++++
|
||||
.../WebsitePermissionsFetcher.java | 1 +
|
||||
.../android/website_preference_bridge.cc | 1 +
|
||||
.../strings/android/site_settings.grdp | 9 +++++++
|
||||
.../core/browser/content_settings_registry.cc | 2 +-
|
||||
.../core/browser/content_settings_utils.cc | 2 ++
|
||||
.../core/common/content_settings.cc | 2 ++
|
||||
.../core/common/content_settings.h | 1 +
|
||||
.../core/common/content_settings.mojom | 1 +
|
||||
.../common/content_settings_mojom_traits.cc | 1 +
|
||||
.../common/content_settings_mojom_traits.h | 5 ++++
|
||||
.../renderer/content_settings_agent_impl.cc | 11 +++++++++
|
||||
.../renderer/content_settings_agent_impl.h | 1 +
|
||||
.../android/page_info_controller_android.cc | 1 +
|
||||
components/page_info/page_info.cc | 6 +++++
|
||||
components/page_info/page_info_ui.cc | 1 +
|
||||
components/site_settings_strings.grdp | 3 +++
|
||||
.../platform/web_content_settings_client.h | 3 +++
|
||||
.../core/html/media/autoplay_policy.cc | 12 ++++++++++
|
||||
.../core/html/media/autoplay_policy.h | 4 ++++
|
||||
31 files changed, 126 insertions(+), 4 deletions(-)
|
||||
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
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-xxhdpi/settings_autoplay.png
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-xxxhdpi/settings_autoplay.png
|
||||
|
||||
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
|
||||
@@ -194,6 +194,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
|
||||
GIT binary patch
|
||||
literal 456
|
||||
zcmV;(0XP1MP)<h;3K|Lk000e1NJLTq001Na001Ni1ONa4O9@aD0004xNkl<Zcmd^>
|
||||
zv2MaJ5QYmZs7m@68Tt%)0T}7#GcJmh4B69}fh}W`x!sUhd4N1chpY%8u@-es;cQTy
|
||||
zGbWY1VQ**q%l&uuT^{am%=;qbIaI7>hvTfF;<*Ut{eMAbL!QB&HFUzBXR~2P41Zx8
|
||||
z)>!6-O>RP(9xN_j-$FSZiy-wPUj)-Jl(4<5Et;Mc!<K5}jwP!>dwn%v3G5VXX+fR6
|
||||
zfpz3x+Y|Y)K6`aNHVw{qdv4}^DAdl0F;g<cu%;M_QeJHg8RVIajV_AK%qV!0vEmv1
|
||||
z#vVbjZa-Q+lSd;emiMaVzX)Z*+nGY^7d%tYY9KFz2z6mO9x2+}RepX<5}`zKxo)iR
|
||||
zz{m)~NhMClXs`4GHM$vG2T_S4KzpqpIGl{BX8{q3sfX5s0TlVSK=Ataj-&0{v9#{N
|
||||
z{;&j_q`#yfB8jBm<%OhAge7edm84b@`b2QRo9WRKN#xNwD<h5zoBL8ri$BDs;tw$`
|
||||
y{$1Kp0i#npN<C~x1#L&}8>IV|-Tf!x{>CqV{oZM{Igf1s0000<MNUMnLSTY>m&@A#
|
||||
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
diff --git a/components/browser_ui/site_settings/android/java/res/drawable-mdpi/settings_autoplay.png b/components/browser_ui/site_settings/android/java/res/drawable-mdpi/settings_autoplay.png
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..49fa10d44f4007532d0d03d15fdcb1a715857e96
|
||||
GIT binary patch
|
||||
literal 296
|
||||
zcmV+@0oVSCP)<h;3K|Lk000e1NJLTq000;O000;W1ONa4N`Cco0002*Nkl<Zc-p;F
|
||||
zu?>ST5R5=Hk+X;yg9#|y{3AI^L4jN_0yR^lp<y0UAY}`bhK9U}6x+c{;s$?XpYHT`
|
||||
z_WQ8+DiaXc!3Y!8NIOv`U+9>_9hQ%}W9}t45w<H~z#4hQDkf8`VbB=1O|%hcI?jda
|
||||
zV;k+`LgB0>TQfw*%xg4TCAk}wycg<C;jW}mI*Sz_g!XRC-~-OCu{Db@O*?8?8^Rj&
|
||||
zS{^N1H6fiLjCAC#fRLNPkP|W*!URjjT!AiQtzvYZ{t%#iA(xXD1Xz-(u@oBGf2}Be
|
||||
u*BbnAfuj*Re80yVxjo)NA1L&T?!2C$I@?4>V>|Ky0000<MNUMnLSTX*1bI&Y
|
||||
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
diff --git a/components/browser_ui/site_settings/android/java/res/drawable-xhdpi/settings_autoplay.png b/components/browser_ui/site_settings/android/java/res/drawable-xhdpi/settings_autoplay.png
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..5a4128a5e02949de754f9cab2635824eda8c539c
|
||||
GIT binary patch
|
||||
literal 551
|
||||
zcmV+?0@(eDP)<h;3K|Lk000e1NJLTq001xm001xu1ONa4{R=S+0005*Nkl<Zc-rk(
|
||||
zy>fy;5RRo0wX?Hwh9Zw(#Vgp}9uO@kj!GT?W_XdLp-A4qiidDg@B~=L$xN`2Fo6Ry
|
||||
zoC`9!!WnNX*>%6WZ+~v@;l6HTnG5Pb03nIUF_Q>F2&iK&{=v0ABR=d&Dwa&+>$CpO
|
||||
zN8o1rO<Uv$u0HDF9##;Ow3|Q-tE-%+18~W?=HLW7u&HLKOxcVLm1<yTUrsfUGq~xX
|
||||
zqx<cUyx0DE0A@`^cGeUaIn=iCwjFlbea(GBJf>jQOd%dgDu@oJ0JqvZU3NJ!T~_A+
|
||||
zw>7k!d)Tk%U1PSM!@i8g3Qx?K@4o3Chv27xSRb|1lL*LZCn{;7NuQNv<q5!Ftw$V!
|
||||
zc)av3R5$TCJ)+DZDSW^ao>676eW3vl6flwYSMx=l(G+1kL4+N%tlEhfAQy}(nDFWr
|
||||
zbXw{Z4tCiO1OTTBcDW68nyP>kgahDIfn8VxO;uQ6Yd8Q-71auD*mMx(DnrEqaH<To
|
||||
z&_)dhyat$p1K?CKh1bGGfX(<C05JbrZN`P>Q#wV`gM2wnZ5*JY22WGzg(js{SktOi
|
||||
z^lWxu_H1_Y+jaYe^U~wOk$z>$zx3sgE%FC1e02PlFgl8cUvcTd1Q~vNjPEQT-<g7p
|
||||
p?=l}ClAlmgAAvHTvG;Wo>j%AMEx!+_@2>y=002ovPDHLkV1fY;_gnw~
|
||||
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
diff --git a/components/browser_ui/site_settings/android/java/res/drawable-xxhdpi/settings_autoplay.png b/components/browser_ui/site_settings/android/java/res/drawable-xxhdpi/settings_autoplay.png
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..7fceb8c2b546970a3720e8ab225799aa03895b7f
|
||||
GIT binary patch
|
||||
literal 792
|
||||
zcmV+z1LypSP)<h;3K|Lk000e1NJLTq002k;002k`1ONa4|Kxkj0008tNkl<ZcmeHN
|
||||
zv2Nl_5Kd(&P^2J2k<wEAFOV*wK{6%nd}~AH7AGB@E1m)cC{TL;PY?@4L47q{DkQ2)
|
||||
zgu;oFPN%!E!Ny}lw9<LD9oFB@H#0js!$l#56r!s*CDlL=Bg|=u6>VsP6)iEx2tCzs
|
||||
zN?!=Ys;Vvm+R!dxZSbnPR`u*)=$?G~q+QDONj}}54UDQIpq+dnupUkhrgMXd90~(9
|
||||
z>D-*sHYV1z%eSyr=BeO3;m5&Ge2@<pO;xiip5YmGMb*%ROFljhg4(L5++aL|o)4Xt
|
||||
z#%NjP*f=bsMdO23efEqzx#k+Py)EC-cdk<X`U-t|-#g6Ixz21IO!tgFux}-M*tcpx
|
||||
z+bE=rR*I5^H|s7_BE7>~l(<Z;9NA<MwvEhAv<UAec5h`y4E^$WnI||NFX<&hz9~zC
|
||||
z>oA;)6G#{m)`C=tNtmpB)?rp!gtK?*J1gwU@xCMXrLcRedOG_Aoa>~>!hiCJ<GzU?
|
||||
zU4g;RFi3>{ojT&^9q|2A6eswfXXRwNew}jUlw`DpvbTS<8sy~{`pMeAwZ6%yL!Xy$
|
||||
zN2*G=JTQ;lS${M|)Hzo?si<yxhaM+sazIk*Xq?iqof0qI(UJg?P=^+O4kR2zHF)`D
|
||||
zl|_IA)LCU-!l_0)@}9u|IUq50<g;J&;sK4Ankxn*pe__Vqj<GBGo&d7B%n^2OnV;x
|
||||
zfh7Y}69W=Zr)o@h8E>K0Up2cT1|*=)t}wk-{0CUjdxjX0fI83Mf&Ybo(3S(znzB<m
|
||||
z^)SCv%fntq6%#ah*z2DdwY@s>U#@89zg#sfKk^r7!;A&m>sd-zwDXs+niu)Z|Ao(>
|
||||
z;TfMn@`obY`5%hfKBYBiHdqh(w`25gSn1i))3E8OQ(Krf&Sz(7oX<QX`)FaR!DvC-
|
||||
z;R|!`ZTxsjnS4B@Ou=|cg8`miBTkKmz^eW)jLCUb2{*+b2?DrQRj0pNXexyiQpitx
|
||||
WnED%yq_MdG0000<MNUMnLSTZmtagO}
|
||||
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
diff --git a/components/browser_ui/site_settings/android/java/res/drawable-xxxhdpi/settings_autoplay.png b/components/browser_ui/site_settings/android/java/res/drawable-xxxhdpi/settings_autoplay.png
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..92a315bb00ac1f4dc675e894bf4af3ba7c68bf39
|
||||
GIT binary patch
|
||||
literal 1064
|
||||
zcmV+@1lRkCP)<h;3K|Lk000e1NJLTq003YB003YJ1ONa4NRhv@000B;Nkl<Zc-rk-
|
||||
zF-Rjp6x}q5UMCS0#3Pl(5mH&l%1Q;{uKI6w6G2RqfI_g2*e8Om;Gwl(ZGDB6<Z@mY
|
||||
z41!h)DtJW--GhTGoY}a$GqZ^U^QZnZ|INPr^Z%bejuk6btXQ$4Pc|mmBCFCqouNZL
|
||||
z+*6<WxThXEbVmEE$`&^!KcwMX<5*@*wCR=nknxH(Yhrn8{DYY8r>Mvd@I-#RfhTrA
|
||||
zML#uC<7*jKp)UCfqsuC_%t(wck71K;$=5J$u~{A)viWQYSLEv(xME8~Gk$Frr{wD&
|
||||
zI9;0^#@?^uf&63!9@uK4#y8Tm7iz{GPOt-V=gT=S+ekOkUbdWb=Rw%P3EhS2?={j1
|
||||
znNJh=@$S+WRQC#g>V2o{6{t=Z?|z3LG~wtMZ-y=hF8Pd>n~yV_n@0=J13_GRGrG;6
|
||||
z!}Wm09<l3XrRL0HmmUXf$+b79b@vCEkE8V|m6_M4a5NCYj5h8ElLt5Mf{yv!1>6J^
|
||||
zi6*pop5R{>=jCZ_r}{L`gMViY9x2#y;<%R48&%;r*r_TXTLH$uVB1MRu#FdSHKn7?
|
||||
z`-}(CeD>8zNbpUBfCq&DBPizKc3=Bf2#S%UBhDc1I|)nBzrdE{;{7Yp^VBj!$TQBx
|
||||
zU|S+zz^3T;B^;-eQx(qzY{qtLVzw3S*uwXXPwGdTn6<_H_N*cX4be2o$8UU5g&+nP
|
||||
ztP-!%(B(t6s4>q!uz#qm24H<k2=lrzDi~B0_J233?tcwcDq&ZkQ87A!4)}QA%f<zu
|
||||
zN+mDL=L_s0dX?>oQ*Am<Tmb4+LW?hjMXctzD}w*YO8`)&lA9OoSdl_b7mgzXK%Gi_
|
||||
z?u=G6wV#{`bvXd)RH8aJPdie9oUbr@1vvofRPqXZWjjJ~o-Oiq9zP`qK%Gi{imxNF
|
||||
z#ZV>GxMfcqM;3rOm2koVsD>M`&n>zm4?vwt*x~f|!wop&79@E9>Qn-8+GpV^zc}AJ
|
||||
zFAqSSO71+T*$FqG_g1BxlLw$qrE-qb>xHV|o^zsEc>wBE^0J)HeYgSrw<?XaJOFhn
|
||||
zHPW0;|APTQNjCuVDP;an+!=-&MJXXSYW_iHekj4JNd|K$X%6Ph52wvfXhcC<e@cl`
|
||||
zVkxC4tod=0da3dbmbI2u4)v8)uq;{FLQA%=g_7RFmf@vE<BPjPEU%+9qVl@=7aZzW
|
||||
zOoyYnVlw}dPjsfExn`|pg0EQ(zvwo+)xh{>55wDS3~zX{EoY-``m=49hBUsaw;r=*
|
||||
z+}2~(e82VBHh+(@{oX!+2n#ThdxByg0maD|^ghF~58(`dil|N~cLlAek3rFLSGLCO
|
||||
ib6hJ{tXQ#P#rX?0El=KlH_u1_0000<MNUMnLSTX(y!wd%
|
||||
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
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
|
||||
@@ -71,6 +71,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="protected_content" />
|
||||
+ <!-- Autoplay -->
|
||||
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
|
||||
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings"
|
||||
+ android:key="autoplay" />
|
||||
<!-- Sound -->
|
||||
<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/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
|
||||
@@ -125,7 +125,10 @@ public class ContentSettingsResources {
|
||||
return new ResourceItem(R.drawable.infobar_downloading,
|
||||
R.string.automatic_downloads_permission_title, ContentSettingValues.ASK,
|
||||
ContentSettingValues.BLOCK, R.string.website_settings_category_ask, 0);
|
||||
-
|
||||
+ case ContentSettingsType.AUTOPLAY:
|
||||
+ return new ResourceItem(R.drawable.settings_autoplay, R.string.autoplay_title,
|
||||
+ ContentSettingValues.ALLOW, ContentSettingValues.BLOCK,
|
||||
+ R.string.website_settings_category_autoplay_allowed, 0);
|
||||
case ContentSettingsType.AUTO_DARK_WEB_CONTENT:
|
||||
return new ResourceItem(R.drawable.ic_brightness_medium_24dp,
|
||||
R.string.auto_dark_web_content_title, ContentSettingValues.ALLOW,
|
||||
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
|
||||
@@ -761,6 +761,12 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
|
||||
case SiteSettingsCategory.Type.BACKGROUND_SYNC:
|
||||
resource = R.string.website_settings_add_site_description_background_sync;
|
||||
break;
|
||||
+ case SiteSettingsCategory.Type.AUTOPLAY:
|
||||
+ resource = WebsitePreferenceBridge.isCategoryEnabled(
|
||||
+ browserContextHandle, ContentSettingsType.AUTOPLAY)
|
||||
+ ? R.string.website_settings_add_site_description_autoplay
|
||||
+ : R.string.website_settings_add_site_description_autoplay;
|
||||
+ break;
|
||||
case SiteSettingsCategory.Type.JAVASCRIPT:
|
||||
resource = WebsitePreferenceBridge.isCategoryEnabled(
|
||||
browserContextHandle, ContentSettingsType.JAVASCRIPT)
|
||||
@@ -934,6 +940,9 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
|
||||
case SiteSettingsCategory.Type.TIMEZONE_OVERRIDE:
|
||||
allowSpecifyingExceptions = true;
|
||||
break;
|
||||
+ case SiteSettingsCategory.Type.AUTOPLAY:
|
||||
+ allowSpecifyingExceptions = true;
|
||||
+ break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
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
|
||||
@@ -133,6 +133,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
return "cookies_permission_list";
|
||||
case ContentSettingsType.FEDERATED_IDENTITY_API:
|
||||
return "federated_identity_api_list";
|
||||
+ case ContentSettingsType.AUTOPLAY:
|
||||
+ return "autoplay_permission_list";
|
||||
case ContentSettingsType.IDLE_DETECTION:
|
||||
return "idle_detection_permission_list";
|
||||
case ContentSettingsType.JAVASCRIPT:
|
||||
@@ -510,6 +512,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
|
||||
if (type == ContentSettingsType.ADS) {
|
||||
setUpAdsPreference(preference);
|
||||
+ } else if (type == ContentSettingsType.AUTOPLAY) {
|
||||
+ setUpAutoplayPreference(preference);
|
||||
} else if (type == ContentSettingsType.SOUND) {
|
||||
setUpSoundPreference(preference);
|
||||
} else if (type == ContentSettingsType.JAVASCRIPT) {
|
||||
@@ -1032,6 +1036,24 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
setupContentSettingsPreference(preference, currentValue, false /* isEmbargoed */);
|
||||
}
|
||||
|
||||
+ private void setUpAutoplayPreference(Preference preference) {
|
||||
+ @ContentSettingValues
|
||||
+ @Nullable
|
||||
+ Integer currentValue = mSite.getContentSetting(
|
||||
+ getSiteSettingsDelegate().getBrowserContextHandle(), ContentSettingsType.AUTOPLAY);
|
||||
+ // In order to always show the autoplay permission, set it up with the default value if it
|
||||
+ // doesn't have a current value.
|
||||
+ if (currentValue == null) {
|
||||
+ currentValue = WebsitePreferenceBridge.isCategoryEnabled(
|
||||
+ getSiteSettingsDelegate().getBrowserContextHandle(),
|
||||
+ ContentSettingsType.AUTOPLAY)
|
||||
+ ? ContentSettingValues.ALLOW
|
||||
+ : ContentSettingValues.BLOCK;
|
||||
+ }
|
||||
+ // Not possible to embargo AUTOPLAY.
|
||||
+ setupContentSettingsPreference(preference, currentValue, false /* isEmbargoed */);
|
||||
+ }
|
||||
+
|
||||
private void setUpJavascriptPreference(Preference preference) {
|
||||
BrowserContextHandle browserContextHandle =
|
||||
getSiteSettingsDelegate().getBrowserContextHandle();
|
||||
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
|
||||
@@ -47,7 +47,7 @@ public class SiteSettingsCategory {
|
||||
Type.PROTECTED_MEDIA, Type.SENSORS, Type.SOUND, Type.USB, Type.VIRTUAL_REALITY,
|
||||
Type.USE_STORAGE, Type.AUTO_DARK_WEB_CONTENT, Type.REQUEST_DESKTOP_SITE,
|
||||
Type.FEDERATED_IDENTITY_API, Type.THIRD_PARTY_COOKIES, Type.SITE_DATA, Type.ANTI_ABUSE,
|
||||
- Type.TIMEZONE_OVERRIDE,
|
||||
+ Type.TIMEZONE_OVERRIDE, Type.AUTOPLAY,
|
||||
Type.NUM_ENTRIES})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Type {
|
||||
@@ -83,10 +83,11 @@ public class SiteSettingsCategory {
|
||||
int SITE_DATA = 27;
|
||||
int ANTI_ABUSE = 28;
|
||||
int TIMEZONE_OVERRIDE = 29;
|
||||
+ int AUTOPLAY = 30;
|
||||
/**
|
||||
* Number of handled categories used for calculating array sizes.
|
||||
*/
|
||||
- int NUM_ENTRIES = 30;
|
||||
+ int NUM_ENTRIES = 31;
|
||||
}
|
||||
|
||||
private final BrowserContextHandle mBrowserContextHandle;
|
||||
@@ -203,6 +204,8 @@ public class SiteSettingsCategory {
|
||||
return ContentSettingsType.NFC;
|
||||
case Type.NOTIFICATIONS:
|
||||
return ContentSettingsType.NOTIFICATIONS;
|
||||
+ case Type.AUTOPLAY:
|
||||
+ return ContentSettingsType.AUTOPLAY;
|
||||
case Type.POPUPS:
|
||||
return ContentSettingsType.POPUPS;
|
||||
case Type.PROTECTED_MEDIA:
|
||||
@@ -286,6 +289,8 @@ public class SiteSettingsCategory {
|
||||
return "nfc";
|
||||
case Type.NOTIFICATIONS:
|
||||
return "notifications";
|
||||
+ case Type.AUTOPLAY:
|
||||
+ return "autoplay";
|
||||
case Type.POPUPS:
|
||||
return "popups";
|
||||
case Type.PROTECTED_MEDIA:
|
||||
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
|
||||
@@ -230,6 +230,15 @@ public final class Website implements WebsiteEntry {
|
||||
} else {
|
||||
RecordUserAction.record("JavascriptContentSetting.DisableBy.SiteSettings");
|
||||
}
|
||||
+ } else if (type == ContentSettingsType.AUTOPLAY) {
|
||||
+ // It is possible to set the permission without having an existing exception,
|
||||
+ // because we always show the autoplay permission in Site Settings.
|
||||
+ if (exception == null) {
|
||||
+ exception = new ContentSettingException(
|
||||
+ ContentSettingsType.AUTOPLAY, getAddress().getHost(), value, "",
|
||||
+ /*isEmbargoed=*/false);
|
||||
+ setContentSettingException(type, exception);
|
||||
+ }
|
||||
} else if (type == ContentSettingsType.SOUND) {
|
||||
// It is possible to set the permission without having an existing exception,
|
||||
// because we always show the sound permission in Site Settings.
|
||||
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
|
||||
@@ -68,6 +68,7 @@ public class WebsitePermissionsFetcher {
|
||||
case ContentSettingsType.AUTOMATIC_DOWNLOADS:
|
||||
case ContentSettingsType.BACKGROUND_SYNC:
|
||||
case ContentSettingsType.BLUETOOTH_SCANNING:
|
||||
+ case ContentSettingsType.AUTOPLAY:
|
||||
case ContentSettingsType.COOKIES:
|
||||
case ContentSettingsType.FEDERATED_IDENTITY_API:
|
||||
case ContentSettingsType.JAVASCRIPT:
|
||||
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
|
||||
@@ -827,6 +827,7 @@ static void JNI_WebsitePreferenceBridge_SetContentSettingEnabled(
|
||||
case ContentSettingsType::REQUEST_DESKTOP_SITE:
|
||||
case ContentSettingsType::SENSORS:
|
||||
case ContentSettingsType::SOUND:
|
||||
+ case ContentSettingsType::AUTOPLAY:
|
||||
value = CONTENT_SETTING_ALLOW;
|
||||
break;
|
||||
default:
|
||||
diff --git a/components/browser_ui/strings/android/site_settings.grdp b/components/browser_ui/strings/android/site_settings.grdp
|
||||
--- a/components/browser_ui/strings/android/site_settings.grdp
|
||||
+++ b/components/browser_ui/strings/android/site_settings.grdp
|
||||
@@ -22,6 +22,15 @@
|
||||
<message name="IDS_ANTI_ABUSE_PERMISSION_TITLE" desc="Title for the anti-abuse permission [CHAR_LIMIT=32]">
|
||||
Auto-verify
|
||||
</message>
|
||||
+ <message name="IDS_AUTOPLAY_TITLE" desc='Title for the Autoplay settings screen [CHAR-LIMIT=32]'>
|
||||
+ Autoplay
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_ADD_SITE_DESCRIPTION_AUTOPLAY" desc="The description for the allow autoplay of muted videos for website dialog.">
|
||||
+ Allow autoplay of muted videos for a specific site.
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_AUTOPLAY_ALLOWED" desc="Summary text explaining that sites are allowed to automatically play muted videos and that it is the recommended setting.">
|
||||
+ Allow sites to automatically play muted videos (recommended)
|
||||
+ </message>
|
||||
<message name="IDS_AR_PERMISSION_TITLE" desc="Title of the permission to use Augmented Reality [CHAR_LIMIT=32]">
|
||||
Augmented reality
|
||||
</message>
|
||||
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
--- a/components/content_settings/core/browser/content_settings_registry.cc
|
||||
+++ b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
@@ -236,7 +236,7 @@ void ContentSettingsRegistry::Init() {
|
||||
ContentSettingsInfo::INHERIT_IN_INCOGNITO,
|
||||
ContentSettingsInfo::EXCEPTIONS_ON_SECURE_ORIGINS_ONLY);
|
||||
|
||||
- Register(ContentSettingsType::AUTOPLAY, "autoplay", CONTENT_SETTING_ALLOW,
|
||||
+ Register(ContentSettingsType::AUTOPLAY, "autoplay", CONTENT_SETTING_BLOCK,
|
||||
WebsiteSettingsInfo::UNSYNCABLE, /*allowlisted_schemes=*/{},
|
||||
/*valid_settings=*/{CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK},
|
||||
WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
|
||||
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
|
||||
@@ -151,6 +151,8 @@ void GetRendererContentSettingRules(const HostContentSettingsMap* map,
|
||||
#endif
|
||||
map->GetSettingsForOneType(ContentSettingsType::JAVASCRIPT,
|
||||
&(rules->script_rules));
|
||||
+ map->GetSettingsForOneType(ContentSettingsType::AUTOPLAY,
|
||||
+ &(rules->autoplay_rules));
|
||||
map->GetSettingsForOneType(ContentSettingsType::POPUPS,
|
||||
&(rules->popup_redirect_rules));
|
||||
|
||||
diff --git a/components/content_settings/core/common/content_settings.cc b/components/content_settings/core/common/content_settings.cc
|
||||
--- a/components/content_settings/core/common/content_settings.cc
|
||||
+++ b/components/content_settings/core/common/content_settings.cc
|
||||
@@ -215,6 +215,7 @@ bool RendererContentSettingRules::IsRendererContentSetting(
|
||||
return content_type == ContentSettingsType::IMAGES ||
|
||||
content_type == ContentSettingsType::JAVASCRIPT ||
|
||||
content_type == ContentSettingsType::POPUPS ||
|
||||
+ content_type == ContentSettingsType::AUTOPLAY ||
|
||||
content_type == ContentSettingsType::MIXEDSCRIPT ||
|
||||
content_type == ContentSettingsType::AUTO_DARK_WEB_CONTENT ||
|
||||
content_type == ContentSettingsType::TIMEZONE_OVERRIDE;
|
||||
@@ -228,6 +229,7 @@ void RendererContentSettingRules::FilterRulesByOutermostMainFrameURL(
|
||||
FilterRulesForType(mixed_content_rules, outermost_main_frame_url);
|
||||
FilterRulesForType(auto_dark_content_rules, outermost_main_frame_url);
|
||||
FilterRulesForType(timezone_override_rules, outermost_main_frame_url);
|
||||
+ FilterRulesForType(autoplay_rules, outermost_main_frame_url);
|
||||
}
|
||||
|
||||
RendererContentSettingRules::RendererContentSettingRules() = default;
|
||||
diff --git a/components/content_settings/core/common/content_settings.h b/components/content_settings/core/common/content_settings.h
|
||||
--- a/components/content_settings/core/common/content_settings.h
|
||||
+++ b/components/content_settings/core/common/content_settings.h
|
||||
@@ -90,6 +90,7 @@ struct RendererContentSettingRules {
|
||||
|
||||
ContentSettingsForOneType image_rules;
|
||||
ContentSettingsForOneType script_rules;
|
||||
+ ContentSettingsForOneType autoplay_rules;
|
||||
ContentSettingsForOneType popup_redirect_rules;
|
||||
ContentSettingsForOneType mixed_content_rules;
|
||||
ContentSettingsForOneType auto_dark_content_rules;
|
||||
diff --git a/components/content_settings/core/common/content_settings.mojom b/components/content_settings/core/common/content_settings.mojom
|
||||
--- a/components/content_settings/core/common/content_settings.mojom
|
||||
+++ b/components/content_settings/core/common/content_settings.mojom
|
||||
@@ -75,6 +75,7 @@ struct ContentSettingPatternSource {
|
||||
struct RendererContentSettingRules {
|
||||
array<ContentSettingPatternSource> image_rules;
|
||||
array<ContentSettingPatternSource> script_rules;
|
||||
+ array<ContentSettingPatternSource> autoplay_rules;
|
||||
array<ContentSettingPatternSource> popup_redirect_rules;
|
||||
array<ContentSettingPatternSource> mixed_content_rules;
|
||||
array<ContentSettingPatternSource> auto_dark_content_rules;
|
||||
diff --git a/components/content_settings/core/common/content_settings_mojom_traits.cc b/components/content_settings/core/common/content_settings_mojom_traits.cc
|
||||
--- a/components/content_settings/core/common/content_settings_mojom_traits.cc
|
||||
+++ b/components/content_settings/core/common/content_settings_mojom_traits.cc
|
||||
@@ -100,6 +100,7 @@ bool StructTraits<content_settings::mojom::RendererContentSettingRulesDataView,
|
||||
RendererContentSettingRules* out) {
|
||||
return data.ReadImageRules(&out->image_rules) &&
|
||||
data.ReadScriptRules(&out->script_rules) &&
|
||||
+ data.ReadAutoplayRules(&out->autoplay_rules) &&
|
||||
data.ReadPopupRedirectRules(&out->popup_redirect_rules) &&
|
||||
data.ReadMixedContentRules(&out->mixed_content_rules) &&
|
||||
data.ReadAutoDarkContentRules(&out->auto_dark_content_rules) &&
|
||||
diff --git a/components/content_settings/core/common/content_settings_mojom_traits.h b/components/content_settings/core/common/content_settings_mojom_traits.h
|
||||
--- a/components/content_settings/core/common/content_settings_mojom_traits.h
|
||||
+++ b/components/content_settings/core/common/content_settings_mojom_traits.h
|
||||
@@ -135,6 +135,11 @@ struct StructTraits<
|
||||
return r.script_rules;
|
||||
}
|
||||
|
||||
+ static const std::vector<ContentSettingPatternSource>& autoplay_rules(
|
||||
+ const RendererContentSettingRules& r) {
|
||||
+ return r.autoplay_rules;
|
||||
+ }
|
||||
+
|
||||
static const std::vector<ContentSettingPatternSource>& popup_redirect_rules(
|
||||
const RendererContentSettingRules& r) {
|
||||
return r.popup_redirect_rules;
|
||||
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
|
||||
@@ -388,6 +388,17 @@ bool ContentSettingsAgentImpl::AllowRunningInsecureContent(
|
||||
return false;
|
||||
}
|
||||
|
||||
+bool ContentSettingsAgentImpl::AllowAutoplay(bool default_value) {
|
||||
+ if (!content_setting_rules_)
|
||||
+ return default_value;
|
||||
+
|
||||
+ blink::WebLocalFrame* frame = render_frame()->GetWebFrame();
|
||||
+ return GetContentSettingFromRules(
|
||||
+ content_setting_rules_->autoplay_rules,
|
||||
+ url::Origin(frame->GetDocument().GetSecurityOrigin()).GetURL()) ==
|
||||
+ CONTENT_SETTING_ALLOW;
|
||||
+}
|
||||
+
|
||||
bool ContentSettingsAgentImpl::AllowPopupsAndRedirects(bool default_value) {
|
||||
if (!content_setting_rules_)
|
||||
return default_value;
|
||||
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
|
||||
@@ -96,6 +96,7 @@ class ContentSettingsAgentImpl
|
||||
void DidNotAllowScript() override;
|
||||
bool AllowRunningInsecureContent(bool allowed_per_settings,
|
||||
const blink::WebURL& url) override;
|
||||
+ bool AllowAutoplay(bool default_value) override;
|
||||
bool AllowPopupsAndRedirects(bool default_value) override;
|
||||
bool ShouldAutoupgradeMixedContent() override;
|
||||
|
||||
diff --git a/components/page_info/android/page_info_controller_android.cc b/components/page_info/android/page_info_controller_android.cc
|
||||
--- a/components/page_info/android/page_info_controller_android.cc
|
||||
+++ b/components/page_info/android/page_info_controller_android.cc
|
||||
@@ -138,6 +138,7 @@ void PageInfoControllerAndroid::SetPermissionInfo(
|
||||
permissions_to_display.push_back(ContentSettingsType::ADS);
|
||||
permissions_to_display.push_back(
|
||||
ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER);
|
||||
+ permissions_to_display.push_back(ContentSettingsType::AUTOPLAY);
|
||||
permissions_to_display.push_back(ContentSettingsType::SOUND);
|
||||
if (base::FeatureList::IsEnabled(features::kWebNfc))
|
||||
permissions_to_display.push_back(ContentSettingsType::NFC);
|
||||
diff --git a/components/page_info/page_info.cc b/components/page_info/page_info.cc
|
||||
--- a/components/page_info/page_info.cc
|
||||
+++ b/components/page_info/page_info.cc
|
||||
@@ -107,6 +107,7 @@ ContentSettingsType kPermissionType[] = {
|
||||
ContentSettingsType::ADS,
|
||||
ContentSettingsType::BACKGROUND_SYNC,
|
||||
ContentSettingsType::SOUND,
|
||||
+ ContentSettingsType::AUTOPLAY,
|
||||
ContentSettingsType::AUTOMATIC_DOWNLOADS,
|
||||
#if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
|
||||
ContentSettingsType::PROTECTED_MEDIA_IDENTIFIER,
|
||||
@@ -150,6 +151,11 @@ bool ShouldShowPermission(const PageInfo::PermissionInfo& info,
|
||||
return is_subresource_filter_activated;
|
||||
}
|
||||
|
||||
+ // Always show autoplay when it has a site-specific override
|
||||
+ if (info.type == ContentSettingsType::AUTOPLAY) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
if (info.type == ContentSettingsType::SOUND) {
|
||||
// The sound content setting should always show up when the tab has played
|
||||
// audio.
|
||||
diff --git a/components/page_info/page_info_ui.cc b/components/page_info/page_info_ui.cc
|
||||
--- a/components/page_info/page_info_ui.cc
|
||||
+++ b/components/page_info/page_info_ui.cc
|
||||
@@ -162,6 +162,7 @@ base::span<const PageInfoUI::PermissionUIInfo> GetContentSettingsUIInfo() {
|
||||
#endif
|
||||
{ContentSettingsType::ADS, IDS_SITE_SETTINGS_TYPE_ADS,
|
||||
IDS_SITE_SETTINGS_TYPE_ADS_MID_SENTENCE},
|
||||
+ {ContentSettingsType::AUTOPLAY, IDS_SITE_SETTINGS_TYPE_AUTOPLAY},
|
||||
{ContentSettingsType::SOUND, IDS_SITE_SETTINGS_TYPE_SOUND,
|
||||
IDS_SITE_SETTINGS_TYPE_SOUND_MID_SENTENCE},
|
||||
{ContentSettingsType::CLIPBOARD_READ_WRITE,
|
||||
diff --git a/components/site_settings_strings.grdp b/components/site_settings_strings.grdp
|
||||
--- a/components/site_settings_strings.grdp
|
||||
+++ b/components/site_settings_strings.grdp
|
||||
@@ -139,6 +139,9 @@
|
||||
<message name="IDS_SITE_SETTINGS_TYPE_SOUND" desc="The label used for the sound site settings controls.">
|
||||
Sound
|
||||
</message>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_AUTOPLAY" desc="The label used for the autoplay permission controls in the Page Info popup.">
|
||||
+ Autoplay
|
||||
+ </message>
|
||||
<message name="IDS_SITE_SETTINGS_TYPE_SOUND_MID_SENTENCE" desc="The label used for the sound site settings controls when used mid-sentence.">
|
||||
sound
|
||||
</message>
|
||||
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
|
||||
@@ -92,6 +92,9 @@ class WebContentSettingsClient {
|
||||
// interface.
|
||||
virtual bool AllowMutationEvents(bool default_value) { return default_value; }
|
||||
|
||||
+ // Controls whether autoplay is allowed for this frame.
|
||||
+ virtual bool AllowAutoplay(bool default_value) { return default_value; }
|
||||
+
|
||||
virtual bool AllowPopupsAndRedirects(bool default_value) {
|
||||
return default_value;
|
||||
}
|
||||
diff --git a/third_party/blink/renderer/core/html/media/autoplay_policy.cc b/third_party/blink/renderer/core/html/media/autoplay_policy.cc
|
||||
--- a/third_party/blink/renderer/core/html/media/autoplay_policy.cc
|
||||
+++ b/third_party/blink/renderer/core/html/media/autoplay_policy.cc
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "third_party/blink/public/mojom/autoplay/autoplay.mojom-blink.h"
|
||||
#include "third_party/blink/public/mojom/permissions_policy/permissions_policy.mojom-blink.h"
|
||||
#include "third_party/blink/public/mojom/webpreferences/web_preferences.mojom-blink.h"
|
||||
+#include "third_party/blink/public/platform/web_content_settings_client.h"
|
||||
#include "third_party/blink/public/platform/web_media_player.h"
|
||||
#include "third_party/blink/public/web/web_local_frame.h"
|
||||
#include "third_party/blink/public/web/web_local_frame_client.h"
|
||||
@@ -310,6 +311,8 @@ void AutoplayPolicy::TryUnlockingUserGesture() {
|
||||
}
|
||||
|
||||
bool AutoplayPolicy::IsGestureNeededForPlayback() const {
|
||||
+ if (!IsAutoplayAllowedPerSettings())
|
||||
+ return true;
|
||||
if (!IsLockedPendingUserGesture())
|
||||
return false;
|
||||
|
||||
@@ -408,6 +411,15 @@ void AutoplayPolicy::MaybeSetAutoplayInitiated() {
|
||||
}
|
||||
}
|
||||
|
||||
+bool AutoplayPolicy::IsAutoplayAllowedPerSettings() const {
|
||||
+ LocalFrame* frame = element_->GetDocument().GetFrame();
|
||||
+ if (!frame)
|
||||
+ return false;
|
||||
+ if (auto* settings_client = frame->GetContentSettingsClient())
|
||||
+ return settings_client->AllowAutoplay(false /* default_value */);
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
bool AutoplayPolicy::ShouldAutoplay() {
|
||||
if (!element_->GetExecutionContext() ||
|
||||
element_->GetExecutionContext()->IsSandboxed(
|
||||
diff --git a/third_party/blink/renderer/core/html/media/autoplay_policy.h b/third_party/blink/renderer/core/html/media/autoplay_policy.h
|
||||
--- a/third_party/blink/renderer/core/html/media/autoplay_policy.h
|
||||
+++ b/third_party/blink/renderer/core/html/media/autoplay_policy.h
|
||||
@@ -133,6 +133,10 @@ class CORE_EXPORT AutoplayPolicy final
|
||||
// should use, if checking to see if an action is allowed.
|
||||
bool IsLockedPendingUserGesture() const;
|
||||
|
||||
+ // Return true if and only if the settings allow autoplay of media on this
|
||||
+ // frame.
|
||||
+ bool IsAutoplayAllowedPerSettings() const;
|
||||
+
|
||||
bool IsAutoplayingMutedInternal(bool muted) const;
|
||||
bool IsOrWillBeAutoplayingMutedInternal(bool muted) const;
|
||||
|
||||
--
|
||||
2.25.1
|
||||
@@ -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
|
||||
@@ -524,6 +524,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
@@ -515,6 +515,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
setUpSoundPreference(preference);
|
||||
} else if (type == ContentSettingsType.JAVASCRIPT) {
|
||||
setUpJavascriptPreference(preference);
|
||||
@@ -21,8 +21,8 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c
|
||||
+ setUpCookiesPreference(preference);
|
||||
} else if (type == ContentSettingsType.GEOLOCATION) {
|
||||
setUpLocationPreference(preference);
|
||||
} else if (type == ContentSettingsType.IMAGES) {
|
||||
@@ -882,16 +884,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
} else if (type == ContentSettingsType.NOTIFICATIONS) {
|
||||
@@ -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() {
|
||||
@@ -1077,17 +1071,35 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
@@ -1055,17 +1049,35 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
@Nullable
|
||||
Integer currentValue =
|
||||
mSite.getContentSetting(browserContextHandle, ContentSettingsType.JAVASCRIPT);
|
||||
@@ -78,10 +78,10 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c
|
||||
+ setupContentSettingsPreference(preference, currentValue, false /* isEmbargoed */);
|
||||
+ }
|
||||
+
|
||||
private void setUpJavascriptJitPreference(Preference preference) {
|
||||
BrowserContextHandle browserContextHandle =
|
||||
getSiteSettingsDelegate().getBrowserContextHandle();
|
||||
@@ -1120,22 +1132,10 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
/**
|
||||
* Updates the ads list preference based on whether the site is a candidate for blocking. This
|
||||
* has some custom behavior.
|
||||
@@ -1081,22 +1093,10 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
setupContentSettingsPreference(preference, null, false);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4,79 +4,28 @@ 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
|
||||
.../res/drawable-xxhdpi/permission_images.png | Bin 0 -> 449 bytes
|
||||
.../drawable-xxxhdpi/permission_images.png | Bin 0 -> 532 bytes
|
||||
.../res/xml/site_settings_preferences.xml | 4 ++++
|
||||
.../ContentSettingsResources.java | 4 ++++
|
||||
.../site_settings/SingleCategorySettings.java | 9 +++++++
|
||||
.../site_settings/SingleWebsiteSettings.java | 22 ++++++++++++++++++
|
||||
.../site_settings/SiteSettingsCategory.java | 9 +++++--
|
||||
.../site_settings/SiteSettingsUtil.java | 1 +
|
||||
.../browser_ui/site_settings/Website.java | 7 ++++++
|
||||
.../WebsitePermissionsFetcher.java | 1 +
|
||||
.../android/website_preference_bridge.cc | 1 +
|
||||
.../strings/android/site_settings.grdp | 6 +++++
|
||||
.../core/browser/content_settings_registry.cc | 3 ++-
|
||||
.../core/browser/content_settings_utils.cc | 8 ++-----
|
||||
.../android/page_info_controller_android.cc | 4 ++++
|
||||
components/page_info/page_info.cc | 7 ++++--
|
||||
components/page_info/page_info_ui.cc | 4 ++--
|
||||
components/site_settings_strings.grdp | 12 +++++-----
|
||||
22 files changed, 88 insertions(+), 19 deletions(-)
|
||||
.../impl/BromiteImagesContentSetting.java | 92 ++++++++++++++++++
|
||||
.../bromite_content_settings/images.grdp | 23 +++++
|
||||
.../bromite_content_settings/images.inc | 7 ++
|
||||
.../core/browser/content_settings_registry.cc | 2 +-
|
||||
.../core/browser/content_settings_utils.cc | 8 +-
|
||||
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
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-xxhdpi/permission_images.png
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/res/drawable-xxxhdpi/permission_images.png
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteImagesContentSetting.java
|
||||
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
|
||||
@@ -186,6 +186,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_javascript_jit.png",
|
||||
"java/res/drawable-hdpi/permission_popups.png",
|
||||
@@ -194,6 +195,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-mdpi/permission_javascript_jit.png",
|
||||
"java/res/drawable-hdpi/settings_autoplay.png",
|
||||
@@ -207,6 +209,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_javascript_jit.png",
|
||||
"java/res/drawable-xhdpi/permission_popups.png",
|
||||
@@ -215,6 +218,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_javascript_jit.png",
|
||||
"java/res/drawable-xxhdpi/permission_popups.png",
|
||||
@@ -223,6 +227,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_javascript_jit.png",
|
||||
"java/res/drawable-xxxhdpi/permission_popups.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
|
||||
@@ -159,239 +108,159 @@ F0RV{K+KvDK
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
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
|
||||
@@ -51,6 +51,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" />
|
||||
+ <!-- Images -->
|
||||
+ <org.chromium.components.browser_ui.settings.ChromeBasePreference
|
||||
+ android:key="images"
|
||||
+ android:fragment="org.chromium.components.browser_ui.site_settings.SingleCategorySettings" />
|
||||
<!-- Timezone Override -->
|
||||
<org.chromium.components.browser_ui.settings.ChromeBasePreference
|
||||
android:key="timezone_override"
|
||||
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
|
||||
@@ -146,6 +146,10 @@ public class ContentSettingsResources {
|
||||
return new ResourceItem(R.drawable.settings_bluetooth, 0, ContentSettingValues.ASK,
|
||||
ContentSettingValues.BLOCK, 0, 0);
|
||||
|
||||
+ case ContentSettingsType.IMAGES:
|
||||
+ return new ResourceItem(R.drawable.permission_images, R.string.images_permission_title,
|
||||
+ ContentSettingValues.ALLOW, ContentSettingValues.BLOCK, 0, 0);
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteImagesContentSetting.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteImagesContentSetting.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteImagesContentSetting.java
|
||||
@@ -0,0 +1,92 @@
|
||||
+/*
|
||||
+ This file is part of Bromite.
|
||||
+
|
||||
case ContentSettingsType.BLUETOOTH_GUARD:
|
||||
return new ResourceItem(R.drawable.settings_bluetooth,
|
||||
R.string.website_settings_bluetooth, ContentSettingValues.ASK,
|
||||
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
|
||||
@@ -785,6 +785,12 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
|
||||
? R.string.website_settings_add_site_description_javascript_jit_block
|
||||
: R.string.website_settings_add_site_description_javascript_jit_allow;
|
||||
break;
|
||||
+ case SiteSettingsCategory.Type.IMAGES:
|
||||
+ resource = WebsitePreferenceBridge.isCategoryEnabled(
|
||||
+ browserContextHandle, ContentSettingsType.IMAGES)
|
||||
+ ? R.string.website_settings_add_site_description_images
|
||||
+ : R.string.website_settings_add_site_description_images;
|
||||
+ break;
|
||||
case SiteSettingsCategory.Type.COOKIES:
|
||||
resource = getCookieSettingsState() == CookieSettingsState.ALLOW
|
||||
? R.string.website_settings_add_site_description_cookies_block
|
||||
@@ -949,6 +955,9 @@ public class SingleCategorySettings extends SiteSettingsPreferenceFragment
|
||||
case SiteSettingsCategory.Type.AUTOPLAY:
|
||||
allowSpecifyingExceptions = true;
|
||||
break;
|
||||
+ case SiteSettingsCategory.Type.IMAGES:
|
||||
+ allowSpecifyingExceptions = true;
|
||||
+ break;
|
||||
case SiteSettingsCategory.Type.JAVASCRIPT_JIT:
|
||||
allowSpecifyingExceptions = true;
|
||||
break;
|
||||
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
|
||||
@@ -137,6 +137,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
return "autoplay_permission_list";
|
||||
case ContentSettingsType.IDLE_DETECTION:
|
||||
return "idle_detection_permission_list";
|
||||
+ case ContentSettingsType.IMAGES:
|
||||
+ return "images_permission_list";
|
||||
case ContentSettingsType.JAVASCRIPT:
|
||||
return "javascript_permission_list";
|
||||
case ContentSettingsType.JAVASCRIPT_JIT:
|
||||
@@ -522,6 +524,8 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
setUpJavascriptPreference(preference);
|
||||
} else if (type == ContentSettingsType.GEOLOCATION) {
|
||||
setUpLocationPreference(preference);
|
||||
+ } else if (type == ContentSettingsType.IMAGES) {
|
||||
+ setUpImagesPreference(preference);
|
||||
} else if (type == ContentSettingsType.JAVASCRIPT_JIT) {
|
||||
setUpJavascriptJitPreference(preference);
|
||||
} else if (type == ContentSettingsType.NOTIFICATIONS) {
|
||||
@@ -1149,6 +1153,24 @@ public class SingleWebsiteSettings extends SiteSettingsPreferenceFragment
|
||||
mSite.isEmbargoed(ContentSettingsType.REQUEST_DESKTOP_SITE));
|
||||
}
|
||||
|
||||
+ private void setUpImagesPreference(Preference preference) {
|
||||
+ BrowserContextHandle browserContextHandle =
|
||||
+ getSiteSettingsDelegate().getBrowserContextHandle();
|
||||
+ @ContentSettingValues
|
||||
+ @Nullable
|
||||
+ Integer currentValue =
|
||||
+ mSite.getContentSetting(browserContextHandle, ContentSettingsType.IMAGES);
|
||||
+ // Always show the Images permission
|
||||
+ if (currentValue == null) {
|
||||
+ currentValue = WebsitePreferenceBridge.isCategoryEnabled(
|
||||
+ browserContextHandle, ContentSettingsType.IMAGES)
|
||||
+ ? ContentSettingValues.ALLOW
|
||||
+ : ContentSettingValues.BLOCK;
|
||||
+ }
|
||||
+ // Not possible to embargo IMAGES.
|
||||
+ setupContentSettingsPreference(preference, currentValue, false /* isEmbargoed */);
|
||||
+ 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.SiteSettingsCategory;
|
||||
+import org.chromium.components.content_settings.ContentSettingValues;
|
||||
+import org.chromium.components.content_settings.ContentSettingsType;
|
||||
+import org.chromium.content_public.browser.BrowserContextHandle;
|
||||
+
|
||||
+import androidx.annotation.Nullable;
|
||||
+import androidx.preference.Preference;
|
||||
+import androidx.preference.PreferenceScreen;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+
|
||||
+public class BromiteImagesContentSetting extends BromiteCustomContentSetting {
|
||||
+ public BromiteImagesContentSetting() {
|
||||
+ super(/*contentSettingsType*/ ContentSettingsType.IMAGES,
|
||||
+ /*defaultEnabledValue*/ ContentSettingValues.ALLOW,
|
||||
+ /*defaultDisabledValue*/ ContentSettingValues.BLOCK,
|
||||
+ /*allowException*/ true,
|
||||
+ /*preferenceKey*/ "images",
|
||||
+ /*profilePrefKey*/ "images");
|
||||
+ }
|
||||
+
|
||||
private String getDSECategorySummary(@ContentSettingValues int value) {
|
||||
return value == ContentSettingValues.ALLOW
|
||||
? getString(R.string.website_settings_permissions_allowed_dse)
|
||||
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
|
||||
@@ -47,7 +47,7 @@ public class SiteSettingsCategory {
|
||||
Type.PROTECTED_MEDIA, Type.SENSORS, Type.SOUND, Type.USB, Type.VIRTUAL_REALITY,
|
||||
Type.USE_STORAGE, Type.AUTO_DARK_WEB_CONTENT, Type.REQUEST_DESKTOP_SITE,
|
||||
Type.FEDERATED_IDENTITY_API, Type.THIRD_PARTY_COOKIES, Type.SITE_DATA, Type.ANTI_ABUSE,
|
||||
- Type.TIMEZONE_OVERRIDE, Type.AUTOPLAY, Type.JAVASCRIPT_JIT,
|
||||
+ Type.TIMEZONE_OVERRIDE, Type.AUTOPLAY, Type.JAVASCRIPT_JIT, Type.IMAGES,
|
||||
Type.NUM_ENTRIES})
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
public @interface Type {
|
||||
@@ -85,10 +85,11 @@ public class SiteSettingsCategory {
|
||||
int TIMEZONE_OVERRIDE = 29;
|
||||
int AUTOPLAY = 30;
|
||||
int JAVASCRIPT_JIT = 31;
|
||||
+ int IMAGES = 32;
|
||||
/**
|
||||
* Number of handled categories used for calculating array sizes.
|
||||
*/
|
||||
- int NUM_ENTRIES = 32;
|
||||
+ int NUM_ENTRIES = 33;
|
||||
}
|
||||
|
||||
private final BrowserContextHandle mBrowserContextHandle;
|
||||
@@ -197,6 +198,8 @@ public class SiteSettingsCategory {
|
||||
return ContentSettingsType.FEDERATED_IDENTITY_API;
|
||||
case Type.IDLE_DETECTION:
|
||||
return ContentSettingsType.IDLE_DETECTION;
|
||||
+ case Type.IMAGES:
|
||||
+ return ContentSettingsType.IMAGES;
|
||||
case Type.JAVASCRIPT:
|
||||
return ContentSettingsType.JAVASCRIPT;
|
||||
case Type.JAVASCRIPT_JIT:
|
||||
@@ -286,6 +289,8 @@ public class SiteSettingsCategory {
|
||||
return "idle_detection";
|
||||
case Type.JAVASCRIPT:
|
||||
return "javascript";
|
||||
+ case Type.IMAGES:
|
||||
+ return "images";
|
||||
case Type.MICROPHONE:
|
||||
return "microphone";
|
||||
case Type.JAVASCRIPT_JIT:
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsUtil.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsUtil.java
|
||||
--- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsUtil.java
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsUtil.java
|
||||
@@ -35,6 +35,7 @@ public class SiteSettingsUtil {
|
||||
ContentSettingsType.SOUND,
|
||||
ContentSettingsType.MIDI_SYSEX,
|
||||
ContentSettingsType.CLIPBOARD_READ_WRITE,
|
||||
+ ContentSettingsType.IMAGES,
|
||||
ContentSettingsType.NFC,
|
||||
ContentSettingsType.BLUETOOTH_SCANNING,
|
||||
ContentSettingsType.VR,
|
||||
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
|
||||
@@ -214,6 +214,13 @@ public final class Website implements WebsiteEntry {
|
||||
/*isEmbargoed=*/false);
|
||||
setContentSettingException(type, exception);
|
||||
}
|
||||
+ } else if (type == ContentSettingsType.IMAGES) {
|
||||
+ if (exception == null) {
|
||||
+ exception = new ContentSettingException(
|
||||
+ ContentSettingsType.IMAGES, getAddress().getHost(), value, "",
|
||||
+ /*isEmbargoed=*/false);
|
||||
+ setContentSettingException(type, exception);
|
||||
+ }
|
||||
} else if (type == ContentSettingsType.JAVASCRIPT) {
|
||||
// It is possible to set the permission without having an existing exception,
|
||||
// because we show the javascript permission in Site Settings if javascript
|
||||
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
|
||||
@@ -71,6 +71,7 @@ public class WebsitePermissionsFetcher {
|
||||
case ContentSettingsType.AUTOPLAY:
|
||||
case ContentSettingsType.COOKIES:
|
||||
case ContentSettingsType.FEDERATED_IDENTITY_API:
|
||||
+ case ContentSettingsType.IMAGES:
|
||||
case ContentSettingsType.JAVASCRIPT:
|
||||
case ContentSettingsType.JAVASCRIPT_JIT:
|
||||
case ContentSettingsType.POPUPS:
|
||||
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
|
||||
@@ -822,6 +822,7 @@ static void JNI_WebsitePreferenceBridge_SetContentSettingEnabled(
|
||||
case ContentSettingsType::BACKGROUND_SYNC:
|
||||
case ContentSettingsType::COOKIES:
|
||||
case ContentSettingsType::FEDERATED_IDENTITY_API:
|
||||
+ case ContentSettingsType::IMAGES:
|
||||
case ContentSettingsType::JAVASCRIPT:
|
||||
case ContentSettingsType::JAVASCRIPT_JIT:
|
||||
case ContentSettingsType::POPUPS:
|
||||
diff --git a/components/browser_ui/strings/android/site_settings.grdp b/components/browser_ui/strings/android/site_settings.grdp
|
||||
--- a/components/browser_ui/strings/android/site_settings.grdp
|
||||
+++ b/components/browser_ui/strings/android/site_settings.grdp
|
||||
@@ -76,6 +76,9 @@
|
||||
<message name="IDS_WEBSITE_SETTINGS_IDLE_DETECTION" desc="Title of the permission to detect user activity [CHAR_LIMIT=32]">
|
||||
Your device use
|
||||
</message>
|
||||
+ <message name="IDS_IMAGES_PERMISSION_TITLE" desc="Title of the permission to show images [CHAR-LIMIT=32]">
|
||||
+ @Override
|
||||
+ public ContentSettingsResources.ResourceItem getResourceItem() {
|
||||
+ return new ContentSettingsResources.ResourceItem(
|
||||
+ /*icon*/ R.drawable.permission_images,
|
||||
+ /*title*/ R.string.images_permission_title,
|
||||
+ /*defaultEnabledValue*/ getDefaultEnabledValue(),
|
||||
+ /*defaultDisabledValue*/ getDefaultDisabledValue(),
|
||||
+ /*enabledSummary*/ R.string.website_settings_category_images_enabled,
|
||||
+ /*disabledSummary*/ R.string.website_settings_category_images_disabled);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getCategorySummary(@Nullable @ContentSettingValues int value) {
|
||||
+ switch (value) {
|
||||
+ case ContentSettingValues.ALLOW:
|
||||
+ return R.string.website_settings_category_images_enabled;
|
||||
+ case ContentSettingValues.BLOCK:
|
||||
+ return R.string.website_settings_category_images_disabled;
|
||||
+ default:
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getCategoryDescription() {
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean requiresTriStateContentSetting() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean showOnlyDescriptions() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getAddExceptionDialogMessage() {
|
||||
+ return R.string.website_settings_category_images_enabled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @Nullable Boolean considerException(SiteSettingsCategory category, @ContentSettingValues int value) {
|
||||
+ return value != ContentSettingValues.BLOCK;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/components/browser_ui/strings/bromite_content_settings/images.grdp b/components/browser_ui/strings/bromite_content_settings/images.grdp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/strings/bromite_content_settings/images.grdp
|
||||
@@ -0,0 +1,23 @@
|
||||
+<?xml version="1.0" encoding="utf-8"?>
|
||||
+<grit-part>
|
||||
+<if expr="is_android">
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_IMAGES" desc="The label used for images site settings controls." formatter_data="android_java">
|
||||
+ Images
|
||||
+ </message>
|
||||
<message name="IDS_JAVASCRIPT_PERMISSION_TITLE" desc="Title of the permission to run javascript [CHAR_LIMIT=32]">
|
||||
JavaScript
|
||||
</message>
|
||||
@@ -266,6 +269,9 @@
|
||||
<message name="IDS_WEBSITE_SETTINGS_ADD_SITE_TOAST" desc="The toast shown when a new site has been added to the exception list.">
|
||||
Site <ph name="SITE_NAME">%1$s<ex>google.com</ex></ph> added
|
||||
</message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_ADD_SITE_DESCRIPTION_IMAGES" desc="The description for the allow Images on website dialog.">
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_IMAGES_MID_SENTENCE" desc="The label used for images site settings controls when used mid-sentence." formatter_data="android_java">
|
||||
+ Images
|
||||
+ </message>
|
||||
+</if>
|
||||
+ <message name="IDS_IMAGES_PERMISSION_TITLE" desc="Title of the permission to show images [CHAR-LIMIT=32]" formatter_data="android_java">
|
||||
+ Images
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_ADD_SITE_DESCRIPTION_IMAGES" desc="The description for the allow Images on website dialog." formatter_data="android_java">
|
||||
+ Allow images on websites you specify while blocking them for the rest of the web
|
||||
+ </message>
|
||||
<message name="IDS_WEBSITE_SETTINGS_ADD_SITE_SITE_URL" desc="The label for the input field where the user can type a website URL.">
|
||||
Site URL
|
||||
</message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_IMAGES_ENABLED" desc="Summary text explaining that sites are allowed to load images." formatter_data="android_java">
|
||||
+ Allow sites to load images
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_IMAGES_DISABLED" desc="Summary text explaining that sites are not allowed to load images." formatter_data="android_java">
|
||||
+ Disallow sites to load images
|
||||
+ </message>
|
||||
+</grit-part>
|
||||
diff --git a/components/content_settings/core/browser/bromite_content_settings/images.inc b/components/content_settings/core/browser/bromite_content_settings/images.inc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/content_settings/core/browser/bromite_content_settings/images.inc
|
||||
@@ -0,0 +1,7 @@
|
||||
+ content_settings::WebsiteSettingsRegistry::GetInstance()
|
||||
+ ->GetMutable(ContentSettingsType::IMAGES)
|
||||
+ ->set_show_into_info_page()
|
||||
+ .set_is_renderer_content_setting()
|
||||
+ .set_title_ui(IDS_SITE_SETTINGS_TYPE_IMAGES)
|
||||
+ .set_mid_sentence_ui(IDS_SITE_SETTINGS_TYPE_IMAGES_MID_SENTENCE);
|
||||
+
|
||||
diff --git a/components/content_settings/core/browser/content_settings_registry.cc b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
--- a/components/content_settings/core/browser/content_settings_registry.cc
|
||||
+++ b/components/content_settings/core/browser/content_settings_registry.cc
|
||||
@@ -95,7 +95,8 @@ void ContentSettingsRegistry::Init() {
|
||||
@@ -96,7 +96,7 @@ void ContentSettingsRegistry::Init() {
|
||||
{kChromeUIScheme, kChromeDevToolsScheme, kExtensionScheme},
|
||||
/*valid_settings=*/{CONTENT_SETTING_ALLOW, CONTENT_SETTING_BLOCK},
|
||||
WebsiteSettingsInfo::TOP_ORIGIN_WITH_RESOURCE_EXCEPTIONS_SCOPE,
|
||||
- WebsiteSettingsRegistry::DESKTOP,
|
||||
+ WebsiteSettingsRegistry::DESKTOP |
|
||||
+ WebsiteSettingsRegistry::PLATFORM_ANDROID,
|
||||
+ WebsiteSettingsRegistry::DESKTOP | WebsiteSettingsRegistry::PLATFORM_ANDROID,
|
||||
ContentSettingsInfo::INHERIT_IN_INCOGNITO,
|
||||
ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS);
|
||||
|
||||
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
|
||||
@@ -134,12 +134,8 @@ void GetRendererContentSettingRules(const HostContentSettingsMap* map,
|
||||
@@ -146,12 +146,8 @@ void GetRendererContentSettingRules(const HostContentSettingsMap* map,
|
||||
ContentSettingToValue(CONTENT_SETTING_ALLOW), std::string(),
|
||||
map->IsOffTheRecord()));
|
||||
#else
|
||||
@@ -406,94 +275,5 @@ diff --git a/components/content_settings/core/browser/content_settings_utils.cc
|
||||
// In Android active mixed content is hard blocked, with no option to allow
|
||||
// it.
|
||||
rules->mixed_content_rules.push_back(ContentSettingPatternSource(
|
||||
diff --git a/components/page_info/android/page_info_controller_android.cc b/components/page_info/android/page_info_controller_android.cc
|
||||
--- a/components/page_info/android/page_info_controller_android.cc
|
||||
+++ b/components/page_info/android/page_info_controller_android.cc
|
||||
@@ -225,6 +225,10 @@ absl::optional<ContentSetting> PageInfoControllerAndroid::GetSettingToDisplay(
|
||||
// audio since last navigation.
|
||||
if (web_contents_->WasEverAudible())
|
||||
return permission.default_setting;
|
||||
+ } else if (permission.type == ContentSettingsType::IMAGES) {
|
||||
+ // The images content setting should show up if it is blocked globally
|
||||
+ // to give users an easy way to create exceptions.
|
||||
+ return permission.default_setting;
|
||||
}
|
||||
|
||||
// TODO(crbug.com/1077766): Also return permissions that are non
|
||||
diff --git a/components/page_info/page_info.cc b/components/page_info/page_info.cc
|
||||
--- a/components/page_info/page_info.cc
|
||||
+++ b/components/page_info/page_info.cc
|
||||
@@ -99,9 +99,7 @@ ContentSettingsType kPermissionType[] = {
|
||||
ContentSettingsType::SENSORS,
|
||||
ContentSettingsType::NOTIFICATIONS,
|
||||
ContentSettingsType::JAVASCRIPT,
|
||||
-#if !BUILDFLAG(IS_ANDROID)
|
||||
ContentSettingsType::IMAGES,
|
||||
-#endif
|
||||
ContentSettingsType::POPUPS,
|
||||
ContentSettingsType::WINDOW_MANAGEMENT,
|
||||
ContentSettingsType::ADS,
|
||||
@@ -157,6 +155,11 @@ bool ShouldShowPermission(const PageInfo::PermissionInfo& info,
|
||||
return true;
|
||||
}
|
||||
|
||||
+ // Always show images when it has a site-specific override
|
||||
+ if (info.type == ContentSettingsType::IMAGES) {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
if (info.type == ContentSettingsType::SOUND) {
|
||||
// The sound content setting should always show up when the tab has played
|
||||
// audio.
|
||||
diff --git a/components/page_info/page_info_ui.cc b/components/page_info/page_info_ui.cc
|
||||
--- a/components/page_info/page_info_ui.cc
|
||||
+++ b/components/page_info/page_info_ui.cc
|
||||
@@ -201,6 +201,8 @@ base::span<const PageInfoUI::PermissionUIInfo> GetContentSettingsUIInfo() {
|
||||
IDS_SITE_SETTINGS_TYPE_FEDERATED_IDENTITY_API_MID_SENTENCE},
|
||||
{ContentSettingsType::IDLE_DETECTION, IDS_SITE_SETTINGS_TYPE_IDLE_DETECTION,
|
||||
IDS_SITE_SETTINGS_TYPE_IDLE_DETECTION_MID_SENTENCE},
|
||||
+ {ContentSettingsType::IMAGES, IDS_SITE_SETTINGS_TYPE_IMAGES,
|
||||
+ IDS_SITE_SETTINGS_TYPE_IMAGES_MID_SENTENCE},
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
// Page Info Permissions that are not defined in Android.
|
||||
{ContentSettingsType::FILE_SYSTEM_WRITE_GUARD,
|
||||
@@ -210,8 +212,6 @@ base::span<const PageInfoUI::PermissionUIInfo> GetContentSettingsUIInfo() {
|
||||
IDS_SITE_SETTINGS_TYPE_FONT_ACCESS_MID_SENTENCE},
|
||||
{ContentSettingsType::HID_GUARD, IDS_SITE_SETTINGS_TYPE_HID_DEVICES,
|
||||
IDS_SITE_SETTINGS_TYPE_HID_DEVICES_MID_SENTENCE},
|
||||
- {ContentSettingsType::IMAGES, IDS_SITE_SETTINGS_TYPE_IMAGES,
|
||||
- IDS_SITE_SETTINGS_TYPE_IMAGES_MID_SENTENCE},
|
||||
{ContentSettingsType::SERIAL_GUARD, IDS_SITE_SETTINGS_TYPE_SERIAL_PORTS,
|
||||
IDS_SITE_SETTINGS_TYPE_SERIAL_PORTS_MID_SENTENCE},
|
||||
{ContentSettingsType::WINDOW_MANAGEMENT,
|
||||
diff --git a/components/site_settings_strings.grdp b/components/site_settings_strings.grdp
|
||||
--- a/components/site_settings_strings.grdp
|
||||
+++ b/components/site_settings_strings.grdp
|
||||
@@ -163,6 +163,12 @@
|
||||
<message name="IDS_SITE_SETTINGS_TYPE_VR_MID_SENTENCE" desc="The label used for the VR site settings controls when used mid-sentence.">
|
||||
virtual reality
|
||||
</message>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_IMAGES" desc="The label used for images site settings controls.">
|
||||
+ Images
|
||||
+ </message>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_IMAGES_MID_SENTENCE" desc="The label used for images site settings controls when used mid-sentence.">
|
||||
+ images
|
||||
+ </message>
|
||||
|
||||
<!-- Site Settings desktop-only -->
|
||||
<if expr="not is_android">
|
||||
@@ -190,12 +196,6 @@
|
||||
<message name="IDS_SITE_SETTINGS_TYPE_HID_DEVICES_MID_SENTENCE" desc="The label used for the HID site settings controls when used mid-sentence.">
|
||||
HID devices
|
||||
</message>
|
||||
- <message name="IDS_SITE_SETTINGS_TYPE_IMAGES" desc="The label used for images site settings controls.">
|
||||
- Images
|
||||
- </message>
|
||||
- <message name="IDS_SITE_SETTINGS_TYPE_IMAGES_MID_SENTENCE" desc="The label used for images site settings controls when used mid-sentence.">
|
||||
- images
|
||||
- </message>
|
||||
<message name="IDS_SITE_SETTINGS_TYPE_INSECURE_CONTENT" desc="The label used for the insecure content site settings controls. This setting controls whether HTTP content will be displayed on HTTPS sites.">
|
||||
Insecure content
|
||||
</message>
|
||||
--
|
||||
2.25.1
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,221 @@
|
||||
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 ++++++
|
||||
.../bromite_content_settings/viewport.inc | 22 +++++
|
||||
.../bromite_content_settings/VIEWPORT.inc | 1 +
|
||||
third_party/blink/common/features.cc | 2 +-
|
||||
.../renderer/core/frame/local_dom_window.cc | 2 +
|
||||
third_party/blink/renderer/core/page/page.cc | 3 +
|
||||
7 files changed, 149 insertions(+), 1 deletion(-)
|
||||
create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteViewportContentSetting.java
|
||||
create mode 100644 components/browser_ui/strings/bromite_content_settings/viewport.grdp
|
||||
create mode 100644 components/content_settings/core/browser/bromite_content_settings/viewport.inc
|
||||
create mode 100644 components/content_settings/core/common/bromite_content_settings/VIEWPORT.inc
|
||||
|
||||
diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteViewportContentSetting.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteViewportContentSetting.java
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromiteViewportContentSetting.java
|
||||
@@ -0,0 +1,93 @@
|
||||
+/*
|
||||
+ 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.SiteSettingsCategory;
|
||||
+import org.chromium.components.content_settings.ContentSettingValues;
|
||||
+import org.chromium.components.content_settings.ContentSettingsType;
|
||||
+import org.chromium.content_public.browser.BrowserContextHandle;
|
||||
+
|
||||
+import androidx.annotation.Nullable;
|
||||
+import androidx.preference.Preference;
|
||||
+import androidx.preference.PreferenceScreen;
|
||||
+
|
||||
+import java.util.ArrayList;
|
||||
+
|
||||
+public class BromiteViewportContentSetting extends BromiteCustomContentSetting {
|
||||
+ public BromiteViewportContentSetting() {
|
||||
+ super(/*contentSettingsType*/ ContentSettingsType.VIEWPORT,
|
||||
+ /*defaultEnabledValue*/ ContentSettingValues.ALLOW,
|
||||
+ /*defaultDisabledValue*/ ContentSettingValues.BLOCK,
|
||||
+ /*allowException*/ true,
|
||||
+ /*preferenceKey*/ "viewport",
|
||||
+ /*profilePrefKey*/ "viewport");
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public ContentSettingsResources.ResourceItem getResourceItem() {
|
||||
+ return new ContentSettingsResources.ResourceItem(
|
||||
+ /*icon*/ R.drawable.web_asset,
|
||||
+ /*title*/ R.string.viewport_permission_title,
|
||||
+ /*defaultEnabledValue*/ getDefaultEnabledValue(),
|
||||
+ /*defaultDisabledValue*/ getDefaultDisabledValue(),
|
||||
+ /*enabledSummary*/ R.string.website_settings_category_viewport_enabled,
|
||||
+ /*disabledSummary*/ R.string.website_settings_category_viewport_disabled);
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getCategorySummary(@Nullable @ContentSettingValues int value) {
|
||||
+ switch (value) {
|
||||
+ case ContentSettingValues.ALLOW:
|
||||
+ return R.string.website_settings_category_viewport_enabled;
|
||||
+ case ContentSettingValues.BLOCK:
|
||||
+ return R.string.website_settings_category_viewport_disabled;
|
||||
+ default:
|
||||
+ // this will cause a runtime exception
|
||||
+ return 0;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getCategoryDescription() {
|
||||
+ return R.string.settings_site_settings_viewport_protection_description;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean requiresTriStateContentSetting() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean showOnlyDescriptions() {
|
||||
+ return true;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int getAddExceptionDialogMessage() {
|
||||
+ return R.string.website_settings_category_viewport_enabled;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public @Nullable Boolean considerException(SiteSettingsCategory category, @ContentSettingValues int value) {
|
||||
+ return value != ContentSettingValues.BLOCK;
|
||||
+ }
|
||||
+}
|
||||
diff --git a/components/browser_ui/strings/bromite_content_settings/viewport.grdp b/components/browser_ui/strings/bromite_content_settings/viewport.grdp
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/browser_ui/strings/bromite_content_settings/viewport.grdp
|
||||
@@ -0,0 +1,27 @@
|
||||
+<?xml version="1.0" encoding="utf-8"?>
|
||||
+<grit-part>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_VIEWPORT" desc="The label used for viewport size change site settings controls." formatter_data="android_java">
|
||||
+ Viewport Size Protection
|
||||
+ </message>
|
||||
+ <message name="IDS_VIEWPORT_PERMISSION_TITLE" desc="Title of the permission to use viewport size change [CHAR-LIMIT=32]" formatter_data="android_java">
|
||||
+ Viewport Size Protection
|
||||
+ </message>
|
||||
+ <message name="IDS_SITE_SETTINGS_TYPE_VIEWPORT_MID_SENTENCE" desc="The label used for viewport size change site settings controls when used mid-sentence." formatter_data="android_java">
|
||||
+ Viewport Size Protection
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_DESCRIPTION" desc="Description of the viewport protection content setting." formatter_data="android_java">
|
||||
+ Hides the screen size by randomly changing the values for each website
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_VIEWPORT_ENABLED" desc="Summary text explaining that viewport size change is full enabled." formatter_data="android_java">
|
||||
+ Enabled
|
||||
+ </message>
|
||||
+ <message name="IDS_WEBSITE_SETTINGS_CATEGORY_VIEWPORT_DISABLED" desc="Summary text explaining that viewport size change is full disabled." formatter_data="android_java">
|
||||
+ Disabled
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_ALLOWED_EXCEPTIONS" desc="Label for the allowed exceptions site list of the viewport protection setting.">
|
||||
+ Viewport Protection is enabled with these websites
|
||||
+ </message>
|
||||
+ <message name="IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_BLOCKED_EXCEPTIONS" desc="Label for the blocked exceptions site list of the viewport protection setting.">
|
||||
+ Not allowed to use Viewport Protection
|
||||
+ </message>
|
||||
+</grit-part>
|
||||
diff --git a/components/content_settings/core/browser/bromite_content_settings/viewport.inc b/components/content_settings/core/browser/bromite_content_settings/viewport.inc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/content_settings/core/browser/bromite_content_settings/viewport.inc
|
||||
@@ -0,0 +1,22 @@
|
||||
+ Register(ContentSettingsType::VIEWPORT, "viewport", CONTENT_SETTING_ALLOW,
|
||||
+ WebsiteSettingsInfo::SYNCABLE,
|
||||
+ /*allowlisted_schemes=*/{},
|
||||
+ /*valid_settings=*/{CONTENT_SETTING_ALLOW,
|
||||
+ CONTENT_SETTING_BLOCK},
|
||||
+ WebsiteSettingsInfo::TOP_ORIGIN_ONLY_SCOPE,
|
||||
+ WebsiteSettingsRegistry::ALL_PLATFORMS,
|
||||
+ ContentSettingsInfo::INHERIT_IN_INCOGNITO,
|
||||
+ ContentSettingsInfo::EXCEPTIONS_ON_SECURE_AND_INSECURE_ORIGINS);
|
||||
+
|
||||
+ content_settings::WebsiteSettingsRegistry::GetInstance()
|
||||
+ ->GetMutable(ContentSettingsType::VIEWPORT)
|
||||
+ ->set_show_into_info_page()
|
||||
+ .set_desktop_ui()
|
||||
+ .set_is_renderer_content_setting()
|
||||
+ .set_title_ui(IDS_SITE_SETTINGS_TYPE_VIEWPORT)
|
||||
+ .set_description_ui(IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_DESCRIPTION)
|
||||
+ .set_allowed_ui(IDS_WEBSITE_SETTINGS_CATEGORY_VIEWPORT_ENABLED)
|
||||
+ .set_blocked_ui(IDS_WEBSITE_SETTINGS_CATEGORY_VIEWPORT_DISABLED)
|
||||
+ .set_allowed_exceptions_ui(IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_ALLOWED_EXCEPTIONS)
|
||||
+ .set_blocked_exceptions_ui(IDS_SETTINGS_SITE_SETTINGS_VIEWPORT_PROTECTION_BLOCKED_EXCEPTIONS)
|
||||
+ .set_mid_sentence_ui(IDS_SITE_SETTINGS_TYPE_VIEWPORT_MID_SENTENCE);
|
||||
diff --git a/components/content_settings/core/common/bromite_content_settings/VIEWPORT.inc b/components/content_settings/core/common/bromite_content_settings/VIEWPORT.inc
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/components/content_settings/core/common/bromite_content_settings/VIEWPORT.inc
|
||||
@@ -0,0 +1 @@
|
||||
+ VIEWPORT,
|
||||
diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/features.cc
|
||||
--- a/third_party/blink/common/features.cc
|
||||
+++ b/third_party/blink/common/features.cc
|
||||
@@ -222,7 +222,7 @@ BASE_FEATURE(kPath2DPaintCache,
|
||||
|
||||
BASE_FEATURE(kViewportProtection,
|
||||
"ViewportProtection",
|
||||
- base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
+ base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
BASE_FEATURE(kPrivacySandboxAdsAPIs,
|
||||
"PrivacySandboxAdsAPIs", // disabled by default
|
||||
diff --git a/third_party/blink/renderer/core/frame/local_dom_window.cc b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
--- a/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
+++ b/third_party/blink/renderer/core/frame/local_dom_window.cc
|
||||
@@ -2322,6 +2322,8 @@ DOMWindow* LocalDOMWindow::open(v8::Isolate* isolate,
|
||||
// var w = window.open()
|
||||
// var not_emulated_screen_info = w.screen
|
||||
bool protection_enabled = base::FeatureList::IsEnabled(features::kViewportProtection);
|
||||
+ protection_enabled |= GetFrame()->GetContentSettingsClient()->AllowContentSetting(
|
||||
+ ContentSettingsType::VIEWPORT, false);
|
||||
result.frame->GetPage()->CalculateEmulatedScreenSetting(
|
||||
To<LocalFrame>(result.frame),
|
||||
/*force*/ protection_enabled);
|
||||
diff --git a/third_party/blink/renderer/core/page/page.cc b/third_party/blink/renderer/core/page/page.cc
|
||||
--- a/third_party/blink/renderer/core/page/page.cc
|
||||
+++ b/third_party/blink/renderer/core/page/page.cc
|
||||
@@ -884,6 +884,9 @@ void Page::UpdateAcceleratedCompositingSettings() {
|
||||
|
||||
void Page::CalculateEmulatedScreenSetting(LocalFrame* frame, bool force) {
|
||||
bool isEnabled = base::FeatureList::IsEnabled(features::kViewportProtection);
|
||||
+ blink::WebContentSettingsClient* settings = frame->GetContentSettingsClient();
|
||||
+ isEnabled |= (settings && settings->AllowContentSetting(
|
||||
+ ContentSettingsType::VIEWPORT, /*default_value*/ false));
|
||||
if (isEnabled || force) {
|
||||
// this is the maximum (and minimum) value which in percentage
|
||||
// corresponds to +- 0.03%
|
||||
--
|
||||
2.25.1
|
||||
+5
-5
@@ -34,7 +34,7 @@ The feature is controlled by a feature flag (default enabled)
|
||||
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
|
||||
@@ -7794,6 +7794,11 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
@@ -7803,6 +7803,11 @@ const FeatureEntry kFeatureEntries[] = {
|
||||
FEATURE_VALUE_TYPE(paint_preview::kPaintPreviewDemo)},
|
||||
#endif // BUILDFLAG(ENABLE_PAINT_PREVIEW) && BUILDFLAG(IS_ANDROID)
|
||||
|
||||
@@ -49,7 +49,7 @@ diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
|
||||
diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descriptions.cc
|
||||
--- a/chrome/browser/flag_descriptions.cc
|
||||
+++ b/chrome/browser/flag_descriptions.cc
|
||||
@@ -7106,6 +7106,12 @@ const char kPaintPreviewDemoDescription[] =
|
||||
@@ -7119,6 +7119,12 @@ const char kPaintPreviewDemoDescription[] =
|
||||
"previews.";
|
||||
#endif // ENABLE_PAINT_PREVIEW && BUILDFLAG(IS_ANDROID)
|
||||
|
||||
@@ -65,7 +65,7 @@ diff --git a/chrome/browser/flag_descriptions.cc b/chrome/browser/flag_descripti
|
||||
diff --git a/chrome/browser/flag_descriptions.h b/chrome/browser/flag_descriptions.h
|
||||
--- a/chrome/browser/flag_descriptions.h
|
||||
+++ b/chrome/browser/flag_descriptions.h
|
||||
@@ -4124,6 +4124,9 @@ extern const char kPaintPreviewDemoName[];
|
||||
@@ -4133,6 +4133,9 @@ extern const char kPaintPreviewDemoName[];
|
||||
extern const char kPaintPreviewDemoDescription[];
|
||||
#endif // ENABLE_PAINT_PREVIEW && BUILDFLAG(IS_ANDROID)
|
||||
|
||||
@@ -92,7 +92,7 @@ diff --git a/third_party/blink/common/features.cc b/third_party/blink/common/fea
|
||||
diff --git a/third_party/blink/public/common/features.h b/third_party/blink/public/common/features.h
|
||||
--- a/third_party/blink/public/common/features.h
|
||||
+++ b/third_party/blink/public/common/features.h
|
||||
@@ -919,6 +919,9 @@ BLINK_COMMON_EXPORT extern const base::FeatureParam<
|
||||
@@ -924,6 +924,9 @@ BLINK_COMMON_EXPORT extern const base::FeatureParam<
|
||||
// base url inheritance behavior from https://crbug.com/1356658.
|
||||
BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kNewBaseUrlInheritanceBehavior);
|
||||
|
||||
@@ -650,7 +650,7 @@ diff --git a/third_party/blink/renderer/core/page/page.h b/third_party/blink/ren
|
||||
diff --git a/third_party/blink/renderer/platform/runtime_enabled_features.json5 b/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
--- a/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
+++ b/third_party/blink/renderer/platform/runtime_enabled_features.json5
|
||||
@@ -1823,8 +1823,8 @@
|
||||
@@ -1819,8 +1819,8 @@
|
||||
// as a speculative site compatibility measure, because web authors may
|
||||
// assume that screen dimensions match window.innerWidth/innerHeight while
|
||||
// a page is fullscreen, but that is not always true. crbug.com/1367416
|
||||
@@ -0,0 +1,513 @@
|
||||
From: uazo <uazo@users.noreply.github.com>
|
||||
Date: Fri, 9 Jun 2023 15:11:46 +0000
|
||||
Subject: bromite build utils
|
||||
|
||||
---
|
||||
build/android/gyp/java_cpp_enum.py | 36 ++++++--
|
||||
build/android/gyp/util/build_utils.py | 25 +++++-
|
||||
build/bromite/bromite_utils.gni | 69 ++++++++++++++
|
||||
build/bromite/gyp/cpp_bromite_include.py | 35 ++++++++
|
||||
build/bromite/gyp/cpp_bromite_include.pydeps | 9 ++
|
||||
build/bromite/gyp/java_bromite_impl.py | 94 ++++++++++++++++++++
|
||||
build/bromite/gyp/java_bromite_impl.pydeps | 9 ++
|
||||
build/config/BUILDCONFIG.gn | 1 +
|
||||
build/config/android/rules.gni | 4 +
|
||||
tools/grit/grit/grd_reader.py | 27 ++++--
|
||||
tools/grit/preprocess_if_expr.py | 32 ++++++-
|
||||
11 files changed, 328 insertions(+), 13 deletions(-)
|
||||
create mode 100644 build/bromite/bromite_utils.gni
|
||||
create mode 100644 build/bromite/gyp/cpp_bromite_include.py
|
||||
create mode 100644 build/bromite/gyp/cpp_bromite_include.pydeps
|
||||
create mode 100644 build/bromite/gyp/java_bromite_impl.py
|
||||
create mode 100644 build/bromite/gyp/java_bromite_impl.pydeps
|
||||
|
||||
diff --git a/build/android/gyp/java_cpp_enum.py b/build/android/gyp/java_cpp_enum.py
|
||||
--- a/build/android/gyp/java_cpp_enum.py
|
||||
+++ b/build/android/gyp/java_cpp_enum.py
|
||||
@@ -173,6 +173,7 @@ class DirectiveSet:
|
||||
|
||||
|
||||
class HeaderParser:
|
||||
+ include_re = re.compile(r'#include "(.*)"')
|
||||
single_line_comment_re = re.compile(r'\s*//\s*([^\n]*)')
|
||||
multi_line_comment_start_re = re.compile(r'\s*/\*')
|
||||
enum_line_re = re.compile(r'^\s*(\w+)(\s*\=\s*([^,\n]+))?,?')
|
||||
@@ -194,7 +195,7 @@ class HeaderParser:
|
||||
enum_single_line_re = re.compile(
|
||||
r'^\s*(?:\[cpp.*\])?\s*enum.*{(?P<enum_entries>.*)}.*$')
|
||||
|
||||
- def __init__(self, lines, path=''):
|
||||
+ def __init__(self, lines, options, path=''):
|
||||
self._lines = lines
|
||||
self._path = path
|
||||
self._enum_definitions = []
|
||||
@@ -204,6 +205,7 @@ class HeaderParser:
|
||||
self._generator_directives = DirectiveSet()
|
||||
self._multi_line_generator_directive = None
|
||||
self._current_enum_entry = ''
|
||||
+ self._options = options
|
||||
|
||||
def _ApplyGeneratorDirectives(self):
|
||||
self._generator_directives.UpdateDefinition(self._current_definition)
|
||||
@@ -227,6 +229,24 @@ class HeaderParser:
|
||||
raise Exception('Multi-line comments in enums are not supported in ' +
|
||||
self._path)
|
||||
|
||||
+ # handles the management of #include files
|
||||
+ include_line = HeaderParser.include_re.match(line)
|
||||
+ if include_line:
|
||||
+ include_file = include_line.groups()[0];
|
||||
+ if not include_file.endswith(".inc"):
|
||||
+ raise Exception('Include file \"' + include_file + '\" must ends with .inc')
|
||||
+
|
||||
+ file_to_include = os.path.join(self._options.gen_dir, include_file)
|
||||
+ if not os.path.exists(file_to_include):
|
||||
+ file_to_include = os.path.join(self._options.root_dir, include_file)
|
||||
+ lines = []
|
||||
+ with open(file_to_include) as include_file_handle:
|
||||
+ lines = include_file_handle.readlines()
|
||||
+
|
||||
+ for new_line in lines:
|
||||
+ self._ParseEnumLine(new_line)
|
||||
+ return
|
||||
+
|
||||
enum_comment = HeaderParser.single_line_comment_re.match(line)
|
||||
if enum_comment:
|
||||
comment = enum_comment.groups()[0]
|
||||
@@ -327,9 +347,9 @@ class HeaderParser:
|
||||
self._ParseSingleLineEnum(single_line_enum.group('enum_entries'))
|
||||
|
||||
|
||||
-def DoGenerate(source_paths):
|
||||
+def DoGenerate(source_paths, options):
|
||||
for source_path in source_paths:
|
||||
- enum_definitions = DoParseHeaderFile(source_path)
|
||||
+ enum_definitions = DoParseHeaderFile(source_path, options)
|
||||
if not enum_definitions:
|
||||
raise Exception('No enums found in %s\n'
|
||||
'Did you forget prefixing enums with '
|
||||
@@ -342,9 +362,9 @@ def DoGenerate(source_paths):
|
||||
yield output_path, output
|
||||
|
||||
|
||||
-def DoParseHeaderFile(path):
|
||||
+def DoParseHeaderFile(path, options):
|
||||
with open(path) as f:
|
||||
- return HeaderParser(f.readlines(), path).ParseDefinitions()
|
||||
+ return HeaderParser(f.readlines(), options, path).ParseDefinitions()
|
||||
|
||||
|
||||
def GenerateOutput(source_path, enum_definition):
|
||||
@@ -423,6 +443,10 @@ def DoMain(argv):
|
||||
parser.add_option('--srcjar',
|
||||
help='When specified, a .srcjar at the given path is '
|
||||
'created instead of individual .java files.')
|
||||
+ parser.add_option('--gen_dir',
|
||||
+ help='Indicates the path to the generated file')
|
||||
+ parser.add_option('--root_dir',
|
||||
+ help='Indicates the path to the build root')
|
||||
|
||||
options, args = parser.parse_args(argv)
|
||||
|
||||
@@ -432,7 +456,7 @@ def DoMain(argv):
|
||||
|
||||
with action_helpers.atomic_output(options.srcjar) as f:
|
||||
with zipfile.ZipFile(f, 'w', zipfile.ZIP_STORED) as srcjar:
|
||||
- for output_path, data in DoGenerate(input_paths):
|
||||
+ for output_path, data in DoGenerate(input_paths, options):
|
||||
zip_helpers.add_to_zip_hermetic(srcjar, output_path, data=data)
|
||||
|
||||
|
||||
diff --git a/build/android/gyp/util/build_utils.py b/build/android/gyp/util/build_utils.py
|
||||
--- a/build/android/gyp/util/build_utils.py
|
||||
+++ b/build/android/gyp/util/build_utils.py
|
||||
@@ -485,4 +485,27 @@ def ReadSourcesList(sources_list_file_name):
|
||||
Note that this function should not be used to parse response files.
|
||||
"""
|
||||
with open(sources_list_file_name) as f:
|
||||
- return [file_name.strip() for file_name in f]
|
||||
+ files = [file_name.strip() for file_name in f]
|
||||
+ # allows inclusion of all files in the indicated folder
|
||||
+ # in the sources of java-related gn targets.
|
||||
+ # "include_all_directory.java" is a special name and must exist in the
|
||||
+ # folder since gn checks for its existence, but it will not be
|
||||
+ # included in the list.
|
||||
+ # example:
|
||||
+ #
|
||||
+ # sources += [
|
||||
+ # "java/src/org/chromium/components/browser_ui/site_settings/impl/include_all_directory.java",
|
||||
+ # ]
|
||||
+ #
|
||||
+ # will include in source all files found in
|
||||
+ # "java/src/org/chromium/components/browser_ui/site_settings/impl"
|
||||
+ include_dirs = [f for f in files if f.endswith('include_all_directory.java')]
|
||||
+ for include_file in include_dirs:
|
||||
+ directory = os.path.dirname(include_file)
|
||||
+ for root, dirs, directory_files in os.walk(directory):
|
||||
+ for directory_file in directory_files:
|
||||
+ files.append(os.path.join(directory, directory_file))
|
||||
+ files = [f for f in files if not f.endswith('include_all_directory.java')
|
||||
+ and not f.endswith('.java.tmpl')]
|
||||
+
|
||||
+ return files
|
||||
diff --git a/build/bromite/bromite_utils.gni b/build/bromite/bromite_utils.gni
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/build/bromite/bromite_utils.gni
|
||||
@@ -0,0 +1,69 @@
|
||||
+import("//build/config/python.gni")
|
||||
+
|
||||
+# generates the file specified in ouput_file containing
|
||||
+# the inclusion of all .inc files found in the folder
|
||||
+# specified
|
||||
+#
|
||||
+# Parameters
|
||||
+# directories (required)
|
||||
+# A list of folders from which to extract the .inc files
|
||||
+#
|
||||
+# output_file (required)
|
||||
+# The name of the include file to be generated
|
||||
+#
|
||||
+# Example
|
||||
+#
|
||||
+# cpp_bromite_include("bromite_content_settings") {
|
||||
+# directories = [ "bromite_content_settings/placeholder.txt" ]
|
||||
+# output_file = "bromite_content_settings.inc"
|
||||
+# }
|
||||
+#
|
||||
+template("cpp_bromite_include") {
|
||||
+ action_with_pydeps(target_name) {
|
||||
+ forward_variables_from(invoker,
|
||||
+ TESTONLY_AND_VISIBILITY + [
|
||||
+ "deps",
|
||||
+ "inputs",
|
||||
+ ])
|
||||
+ script = "//build/bromite/gyp/cpp_bromite_include.py"
|
||||
+
|
||||
+ _rebased_directories = rebase_path(invoker.inputs, root_build_dir)
|
||||
+ _output = "$target_gen_dir/" + invoker.output_file
|
||||
+ _output_rebased = rebase_path(_output)
|
||||
+
|
||||
+ args = [
|
||||
+ "--output=$_output_rebased",
|
||||
+ ]
|
||||
+ args += _rebased_directories
|
||||
+
|
||||
+ outputs = [ _output ]
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+# allows the generation of the java file needed for
|
||||
+# the inclusion of the defined site settings
|
||||
+# in separate files
|
||||
+# used by content settings patch
|
||||
+template("java_bromite_impl") {
|
||||
+ action_with_pydeps(target_name) {
|
||||
+ forward_variables_from(invoker,
|
||||
+ TESTONLY_AND_VISIBILITY + [
|
||||
+ "deps",
|
||||
+ "inputs",
|
||||
+ ])
|
||||
+ script = "//build/bromite/gyp/java_bromite_impl.py"
|
||||
+
|
||||
+ _srcjar_path = "${target_gen_dir}/${target_name}.srcjar"
|
||||
+ _rebased_srcjar_path = rebase_path(_srcjar_path, root_build_dir)
|
||||
+ _rebased_directories = rebase_path(invoker.inputs, root_build_dir)
|
||||
+ _rebased_template = rebase_path(invoker.template, root_build_dir)
|
||||
+
|
||||
+ args = [
|
||||
+ "--srcjar=$_rebased_srcjar_path",
|
||||
+ "--template=$_rebased_template",
|
||||
+ ]
|
||||
+ args += _rebased_directories
|
||||
+
|
||||
+ outputs = [ _srcjar_path ]
|
||||
+ }
|
||||
+}
|
||||
diff --git a/build/bromite/gyp/cpp_bromite_include.py b/build/bromite/gyp/cpp_bromite_include.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/build/bromite/gyp/cpp_bromite_include.py
|
||||
@@ -0,0 +1,35 @@
|
||||
+#!/usr/bin/env python3
|
||||
+
|
||||
+import argparse
|
||||
+import os
|
||||
+import re
|
||||
+import sys
|
||||
+
|
||||
+def _Main(argv):
|
||||
+ parser = argparse.ArgumentParser()
|
||||
+
|
||||
+ parser.add_argument('--output',
|
||||
+ required=True,
|
||||
+ help='The path at which to generate the .inc file')
|
||||
+
|
||||
+ parser.add_argument(
|
||||
+ 'inputs', nargs='+', help='Input folder(s)', metavar='INPUTFILE')
|
||||
+ args = parser.parse_args(argv)
|
||||
+
|
||||
+ for include_file in args.inputs:
|
||||
+ directory = os.path.dirname(include_file)
|
||||
+ files = []
|
||||
+ for root, dirs, directory_files in os.walk(directory):
|
||||
+ for directory_file in sorted(directory_files):
|
||||
+ files.append(os.path.join(directory, directory_file))
|
||||
+
|
||||
+ files = [f for f in files if f.endswith('.inc')]
|
||||
+
|
||||
+ with open(args.output, 'w') as f:
|
||||
+ for file in files:
|
||||
+ f.write("#include \"" + file + "\"\n")
|
||||
+ f.write("\n")
|
||||
+
|
||||
+
|
||||
+if __name__ == '__main__':
|
||||
+ _Main(sys.argv[1:])
|
||||
diff --git a/build/bromite/gyp/cpp_bromite_include.pydeps b/build/bromite/gyp/cpp_bromite_include.pydeps
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/build/bromite/gyp/cpp_bromite_include.pydeps
|
||||
@@ -0,0 +1,9 @@
|
||||
+# Generated by running:
|
||||
+# build/print_python_deps.py --root build/bromite/gyp --output build/bromite/gyp/cpp_bromite_include.pydeps build/bromite/gyp/cpp_bromite_include.py
|
||||
+../../action_helpers.py
|
||||
+../../android/gyp/util/__init__.py
|
||||
+../../android/gyp/util/build_utils.py
|
||||
+../../android/gyp/util/java_cpp_utils.py
|
||||
+../../gn_helpers.py
|
||||
+../../zip_helpers.py
|
||||
+cpp_bromite_include.py
|
||||
diff --git a/build/bromite/gyp/java_bromite_impl.py b/build/bromite/gyp/java_bromite_impl.py
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/build/bromite/gyp/java_bromite_impl.py
|
||||
@@ -0,0 +1,94 @@
|
||||
+#!/usr/bin/env python3
|
||||
+
|
||||
+import argparse
|
||||
+import os
|
||||
+import re
|
||||
+import sys
|
||||
+import zipfile
|
||||
+
|
||||
+sys.path.append('build/android/gyp')
|
||||
+sys.path.append('../../build/android/gyp')
|
||||
+
|
||||
+from util import build_utils
|
||||
+from util import java_cpp_utils
|
||||
+import action_helpers # build_utils adds //build to sys.path.
|
||||
+import zip_helpers
|
||||
+
|
||||
+def _GenerateOutput(template, source_paths, template_path, strings):
|
||||
+ description_template = """
|
||||
+// This following string constants were inserted by
|
||||
+// {SCRIPT_NAME}
|
||||
+// Directory
|
||||
+// {SOURCE_PATHS}
|
||||
+// Template
|
||||
+// {TEMPLATE_PATH}
|
||||
+
|
||||
+"""
|
||||
+ values = {
|
||||
+ 'SCRIPT_NAME': java_cpp_utils.GetScriptName(),
|
||||
+ 'SOURCE_PATHS': ',\n// '.join(source_paths),
|
||||
+ 'TEMPLATE_PATH': template_path,
|
||||
+ }
|
||||
+ description = description_template.format(**values)
|
||||
+
|
||||
+ import_clause = '\n'.join(
|
||||
+ ['import org.chromium.components.browser_ui.site_settings.impl.' + f + ';' for f in strings])
|
||||
+ add_clause = '\n\t'.join(['\tadd(new ' + f + '());' for f in strings])
|
||||
+
|
||||
+ values = {
|
||||
+ 'DESCRIPTION': description,
|
||||
+ 'ADD_CLAUSE': add_clause,
|
||||
+ 'IMPORT_CLAUSE': import_clause,
|
||||
+ }
|
||||
+ return template.format(**values)
|
||||
+
|
||||
+
|
||||
+def _Generate(source_paths, template_path):
|
||||
+ with open(template_path) as f:
|
||||
+ lines = f.readlines()
|
||||
+
|
||||
+ template = ''.join(lines)
|
||||
+ package, class_name = java_cpp_utils.ParseTemplateFile(lines)
|
||||
+ output_path = java_cpp_utils.GetJavaFilePath(package, class_name)
|
||||
+ strings = []
|
||||
+
|
||||
+ for directory in source_paths:
|
||||
+ if not directory.endswith('include_all_directory.java'):
|
||||
+ raise Exception("input path not ends with 'include_all_directory.java'")
|
||||
+ for root, dirs, directory_files in os.walk(os.path.dirname(directory)):
|
||||
+ for directory_file in sorted(directory_files):
|
||||
+ strings.append(directory_file)
|
||||
+
|
||||
+ strings = [f.replace('.java', '') for f in strings
|
||||
+ if not f.endswith('include_all_directory.java') and
|
||||
+ not f.endswith('.java.tmpl') ]
|
||||
+
|
||||
+ output = _GenerateOutput(template, source_paths, template_path, strings)
|
||||
+
|
||||
+ return output, output_path
|
||||
+
|
||||
+
|
||||
+def _Main(argv):
|
||||
+ parser = argparse.ArgumentParser()
|
||||
+
|
||||
+ parser.add_argument('--srcjar',
|
||||
+ required=True,
|
||||
+ help='The path at which to generate the .srcjar file')
|
||||
+
|
||||
+ parser.add_argument('--template',
|
||||
+ required=True,
|
||||
+ help='The template file with which to generate the Java '
|
||||
+ 'class.')
|
||||
+
|
||||
+ parser.add_argument(
|
||||
+ 'inputs', nargs='+', help='Input folder(s)', metavar='INPUTFILE')
|
||||
+ args = parser.parse_args(argv)
|
||||
+
|
||||
+ with action_helpers.atomic_output(args.srcjar) as f:
|
||||
+ with zipfile.ZipFile(f, 'w', zipfile.ZIP_STORED) as srcjar:
|
||||
+ data, path = _Generate(args.inputs, args.template)
|
||||
+ zip_helpers.add_to_zip_hermetic(srcjar, path, data=data)
|
||||
+
|
||||
+
|
||||
+if __name__ == '__main__':
|
||||
+ _Main(sys.argv[1:])
|
||||
diff --git a/build/bromite/gyp/java_bromite_impl.pydeps b/build/bromite/gyp/java_bromite_impl.pydeps
|
||||
new file mode 100644
|
||||
--- /dev/null
|
||||
+++ b/build/bromite/gyp/java_bromite_impl.pydeps
|
||||
@@ -0,0 +1,9 @@
|
||||
+# Generated by running:
|
||||
+# build/print_python_deps.py --root build/bromite/gyp --output build/bromite/gyp/java_bromite_impl.pydeps build/bromite/gyp/java_bromite_impl.py
|
||||
+../../action_helpers.py
|
||||
+../../android/gyp/util/__init__.py
|
||||
+../../android/gyp/util/build_utils.py
|
||||
+../../android/gyp/util/java_cpp_utils.py
|
||||
+../../gn_helpers.py
|
||||
+../../zip_helpers.py
|
||||
+java_bromite_impl.py
|
||||
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
|
||||
--- a/build/config/BUILDCONFIG.gn
|
||||
+++ b/build/config/BUILDCONFIG.gn
|
||||
@@ -640,6 +640,7 @@ set_defaults("component") {
|
||||
configs = default_component_configs
|
||||
}
|
||||
|
||||
+import("//build/bromite/bromite_utils.gni")
|
||||
# =============================================================================
|
||||
# ACTION OVERRIDE
|
||||
# =============================================================================
|
||||
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
|
||||
--- a/build/config/android/rules.gni
|
||||
+++ b/build/config/android/rules.gni
|
||||
@@ -586,6 +586,10 @@ if (enable_java_templates && is_android) {
|
||||
_rebased_sources = rebase_path(invoker.sources, root_build_dir)
|
||||
|
||||
args = [ "--srcjar=$_rebased_srcjar_path" ] + _rebased_sources
|
||||
+ _root_gen_dir = rebase_path(root_gen_dir)
|
||||
+ _root_dir = rebase_path(root_build_dir)
|
||||
+ args += [ "--gen_dir=$_root_gen_dir",
|
||||
+ "--root_dir=$_root_dir" ]
|
||||
outputs = [ _srcjar_path ]
|
||||
}
|
||||
}
|
||||
diff --git a/tools/grit/grit/grd_reader.py b/tools/grit/grit/grd_reader.py
|
||||
--- a/tools/grit/grit/grd_reader.py
|
||||
+++ b/tools/grit/grit/grd_reader.py
|
||||
@@ -93,11 +93,28 @@ class GrdContentHandler(xml.sax.handler.ContentHandler):
|
||||
raise exception.FileNotFound(partname)
|
||||
# Exceptions propagate to the handler in grd_reader.Parse().
|
||||
oldsource = self.source
|
||||
- try:
|
||||
- self.source = partname
|
||||
- xml.sax.parse(partname, GrdPartContentHandler(self))
|
||||
- finally:
|
||||
- self.source = oldsource
|
||||
+ # modifies the behavior of
|
||||
+ # <part file="folder" />
|
||||
+ # allowing the inclusion of all grdp files found in the folder
|
||||
+ # specified.
|
||||
+ # the file value must end with "/placeholder.txt"
|
||||
+ if partname.endswith("/placeholder.txt"):
|
||||
+ partname = os.path.dirname(partname)
|
||||
+ for root, dirs, files in os.walk(partname):
|
||||
+ for file in files:
|
||||
+ filepath = os.path.join(partname, file)
|
||||
+ if filepath.endswith(".grdp"):
|
||||
+ try:
|
||||
+ self.source = partname
|
||||
+ xml.sax.parse(filepath, GrdPartContentHandler(self))
|
||||
+ finally:
|
||||
+ self.source = oldsource
|
||||
+ else:
|
||||
+ try:
|
||||
+ self.source = partname
|
||||
+ xml.sax.parse(partname, GrdPartContentHandler(self))
|
||||
+ finally:
|
||||
+ self.source = oldsource
|
||||
|
||||
if self.debug:
|
||||
print("End parsing of element %s" % name)
|
||||
diff --git a/tools/grit/preprocess_if_expr.py b/tools/grit/preprocess_if_expr.py
|
||||
--- a/tools/grit/preprocess_if_expr.py
|
||||
+++ b/tools/grit/preprocess_if_expr.py
|
||||
@@ -8,6 +8,7 @@ import io
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
+import re
|
||||
|
||||
# For Node, EvaluateExpression
|
||||
import grit.node.base
|
||||
@@ -71,6 +72,35 @@ def ExtensionForComments(input_file):
|
||||
extension = '.html'
|
||||
return extension
|
||||
|
||||
+def _extract_template_from_dir(html_file):
|
||||
+ template = ''
|
||||
+ directory = os.path.dirname(html_file)
|
||||
+ for root, dirs, directory_files in os.walk(directory):
|
||||
+ for directory_file in directory_files:
|
||||
+ if directory_file.endswith(".html"):
|
||||
+ template += _extract_template(os.path.join(directory, directory_file))
|
||||
+
|
||||
+ return template
|
||||
+
|
||||
+def _extract_template(html_file):
|
||||
+ include_re = re.compile(r'^\s*<include\s*path="(.*)"\s*/>')
|
||||
+ with io.open(html_file, encoding='utf-8', mode='r') as f:
|
||||
+ lines = f.readlines()
|
||||
+
|
||||
+ template_lines = []
|
||||
+ for line in lines:
|
||||
+ include_line = include_re.match(line)
|
||||
+ if include_line:
|
||||
+ include_file = include_line.groups()[0]
|
||||
+ file_to_include = os.path.join(os.path.dirname(html_file), include_file)
|
||||
+ if file_to_include.endswith("placeholder.txt"):
|
||||
+ line = _extract_template_from_dir(file_to_include)
|
||||
+ else:
|
||||
+ line = _extract_template(file_to_include)
|
||||
+ template_lines.append(line)
|
||||
+
|
||||
+ template = ''.join(template_lines)
|
||||
+ return template
|
||||
|
||||
def main(argv):
|
||||
parser = argparse.ArgumentParser()
|
||||
@@ -95,7 +125,7 @@ def main(argv):
|
||||
in_path = os.path.join(in_folder, input_file)
|
||||
content = ""
|
||||
with open(in_path, encoding='utf-8') as f:
|
||||
- content = f.read()
|
||||
+ content = _extract_template(in_path)
|
||||
|
||||
removal_comments_extension = None # None means no removal comments
|
||||
if args.enable_removal_comments:
|
||||
--
|
||||
2.25.1
|
||||
Reference in New Issue
Block a user