Files
cromite/build/patches/00WIN-ADDTO-Add-webGL-site-setting.patch
T
2023-03-30 14:32:09 +02:00

255 lines
16 KiB
Diff

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
@@ -4278,6 +4278,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
@@ -195,6 +195,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
@@ -1169,4 +1169,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
@@ -117,6 +117,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
@@ -104,6 +104,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
@@ -347,6 +347,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
@@ -2441,6 +2441,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
@@ -609,7 +609,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