diff --git a/build/patches/Add-a-flag-to-disable-GamePad-API.patch b/build/patches/Add-a-flag-to-disable-GamePad-API.patch index fb01fe03..807d55f0 100644 --- a/build/patches/Add-a-flag-to-disable-GamePad-API.patch +++ b/build/patches/Add-a-flag-to-disable-GamePad-API.patch @@ -5,16 +5,19 @@ Subject: Add a flag to disable GamePad API Adds restrict-gamepad-access flag (default active) to disable GamePad API. License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html --- - chrome/browser/flag-metadata.json | 4 ++-- - chrome/browser/flag_descriptions.cc | 2 +- - device/gamepad/public/cpp/gamepad_features.cc | 1 + - .../blink/renderer/modules/gamepad/navigator_gamepad.cc | 6 ++++++ - 4 files changed, 10 insertions(+), 3 deletions(-) + chrome/browser/flag-metadata.json | 4 ++-- + content/child/runtime_features.cc | 2 ++ + .../about_flags_cc/Add-a-flag-to-disable-GamePad-API.inc | 7 +++++++ + device/gamepad/public/cpp/gamepad_features.cc | 3 +++ + device/gamepad/public/cpp/gamepad_features.h | 1 + + .../blink/renderer/modules/gamepad/navigator_gamepad.cc | 6 ++++++ + 6 files changed, 21 insertions(+), 2 deletions(-) + create mode 100644 cromite_flags/chrome/browser/about_flags_cc/Add-a-flag-to-disable-GamePad-API.inc diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.json --- a/chrome/browser/flag-metadata.json +++ b/chrome/browser/flag-metadata.json -@@ -7807,9 +7807,9 @@ +@@ -7716,9 +7716,9 @@ "expiry_milestone" : 130 }, { @@ -26,31 +29,56 @@ diff --git a/chrome/browser/flag-metadata.json b/chrome/browser/flag-metadata.js }, { "name": "retain-omnibox-on-focus", -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 -@@ -3331,7 +3331,7 @@ const char kResetShortcutCustomizationsDescription[] = - - const char kRestrictGamepadAccessName[] = "Restrict gamepad access"; - const char kRestrictGamepadAccessDescription[] = -- "Enables Permissions Policy and Secure Context restrictions on the Gamepad " -+ "Disable the Gamepad " - "API"; - - #if BUILDFLAG(IS_ANDROID) +diff --git a/content/child/runtime_features.cc b/content/child/runtime_features.cc +--- a/content/child/runtime_features.cc ++++ b/content/child/runtime_features.cc +@@ -271,6 +271,8 @@ void SetRuntimeFeaturesFromChromiumFeatures() { + raw_ref(features::kPeriodicBackgroundSync)}, + {wf::EnablePushMessagingSubscriptionChange, + raw_ref(features::kPushSubscriptionChangeEvent)}, ++ {wf::EnableRestrictGamepadAccess, ++ raw_ref(features::kRestrictGamepadAccess)}, + {wf::EnableSecurePaymentConfirmation, + raw_ref(features::kSecurePaymentConfirmation)}, + {wf::EnableSecurePaymentConfirmationDebug, +diff --git a/cromite_flags/chrome/browser/about_flags_cc/Add-a-flag-to-disable-GamePad-API.inc b/cromite_flags/chrome/browser/about_flags_cc/Add-a-flag-to-disable-GamePad-API.inc +new file mode 100644 +--- /dev/null ++++ b/cromite_flags/chrome/browser/about_flags_cc/Add-a-flag-to-disable-GamePad-API.inc +@@ -0,0 +1,7 @@ ++#ifdef FLAG_SECTION ++ ++ {"restrict-gamepad-access", "Restrict gamepad access", ++ "Disable the Gamepad API", kOsAll, ++ FEATURE_VALUE_TYPE(features::kRestrictGamepadAccess)}, ++ ++#endif diff --git a/device/gamepad/public/cpp/gamepad_features.cc b/device/gamepad/public/cpp/gamepad_features.cc --- a/device/gamepad/public/cpp/gamepad_features.cc +++ b/device/gamepad/public/cpp/gamepad_features.cc -@@ -64,4 +64,5 @@ bool IsGamepadMultitouchEnabled() { +@@ -27,4 +27,7 @@ bool IsGamepadMultitouchEnabled() { return false; } -+SET_CROMITE_FEATURE_ENABLED(kRestrictGamepadAccess); ++CROMITE_FEATURE(kRestrictGamepadAccess, ++ "RestrictGamepadAccess", ++ base::FEATURE_ENABLED_BY_DEFAULT); } // namespace features +diff --git a/device/gamepad/public/cpp/gamepad_features.h b/device/gamepad/public/cpp/gamepad_features.h +--- a/device/gamepad/public/cpp/gamepad_features.h ++++ b/device/gamepad/public/cpp/gamepad_features.h +@@ -11,6 +11,7 @@ + namespace features { + + GAMEPAD_FEATURES_EXPORT BASE_DECLARE_FEATURE(kEnableGamepadMultitouch); ++GAMEPAD_FEATURES_EXPORT BASE_DECLARE_FEATURE(kRestrictGamepadAccess); + + GAMEPAD_FEATURES_EXPORT bool IsGamepadMultitouchEnabled(); + diff --git a/third_party/blink/renderer/modules/gamepad/navigator_gamepad.cc b/third_party/blink/renderer/modules/gamepad/navigator_gamepad.cc --- a/third_party/blink/renderer/modules/gamepad/navigator_gamepad.cc +++ b/third_party/blink/renderer/modules/gamepad/navigator_gamepad.cc -@@ -120,6 +120,10 @@ void RecordGamepadsForIdentifiabilityStudy( +@@ -112,6 +112,10 @@ void RecordGamepadsForIdentifiabilityStudy( HeapVector> NavigatorGamepad::getGamepads( Navigator& navigator, ExceptionState& exception_state) { @@ -61,7 +89,7 @@ diff --git a/third_party/blink/renderer/modules/gamepad/navigator_gamepad.cc b/t if (!navigator.DomWindow()) { // Using an existing NavigatorGamepad if one exists, but don't create one // for a detached window, as its subclasses depend on a non-null window. -@@ -442,6 +446,8 @@ void NavigatorGamepad::SampleAndCompareGamepadState() { +@@ -418,6 +422,8 @@ void NavigatorGamepad::SampleAndCompareGamepadState() { void NavigatorGamepad::DispatchGamepadEvent(const AtomicString& event_name, Gamepad* gamepad) { diff --git a/build/patches/Change-popup-site-setting.patch b/build/patches/Change-popup-site-setting.patch index e51ad436..de58a636 100644 --- a/build/patches/Change-popup-site-setting.patch +++ b/build/patches/Change-popup-site-setting.patch @@ -6,7 +6,7 @@ In site settings added ability to block all popups per site License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html --- - .../tab_under_navigation_throttle.cc | 1 + + .../tab_under_navigation_throttle.cc | 10 +- .../android/popup_blocked_message_delegate.cc | 20 +++- .../android/popup_blocked_message_delegate.h | 1 + components/blocked_content/popup_blocker.cc | 3 + @@ -15,7 +15,7 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html .../bromite_content_settings/popups.grdp | 12 ++ .../bromite_content_settings/popups.inc | 8 ++ .../core/browser/content_settings_registry.cc | 2 +- - 9 files changed, 153 insertions(+), 3 deletions(-) + 9 files changed, 159 insertions(+), 6 deletions(-) create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/impl/BromitePopupContentSetting.java create mode 100644 components/browser_ui/strings/bromite_content_settings/popups.grdp create mode 100644 components/content_settings/core/browser/bromite_content_settings/popups.inc @@ -23,14 +23,23 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html diff --git a/chrome/browser/ui/blocked_content/tab_under_navigation_throttle.cc b/chrome/browser/ui/blocked_content/tab_under_navigation_throttle.cc --- a/chrome/browser/ui/blocked_content/tab_under_navigation_throttle.cc +++ b/chrome/browser/ui/blocked_content/tab_under_navigation_throttle.cc -@@ -65,6 +65,7 @@ void LogTabUnderAttempt(content::NavigationHandle* handle) { - BASE_FEATURE(kBlockTabUnders, - "BlockTabUnders", - base::FEATURE_DISABLED_BY_DEFAULT); -+SET_CROMITE_FEATURE_ENABLED(kBlockTabUnders); +@@ -140,9 +140,13 @@ TabUnderNavigationThrottle::MaybeBlockNavigation() { - // static - std::unique_ptr + LogTabUnderAttempt(navigation_handle()); + +- // We unconditionally proceed. There used to be a tab-under blocking +- // experiment, but it never launched. +- return content::NavigationThrottle::PROCEED; ++ const std::string error = ++ base::StringPrintf(kBlockTabUnderFormatMessage, ++ navigation_handle()->GetURL().spec().c_str()); ++ contents->GetPrimaryMainFrame()->AddMessageToConsole( ++ blink::mojom::ConsoleMessageLevel::kError, error.c_str()); ++ ShowUI(); ++ return content::NavigationThrottle::CANCEL; + } + + void TabUnderNavigationThrottle::ShowUI() { diff --git a/components/blocked_content/android/popup_blocked_message_delegate.cc b/components/blocked_content/android/popup_blocked_message_delegate.cc --- a/components/blocked_content/android/popup_blocked_message_delegate.cc +++ b/components/blocked_content/android/popup_blocked_message_delegate.cc diff --git a/build/patches/Chrome-web-store-protection.patch b/build/patches/Chrome-web-store-protection.patch index e01a196b..9da7fa71 100644 --- a/build/patches/Chrome-web-store-protection.patch +++ b/build/patches/Chrome-web-store-protection.patch @@ -18,18 +18,22 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html .../developer_private/developer_private_api.h | 3 + .../webstore_private/webstore_private_api.cc | 15 ++++- chrome/browser/extensions/cws_info_service.cc | 1 + + .../extensions/cws_info_service_factory.cc | 3 +- + .../extensions/extension_management.cc | 1 + + .../extension_safety_check_utils.cc | 3 +- + .../browser/extensions/extension_service.cc | 4 +- .../extensions/extension_system_impl.cc | 2 + .../chrome_extension_downloader_factory.cc | 1 - .../extensions/updater/extension_updater.cc | 40 ++++++++----- .../extensions/updater/extension_updater.h | 4 ++ .../extensions/webstore_install_helper.cc | 2 +- .../browser/extensions/webstore_installer.cc | 2 +- - .../browser/resources/extensions/manager.html | 1 + - .../browser/resources/extensions/manager.ts | 7 +++ + .../resources/extensions/manager.html.ts | 1 + + .../browser/resources/extensions/manager.ts | 5 ++ .../browser/resources/extensions/service.ts | 5 ++ .../browser/resources/extensions/toolbar.css | 5 ++ - .../browser/resources/extensions/toolbar.html | 7 +++ - .../browser/resources/extensions/toolbar.ts | 21 +++++++ + .../resources/extensions/toolbar.html.ts | 7 +++ + .../browser/resources/extensions/toolbar.ts | 17 ++++++ .../resources/webstore_app/manifest.json | 7 +-- .../ui/webui/extensions/extensions_ui.cc | 8 +++ .../chrome_update_query_params_delegate.cc | 13 ++-- @@ -44,7 +48,7 @@ License: GPL-2.0-or-later - https://spdx.org/licenses/GPL-2.0-or-later.html extensions/common/extension_features.cc | 15 +++++ extensions/common/extension_features.h | 5 ++ .../definitions/developer_private.d.ts | 2 + - 31 files changed, 258 insertions(+), 103 deletions(-) + 35 files changed, 257 insertions(+), 109 deletions(-) create mode 100644 cromite_flags/chrome/browser/about_flags_cc/Webstore-protection.inc diff --git a/chrome/app/extensions_strings.grdp b/chrome/app/extensions_strings.grdp @@ -166,7 +170,7 @@ diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api #include "extensions/common/manifest.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/permissions_parser.h" -@@ -220,6 +221,8 @@ WebstorePrivateApi::Delegate* test_delegate = nullptr; +@@ -219,6 +220,8 @@ WebstorePrivateApi::Delegate* test_delegate = nullptr; // there was previously stored data, or an empty string otherwise. The Set will // overwrite any previous login. std::string GetWebstoreLogin(Profile* profile) { @@ -175,7 +179,7 @@ diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api if (profile->GetPrefs()->HasPrefPath(kWebstoreLogin)) { return profile->GetPrefs()->GetString(kWebstoreLogin); } -@@ -227,11 +230,15 @@ std::string GetWebstoreLogin(Profile* profile) { +@@ -226,11 +229,15 @@ std::string GetWebstoreLogin(Profile* profile) { } void SetWebstoreLogin(Profile* profile, const std::string& login) { @@ -191,7 +195,7 @@ diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api switch (status) { case kCanRequest: return api::webstore_private::ExtensionInstallStatus::kCanRequest; -@@ -1152,7 +1159,8 @@ ExtensionFunction::ResponseAction +@@ -1151,7 +1158,8 @@ ExtensionFunction::ResponseAction WebstorePrivateIsInIncognitoModeFunction::Run() { Profile* profile = Profile::FromBrowserContext(browser_context()); return RespondNow(ArgumentList(IsInIncognitoMode::Results::Create( @@ -201,7 +205,7 @@ diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api } WebstorePrivateIsPendingCustodianApprovalFunction:: -@@ -1247,11 +1255,14 @@ WebstorePrivateGetReferrerChainFunction::Run() { +@@ -1246,11 +1254,14 @@ WebstorePrivateGetReferrerChainFunction::Run() { request.mutable_referrer_chain_options()->set_recent_navigations_to_collect( recent_navigations_to_collect); @@ -220,14 +224,72 @@ diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_api diff --git a/chrome/browser/extensions/cws_info_service.cc b/chrome/browser/extensions/cws_info_service.cc --- a/chrome/browser/extensions/cws_info_service.cc +++ b/chrome/browser/extensions/cws_info_service.cc -@@ -163,6 +163,7 @@ namespace extensions { - BASE_FEATURE(kCWSInfoService, - "CWSInfoService", - base::FEATURE_ENABLED_BY_DEFAULT); +@@ -157,6 +157,7 @@ void RecordNetworkHistograms(const network::SimpleURLLoader* url_loader) { + } // namespace + + namespace extensions { +SET_CROMITE_FEATURE_DISABLED(kCWSInfoService); // Increase the frequency of periodic retrieval of extensions metadata from // CWS. This feature is used only for testing purposes. +diff --git a/chrome/browser/extensions/cws_info_service_factory.cc b/chrome/browser/extensions/cws_info_service_factory.cc +--- a/chrome/browser/extensions/cws_info_service_factory.cc ++++ b/chrome/browser/extensions/cws_info_service_factory.cc +@@ -47,7 +47,8 @@ CWSInfoServiceFactory::CWSInfoServiceFactory() + std::unique_ptr + CWSInfoServiceFactory::BuildServiceInstanceForBrowserContext( + content::BrowserContext* context) const { +- return std::make_unique(Profile::FromBrowserContext(context)); ++ // Disallow periodic retrieval of extensions metadata from the Chrome Web Store ++ return nullptr; + } + + bool CWSInfoServiceFactory::ServiceIsCreatedWithBrowserContext() const { +diff --git a/chrome/browser/extensions/extension_management.cc b/chrome/browser/extensions/extension_management.cc +--- a/chrome/browser/extensions/extension_management.cc ++++ b/chrome/browser/extensions/extension_management.cc +@@ -379,6 +379,7 @@ bool ExtensionManagement::IsExemptFromMV2DeprecationByPolicy( + + bool ExtensionManagement::IsAllowedByUnpublishedAvailabilityPolicy( + const Extension* extension) { ++ if ((true)) return true; + // This policy only applies to extensions that update from CWS. + if (!UpdatesFromWebstore(*extension)) { + return true; +diff --git a/chrome/browser/extensions/extension_safety_check_utils.cc b/chrome/browser/extensions/extension_safety_check_utils.cc +--- a/chrome/browser/extensions/extension_safety_check_utils.cc ++++ b/chrome/browser/extensions/extension_safety_check_utils.cc +@@ -240,8 +240,7 @@ developer::SafetyCheckWarningReason GetSafetyCheckWarningReasonHelper( + developer::SafetyCheckWarningReason acknowledged_reason = + GetPrefAcknowledgeSafetyCheckWarningReason(extension, + ExtensionPrefs::Get(profile)); +- std::optional cws_info = +- cws_info_service->GetCWSInfo(extension); ++ std::optional cws_info; + bool valid_cws_info = cws_info.has_value() && cws_info->is_present; + if (unpublished_only) { + if (valid_cws_info && cws_info->unpublished_long_ago) { +diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc +--- a/chrome/browser/extensions/extension_service.cc ++++ b/chrome/browser/extensions/extension_service.cc +@@ -443,8 +443,6 @@ ExtensionService::ExtensionService( + + UpgradeDetector::GetInstance()->AddObserver(this); + +- cws_info_service_observation_.Observe(CWSInfoService::Get(profile_)); +- + ExtensionManagementFactory::GetForBrowserContext(profile_)->AddObserver(this); + + // Set up the ExtensionUpdater. +@@ -1930,7 +1928,7 @@ void ExtensionService::OnExtensionManagementSettingsChanged() { + // unpublished extensions should not be enabled. This update allows + // unpublished extensions to be disabled sooner rather than waiting till the + // next regularly scheduled fetch. +- if (profile_->GetPrefs()->GetInteger( ++ if (((false)) && profile_->GetPrefs()->GetInteger( + pref_names::kExtensionUnpublishedAvailability) != + kAllowUnpublishedExtensions) { + CWSInfoService::Get(profile_)->CheckAndMaybeFetchInfo(); diff --git a/chrome/browser/extensions/extension_system_impl.cc b/chrome/browser/extensions/extension_system_impl.cc --- a/chrome/browser/extensions/extension_system_impl.cc +++ b/chrome/browser/extensions/extension_system_impl.cc @@ -442,50 +504,48 @@ diff --git a/chrome/browser/extensions/webstore_install_helper.cc b/chrome/brows diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc -@@ -624,7 +624,7 @@ void WebstoreInstaller::StartDownload( - download_url_, render_process_host_id, render_frame_host->GetRoutingID(), +@@ -625,7 +625,7 @@ void WebstoreInstaller::StartDownload( traffic_annotation)); params->set_file_path(file); + params->set_initiator(render_frame_host->GetLastCommittedOrigin()); - if (controller.GetVisibleEntry()) { + if ((false) && controller.GetVisibleEntry()) { content::Referrer referrer = content::Referrer::SanitizeForRequest( download_url_, content::Referrer(controller.GetVisibleEntry()->GetURL(), -diff --git a/chrome/browser/resources/extensions/manager.html b/chrome/browser/resources/extensions/manager.html ---- a/chrome/browser/resources/extensions/manager.html -+++ b/chrome/browser/resources/extensions/manager.html -@@ -64,6 +64,7 @@ - +diff --git a/chrome/browser/resources/extensions/manager.html.ts b/chrome/browser/resources/extensions/manager.html.ts +--- a/chrome/browser/resources/extensions/manager.html.ts ++++ b/chrome/browser/resources/extensions/manager.html.ts +@@ -12,6 +12,7 @@ export function getHtml(this: ExtensionsManagerElement) { + - loadTimeData.getBoolean('MV2DeprecationNoticeDismissed'), - }, +@@ -142,6 +142,8 @@ export class ExtensionsManagerElement extends ExtensionsManagerElementBase { + */ + didInitPage_: {type: Boolean}, -+ isExtUpdateEnabled: { -+ type: Boolean, -+ value: () => loadTimeData.getBoolean('isExtUpdateEnabled'), -+ }, ++ isExtUpdateEnabled: {type: Boolean}, + - showActivityLog: { - type: Boolean, - value: () => loadTimeData.getBoolean('showActivityLog'), -@@ -210,6 +215,7 @@ export class ExtensionsManagerElement extends ExtensionsManagerElementBase { - delegate: Service; - inDevMode: boolean; - isMv2DeprecationNoticeDismissed: boolean; -+ isExtUpdateEnabled: boolean; - showActivityLog: boolean; - enableEnhancedSiteControls: boolean; - devModeControlledByPolicy: boolean; -@@ -277,6 +283,7 @@ export class ExtensionsManagerElement extends ExtensionsManagerElementBase { + narrow_: {type: Boolean}, + + showDrawer_: {type: Boolean}, +@@ -163,6 +165,8 @@ export class ExtensionsManagerElement extends ExtensionsManagerElementBase { + inDevMode: boolean = loadTimeData.getBoolean('inDevMode'); + isMv2DeprecationNoticeDismissed: boolean = + loadTimeData.getBoolean('MV2DeprecationNoticeDismissed'); ++ isExtUpdateEnabled: boolean = ++ loadTimeData.getBoolean('isExtUpdateEnabled'); + showActivityLog: boolean = loadTimeData.getBoolean('showActivityLog'); + enableEnhancedSiteControls: boolean = + loadTimeData.getBoolean('enableEnhancedSiteControls'); +@@ -224,6 +228,7 @@ export class ExtensionsManagerElement extends ExtensionsManagerElementBase { this.canLoadUnpacked = profileInfo.canLoadUnpacked; this.isMv2DeprecationNoticeDismissed = profileInfo.isMv2DeprecationNoticeDismissed; @@ -496,7 +556,7 @@ diff --git a/chrome/browser/resources/extensions/manager.ts b/chrome/browser/res diff --git a/chrome/browser/resources/extensions/service.ts b/chrome/browser/resources/extensions/service.ts --- a/chrome/browser/resources/extensions/service.ts +++ b/chrome/browser/resources/extensions/service.ts -@@ -290,6 +290,11 @@ export class Service implements ServiceInterface { +@@ -293,6 +293,11 @@ export class Service implements ServiceInterface { {inDeveloperMode: inDevMode}); } @@ -523,18 +583,18 @@ diff --git a/chrome/browser/resources/extensions/toolbar.css b/chrome/browser/re cr-toolbar { --cr-toolbar-center-basis: 680px; --cr-toolbar-field-max-width: var(--cr-toolbar-center-basis); -diff --git a/chrome/browser/resources/extensions/toolbar.html b/chrome/browser/resources/extensions/toolbar.html ---- a/chrome/browser/resources/extensions/toolbar.html -+++ b/chrome/browser/resources/extensions/toolbar.html -@@ -15,6 +15,13 @@ - ?checked="${this.inDevMode}" aria-labelledby="devModeLabel"> +diff --git a/chrome/browser/resources/extensions/toolbar.html.ts b/chrome/browser/resources/extensions/toolbar.html.ts +--- a/chrome/browser/resources/extensions/toolbar.html.ts ++++ b/chrome/browser/resources/extensions/toolbar.html.ts +@@ -25,6 +25,13 @@ export function getHtml(this: ToolbarElement) { + aria-labelledby="devModeLabel"> +
+ $i18n{toolbarExtensionUpdateEnabled} -+ ++ $i18n{toolbarExtensionUpdateEnabledNeedRestart} + -+ ++ + +
@@ -560,21 +620,19 @@ diff --git a/chrome/browser/resources/extensions/toolbar.ts b/chrome/browser/res } export interface ExtensionsToolbarElement { -@@ -79,6 +82,13 @@ export class ExtensionsToolbarElement extends ExtensionsToolbarElementBase { +@@ -79,6 +82,11 @@ export class ExtensionsToolbarElement extends ExtensionsToolbarElementBase { reflect: true, }, + isExtUpdateEnabled: { + type: Boolean, -+ value: false, -+ observer: 'onExtUpdateEnabledChanged_', -+ reflectToAttribute: true, ++ reflect: true, + }, + devModeControlledByPolicy: {type: Boolean}, isChildAccount: {type: Boolean}, -@@ -91,6 +101,7 @@ export class ExtensionsToolbarElement extends ExtensionsToolbarElementBase { +@@ -91,6 +99,7 @@ export class ExtensionsToolbarElement extends ExtensionsToolbarElementBase { expanded_: {type: Boolean}, showPackDialog_: {type: Boolean}, @@ -582,25 +640,23 @@ diff --git a/chrome/browser/resources/extensions/toolbar.ts b/chrome/browser/res /** * Prevents initiating update while update is in progress. -@@ -102,6 +113,8 @@ export class ExtensionsToolbarElement extends ExtensionsToolbarElementBase { +@@ -102,6 +111,8 @@ export class ExtensionsToolbarElement extends ExtensionsToolbarElementBase { extensions: chrome.developerPrivate.ExtensionInfo[] = []; delegate: ToolbarDelegate = new DummyToolbarDelegate(); inDevMode: boolean = false; -+ isExtUpdateEnabled: boolean; ++ isExtUpdateEnabled: boolean = false; + shouldShowRelaunchDialog: boolean = false; devModeControlledByPolicy: boolean = false; isChildAccount: boolean = false; -@@ -154,6 +167,14 @@ export class ExtensionsToolbarElement extends ExtensionsToolbarElementBase { +@@ -154,6 +165,12 @@ export class ExtensionsToolbarElement extends ExtensionsToolbarElementBase { 'Options_ToggleDeveloperMode_' + (e.detail ? 'Enabled' : 'Disabled')); } -+ private onExtUpdateEnabledChanged_(evt: Event, value: boolean, _old: boolean) { -+ if (evt instanceof Event) { -+ this.delegate.setExtUpdateEnabled(value); -+ this.shouldShowRelaunchDialog = true; -+ this.isExtUpdateEnabled = value; -+ } ++ protected onExtUpdateEnabledChanged_(e: CustomEvent) { ++ this.delegate.setExtUpdateEnabled(e.detail); ++ this.shouldShowRelaunchDialog = true; ++ this.isExtUpdateEnabled = e.detail; + } + private onInDevModeChanged_(_current: boolean, previous: boolean) { @@ -834,7 +890,7 @@ diff --git a/extensions/browser/api/management/management_api.cc b/extensions/br if (!extension) { return RespondNow(Error(keys::kNoExtensionError, params->id)); } -@@ -548,8 +572,8 @@ void ManagementSetEnabledFunction::CheckPermissionsIncrease() { +@@ -547,8 +571,8 @@ void ManagementSetEnabledFunction::CheckPermissionsIncrease() { // Extension could have been uninstalled externally while previous check was // happening. const Extension* extension = @@ -845,7 +901,7 @@ diff --git a/extensions/browser/api/management/management_api.cc b/extensions/br if (!extension) { FinishEnable(Error(keys::kNoExtensionError)); return; -@@ -592,8 +616,8 @@ void ManagementSetEnabledFunction::CheckManifestV2Deprecation() { +@@ -591,8 +615,8 @@ void ManagementSetEnabledFunction::CheckManifestV2Deprecation() { // Extension can be uninstalled externally while the previous check was // happening async. const Extension* extension = @@ -856,7 +912,7 @@ diff --git a/extensions/browser/api/management/management_api.cc b/extensions/br if (!extension) { FinishEnable(Error(keys::kNoExtensionError)); return; -@@ -737,8 +761,8 @@ void ManagementSetEnabledFunction::OnSupervisedExtensionApprovalDone( +@@ -736,8 +760,8 @@ void ManagementSetEnabledFunction::OnSupervisedExtensionApprovalDone( } const Extension* ManagementSetEnabledFunction::GetExtension() { @@ -867,7 +923,7 @@ diff --git a/extensions/browser/api/management/management_api.cc b/extensions/br } ManagementUninstallFunctionBase::ManagementUninstallFunctionBase() = default; -@@ -763,8 +787,7 @@ ExtensionFunction::ResponseAction ManagementUninstallFunctionBase::Uninstall( +@@ -762,8 +786,7 @@ ExtensionFunction::ResponseAction ManagementUninstallFunctionBase::Uninstall( ->GetDelegate(); target_extension_id_ = target_extension_id; const Extension* target_extension = @@ -877,7 +933,7 @@ diff --git a/extensions/browser/api/management/management_api.cc b/extensions/br ExtensionRegistry::EVERYTHING); if (!target_extension || !ShouldExposeViaManagementAPI(*target_extension)) { return RespondNow(Error(keys::kNoExtensionError, target_extension_id_)); -@@ -829,8 +852,7 @@ void ManagementUninstallFunctionBase::UninstallExtension() { +@@ -828,8 +851,7 @@ void ManagementUninstallFunctionBase::UninstallExtension() { // The extension can be uninstalled in another window while the UI was // showing. Do nothing in that case. const Extension* target_extension = @@ -887,7 +943,7 @@ diff --git a/extensions/browser/api/management/management_api.cc b/extensions/br ExtensionRegistry::EVERYTHING); std::string error; bool success = false; -@@ -907,8 +929,7 @@ ExtensionFunction::ResponseAction ManagementCreateAppShortcutFunction::Run() { +@@ -906,8 +928,7 @@ ExtensionFunction::ResponseAction ManagementCreateAppShortcutFunction::Run() { management::CreateAppShortcut::Params::Create(args()); EXTENSION_FUNCTION_VALIDATE(params); const Extension* extension = @@ -897,7 +953,7 @@ diff --git a/extensions/browser/api/management/management_api.cc b/extensions/br if (!extension) { return RespondNow(Error( ErrorUtils::FormatErrorMessage(keys::kNoExtensionError, params->id))); -@@ -961,8 +982,7 @@ ExtensionFunction::ResponseAction ManagementSetLaunchTypeFunction::Run() { +@@ -960,8 +981,7 @@ ExtensionFunction::ResponseAction ManagementSetLaunchTypeFunction::Run() { management::SetLaunchType::Params::Create(args()); EXTENSION_FUNCTION_VALIDATE(params); const Extension* extension = @@ -1104,7 +1160,7 @@ diff --git a/extensions/browser/updater/extension_downloader.h b/extensions/brow diff --git a/extensions/browser/updater/manifest_fetch_data.cc b/extensions/browser/updater/manifest_fetch_data.cc --- a/extensions/browser/updater/manifest_fetch_data.cc +++ b/extensions/browser/updater/manifest_fetch_data.cc -@@ -107,7 +107,7 @@ ManifestFetchData::ManifestFetchData(const GURL& update_url, +@@ -106,7 +106,7 @@ ManifestFetchData::ManifestFetchData(const GURL& update_url, : base_url_(update_url), full_url_(update_url), brand_code_(brand_code), @@ -1113,7 +1169,7 @@ diff --git a/extensions/browser/updater/manifest_fetch_data.cc b/extensions/brow fetch_priority_(fetch_priority) { UpdateFullUrl(base_query_params); request_ids_.insert(request_id); -@@ -161,18 +161,12 @@ bool ManifestFetchData::AddExtension(const std::string& id, +@@ -159,18 +159,12 @@ bool ManifestFetchData::AddExtension(const std::string& id, // Compute the string we'd append onto the full_url_, and see if it fits. std::vector parts; parts.push_back("id=" + id); @@ -1146,7 +1202,7 @@ diff --git a/extensions/browser/updater/safe_manifest_parser.cc b/extensions/bro diff --git a/extensions/common/extension_features.cc b/extensions/common/extension_features.cc --- a/extensions/common/extension_features.cc +++ b/extensions/common/extension_features.cc -@@ -198,4 +198,19 @@ BASE_FEATURE(kSilentDebuggerExtensionAPI, +@@ -191,4 +191,19 @@ BASE_FEATURE(kSilentDebuggerExtensionAPI, "SilentDebuggerExtensionAPI", base::FEATURE_DISABLED_BY_DEFAULT); @@ -1169,7 +1225,7 @@ diff --git a/extensions/common/extension_features.cc b/extensions/common/extensi diff --git a/extensions/common/extension_features.h b/extensions/common/extension_features.h --- a/extensions/common/extension_features.h +++ b/extensions/common/extension_features.h -@@ -235,6 +235,11 @@ BASE_DECLARE_FEATURE(kDeclarativeNetRequestHeaderSubstitution); +@@ -228,6 +228,11 @@ BASE_DECLARE_FEATURE(kDeclarativeNetRequestHeaderSubstitution); // Show no warning banner when an extension uses CDP's `chrome.debugger`. BASE_DECLARE_FEATURE(kSilentDebuggerExtensionAPI); diff --git a/build/patches/Content-settings-infrastructure.patch b/build/patches/Content-settings-infrastructure.patch index 807f3f6e..8c4f929f 100644 --- a/build/patches/Content-settings-infrastructure.patch +++ b/build/patches/Content-settings-infrastructure.patch @@ -30,7 +30,7 @@ Require: bromite-build-utils.patch .../ui/views/page_info/page_info_main_view.cc | 28 +- .../views/page_info/page_info_view_factory.cc | 20 + .../views/page_info/page_info_view_factory.h | 5 + - .../page_info/permission_toggle_row_view.cc | 173 +++++++- + .../page_info/permission_toggle_row_view.cc | 176 +++++++- .../page_info/permission_toggle_row_view.h | 18 +- .../settings_localized_strings_provider.cc | 54 +++ .../ui/webui/settings/site_settings_helper.cc | 46 +- @@ -43,8 +43,8 @@ Require: bromite-build-utils.patch .../BromiteCustomContentSettingImpl.java | 412 ++++++++++++++++++ ...tomTriStateSiteSettingsPreferenceImpl.java | 24 + .../ContentSettingsResources.java | 16 +- - .../site_settings/SingleCategorySettings.java | 50 ++- - .../site_settings/SingleWebsiteSettings.java | 54 ++- + .../site_settings/SingleCategorySettings.java | 55 ++- + .../site_settings/SingleWebsiteSettings.java | 56 ++- .../site_settings/SiteSettings.java | 31 +- .../site_settings/SiteSettingsCategory.java | 18 +- .../site_settings/SiteSettingsDelegate.java | 2 + @@ -83,7 +83,7 @@ Require: bromite-build-utils.patch .../platform/web_content_settings_client.h | 13 + .../execution_context/execution_context.cc | 16 + .../execution_context/execution_context.h | 5 + - 72 files changed, 1919 insertions(+), 93 deletions(-) + 72 files changed, 1920 insertions(+), 102 deletions(-) create mode 100644 components/browser_ui/settings/android/java/res/layout/preference_spinner_single_widget.xml create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSetting.java create mode 100644 components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/BromiteCustomContentSettingImpl.java @@ -97,8 +97,8 @@ Require: bromite-build-utils.patch diff --git a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java --- a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/site_settings/ChromeSiteSettingsDelegate.java -@@ -64,6 +64,10 @@ import org.chromium.url.GURL; - +@@ -69,6 +69,10 @@ import org.chromium.url.GURL; + import java.util.List; import java.util.Set; +import android.content.Intent; @@ -108,7 +108,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/C /** A SiteSettingsDelegate instance that contains Chrome-specific Site Settings logic. */ public class ChromeSiteSettingsDelegate implements SiteSettingsDelegate { public static final String EMBEDDED_CONTENT_HELP_CENTER_URL = -@@ -229,7 +233,7 @@ public class ChromeSiteSettingsDelegate implements SiteSettingsDelegate { +@@ -240,7 +244,7 @@ public class ChromeSiteSettingsDelegate implements SiteSettingsDelegate { @Override public boolean isHelpAndFeedbackEnabled() { @@ -117,8 +117,8 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/C } @Override -@@ -366,6 +370,17 @@ public class ChromeSiteSettingsDelegate implements SiteSettingsDelegate { - return mPrivacySandboxBridge.getFirstPartySetOwner(memberOrigin); +@@ -402,6 +406,17 @@ public class ChromeSiteSettingsDelegate implements SiteSettingsDelegate { + return mPrivacySandboxBridge.getRelatedWebsiteSetOwner(memberOrigin); } + @Override @@ -138,7 +138,7 @@ diff --git a/chrome/android/java/src/org/chromium/chrome/browser/site_settings/C diff --git a/chrome/browser/content_settings/page_specific_content_settings_delegate.cc b/chrome/browser/content_settings/page_specific_content_settings_delegate.cc --- a/chrome/browser/content_settings/page_specific_content_settings_delegate.cc +++ b/chrome/browser/content_settings/page_specific_content_settings_delegate.cc -@@ -162,7 +162,7 @@ namespace { +@@ -199,7 +199,7 @@ namespace { void GetGuestViewDefaultContentSettingRules( bool incognito, RendererContentSettingRules* rules) { @@ -150,7 +150,7 @@ diff --git a/chrome/browser/content_settings/page_specific_content_settings_dele 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 -@@ -1491,4 +1491,5 @@ +@@ -1493,4 +1493,5 @@ @@ -262,7 +262,7 @@ diff --git a/chrome/browser/resources/settings/route.ts b/chrome/browser/resourc /** * Add all of the child routes that originate from the privacy route, -@@ -163,6 +164,7 @@ function addPrivacyChildRoutes(r: Partial) { +@@ -167,6 +168,7 @@ function addPrivacyChildRoutes(r: Partial) { r.SITE_SETTINGS_WEB_APP_INSTALLATION = r.SITE_SETTINGS.createChild('webApplications'); } @@ -692,7 +692,7 @@ diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_ /** * Determine localization string for i18n for a given content settings type. * Sorted alphabetically by |ContentSettingsType|. -@@ -107,6 +155,13 @@ export function getLocalizationStringForContentType( +@@ -108,6 +156,13 @@ export function getLocalizationStringForContentType( case ContentSettingsTypes.SMART_CARD_READERS: return null; default: @@ -709,15 +709,15 @@ diff --git a/chrome/browser/resources/settings/site_settings_page/site_settings_ diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn --- a/chrome/browser/ui/BUILD.gn +++ b/chrome/browser/ui/BUILD.gn -@@ -1808,6 +1808,7 @@ static_library("ui") { - "//components/commerce/core:shopping_service", +@@ -1759,6 +1759,7 @@ static_library("ui") { + "//components/commerce/core/mojom:mojo_bindings", "//components/commerce/core/webui", "//components/endpoint_fetcher:endpoint_fetcher", + "//components/content_settings/core/browser:browser", "//components/enterprise/common:files_scan_data", "//components/feedback/proto", "//components/headless/policy", -@@ -5047,6 +5048,7 @@ static_library("ui") { +@@ -5007,6 +5008,7 @@ static_library("ui") { "//components/power_bookmarks/storage", "//components/reading_list/features:flags", "//components/segmentation_platform/embedder/default_model:default_model", @@ -1016,12 +1016,15 @@ diff --git a/chrome/browser/ui/views/page_info/permission_toggle_row_view.cc b/c void PermissionToggleRowView::OnToggleButtonPressed() { PageInfoUI::ToggleBetweenAllowAndBlock(permission_); PermissionChanged(); -@@ -176,24 +280,19 @@ void PermissionToggleRowView::OnToggleButtonPressed() { - void PermissionToggleRowView::InitForUserSource( - bool should_show_spacer_view, - const std::u16string& toggle_accessible_name) { -- const int icon_label_spacing = ChromeLayoutProvider::Get()->GetDistanceMetric( -- views::DISTANCE_RELATED_LABEL_HORIZONTAL); +@@ -176,27 +280,19 @@ void PermissionToggleRowView::OnToggleButtonPressed() { + void PermissionToggleRowView::AddToggleButton( + const std::u16string& toggle_accessible_name, + int icon_label_spacing) { +- // This skips adding a toggle for 'CAPTURED_SURFACE_CONTROL' pemrission type. +- // We want to use the toggle inside the submenu and not here. +- if (permission_.type == ContentSettingsType::CAPTURED_SURFACE_CONTROL) { +- return; +- } - - auto toggle_button = std::make_unique( - base::BindRepeating(&PermissionToggleRowView::OnToggleButtonPressed, @@ -1045,10 +1048,10 @@ diff --git a/chrome/browser/ui/views/page_info/permission_toggle_row_view.cc b/c - toggle_button_ = row_view_->AddControl(std::move(toggle_button)); + choose_button_ = row_view_->AddControlUnderLabel(std::move(toggle_button)); + } - const int icon_size = GetLayoutConstant(PAGE_INFO_ICON_SIZE); - -@@ -227,9 +326,6 @@ void PermissionToggleRowView::InitForUserSource( + void PermissionToggleRowView::InitForUserSource( +@@ -238,9 +334,6 @@ void PermissionToggleRowView::InitForUserSource( auto spacer_view = std::make_unique(); spacer_view->SetPreferredSize(gfx::Size(icon_size, icon_size)); spacer_view_ = row_view_->AddControl(std::move(spacer_view)); @@ -1058,7 +1061,7 @@ diff --git a/chrome/browser/ui/views/page_info/permission_toggle_row_view.cc b/c } } } -@@ -256,6 +352,12 @@ void PermissionToggleRowView::InitForManagedSource( +@@ -267,6 +360,12 @@ void PermissionToggleRowView::InitForManagedSource( } void PermissionToggleRowView::UpdateUiOnPermissionChanged() { @@ -1071,7 +1074,7 @@ diff --git a/chrome/browser/ui/views/page_info/permission_toggle_row_view.cc b/c if (blocked_on_system_level_label_) { if (permission_.setting == CONTENT_SETTING_DEFAULT) { permission_blocked_on_system_level_ = false; -@@ -301,6 +403,37 @@ void PermissionToggleRowView::UpdateUiOnPermissionChanged() { +@@ -312,6 +411,37 @@ void PermissionToggleRowView::UpdateUiOnPermissionChanged() { } } } @@ -1145,9 +1148,9 @@ diff --git a/chrome/browser/ui/views/page_info/permission_toggle_row_view.h b/ch + void ExecuteCommand(int command_id, int event_flags) override; + void OnToggleButtonPressed(); - void InitForUserSource(bool should_show_spacer_view, - const std::u16string& toggle_accessible_name); -@@ -84,6 +96,10 @@ class PermissionToggleRowView : public views::View { + void AddToggleButton(const std::u16string& toggle_accessible_name, + int icon_label_spacing); +@@ -86,6 +98,10 @@ class PermissionToggleRowView : public views::View { raw_ptr toggle_button_ = nullptr; raw_ptr spacer_view_ = nullptr; @@ -1169,17 +1172,17 @@ diff --git a/chrome/browser/ui/webui/settings/settings_localized_strings_provide #include "build/branding_buildflags.h" #include "build/build_config.h" #include "build/buildflag.h" -@@ -78,6 +79,9 @@ +@@ -77,6 +78,9 @@ + #include "components/google/core/common/google_util.h" #include "components/history/core/common/pref_names.h" #include "components/history_embeddings/history_embeddings_features.h" - #include "components/omnibox/common/omnibox_features.h" +#include "components/content_settings/core/browser/content_settings_registry.h" +#include "components/content_settings/core/browser/website_settings_info.h" +#include "components/content_settings/core/browser/website_settings_registry.h" #include "components/password_manager/core/browser/leak_detection_dialog_utils.h" #include "components/password_manager/core/browser/manage_passwords_referrer.h" #include "components/password_manager/core/common/password_manager_features.h" -@@ -3809,6 +3813,56 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source, +@@ -3773,6 +3777,56 @@ void AddLocalizedStrings(content::WebUIDataSource* html_source, policy_indicator::AddLocalizedStrings(html_source); AddSecurityKeysStrings(html_source); @@ -1269,7 +1272,7 @@ diff --git a/chrome/browser/ui/webui/settings/site_settings_helper.cc b/chrome/b struct SiteSettingSourceStringMapping { SiteSettingSource source; -@@ -504,6 +506,13 @@ bool HasRegisteredGroupName(ContentSettingsType type) { +@@ -503,6 +505,13 @@ bool HasRegisteredGroupName(ContentSettingsType type) { return true; } } @@ -1283,7 +1286,7 @@ diff --git a/chrome/browser/ui/webui/settings/site_settings_helper.cc b/chrome/b return false; } -@@ -517,11 +526,24 @@ ContentSettingsType ContentSettingsTypeFromGroupName(std::string_view name) { +@@ -516,11 +525,24 @@ ContentSettingsType ContentSettingsTypeFromGroupName(std::string_view name) { return entry.type; } } @@ -1309,15 +1312,15 @@ diff --git a/chrome/browser/ui/webui/settings/site_settings_helper.cc b/chrome/b for (const auto& entry : kContentSettingsTypeGroupNames) { if (type == entry.type) { // Content setting types that aren't represented in the settings UI -@@ -536,7 +558,6 @@ std::string_view ContentSettingsTypeToGroupName(ContentSettingsType type) { +@@ -535,7 +557,6 @@ std::string_view ContentSettingsTypeToGroupName(ContentSettingsType type) { return entry.name ? entry.name : std::string_view(); } } - - NOTREACHED_IN_MIGRATION() << static_cast(type) - << " is not a recognized content settings type."; - return std::string_view(); -@@ -643,6 +664,13 @@ std::vector GetVisiblePermissionCategories( + NOTREACHED() << static_cast(type) + << " is not a recognized content settings type."; + } +@@ -642,6 +663,13 @@ std::vector GetVisiblePermissionCategories( base_types->push_back(ContentSettingsType::WEB_APP_INSTALLATION); } @@ -1334,7 +1337,7 @@ diff --git a/chrome/browser/ui/webui/settings/site_settings_helper.cc b/chrome/b diff --git a/components/browser_ui/settings/android/BUILD.gn b/components/browser_ui/settings/android/BUILD.gn --- a/components/browser_ui/settings/android/BUILD.gn +++ b/components/browser_ui/settings/android/BUILD.gn -@@ -84,6 +84,7 @@ android_resources("java_resources") { +@@ -86,6 +86,7 @@ android_resources("java_resources") { "java/res/layout/managed_disclaimer_preference_for_radio_groups.xml", "java/res/layout/preference_chrome_image_view.xml", "java/res/layout/preference_spinner.xml", @@ -1497,7 +1500,7 @@ diff --git a/components/browser_ui/settings/android/widget/java/src/org/chromium 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 -@@ -146,6 +146,23 @@ android_library("java") { +@@ -147,6 +147,23 @@ android_library("java") { ":site_settings_jni_headers", "//components/content_settings/android:java_pref_names_srcjar", ] @@ -1521,7 +1524,7 @@ diff --git a/components/browser_ui/site_settings/android/BUILD.gn b/components/b } android_library("javatests") { -@@ -194,6 +211,7 @@ robolectric_library("junit") { +@@ -195,6 +212,7 @@ robolectric_library("junit") { } android_resources("java_resources") { @@ -2178,7 +2181,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c int icon, int title, @ContentSettingValues @Nullable Integer defaultEnabledValue, -@@ -425,6 +425,8 @@ public class ContentSettingsResources { +@@ -435,6 +435,8 @@ public class ContentSettingsResources { R.string.website_settings_category_vr_blocked, R.string.website_settings_category_vr_a11y); } @@ -2187,7 +2190,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c assert false; // NOTREACHED return null; } -@@ -583,6 +585,14 @@ public class ContentSettingsResources { +@@ -593,6 +595,14 @@ public class ContentSettingsResources { return getResourceItem(contentType).getDefaultDisabledValue(); } @@ -2202,7 +2205,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c /** * Returns the string resource id for a given ContentSetting to show with a permission category. * -@@ -746,6 +756,8 @@ public class ContentSettingsResources { +@@ -756,6 +766,8 @@ public class ContentSettingsResources { * Blocked states, in that order. */ public static int[] getTriStateSettingDescriptionIDs(int contentType) { @@ -2276,25 +2279,31 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c if (BINARY_TOGGLE_KEY.equals(preference.getKey())) { assert !mCategory.isManaged(); boolean toggleValue = (boolean) newValue; -@@ -812,6 +831,8 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment - .website_settings_allowed_group_heading_request_desktop_site; - break; +@@ -791,7 +810,7 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment + ? R.string.website_settings_blocked_group_heading_request_desktop_site + : R.string.website_settings_allowed_group_heading_request_desktop_site; } -+ if (resource == 0) -+ resource = BromiteCustomContentSettingImpl.getAddExceptionDialogMessage(mCategory); - assert resource > 0; - return getString(resource); +- return 0; ++ return BromiteCustomContentSettingImpl.getAddExceptionDialogMessage(mCategory); } -@@ -927,6 +948,8 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment + + // OnPreferenceClickListener: +@@ -904,10 +923,11 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment default: break; } +- +- int exceptionDialogMessageResourceId = getAddExceptionDialogMessageResourceId(); +- assert allowSpecifyingExceptions == (exceptionDialogMessageResourceId != 0); + Boolean allow = BromiteCustomContentSettingImpl.allowSpecifyingExceptions(mCategory); + if (allow != null) allowSpecifyingExceptions = (boolean)allow; if (allowSpecifyingExceptions) { ++ int exceptionDialogMessageResourceId = getAddExceptionDialogMessageResourceId(); ++ assert exceptionDialogMessageResourceId != 0; getPreferenceScreen() .addPreference( -@@ -1112,8 +1135,16 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment + new AddExceptionPreference( +@@ -1092,8 +1112,16 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment private boolean isBlocked() { switch (mGlobalToggleLayout) { case GlobalToggleLayout.TRI_STATE_TOGGLE: @@ -2311,7 +2320,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c return (triStateToggle.getCheckedSetting() == ContentSettingValues.BLOCK); case GlobalToggleLayout.TRI_STATE_COOKIE_TOGGLE: TriStateCookieSettingsPreference triStateCookieToggle = -@@ -1180,7 +1211,11 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment +@@ -1160,7 +1188,11 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment } else if (mCategory.getType() == SiteSettingsCategory.Type.STORAGE_ACCESS) { infoText.setSummary(getStorageAccessSummary()); } else { @@ -2324,7 +2333,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c } // Hide the anti-abuse text preferences, as needed. -@@ -1217,6 +1252,7 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment +@@ -1197,6 +1229,7 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment } else { screen.removePreference(mLocationTriStatePref); } @@ -2332,7 +2341,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c if (permissionBlockedByOs) { maybeShowOsWarning(screen); -@@ -1373,7 +1409,7 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment +@@ -1355,7 +1388,7 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment getSiteSettingsDelegate().getBrowserContextHandle(), contentType); int[] descriptionIds = ContentSettingsResources.getTriStateSettingDescriptionIDs(contentType); @@ -2341,7 +2350,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c } private void configureBinaryToggle(ChromeSwitchPreference binaryToggle, int contentType) { -@@ -1497,6 +1533,14 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment +@@ -1479,6 +1512,14 @@ public class SingleCategorySettings extends BaseSiteSettingsFragment @ContentSettingValues Integer value = site.getContentSetting(browserContextHandle, contentSettingsType); @@ -2367,16 +2376,16 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c /** Shows the permissions and other settings for a particular website. */ public class SingleWebsiteSettings extends BaseSiteSettingsFragment -@@ -172,7 +173,7 @@ public class SingleWebsiteSettings extends BaseSiteSettingsFragment - case ContentSettingsType.CLIPBOARD_READ_WRITE: - return "clipboard_permission_list"; +@@ -175,7 +176,7 @@ public class SingleWebsiteSettings extends BaseSiteSettingsFragment + case ContentSettingsType.FILE_SYSTEM_WRITE_GUARD: + return "file_system_write_guard_permission_list"; default: - return null; + return BromiteCustomContentSettingImpl.getProfilePrefKey(type); } } -@@ -543,8 +544,21 @@ public class SingleWebsiteSettings extends BaseSiteSettingsFragment +@@ -564,8 +565,21 @@ public class SingleWebsiteSettings extends BaseSiteSettingsFragment private void setupContentSettingsPreferences() { mMaxPermissionOrder = findPreference(PREF_PERMISSIONS_HEADER).getOrder(); @@ -2400,7 +2409,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c preference.setKey(getPreferenceKey(type)); if (type == ContentSettingsType.ADS) { -@@ -1090,20 +1104,32 @@ public class SingleWebsiteSettings extends BaseSiteSettingsFragment +@@ -1142,20 +1156,30 @@ public class SingleWebsiteSettings extends BaseSiteSettingsFragment @ContentSettingValues @Nullable Integer value, boolean isEmbargoed, boolean isOneTime) { @@ -2417,7 +2426,9 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c setUpPreferenceCommon(preference, value); - ChromeSwitchPreference switchPreference = (ChromeSwitchPreference) preference; -- switchPreference.setChecked(value == ContentSettingValues.ALLOW); +- @ContentSettingsType.EnumType +- int contentType = getContentSettingsTypeFromPreferenceKey(preference.getKey()); +- switchPreference.setChecked(value == getEnabledValue(contentType)); + Preference switchPreference = preference; + if (preference instanceof ChromeSwitchPreference) { + ((ChromeSwitchPreference)switchPreference).setChecked(value != ContentSettingValues.BLOCK); @@ -2430,8 +2441,6 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c - : getString(ContentSettingsResources.getCategorySummary(value, isOneTime))); + : getString(ContentSettingsResources.getCategorySummary(content_type, value, isOneTime))); switchPreference.setOnPreferenceChangeListener(this); - @ContentSettingsType.EnumType - int contentType = getContentSettingsTypeFromPreferenceKey(preference.getKey()); - if (contentType == mHighlightedPermission) { - switchPreference.setBackgroundColor( + if (preference instanceof ChromeSwitchPreference && contentType == mHighlightedPermission) { @@ -2439,9 +2448,9 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c AppCompatResources.getColorStateList(getContext(), mHighlightColor) .getDefaultColor()); } -@@ -1321,14 +1347,20 @@ public class SingleWebsiteSettings extends BaseSiteSettingsFragment - permission = - (Boolean) newValue ? ContentSettingValues.ALLOW : ContentSettingValues.BLOCK; +@@ -1376,14 +1400,20 @@ public class SingleWebsiteSettings extends BaseSiteSettingsFragment + if (newValue instanceof Boolean) { + permission = (Boolean) newValue ? getEnabledValue(type) : ContentSettingValues.BLOCK; } else { - permission = (Integer) newValue; + Integer newPermission = @@ -2491,7 +2500,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c Preference p = findPreference(prefCategory); int contentType = SiteSettingsCategory.contentSettingsType(prefCategory); // p can be null if the Preference was removed in configurePreferences. -@@ -171,19 +172,21 @@ public class SiteSettings extends BaseSiteSettingsFragment +@@ -174,19 +175,21 @@ public class SiteSettings extends BaseSiteSettingsFragment } else if (Type.ZOOM == prefCategory) { // Don't want to set a summary for Zoom because we don't want any message to display // under the Zoom row on site settings. @@ -2528,25 +2537,25 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/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 -@@ -73,7 +73,7 @@ public class SiteSettingsCategory { - Type.ZOOM, +@@ -74,7 +74,7 @@ public class SiteSettingsCategory { Type.STORAGE_ACCESS, Type.TRACKING_PROTECTION, + Type.FILE_EDITING, - Type.NUM_ENTRIES + Type.NUM_ENTRIES_CHROMIUM }) @Retention(RetentionPolicy.SOURCE) public @interface Type { -@@ -113,7 +113,7 @@ public class SiteSettingsCategory { - int HAND_TRACKING = 31; +@@ -115,7 +115,7 @@ public class SiteSettingsCategory { + int FILE_EDITING = 32; /** Number of handled categories used for calculating array sizes. */ -- int NUM_ENTRIES = 32; -+ int NUM_ENTRIES_CHROMIUM = 32; +- int NUM_ENTRIES = 33; ++ int NUM_ENTRIES_CHROMIUM = 33; } private final BrowserContextHandle mBrowserContextHandle; -@@ -162,6 +162,9 @@ public class SiteSettingsCategory { +@@ -164,6 +164,9 @@ public class SiteSettingsCategory { } else { permission = ""; } @@ -2556,7 +2565,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c return new SiteSettingsCategory(browserContextHandle, type, permission); } -@@ -170,7 +173,7 @@ public class SiteSettingsCategory { +@@ -172,7 +175,7 @@ public class SiteSettingsCategory { @ContentSettingsType.EnumType int contentSettingsType) { assert contentSettingsType != -1; assert Type.ALL_SITES == 0; @@ -2565,7 +2574,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c if (contentSettingsType(i) == contentSettingsType) { return createFromType(browserContextHandle, i); } -@@ -181,7 +184,7 @@ public class SiteSettingsCategory { +@@ -183,7 +186,7 @@ public class SiteSettingsCategory { public static SiteSettingsCategory createFromPreferenceKey( BrowserContextHandle browserContextHandle, String preferenceKey) { assert Type.ALL_SITES == 0; @@ -2574,7 +2583,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c if (preferenceKey(i).equals(preferenceKey)) { return createFromType(browserContextHandle, i); } -@@ -254,8 +257,7 @@ public class SiteSettingsCategory { +@@ -258,8 +261,7 @@ public class SiteSettingsCategory { case Type.TRACKING_PROTECTION: return ContentSettingsType.DEFAULT; // Conversion unavailable. } @@ -2584,7 +2593,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c } /** -@@ -342,8 +344,12 @@ public class SiteSettingsCategory { +@@ -348,8 +350,12 @@ public class SiteSettingsCategory { case Type.ZOOM: return "zoom"; default: @@ -2600,7 +2609,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsDelegate.java b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsDelegate.java --- a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsDelegate.java +++ b/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SiteSettingsDelegate.java -@@ -198,6 +198,8 @@ public interface SiteSettingsDelegate { +@@ -217,6 +217,8 @@ public interface SiteSettingsDelegate { */ String getRelatedWebsiteSetOwner(String memberOrigin); @@ -2656,7 +2665,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/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 -@@ -326,7 +326,11 @@ public final class Website implements WebsiteEntry { +@@ -327,7 +327,11 @@ public final class Website implements WebsiteEntry { RecordUserAction.record("SoundContentSetting.UnmuteBy.SiteSettings"); } } @@ -2672,7 +2681,7 @@ diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/c diff --git a/components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/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 -@@ -108,7 +108,7 @@ public class WebsitePermissionsFetcher { +@@ -110,7 +110,7 @@ public class WebsitePermissionsFetcher { case ContentSettingsType.USB_GUARD: return WebsitePermissionsType.CHOSEN_OBJECT_INFO; default: @@ -2838,7 +2847,7 @@ diff --git a/components/content_settings/core/browser/content_settings_uma_util. 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 -@@ -19,6 +19,7 @@ +@@ -20,6 +20,7 @@ #include "build/build_config.h" #include "components/content_settings/core/browser/content_settings_registry.h" #include "components/content_settings/core/browser/host_content_settings_map.h" @@ -2846,7 +2855,7 @@ diff --git a/components/content_settings/core/browser/content_settings_utils.cc #include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings_types.h" #include "components/content_settings/core/common/content_settings_utils.h" -@@ -127,6 +128,17 @@ PatternPair ParsePatternString(const std::string& pattern_str) { +@@ -128,6 +129,17 @@ PatternPair ParsePatternString(const std::string& pattern_str) { void GetRendererContentSettingRules(const HostContentSettingsMap* map, RendererContentSettingRules* rules) { @@ -3291,7 +3300,7 @@ diff --git a/components/page_info/android/java/src/org/chromium/components/page_ diff --git a/components/page_info/android/java/src/org/chromium/components/page_info/PermissionParamsListBuilder.java b/components/page_info/android/java/src/org/chromium/components/page_info/PermissionParamsListBuilder.java --- a/components/page_info/android/java/src/org/chromium/components/page_info/PermissionParamsListBuilder.java +++ b/components/page_info/android/java/src/org/chromium/components/page_info/PermissionParamsListBuilder.java -@@ -109,6 +109,7 @@ public class PermissionParamsListBuilder { +@@ -110,6 +110,7 @@ public class PermissionParamsListBuilder { permissionParams.allowed = true; break; case ContentSettingValues.BLOCK: @@ -3310,7 +3319,7 @@ diff --git a/components/page_info/android/page_info_controller_android.cc b/comp #include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings_types.h" #include "components/page_info/android/page_info_client.h" -@@ -162,6 +163,15 @@ void PageInfoControllerAndroid::SetPermissionInfo( +@@ -164,6 +165,15 @@ void PageInfoControllerAndroid::SetPermissionInfo( } permissions_to_display.push_back(ContentSettingsType::STORAGE_ACCESS); @@ -3326,7 +3335,7 @@ diff --git a/components/page_info/android/page_info_controller_android.cc b/comp std::map user_specified_settings_to_display; std::map -@@ -221,6 +231,14 @@ std::optional PageInfoControllerAndroid::GetSettingToDisplay( +@@ -223,6 +233,14 @@ std::optional PageInfoControllerAndroid::GetSettingToDisplay( return permission.setting; } @@ -3352,7 +3361,7 @@ diff --git a/components/page_info/page_info.cc b/components/page_info/page_info. #include "components/content_settings/browser/ui/cookie_controls_controller.h" #include "components/content_settings/core/browser/content_settings_registry.h" #include "components/content_settings/core/browser/content_settings_uma_util.h" -@@ -1249,6 +1250,14 @@ void PageInfo::PopulatePermissionInfo(PermissionInfo& permission_info, +@@ -1262,6 +1263,14 @@ void PageInfo::PopulatePermissionInfo(PermissionInfo& permission_info, // applies to permissions listed in |kPermissionType|. bool PageInfo::ShouldShowPermission( const PageInfo::PermissionInfo& info) const { @@ -3367,7 +3376,7 @@ diff --git a/components/page_info/page_info.cc b/components/page_info/page_info. // Note |ContentSettingsType::ADS| will show up regardless of its default // value when it has been activated on the current origin. if (info.type == ContentSettingsType::ADS) { -@@ -1370,7 +1379,19 @@ void PageInfo::PresentSitePermissions() { +@@ -1378,7 +1387,19 @@ void PageInfo::PresentSitePermissions() { HostContentSettingsMap* content_settings = GetContentSettings(); DCHECK(web_contents_); @@ -3413,7 +3422,7 @@ diff --git a/components/page_info/page_info_ui.cc b/components/page_info/page_in switch (type) { case ContentSettingsType::GEOLOCATION: message_id = IDS_PAGE_INFO_STATE_TEXT_LOCATION_ASK; -@@ -630,6 +638,12 @@ PageInfoUI::~PageInfoUI() = default; +@@ -627,6 +635,12 @@ PageInfoUI::~PageInfoUI() = default; // static std::u16string PageInfoUI::PermissionTypeToUIString(ContentSettingsType type) { @@ -3426,7 +3435,7 @@ diff --git a/components/page_info/page_info_ui.cc b/components/page_info/page_in for (const PermissionUIInfo& info : GetContentSettingsUIInfo()) { if (info.type == type) return l10n_util::GetStringUTF16(info.string_id); -@@ -641,6 +655,12 @@ std::u16string PageInfoUI::PermissionTypeToUIString(ContentSettingsType type) { +@@ -637,6 +651,12 @@ std::u16string PageInfoUI::PermissionTypeToUIString(ContentSettingsType type) { // static std::u16string PageInfoUI::PermissionTypeToUIStringMidSentence( ContentSettingsType type) { @@ -3439,7 +3448,7 @@ diff --git a/components/page_info/page_info_ui.cc b/components/page_info/page_in for (const PermissionUIInfo& info : GetContentSettingsUIInfo()) { if (info.type == type) return l10n_util::GetStringUTF16(info.string_id_mid_sentence); -@@ -1086,6 +1106,11 @@ bool PageInfoUI::ContentSettingsTypeInPageInfo(ContentSettingsType type) { +@@ -1078,6 +1098,11 @@ bool PageInfoUI::ContentSettingsTypeInPageInfo(ContentSettingsType type) { if (info.type == type) return true; }