diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 782bf25a0806e9078a0edbf21d96d420f4dd9ad4..0000000000000000000000000000000000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -name: Bug report -about: Create a Bromite bug report - ---- - - - -### Bromite version - -Version: `89.0...` -Arch: `arm` or `arm64` or `x86` -Android version: (example: `9.0`) -Device model: (example: `SM-G960UZKABST`) - -### Flags - -These are the flags changed under `chrome://flags`: - - - -### Is this bug about the SystemWebView? - - - -Yes/No - -### Is the bug reproducible with latest version? - - - -Yes/No - -### Can the bug be reproduced with corresponding Chromium version? - - - -Yes/No - -### Is this bug happening in an incognito tab? -Yes/No - -### Allow ads for the site; is the bug caused by the adblocker? -Yes/No - -### Is the bug a crash? - -No - --- or -- - -Yes, this is the crash dump: -``` - -``` - -### Describe the bug - - - -### Steps to reproduce the bug - -Steps to reproduce the bug: -1. Go to '...' -2. Click on '...' -3. Scroll down to '...' -4. See error - -Do not write "any website", specify which URLs can be used to reproduce the issue. - -### Expected behavior - - - -### Screenshots - - diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml new file mode 100644 index 0000000000000000000000000000000000000000..1f211ea43c7674c9a9c462b3660a7d6b9b426428 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -0,0 +1,212 @@ +name: Bug report +description: Create a Bromite bug report +body: + - type: markdown + attributes: + value: | + Welcome! Thanks for taking the time to submit a bug report. + + If this is not a bug about the Bromite browser, or you are looking for a place to ask a question to the community, + then please use the [GitHub Discussions](https://github.com/bromite/bromite/discussions) instead. + + Make sure you have acknowledged and completed this template before submitting your issue. + + Please read it carefully: incorrect issues will be automatically closed and ignored. + + - type: checkboxes + id: preliminary_checklist + attributes: + label: Preliminary checklist + options: + - label: "I have read the [README](https://github.com/bromite/bromite/blob/master/README.md)." + required: true + - label: "I have searched the existing issues for my problem. This is a new ticket, NOT a duplicate or related to another open issue." + required: true + - label: "I have read the [FAQs](https://github.com/bromite/bromite/blob/master/FAQ.md)." + required: true + - label: "I have updated Bromite to the latest version. The bug is reproducible on this latest version." + required: true + - label: "This is a bug report about the Bromite browser; not the website nor F-Droid nor anything else." + required: true + + - type: dropdown + id: is_chromium + attributes: + label: Can the bug be reproduced with corresponding Chromium version? + description: | + Please pick the same version of Chromium as Bromite from here: https://github.com/bromite/chromium/releases + If the bug is reproducible then it might be a configuration issue or an upstream bug. Upstream bugs can be reported on the [Chromium issue tracker](https://bugs.chromium.org/p/chromium/issues/list) and + do not forget to read [Chromium project bug reporting guidelines](https://www.chromium.org/for-testers/bug-reporting-guidelines) first. + + If the bug is related to functionality that does not exist in Chromium then answer "No". + multiple: false + options: + - "Yes" + - "No" + validations: + required: true + + - type: input + id: bromite_version + attributes: + label: Bromite version + description: What version of Bromite are you using? Please specify a single version e.g. `96.0.4664.1` not `latest`. If this is not the latest version then please update and retry before submitting this bug report. + validations: + required: true + + - type: dropdown + id: device_architecture + attributes: + label: Device architecture + multiple: false + options: + - arm + - arm64 + - arm64-v8a + - armeabi-v7a + - x86 + - x64 + validations: + required: true + + - type: dropdown + id: android_version + attributes: + label: Android version + multiple: false + description: What version of Android are you running? + options: + - 12.1 + - 12.0 + - 11 + - 10 + - 9 + - 8.1 + - 8.0 + - 7.1 + - 7.0 + - 6 + - 5.1 + - 5.0 + - 4.4 + - 4.3 + - 4.2 + - 4.1 + - 4.0 + validations: + required: true + + - type: input + id: device_model + attributes: + label: Device model + description: What is your device model? This can usually be found in your device's settings in the "About" section. + placeholder: (e.g. `OnePlus 8 (IN2010)`, or `SM-G960UZKABST`, etc.) + validations: + required: true + + - type: textarea + id: changed_flags + attributes: + label: Changed flags + description: | + These are the flags changed under `chrome://flags`. + Report all the flags with non-default configuration (they will be blue-highlighted). + + If no flags are changed then write 'no flags changed'. + placeholder: show-overdraw-feedback, enable-parallel-downloading + validations: + required: true + + - type: dropdown + id: is_system_webview + attributes: + label: Is this bug about the SystemWebView? + description: Please note that no support for System WebView installation is provided. + multiple: false + options: + - "Yes" + - "No" + validations: + required: true + + - type: dropdown + id: is_incognito + attributes: + label: Is this bug happening in an incognito tab? + multiple: false + options: + - "Yes" + - "No" + validations: + required: true + + - type: dropdown + id: adblock + attributes: + label: Is this bug caused by the adblocker? + description: You can test this by temporarily allowing ads for the site. + multiple: false + options: + - "Yes" + - "No" + validations: + required: true + + - type: textarea + id: bug_crash + attributes: + label: Is this bug a crash? + description: | + 1. No. + 2. Yes, I have attached the crash report dump that I downloaded from `chrome://crashes` + 3. Yes, I have copy/pasted the crash dump + placeholder: | + Drag the crash report dump here to attach it or paste the logcat dump individuated with `adb logcat | grep -E '( cr_|bromite|chromium)'`. + validations: + required: true + + - type: textarea + id: bug_description + attributes: + label: Describe the bug + description: Write a clear and concise description of the bug. + validations: + required: true + + - type: textarea + id: bug_steps + attributes: + label: Steps to reproduce the bug + description: | + Explain how to cause the bug as clearly as possible. Bugs that are not reproducible cannot be investigated. + + Also, do not write "any website": please specify which URLs can be used to reproduce the issue. + placeholder: | + Steps to reproduce the bug (e.g.): + 1. Go to '...' + 2. Click on '...' + 3. Scroll down to '...' + 4. See error + validations: + required: true + + - type: textarea + id: expected_behavior + attributes: + label: Expected behavior + description: A clear and concise description of what you expected to happen. + validations: + required: true + + - type: textarea + id: screenshots + attributes: + label: Screenshots + description: | + If applicable, add screenshots to help explain your problem. + Otherwise, ignore this section. + placeholder: | + Drag the screenshot files here to attach them. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 8540ae0a1c687150e052536d5a2a4ea814107ea6..0000000000000000000000000000000000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: Feature request -about: Suggest a privacy-related idea for this project - ---- - - - - - -### Is your feature request related to privacy? - - - -### Is there a patch available for this feature somewhere? - - - -### Describe the solution you would like - - - -### Describe alternatives you have considered - - diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml new file mode 100644 index 0000000000000000000000000000000000000000..a3dd75e0e005dcde34cfa504283f3f70a47e0935 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -0,0 +1,68 @@ +name: Feature request +description: Create a Bromite feature request +body: + - type: markdown + attributes: + value: | + Welcome! Thanks for taking time to submit a feature request. + + If this is not a feature request about the Bromite browser, or you are looking for a place + to ask a question to the community then please use the [GitHub Discussions](https://github.com/bromite/bromite/discussions) instead. + + Make sure you have acknowledged and completed this template before submitting your issue. + + Please read it carefully: incorrect issues will be automatically closed and ignored. + + Note: + - Features unrelated to privacy will not be considered. + - Do not ask "I would like feature X which is available in browser Y." + + - type: checkboxes + id: preliminary_checklist + attributes: + label: Preliminary checklist + options: + - label: "I have read the [README](https://github.com/bromite/bromite/blob/master/README.md)" + required: true + - label: "I have read the [FAQs](https://github.com/bromite/bromite/blob/master/FAQ.md)." + required: true + - label: "I have searched [existing issues](https://github.com/bromite/bromite/issues) for my feature request. This is a new issue (NOT a duplicate) and is not related to another issue." + required: true + - label: "This is a feature request for the Bromite browser; not the website nor F-Droid nor anything else." + required: true + + - type: dropdown + id: is_privacy_related + attributes: + label: Is your feature request related to privacy? + description: Features that are not related to privacy are not considered. + multiple: false + options: + - "Yes" + - "No" + validations: + required: true + + - type: textarea + id: is_patch_available + attributes: + label: Is there a patch available for this feature somewhere? + description: If yes please provide URL and related license information. + validations: + required: true + + - type: textarea + id: solution_description + attributes: + label: Describe the solution you would like + description: A clear and concise description of what you want to happen. + validations: + required: true + + - type: textarea + id: alternatives_considered + attributes: + label: Describe alternatives you have considered + description: A clear and concise description of any alternative solutions or features you have considered. + validations: + required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000000000000000000000000000000000000..50edb99a5729c7d434672e0e1d9fca61146798f8 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,15 @@ +## Description + +*Please explain here what feature or bugfix these changes are addressing and why they should be included* + +## All submissions + +* [ ] there are no other open [Pull Requests](../../../pulls) for the same update/change +* [ ] Bromite can be built with these changes +* [ ] I have tested that the new change works as intended (AVD or physical device will do) + +### Format + +* [ ] patch subject and filename match (e.g. `Subject: Alternative cache (NIK-based)` -> `Alternative-cache-NIK-based.patch`) +* [ ] patch description contains explanation of changes +* [ ] no unnecessary whitespace or unrelated changes diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..18b4cac418161330f68270b9293b8e4036250fd3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +################################################################################ +# This .gitignore file was automatically created by Microsoft(R) Visual Studio. +################################################################################ + +/.vs/bromite-uazo/config +/.vs/bromite-uazo/FileContentIndex +/.vs diff --git a/CHANGELOG.md b/CHANGELOG.md index aae328e940bfff552b0958eb75a2dc72cf1ced2b..29246afad51c6fb93977f76fc4b9b49fafa276f6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,238 @@ +# 105.0.5195.41 +* revert by-pass for clipboard permissions for NTP doodles (fixes https://bugs.chromium.org/p/chromium/issues/detail?id=1334203) +* prevent history detection via favicon (fixes https://github.com/bromite/bromite/issues/2269) +* fix the lack of protection in canvas.convertToBlob() +* improve incognito mode detection countermeasures (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1615) +* fix toolbar gesture when using bottom navigation bar (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2253) + +# 104.0.5112.91 +* re-introduce modal flag to prompt when closing all tabs +* sharing hub: always use visible URL (fixes https://github.com/bromite/bromite/issues/2204) +* add SVG fingerprinting mitigation (thanks to @uazo) +* updated zh_CN translactions (thanks to @zhmars) +* dropped patch to open YouTube links in Bromite + +# 104.0.5112.63 + +# 103.0.5060.140 +* fix timezone override not working correctly (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2133) +* never provide navigator.connection info (thanks to @uazo) +* fix management of custom User-Agent (thanks to @uazo) + +# 103.0.5060.126 +* fix malfunctioning sticky desktop mode (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2179) +* fix non-working passwords manager (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2188) +* fix crash when opening recent tabs (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2190) +* fix autoplay not working correctly (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2096) +* add GN flag for clangd builds (thanks to @uazo) + +# 103.0.5060.121 +* do not enable always use HTTPS by default +* match system dark mode (thanks to @krlvm) +* remove window name on cross origin navigation (thanks to @uazo) +* remove preload of GMS fonts on stock Android (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2156) + +# 102.0.5005.96 +* fix history expiration bug (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2104) +* fix category setting activation (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2091) +* improve plain text rendering on mobile +* rewritten certificate transparency patch (fixes https://github.com/bromite/bromite/issues/2101) + +# 102.0.5005.92 +* restore offline-indicator-v2 flag functionality (thanks to @Zelda189) + +# 102.0.5005.67 +* dropped patch to disable mobile identity consistency by default +* fix text for blocked ads (fixes https://github.com/bromite/bromite/issues/2026) +* fix OpenSeach visited site detection bug (fixes https://github.com/bromite/bromite/issues/1994) + +# 101.0.4951.69 +* flag to toggle site engagement (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2022) +* site settings to enable webGL (thanks to @uazo) +* removed flag to disable webGL +* fix bottom navigation bar search/site suggestions behaviour (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2049) +* enable process isolation for all iframes +* add webRTC site settings (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1965) + +# 101.0.4951.53 +* move incognito settings to separate page (thanks to @uazo) +* disable automatic offline pages saving by default (thanks to @uazo) +* make history support and site settings in always incognito mode disabled by default (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1991) +* move pop-up toolbar to the bottom when using bottom navigation bar (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2030) +* menu does not show all entries (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/2011) +* stray shadow when using bottom toolbar (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1995) + +# 101.0.4951.39 +* save only ContentSettings in always-incognito mode (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1942) +* fix a couple issues related to signin and metrics leftover code affecting debug builds (thanks to @uazo) +* remove some more parameters from the English-version search engine (thanks to @uazo) +* add welcome screen with mention of privacy statements (fixes https://github.com/bromite/bromite/issues/691) + +# 100.0.4896.135 +* remove mremap from seccomp baseline policy +* add flag to move top toolbar to bottom (thanks to @uazo) + +# 100.0.4896.92 +* improve user script errors and visualized name (thanks to @uazo) +* fix autofill password not working anymore (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1956) +* mark sites as visited when they have an already-parsed OpenSearch descriptor +* disable TLS resumption by default (thanks to @uazo) +* partition DoH requests by top-frame NIK (thanks to @uazo) + +# 100.0.4896.83 +* update zh_CN translations (thanks to @zhmars) +* fix custom UA reported via Javascript (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1936) +* introduce session granularity for permissions (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1549) +* disable crash reporting +* avoid script injection on some sites +* fix upstream OpenSearch bug with search engines prematurely discarded +* fix upstream DNS bug with inconsistent Android system DNS configuration (fixes https://github.com/bromite/bromite/issues/1960) +* use less invasive approach to protect local IP address when using webRTC (fixes https://github.com/bromite/bromite/issues/589) +* add menu entry to select all bookmarks (fixes https://github.com/bromite/bromite/issues/1959) +* fix Note 9 crash on startup (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1871) +* remove passwords menu entry for leak check +* remove privacy menu entry to use phone as a security key + +# 100.0.4896.57 +* allow OpenSearch search engine URLs with path +* disable AsyncDNS by default +* remove translate menu entries +* fix patch to remove contextual search (thanks to @nikolowry) +* add option to never expire history +* improve description for JIT site settings (fixes https://github.com/bromite/bromite/issues/1931) +* remove more signin integration (fixes https://github.com/bromite/bromite/issues/1902) +* miscellaneous fixes for AMP and background video playback (fixes https://github.com/bromite/bromite/issues/1921) +* update zh_CN translations (thanks to @zhmars) + +# 99.0.4844.77 +* fix missing adaptive icon for updates +* do not close adblock filters editor when tapping reset button +* change text for 'Never' in history days to keep setting +* bring back dictionary hints in address bar + +# 99.0.4844.58 +* remove contextual search (fixes https://github.com/bromite/bromite/issues/1750) +* remove global JIT settings +* add privacy setting for how many number of days of history to keep (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1870) +* disable UA full version (thanks to @uazo) +* reintroduce patch for Save-Data header +* updated zh_CN translations (thanks to @zhmars) +* reintroduce Save-Data header flag + +# 99.0.4844.55 +* flag to enable Certificate Transparency (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1554) +* allow adding search engines from incognito mode +* disable all predictors code (thanks to @uazo) +* revert allow block of view-source URLs +* enable StrictOriginIsolation and SitePerProcess for all devices (thanks to @uazo) +* JIT toggle site setting (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1720 and https://github.com/bromite/bromite/issues/1819) +* move always incognito preference to native (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1496 and https://github.com/bromite/bromite/issues/1568) +* remove Save-Data header flag +* close a potential security issue with user scripts on native pages (thanks to @uazo) +* disable safety checks and possible Omaha interactions +* disable SegmentationPlatformFeature and Optimization Hints (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1632) +* add notification for a major upstream version being released (fixes https://github.com/bromite/bromite/issues/1796) +* fix screenshots in incognito allowed by default (fixes https://github.com/bromite/bromite/issues/1816) + +# 98.0.4758.116 +* disable minidumps upload +* complete disabling of client hint headers (thanks to @uazo) +* disable another way to activate origin trials (thanks to @uazo) +* fix for gateway attacks via websockets blocking (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1693) + +# 98.0.4758.108 +* re-introduce flag for text fragments +* re-introduce content feature flag to disable field trials +* disable idle detection +* disable critical client hints +* disable supervised users +* partial fix for incognito notification (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1503) +* consider websockets 'unknown' address space as 'public' (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1693) +* fix crash when accessing site settings of some sites (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1355) + +# 97.0.4692.106 +* disable url-keyed metrics reporting service (thanks to @uazo) +* disable mobile identity consistency by default +* disable appending variations header +* use Google Chrome branding for client hints +* make HTTPS-only mode enabled by default +* enable trivial auto var init (thanks to @BayLee4, fixes https://github.com/bromite/bromite/issues/1749) +* enable use_cfi_cast + +# 96.0.4664.183 +* updated zh_CN translations (thanks to @zhmars) + +# 96.0.4664.104 +* separate patches for package name + +# 96.0.4664.54 +* restored offline-indicator-v2 flag (fixes https://github.com/bromite/bromite/issues/1588) +* re-introduced option to use home page as NTP (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1519) +* ask user before closing all tabs (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1561) +* fix crash on always incognito on tablet (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1611) +* dropped patch to not upload crash data +* fix autofill pop-up not appearing (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1534) + +# 95.0.4638.79 +* improvements for field trials disable patch (thanks to @uazo) +* remove privacy sandbox UI leftover (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1560) +* disable conversion measurement API (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1531) +* remove all code related to FLoC (thanks to @uazo) +* remove all code related to ENABLE_REPORTING (thanks to @uazo) +* enable ad-tagging feature +* SystemWebView: ignore StrictMode warning (thanks to @jylitalbit, https://github.com/bromite/bromite/pull/1567) +* improvements for field trials fetch patch (thanks to @uazo) +* disable accessibility service by default (thanks to @uazo, https://github.com/bromite/bromite/pull/1559) + +# 95.0.4638.78 +* disable third-party origin trials (fixes https://github.com/bromite/bromite/issues/1530) +* dropped patch for async DNS flag +* dropped duplicate patch for pull-to-refresh flag +* fix application not closing on incognito tab (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1503) +* fix external links in incognito not always opening (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1474) +* fix incognito tab closing new tab under normal tab (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1030) +* allow custom tab intents and opening external links in incognito (thanks to @uazo) +* never use HTTP probes for connectivity check on Android < M +* re-introduce option to use home page as NTP (thanks to @uazo, https://github.com/bromite/bromite/pull/1586) + +# 94.0.4606.109 +* experimental user scripts support (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/792) +* Bromite auto-update notifications enabled by default +* enable Android native autofill (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/547) + +# 94.0.4606.102 +* add flag to disable pull-to-refresh effect +* add recents, offlinepage and send to home screen for always incognito (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1182 and https://github.com/bromite/bromite/issues/1362) +* prompt to restart when always-incognito is enabled (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1459) +* merge patches for custom tab intents + +# 94.0.4606.94 +* Bromite auto-update feature, disabled by default (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/706) +* add site setting for images (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1339) +* use SM-G960U as model provided via client hints and Javascript +* drop patches already merged upstream + +# 93.0.4577.110 + +* set enable_reporting to false (thanks to @nikolowry) +* backported patches for security issues https://crbug.com/1245578 and https://crbug.com/1251787 +* disable AGSA by default +* disable UA client hint for model +* disable lock icon in address bar by default +* enable share intent (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1062) +* allow forcing external links to open in incognito (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/728) +* avoid double restart for default tab groups flags status + +# 93.0.4577.83 +* dropped patch for FLoC (already disabled by upstream) +* dropped patch for build with system sysroots +* disable tab groups by default (needs restart) +* added 'services/network/public/mojom' to ad blocker patch to avoid a build error + +# 92.0.4515.176 +* use upstream feature to prevent default search engine permissions grants +* slightly improve error message for gateway attacks prevention error + # 92.0.4515.134 # 92.0.4515.125 @@ -25,7 +260,6 @@ # 91.0.4472.102 * fix opening new tabs from links in always-incognito mode (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1154) -* allow saving pages in incognito mode (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/1182) # 91.0.4472.97 * add flag for omnibox autocomplete filtering (fixes https://github.com/bromite/bromite/issues/1152) @@ -84,7 +318,7 @@ * use 64-bit ABI for webview processes (fixes https://github.com/bromite/bromite/issues/997) * use dedicated folder for bookmark all tabs * fix Javascript and cookies permissions missing (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/990) -* fix missing enable save data header flag (fixes https://github.com/bromite/bromite/issues/989) +* fix missing enable Save-Data header flag (fixes https://github.com/bromite/bromite/issues/989) * fix menu items not properly displayed with tab overflow menu regroup (thanks to @uazo, fixes https://github.com/bromite/bromite/issues/963) # 89.0.4389.78 diff --git a/FAQ.md b/FAQ.md index f92b47019c5e0bc36ffd7816038211b1c0f96aa0..e84849b7613c6313d4cc333a62ce39db4a1127d2 100644 --- a/FAQ.md +++ b/FAQ.md @@ -20,7 +20,7 @@ Projects which follow a strict approach on this are [Iridium](https://iridiumbro Yes, in order to play protected/encrypted media content the browser will use Android's DRM media framework to automatically negotiate access (same as Chromium). This means for example that requests to Android license servers will be performed (`www.googleapis.com`), see https://w3c.github.io/encrypted-media/#direct-individualization -To disable this functionality you should disable protected content playback from Site settings -> Multimedia. +To disable this functionality you should disable protected content playback from Site settings -> Protected Content. ## What is the SystemWebView? It is the core component of Android for all web page visualizations. For example when you access a new wifi network and need to activate it, that is using the SystemWebView. If you do not know what it is then you do not need to install it. @@ -31,14 +31,14 @@ Ad-blocking was present and always enabled in the SystemWebView from version `72 ## How to enable DNS-over-HTTPS? -See [this wiki page](https://github.com/bromite/bromite/wiki/Enabling-DNS-over-HTTPS). +See [this page](https://www.bromite.org/doh). ## Can you add HTTPS everywhere? No. We cannot add add-ons to Bromite (merely some features). ## Is Bromite on Play Store? -No, and this is unlikely to change. Many limitations apply for submissions there, including which ads are allowed to be blocked. +No, and this is not going to change. Many limitations apply for submissions there, including which ads are allowed to be blocked. Bromite favors user freedom in software choice: the device is yours so you get to choose which software to run on it, end of the story. @@ -48,9 +48,7 @@ It is not on the official F-Droid repository and there are no (more) plans to su You can use F-Droid client to install and receive updates via [the official Bromite F-Droid repository](https://www.bromite.org/fdroid). ## Does Bromite support WebRTC? -Yes, since version 69. While the desktop version of Chromium has an option to disable it (video/audio site settings), the Android version cannot. - -The WebRTC functionality has always been using safe defaults to prevent leaks (disabled multiple routes and non-proxied UDP). +Partially, see https://github.com/bromite/bromite/wiki/WebRTC ## Using Bromite will favour the monopoly of the Chromium/Blink engine, why do you develop and maintain Bromite? In short, to show what a Chromium-based engine could do **for the user** if the user experience and needs were the main focus of modern browser design. @@ -74,9 +72,20 @@ PWAs are only supported as home shortcuts; WebAPKs will not work because they ar ## Does Bromite support the Android autofill framework? -No; the only autofill available in Chromium browsers requires integration with the Play Store binary blobs. -Some apps use accessibility services as a workaround. +Yes, since version 94.0.4606.109 the native Android autofill can be used; this does not require accessibility services as a workaround. ## Does Bromite support casting media content? -No; this would require Play Store binary blobs. +No, this would require Play Store binary blobs. + +## Can you add this search engine as default? +No. +Bromite does not make any choice related to default search engines, the Chromium default is used. +Various Android browsers get some fee to ship their apps with a specific default search engine, Bromite does not get any fee from anyone. +Changing the default search engine would lead to an endless series of requests to change it based on personal preferences, thus no change is made to the default. +See also: https://github.com/bromite/bromite/wiki/SearchEngines + +## Some sites show ads, how can I fix this? +You can compare the blocked URLs with a desktop browser and Bromite (using [remote debugging](https://developer.chrome.com/docs/devtools/remote-debugging/)) and figure out some new filter rules to be added. +If the ads are blocked via cosmetic filtering then blocking them is not possible with Bromite's engine and you might need something like an [user script](https://github.com/bromite/bromite/wiki/UserScripts) instead. +See also: https://github.com/bromite/bromite/wiki/AdBlocking diff --git a/README.md b/README.md index 0525e677954fcfdb69989a7c835e5ad67190934a..ff2014d233c915e22d454298b11c44bd525df50c 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ # Bromite - Take back your browser - -current Bromite release GNU GPL v3 - -Bromite + + current Bromite release + + GNU GPL v3 +
+ + Bromite + Bromite is a [Chromium](https://www.chromium.org/Home) fork with support for ad blocking and enhanced privacy. -Bromite is only available for Android Lollipop (v5.0, API level 21) and above. +Bromite is only available for Android Marshmallow (v6.0, API level 23) and above. Downloads on Github @@ -25,21 +29,23 @@ Please donate to support development of Bromite and the costs for the build syst [→ Support development with a donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JP3XTQPVRNET2): [![paypal](https://www.bromite.org/assets/img/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=JP3XTQPVRNET2) -BTC donations address: `bc1qmpyuqsvs3tz3uaysplmwjr33gg4rzu6cqweaq834ehc25vduxppqkrszel` +BTC donations address: `bc1qlx7h0lj9z88g2xfeuwsrtfs77sxuhrxf2t28sw` -ETH donations address: `0xf47ff39223d828f99fec5ab53bd068c5c0522042` +ETH donations address: `0x5d392F8FBf3465afe05B1Adc575e248D33B891F6` # Features * customizable adblock filters via user-provided URL (see https://www.bromite.org/custom-filters) +* automatically updated adblock filters * remove click-tracking and AMP from search results * DNS-over-HTTPS support with any valid IETF DoH endpoint * always-incognito mode * disable all field trials permanently * disable smart search by default, allow web search from incognito mode -* always-visible cookies, javascript and ads site settings +* always-visible cookies, javascript and ads site settings from address bar popup * remove Play integration binary blobs * use [CFI](https://en.wikipedia.org/wiki/Control-flow_integrity) on all architectures except x86 +* enable trivial auto var init * disable media router and remoting by default * disable dynamic module loading * show warnings for TLSv1.0/TLSv1.1 pages @@ -53,7 +59,7 @@ ETH donations address: `0xf47ff39223d828f99fec5ab53bd068c5c0522042` * security enhancement patches from [GrapheneOS](https://github.com/GrapheneOS) project * disable scroll-to-text-fragment * reduced referer granularity -* block gateway attacks via websockets +* block gateway attacks via websockets (partial fix, see [this upstream issue](https://bugs.chromium.org/p/chromium/issues/detail?id=590714)) * use 64-bit ABI for webview processes * make all favicon requests on-demand ([supercookie](https://supercookie.me/) mitigation) * enable all network isolation features (`PartitionConnectionsByNetworkIsolationKey`, `PartitionHttpServerPropertiesByNetworkIsolationKey`, `SplitHostCacheByNetworkIsolationKey`, `AppendFrameOriginToNetworkIsolationKey`, `SplitCacheByNetworkIsolationKey`, `UseRegistrableDomainInNetworkIsolationKey`, `PartitionSSLSessionsByNetworkIsolationKey`, `PartitionExpectCTStateByNetworkIsolationKey`, `PartitionDomainReliabilityByNetworkIsolationKey`) @@ -61,13 +67,32 @@ ETH donations address: `0xf47ff39223d828f99fec5ab53bd068c5c0522042` * ask permission to play protected media * disable the DIAL repeating discovery * disable RTCGetCurrentBrowsingContextMedia by default -* disable FLoC by default +* disable FLoC and privacy sandbox by default * disable feeds +* disable reporting of certificate errors +* use pre-defined phone model for client hints and Javascript +* allow forcing external links to open in incognito +* disable AGSA by default +* flag to enable Certificate Transparency +* allow adding search engines from incognito mode +* disable predictors +* disable supervised users +* disable safety check +* disable capability to block `view-source:` URLs +* disable `SegmentationPlatformFeature`, `OptimizationHints`, client hint headers +* disable `AsyncDNS` by default +* customize history expiration threshold +* disable idle detection +* HTTPS-only mode enabled by default +* disable TLS resumption by default +* partition DoH requests by top-frame NIK +* strict site isolation and strict origin isolation ## Features not related to privacy +* browser automatic updates, enabled by default +* native Android autofill support * import/export bookmarks * bookmark all tabs from tabs regroup menu -* flag to allow screenshots of incognito tabs * allow playing videos in background tabs and disable pause on switching tabs * all codecs included (proprietary, open H.264 etc.) * [AV1 codec support](https://github.com/bromite/bromite/wiki/AV1-support) @@ -80,11 +105,18 @@ ETH donations address: `0xf47ff39223d828f99fec5ab53bd068c5c0522042` * adding an URL as bookmark will clear its blocked status for the NTP tiles * history support in incognito mode * view source of pages -* timezone customization * sticky desktop mode setting -* disable video autoplay by default, reintroduce site settings * mobile/desktop user agent customization * accessibility preference to force tablet UI +* use Alt+D to focus address bar +* allow sharing to Bromite +* UI for crash information collection +* allow OpenSearch search engine detection in incognito +* allow OpenSearch search engine detection with paths +* keyboard dictionary hints in address bar +* always allow `view-source:` URLs +* allow moving navigation bar to bottom +* add option to use home page as NTP You can inspect all functionality/privacy changes by reading the [patches](https://github.com/bromite/bromite/tree/master/build/patches) and/or the [CHANGELOG](./CHANGELOG.md). @@ -100,15 +132,15 @@ Flags which have been retired from upstream Chromium but are still available in * `#num-raster-threads` * `#enable-image-reader`, enabled by default * `#enable-tab-groups` and `#enable-tab-groups-ui-improvements` +* `#offline-indicator-v2` New flags: * `#fingerprinting-canvas-image-data-noise`, `#fingerprinting-client-rects-noise` and `#fingerprinting-canvas-measuretext-noise`, enabled by default -* `#enable-incognito-snapshots-in-android-recents`, disabled by default +* `#incognito-screenshot`, disabled by default * `#max-connections-per-host` * `#resume-background-video` * `#ipv6-probing` -* `#disable-webgl` * `#enable-device-motion` and `#enable-device-orientation` * `#show-legacy-tls-warnings` * `#save-data-header`, disabled by default @@ -116,7 +148,20 @@ New flags: * `#allow-user-certificates`, disabled by default * `#cleartext-permitted`, enabled by default, can be used to disable all cleartext-HTTP traffic * `#omnibox-autocomplete-filtering`, can be used to restrict omnibox autocomplete results -* `#disable-external-intent-requests` +* `#disable-external-intent-requests`, can be used to disable opening any external app for any URL +* `#enable-userscripts-log`, see https://github.com/bromite/bromite/wiki/UserScripts#flags +* `#certificate-transparency-enabled`, enabled by default; see https://chromium.googlesource.com/chromium/src/+/master/net/docs/certificate-transparency.md +* `#move-top-toolbar-to-bottom`, disabled by default +* `#site-engagement`, enabled by default, can be used to disable the automatically-generated icons for most visited sites on the NTP + +### Site settings + +* webGL, disabled by default +* images, enabled by default +* Javascript JIT, disabled by default +* timezone customization override +* autoplay, disabled by default +* webRTC, disabled by default # Privacy limitations @@ -128,9 +173,11 @@ All built versions are available as [releases](https://github.com/bromite/bromit Each tag corresponds to a Chromium Stable release tag. -Bromite is currently built for ARM, ARM64 and x86 and for the Android SDK versions 19 and 21; [Bromite SystemWebView](https://www.bromite.org/system_web_view) is provided as well (SDK21+). +Bromite is currently built for ARM, ARM64 and x86 and for the Android SDK version 23+; [Bromite SystemWebView](https://www.bromite.org/system_web_view) is provided as well (SDK23+). For every Bromite build you can always find a matching [vanilla Chromium](https://www.bromite.org/chromium) build which is used for example to verify which issues are specific to Bromite or not. +You will automatically receive notifications about new updates (and be able to install them) via the auto updater functionality (enabled by default), see [related wiki page](https://github.com/bromite/bromite/wiki/AutomaticUpdates). + All official releases are also available through the [official third-party F-Droid repository](https://www.bromite.org/fdroid). ## Integrity and authenticity @@ -160,7 +207,7 @@ The [Bromite main repository](https://github.com/bromite/bromite) contains tags Please refer to [official Chromium build documentation](https://www.chromium.org/developers/how-tos/get-the-code) to get started on how to build Chromium; if you can build Chromium for Android, you can build Bromite. The Chromium version tag used as base for the patches is available here: [RELEASE](./build/RELEASE); this is always corresponding to the git tag for every release. -The GN args used to build Bromite are available here: [GN_ARGS](./build/GN_ARGS). +The GN args used to build Bromite are available here: [bromite.gn_args](./build/bromite.gn_args). The patches are to be applied second the order specified in the `bromite_patches_list.txt` file (you can use `git am`). ## How to build the filters diff --git a/build/LASTCHANGE b/build/LASTCHANGE new file mode 100644 index 0000000000000000000000000000000000000000..dc91308f3a005c15ede69808fc096b5aa94c9497 --- /dev/null +++ b/build/LASTCHANGE @@ -0,0 +1 @@ +e3a3a1fe718bf559be801d14660fb6f9dc9bf603- \ No newline at end of file diff --git a/build/RELEASE b/build/RELEASE index 4d3f981918c5df636951dee6fd8b60a1d1acb6fb..7fbaf42290dd4ce74cdf93d4f04ba06aa9ad4d37 100644 --- a/build/RELEASE +++ b/build/RELEASE @@ -1 +1 @@ -92.0.4515.134 +115.0.5790.98 \ No newline at end of file diff --git a/build/RELEASE_COMMIT b/build/RELEASE_COMMIT new file mode 100644 index 0000000000000000000000000000000000000000..70036174671c8563903af5202e272f0ae4714d50 --- /dev/null +++ b/build/RELEASE_COMMIT @@ -0,0 +1 @@ +5923fa90d4e3587c130983442b9cf90f4c76e851 \ No newline at end of file diff --git a/build/bromite.gn_args b/build/bromite.gn_args new file mode 100644 index 0000000000000000000000000000000000000000..3dd69604c0ff41b95df1d0dea482e8194b6ce8b0 --- /dev/null +++ b/build/bromite.gn_args @@ -0,0 +1,49 @@ +android_channel="stable" +blink_symbol_level=1 +build_contextual_search=false +build_with_tflite_lib=false +chrome_pgo_phase=0 +dcheck_always_on=false +debuggable_apks=false +dfmify_dev_ui=false +disable_android_lint=true +disable_autofill_assistant_dfm=true +disable_fieldtrial_testing_config=true +disable_tab_ui_dfm=true +enable_av1_decoder=true +enable_dav1d_decoder=true +enable_gvr_services=false +enable_hangout_services_extension=false +enable_iterator_debugging=false +enable_mdns=false +enable_mse_mpeg2ts_stream_parser=true +enable_nacl=false +enable_platform_dolby_vision=true +enable_platform_hevc=true +enable_remoting=false +enable_reporting=false +enable_vr=false +exclude_unwind_tables=false +ffmpeg_branding="Chrome" +icu_use_data_file=true +is_cfi=true +is_component_build=false +is_debug=false +is_official_build=true +proprietary_codecs=true +rtc_build_examples=false +symbol_level=1 +system_webview_package_name="org.bromite.webview" +target_os="android" +treat_warnings_as_errors=true +use_cfi_cast=true +use_debug_fission=true +use_errorprone_java_compiler=false +use_gnome_keyring=false +use_official_google_api_keys=false +use_rtti=false +use_sysroot=false +webview_includes_weblayer=false +enable_arcore=false +enable_openxr=false +enable_gvr_services=false diff --git a/build/bromite_patches_list.txt b/build/bromite_patches_list.txt index 76684f5d773b6ad81182d464a2316c00d2328788..567df0a731772a47772214f9ecf66db16e9c8e8a 100644 --- a/build/bromite_patches_list.txt +++ b/build/bromite_patches_list.txt @@ -1,41 +1,42 @@ -Disable-third-party-cookies-by-default.patch -AV1-codec-support.patch +Remove-EV-certificates.patch +do-not-hide-.orig-files.patch +Do-not-link-with-libatomic.patch +do-not-add-suffix-to-package-name.patch +exit-on-failure-of-inclusion.patch +Move-some-account-settings-back-to-privacy-settings.patch +kill-Vision.patch +kill-Location-fall-back-to-system.patch +kill-Auth.patch +Remove-binary-blob-integrations.patch +Remove-SMS-integration.patch +Remove-voice-recognition-integration.patch +Do-not-compile-QR-code-sharing.patch +Add-support-for-ISupportHelpAndFeedback.patch Switch-to-fstack-protector-strong.patch Enable-fwrapv-in-Clang-for-non-UBSan-builds.patch -DCScan-Fix-builds-with-system-sysroots.patch +Bromite-package-name.patch Restore-classic-new-tab-page.patch Always-use-new-tab-page-for-default-home-page.patch -Always-allow-partner-customisation.patch -battery_status_service-disable-more-privacy-nightmares.patch +disable-battery-status-updater.patch Battery-API-return-nothing.patch updater-disable-updater-pings.patch -Remove-EV-certificates.patch -promo-disable-Google-promotion-fetching.patch Disable-omission-of-URL-elements-in-Omnibox.patch Modify-default-preferences.patch Do-not-hide-component-extensions.patch Do-not-store-passwords-by-default.patch Disable-NTP-remote-suggestions-by-default.patch Disable-references-to-fonts.googleapis.com.patch -Change-default-webRTC-policy-to-not-use-any-address.patch -Never-send-any-crash-upload-data.patch -Hide-send-reports-checkbox.patch +webRTC-do-not-expose-local-IP-addresses.patch Never-fetch-popular-sites.patch ungoogled-chromium-Disable-webRTC-log-uploader.patch ungoogled-chromium-Disable-untraceable-URLs.patch ungoogled-chromium-Disable-translate-integration.patch ungoogled-chromium-Disable-profile-avatar.patch -ungoogled-chromium-Disable-intranet-redirect-detector.patch -ungoogled-chromium-Disable-Google-host-detection.patch +ungoogled-chromium-Disable-intranet-detector.patch +ungoogled-chromium-no-special-hosts-domains.patch ungoogled-chromium-Disable-Gaia.patch -ungoogled-chromium-Disable-domain-reliability.patch ungoogled-chromium-Disable-Network-Time-Tracker.patch -Disable-safe-browsing.patch -Skip-the-first-run-and-metrics.patch Disable-all-promo-dialogs.patch -Remove-signin-and-data-saver-integrations.patch -Hide-passwords-manager-link.patch -Disable-Omaha-update-checks.patch Disable-update-scheduler.patch Add-English-only-search-engine.patch Add-DuckDuckGo-Lite-search-engine.patch @@ -44,119 +45,240 @@ build-remove-calling-untrusted-hooks.patch Inject-scripts-for-AMP-tracking-ads-and-video.patch Allow-playing-audio-in-background.patch Add-flag-to-control-video-playback-resume-feature.patch -Open-YouTube-links-in-Bromite.patch Add-exit-menu-item.patch Remove-help-menu-item.patch -AudioBuffer-AnalyserNode-fp-mitigations.patch Multiple-fingerprinting-mitigations.patch -Disable-metrics-on-all-I-O-threads.patch -Always-respect-async-dns-flag-regardless-of-SDK-version.patch Add-flag-to-configure-maximum-connections-per-host.patch Do-not-ignore-download-location-prompt-setting.patch +Add-support-for-writing-URIs.patch Add-bookmark-import-export-actions.patch +Bookmarks-select-all-menu-entry.patch Add-an-always-incognito-mode.patch -Add-custom-tab-intents-privacy-option.patch +Keep-flag-to-allow-screenshots-in-Incognito-mode.patch Add-option-to-not-persist-tabs-across-sessions.patch +Add-a-proxy-configuration-page.patch +Add-custom-tab-intents-privacy-option.patch +Disable-FLoC-and-privacy-sandbox.patch +History-number-of-days-privacy-setting.patch Disable-fetching-of-all-field-trials.patch -Disable-seed-based-field-trials.patch Disable-plugins-enumeration.patch -net-cert-increase-default-key-length-for-newly-generated-RSA-keys.patch +net-cert-increase-default-key-length.patch dns-send-IPv6-connectivity-probes-to-RIPE-DNS.patch -profile-resetter-do-not-tick-send-settings-by-default.patch +Add-flag-to-disable-IPv6-probes.patch +profile-resetter-disable-send-settings.patch Do-not-build-API-keys-infobar.patch -autofill-disable-autofill-download-manager.patch +autofill-miscellaneous.patch +Enable-native-Android-autofill.patch first_run-deactivate-autoupdate-globally.patch -translate-disable-fetching-of-translate-languages-from-server.patch -kill-TOS-and-metrics-opt-out.patch -kill-Vision.patch -kill-Location-fall-back-to-system.patch -kill-Auth.patch -Remove-binary-blob-integrations.patch -Remove-SMS-integration.patch -Do-not-compile-QR-code-sharing.patch -Allow-website-sign-in-without-account-sign-in.patch +translate-disable-fetching-of-languages-from-server.patch Offer-builtin-autocomplete-for-chrome-flags.patch -Do-not-grant-notifications-to-default-search-engine.patch -Add-flag-to-disable-IPv6-probes.patch -Add-a-proxy-configuration-page.patch Use-4-tile-rows-never-show-logo.patch -Disable-metrics-collection-for-NTP-tiles.patch +Disable-various-metrics.patch Enable-SPPI-for-devices-with-enough-memory.patch +Enable-StrictOriginIsolation-and-SitePerProcess.patch Use-64-bit-WebView-processes.patch -prefs-disable-signinallowed-by-default.patch -prefs-always-prompt-for-download-directory-by-default.patch -Disable-offline-pages-in-the-downloads-home-to-be-opened-in-CCT-by-default.patch -disable-payment-support-by-default.patch -disable-background-sync-by-default.patch -disable-sensors-access-site-setting-by-default.patch +prefs-always-prompt-for-download-directory.patch +Disable-offline-pages-in-CCT.patch Disable-media-router-and-remoting-by-default.patch Restore-Search-Ready-Omnibox-flag.patch disable-AdsBlockedInfoBar.patch -Bromite-AdBlockUpdaterService.patch +Bromite-subresource-adblocker.patch +Bromite-auto-updater.patch Replace-DoH-probe-domain-with-RIPE-domain.patch -Increase-number-of-autocomplete-matches-from-5-to-10.patch -Disable-HEAD-requests-for-single-word-Omnibar-searches.patch +Increase-number-of-autocomplete-matches-to-10.patch +Disable-requests-for-single-word-Omnibar-searches.patch Disable-some-signed-exchange-features.patch -Add-flag-to-disable-WebGL.patch -DoH-secure-mode-by-default.patch +DoH-improvements.patch 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 -Disable-autofill-assistant-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 -Enable-user-agent-freeze-by-default.patch -disable-browser-autologin-by-default.patch +Guard-for-user-agent-reduction.patch AImageReader-CFI-crash-mitigations.patch -Update-i18n-zh_CN-support.patch -Add-a-flag-to-allow-screenshots-in-Incognito-mode.patch Add-menu-item-to-view-source.patch +Revert-removal-of-execution-context-address-space.patch Block-gateway-attacks-via-websockets.patch Enable-prefetch-privacy-changes-by-default.patch Disable-support-for-RAR-files-inspection.patch -Add-history-support-in-incognito-mode.patch Enable-darken-websites-checkbox-in-themes.patch Remove-blocklisted-URLs-upon-bookmark-creation.patch Disable-the-DIAL-repeating-discovery.patch Block-qjz9zk-or-trk-requests.patch Hardening-against-incognito-mode-detection.patch -Remove-weblayer-dependency-on-Play-Services.patch -Timezone-customization.patch -Move-some-account-settings-back-to-privacy-settings.patch Restore-Simplified-NTP-launch.patch -Revert-the-removal-of-an-option-to-block-autoplay.patch +Add-option-to-use-home-page-as-NTP.patch Disable-text-fragments-by-default.patch disable-WebView-variations-support.patch -disable-autofill-server-communication-by-default.patch -ask-permission-to-play-protected-media-by-default.patch Enable-network-isolation-features.patch -Disable-unified-autoplay-feature.patch Revert-flags-remove-num-raster-threads.patch webview-Hard-no-to-persistent-histograms.patch Ignore-enterprise-policies-for-secure-DNS.patch Add-menu-item-to-bookmark-all-tabs.patch -Add-flag-for-save-data-header.patch +Re-introduce-modal-dialog-flag-to-close-all-tabs.patch Add-option-to-force-tablet-UI.patch -Make-all-favicon-requests-on-demand.patch Add-Alt-D-hotkey-to-focus-address-bar.patch -Remove-offline-measurement-background-task.patch User-agent-customization.patch Add-AllowUserCertificates-flag.patch Add-IsCleartextPermitted-flag.patch -Disable-RTCGetCurrentBrowsingContextMedia-by-default.patch -Disable-FLoC-by-default.patch -Unexpire-tab-groups-flags.patch Add-flag-for-omnibox-autocomplete-filtering.patch -Enable-IntentBlockExternalFormRedirectsNoGesture-by-default.patch +Revert-Delete-block-external-form-redirects.patch Add-flag-to-disable-external-intent-requests.patch +Enable-share-intent.patch Logcat-crash-reports-UI.patch -Add-support-for-ISupportHelpAndFeedback.patch -JIT-less-toggle.patch -API-level-21-prevent-crash-on-download.patch -Add-vibration-flag.patch +Add-flag-to-disable-vibration.patch mime_util-force-text-x-suse-ymp-to-be-downloaded.patch -Disable-UA-client-hint.patch -Automated-domain-substitution.patch -Fix-build-test-suite.patch +Client-hints-overrides.patch +Allow-building-without-enable_reporting.patch +Disable-lock-icon-in-address-bar-by-default.patch +Experimental-user-scripts-support.patch +Keep-empty-tabs-between-sessions.patch +Disable-third-party-origin-trials.patch +Never-use-HTTP-probes-for-connection-detection.patch +Disable-Accessibility-service-by-default.patch +Disable-conversion-measurement-api.patch +Restore-offline-indicator-v2-flag.patch +Re-introduce-override_build_timestamp.patch +enable-ftrivial-auto-var-init-zero.patch +disable-appending-variations-header.patch +Disable-idle-detection.patch +Allow-building-without-supervised-users.patch +Disable-minidump-upload-scheduling.patch +Revert-Permit-blocking-of-view-source.patch +Disable-safety-check.patch +Disable-all-predictors-code.patch +OpenSearch-miscellaneous.patch +Add-flag-for-save-data-header.patch +Disable-UA-full-version.patch +Dictionary-suggestions-for-the-Omnibox.patch +Disable-AsyncDNS-by-default.patch +00Restore-LastTabStandingTracker.patch +Add-lifetime-options-for-permissions.patch +Disable-crash-reporting.patch +Samsung-Note-9-SDK27-crazylinker-workaround.patch +Disable-TLS-resumption.patch +Move-navigation-bar-to-bottom.patch +Welcome-screen.patch +Add-site-engagement-flag.patch +Enable-Certificate-Transparency.patch +Invalidate-components-public-key.patch +Improve-plain-text-rendering-on-mobile.patch +Remove-segmentation-platform.patch +Follow-only-system-dark-mode.patch +Remove-window-name-on-cross-origin-navigation.patch +Remove-preload-of-com.google.android.gms.fonts.patch +Partition-Blink-memory-cache.patch +Remove-navigator.connection-info.patch +Disable-PrivacyGuide.patch +sharing-hub-always-use-visible-URL.patch +Enable-HEVC-by-default.patch +Partition-blobs-by-top-frame-URL.patch +Override-Navigator-Language.patch +Disable-add-to-home-screen-prompt.patch +Remove-HTTP-referrals-in-cross-origin-navigation.patch +Enable-ECH-by-default.patch +Disable-StartSurface-feature.patch +Enable-PermuteTLSExtensions-by-default.patch +Enable-third-party-storage-partitioning.patch +Restore-adaptive-button-in-top-toolbar-customization.patch +Add-kill-switch-for-unsupported-clangd-flags.patch + +eyeo-beta-114.0.5735.53-v1-base.patch +eyeo-beta-114.0.5735.53-v1-android_settings.patch +eyeo-beta-114.0.5735.53-v1-extension_api.patch +00Eyeo-Adblock-Remove-Privacy-Issues.patch + +00WIN-ADDTO-Add-an-always-incognito-mode.patch +00WIN-ADDTO-Experimental-user-scripts-support.patch +00WIN-ADDTO-ungoogled-chr--Disable-profile-avatar.patch +00WIN-ADDTO-Add-a-proxy-configuration-page.patch +00WIN-ADDTO-Add-bookmark-import-export-actions.patch +00WIN-ADDTO-openH264--enable-ARM-ARM64-optimizati.patch +00WIN-ADDTO-AImageReader-CFI-crash-mitigations.patch +00WIN-ADDTO-Remove-binary-blob-integrations.patch +00WIN-ADDTO-Add-lifetime-options-for-permissions.patch +00WIN-ADDTO-Disable-various-metrics.patch +00WIN-ADDTO-Do-not-build-API-keys-infobar.patch +00WIN-ADDTO-Revert-flags--remove-num-raster-thre.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-Logcat-crash-reports-UI.patch +00WIN-ADDTO-Add-AllowUserCertificates-flag.patch +00WIN-enable-pdf-plugin.patch +00WIN-disable-annotate-downloads.patch +00WIN-enable-HighEfficiencyMode-by-default.patch +00WIN-enable-file-system-access-blocklist.patch +00WIN-Disable-TabHoverCard-images.patch +00WIN-Fix-log-to-file.patch +00WIN-minimum-data-to-enable-install-extensions.patch +00WIN-Disable-updater.patch +00WIN-Disable-first-run.patch +00WIN-Add-some-prefs-to-secure-preferences.patch +00WIN-Disable-search-for-image.patch + +00Temp-Disable-kAutomaticLazyFrameLoadingToEmbeds.patch +00Remove-experimental-relative-c---abi-vtables.patch +AudioBuffer-AnalyserNode-fp-mitigations.patch +00Disable-Component-Updates.patch +00add-browser-policy.patch +00Always-open-browser-controls-in-new-tab.patch +00Partitioning-all-cookies-by-top-frame-domain.patch +00Disable-FedCm.patch +00Disable-BackForwardCache.patch +00Evict-the-entire-FrameTree-like-desktop.patch +00Disable-visited-pseudo-class.patch +00Add-setting-to-clear-data-on-exit.patch +00WIN-Disable-sharing-hub.patch +00WIN-Enable-Network-Service-Sandbox-and-CIG.patch +00Disable-csp-reports.patch +00Fonts-fingerprinting-mitigation.patch +00Keyboard-protection-flag.patch +00Disable-privacy-issues-in-password-manager.patch +00Partition-HSTS-cache-by-NAK.patch +00Warning-message-for-unsupported-hardware-aes.patch +00Enable-Document-Open-Inheritance-Removal.patch +00Add-setting-to-invert-tap-and-long-tap.patch +00Remove-ChromiumNetworkAdapter.patch +00Internal-firewall.patch +00Disable-devtools-remote-and-custom-protocols.patch +00Remove-detection-of-captive-portals.patch +00Disable-SHA1-Server-Signature.patch +00Remove-auth-header-upon-cross-origin-redirect.patch +00Clear-CORS-Preflight-Cache-on-clearing-data.patch +00Multi-Screen-Window-Placement-API-fix.patch +00Remove-https-connection-from-chrome-discards.patch +00Add-a-flag-to-disable-GamePad-API.patch +00Disable-WebGPU.patch +00Disable-FirstPartySets-and-StorageAccessAPI.patch +00Disable-GetInstalledRelatedApps-API.patch +00Disable-GSA-by-default.patch +00Disable-PrivateStateTokens-API.patch +00Disallowing-MIDI-permission-by-default.patch +00Disable-Compression-Dictionary-Transport.patch +00Disallow-Android-App-Scheme-as-referrer.patch +00Deprecate-Data-URL-in-SVGUseElement.patch + +00TEMP-Add-a-log-to-track-strange-behavior.patch +00v113-temp-fix-build.patch +00114-temp-disable-find-bad-constructs-external-repo.patch +00115-temp-fix-build.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 +00Remove-support-for-device-memory-and-cpu-recovery.patch +00Log-dangling-attributes-in-some-html-elements.patch +00Keep-Side-Panel-Companion-disabled.patch +00Lock-Profile-Cookie-Database.patch +00Show-warnings-on-downloads-over-HTTP.patch \ No newline at end of file diff --git a/build/GN_ARGS b/build/chromium.gn_args similarity index 78% rename from build/GN_ARGS rename to build/chromium.gn_args index a33a7ab31664a0b08e1e6f04f018420b3492d3b1..6fabb88961ff9bdfdd79b586f90593c1fbaa54dd 100644 --- a/build/GN_ARGS +++ b/build/chromium.gn_args @@ -1,11 +1,14 @@ android_channel="stable" blink_symbol_level=1 +build_contextual_search=false +build_with_tflite_lib=false chrome_pgo_phase=0 dcheck_always_on=false debuggable_apks=false dfmify_dev_ui=false disable_android_lint=true disable_autofill_assistant_dfm=true +disable_fieldtrial_testing_config=true disable_tab_ui_dfm=true enable_av1_decoder=true enable_dav1d_decoder=true @@ -15,24 +18,27 @@ enable_iterator_debugging=false enable_mdns=false enable_mse_mpeg2ts_stream_parser=true enable_nacl=false -enable_nacl_nonsfi=false enable_platform_dolby_vision=true enable_platform_hevc=true enable_remoting=false enable_reporting=true +enable_supervised_users=false enable_vr=false exclude_unwind_tables=false ffmpeg_branding="Chrome" -fieldtrial_testing_like_official_build=true icu_use_data_file=true +is_cfi=true is_component_build=false is_debug=false is_official_build=true proprietary_codecs=true rtc_build_examples=false -safe_browsing_mode=0 +safe_browsing_mode=2 symbol_level=1 +system_webview_package_name="com.android.webview" target_os="android" +treat_warnings_as_errors=true +use_cfi_cast=true use_debug_fission=true use_errorprone_java_compiler=false use_gnome_keyring=false diff --git a/build/chromium_patches_list.txt b/build/chromium_patches_list.txt index 8604f65ddad2a949518ad6f5e7317200906dc199..188a4659dfefa4d9d0ee05e497333aecfdac5252 100644 --- a/build/chromium_patches_list.txt +++ b/build/chromium_patches_list.txt @@ -1,5 +1,11 @@ AV1-codec-support.patch +exit-on-failure-of-inclusion.patch +Reintroduce-override_build_timestamp.patch +do-not-hide-.orig-files.patch +Do-not-link-with-libatomic.patch +do-not-add-suffix-to-package-name.patch Switch-to-fstack-protector-strong.patch Enable-fwrapv-in-Clang-for-non-UBSan-builds.patch -DCScan-Fix-builds-with-system-sysroots.patch +enable-ftrivial-auto-var-init-zero.patch Disable-feeds-support-by-default.patch +Chromium-package-name.patch diff --git a/build/patches/00114-temp-disable-find-bad-constructs-external-repo.patch b/build/patches/00114-temp-disable-find-bad-constructs-external-repo.patch new file mode 100644 index 0000000000000000000000000000000000000000..ce2169730080a9c797741316489ab7af2e12e128 --- /dev/null +++ b/build/patches/00114-temp-disable-find-bad-constructs-external-repo.patch @@ -0,0 +1,58 @@ +From: uazo +Date: Tue, 30 May 2023 15:45:59 +0000 +Subject: 114 temp disable find_bad_constructs external repo + +--- + build/config/android/rules.gni | 1 + + crypto/BUILD.gn | 1 + + net/BUILD.gn | 1 + + third_party/libevent/BUILD.gn | 2 ++ + 4 files changed, 5 insertions(+) + +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 +@@ -5128,6 +5128,7 @@ if (enable_java_templates && is_android) { + _module_build_config = _module.build_config + _module_build_config_target = _module.build_config_target + _module_target_name = get_label_info(_module_target, "name") ++ not_needed(["_module_target_name"]) + + if (!_proguard_enabled) { + _dex_target = "${_module_target_name}__final_dex" +diff --git a/crypto/BUILD.gn b/crypto/BUILD.gn +--- a/crypto/BUILD.gn ++++ b/crypto/BUILD.gn +@@ -14,6 +14,7 @@ buildflag_header("buildflags") { + } + + component("crypto") { ++ configs -= [ "//build/config/clang:find_bad_constructs" ] + output_name = "crcrypto" # Avoid colliding with OpenSSL's libcrypto. + sources = [ + "aead.cc", +diff --git a/net/BUILD.gn b/net/BUILD.gn +--- a/net/BUILD.gn ++++ b/net/BUILD.gn +@@ -1634,6 +1634,7 @@ component("net") { + configs -= [ "//build/config/compiler:default_optimization" ] + configs += [ "//build/config/compiler:optimize_max" ] + } ++ configs -= [ "//build/config/clang:find_bad_constructs" ] + } + + # net_export.h has its own build target so that code (eg +diff --git a/third_party/libevent/BUILD.gn b/third_party/libevent/BUILD.gn +--- a/third_party/libevent/BUILD.gn ++++ b/third_party/libevent/BUILD.gn +@@ -69,6 +69,8 @@ static_library("libevent") { + configs += [ "//build/config/compiler:optimize_max" ] + } + ++ configs -= [ "//build/config/clang:find_bad_constructs" ] ++ + configs -= [ "//build/config/compiler:chromium_code" ] + configs += [ "//build/config/compiler:no_chromium_code" ] + } +-- +2.25.1 diff --git a/build/patches/00115-temp-fix-build.patch b/build/patches/00115-temp-fix-build.patch new file mode 100644 index 0000000000000000000000000000000000000000..983927e5f3aa770a8321a028fe64e2857c3bf688 --- /dev/null +++ b/build/patches/00115-temp-fix-build.patch @@ -0,0 +1,22 @@ +From: uazo +Date: Tue, 18 Jul 2023 05:36:06 +0000 +Subject: 115 temp fix build + +Fix rust toolchain builder +--- + build/toolchain/gcc_toolchain.gni | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/build/toolchain/gcc_toolchain.gni b/build/toolchain/gcc_toolchain.gni +--- a/build/toolchain/gcc_toolchain.gni ++++ b/build/toolchain/gcc_toolchain.gni +@@ -855,6 +855,7 @@ template("gcc_toolchain") { + is_debug = false + is_component_build = false + is_official_build = false ++ generate_linker_map = false + } + } + } +-- +2.25.1 diff --git a/build/patches/00Add-a-flag-to-disable-GamePad-API.patch b/build/patches/00Add-a-flag-to-disable-GamePad-API.patch new file mode 100644 index 0000000000000000000000000000000000000000..ca03fadab904d0b35bcb0f1b99833e5d30bb514c --- /dev/null +++ b/build/patches/00Add-a-flag-to-disable-GamePad-API.patch @@ -0,0 +1,78 @@ +From: uazo +Date: Fri, 21 Apr 2023 13:10:20 +0000 +Subject: Add a flag to disable GamePad API + +Adds restrict-gamepad-access flag (default active) to disable GamePad API. +--- + chrome/browser/flag-metadata.json | 4 ++-- + chrome/browser/flag_descriptions.cc | 2 +- + device/gamepad/public/cpp/gamepad_features.cc | 4 ++-- + .../blink/renderer/modules/gamepad/navigator_gamepad.cc | 6 ++++++ + 4 files changed, 11 insertions(+), 5 deletions(-) + +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 +@@ -6657,9 +6657,9 @@ + "expiry_milestone": 120 + }, + { +- "name": "restrict-gamepad-access", ++ "name": "restrict-gamepad-access", // restrict-gamepad-access" + "owners": [ "//device/gamepad/OWNERS", "jameshollyer@chromium.org" ], +- "expiry_milestone": 96 ++ "expiry_milestone": -1 + }, + { + "name": "revamped-password-management-bubble", +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 +@@ -2882,7 +2882,7 @@ const char kReduceAcceptLanguageDescription[] = + + const char kRestrictGamepadAccessName[] = "Restrict gamepad access"; + const char kRestrictGamepadAccessDescription[] = +- "Enables Permissions Policy and Secure Context restrictions on the Gamepad " ++ "Disable the Gamepad " + "API"; + + const char kRoundedDisplay[] = "Rounded display"; +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 +@@ -27,8 +27,8 @@ BASE_FEATURE(kEnableWindowsGamingInputDataFetcher, + base::FEATURE_DISABLED_BY_DEFAULT); + + BASE_FEATURE(kRestrictGamepadAccess, +- "RestrictGamepadAccess", +- base::FEATURE_DISABLED_BY_DEFAULT); ++ "RestrictGamepadAccess", // enabled ++ base::FEATURE_ENABLED_BY_DEFAULT); // in bromite + + // Enables gamepad multitouch + BASE_FEATURE(kEnableGamepadMultitouch, +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 +@@ -113,6 +113,10 @@ void RecordGamepadsForIdentifiabilityStudy( + HeapVector> NavigatorGamepad::getGamepads( + Navigator& navigator, + ExceptionState& exception_state) { ++ if (base::FeatureList::IsEnabled(::features::kRestrictGamepadAccess)) { ++ exception_state.ThrowSecurityError("Access to the feature \"gamepad\" is denied"); ++ return HeapVector>(); ++ } + 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. +@@ -430,6 +434,8 @@ void NavigatorGamepad::SampleAndCompareGamepadState() { + + void NavigatorGamepad::DispatchGamepadEvent(const AtomicString& event_name, + Gamepad* gamepad) { ++ if (base::FeatureList::IsEnabled(::features::kRestrictGamepadAccess)) ++ return; + // Ensure that we're blocking re-entrancy. + DCHECK(processing_events_); + DCHECK(has_connection_event_listener_); +-- +2.25.1 diff --git a/build/patches/00Add-setting-to-clear-data-on-exit.patch b/build/patches/00Add-setting-to-clear-data-on-exit.patch new file mode 100644 index 0000000000000000000000000000000000000000..b1b3e5537900d49c704c56b00f8bcb8c7fda1e16 --- /dev/null +++ b/build/patches/00Add-setting-to-clear-data-on-exit.patch @@ -0,0 +1,675 @@ +From: uazo +Date: Thu, 16 Feb 2023 15:28:16 +0000 +Subject: Add setting to clear data on exit + +--- + chrome/android/chrome_java_sources.gni | 1 + + .../chrome/browser/ChromeTabbedActivity.java | 7 +- + .../ClearBrowsingDataFragment.java | 6 ++ + .../ClearBrowsingDataFragmentAtStart.java | 74 +++++++++++++++++++ + .../ClearBrowsingDataTabsFragment.java | 7 +- + chrome/app/settings_strings.grdp | 10 +++ + .../browsing_data/browsing_data_bridge.cc | 2 +- + .../chrome_browsing_data_lifetime_manager.cc | 22 +++++- + .../chrome_browsing_data_remover_delegate.cc | 11 +++ + .../api/settings_private/prefs_util.cc | 17 +++++ + .../browser/profiles/ProfileManagerUtils.java | 5 ++ + .../profiles/android/profile_manager_utils.cc | 5 ++ + chrome/browser/profiles/profile_manager.cc | 13 ++++ + chrome/browser/profiles/profile_manager.h | 2 + + .../clear_browsing_data_dialog.html | 44 +++++++++++ + .../clear_browsing_data_dialog.ts | 1 + + .../strings/android_chrome_strings.grd | 3 + + .../settings_localized_strings_provider.cc | 1 + + .../core/browsing_data_policies_utils.cc | 16 ++-- + .../core/browsing_data_policies_utils.h | 11 +++ + .../browsing_data/core/browsing_data_utils.cc | 34 +++++++++ + .../core/clear_browsing_data_tab.h | 2 +- + components/browsing_data/core/pref_names.cc | 27 +++++++ + components/browsing_data/core/pref_names.h | 9 +++ + 24 files changed, 316 insertions(+), 14 deletions(-) + create mode 100644 chrome/android/java/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataFragmentAtStart.java + +diff --git a/chrome/android/chrome_java_sources.gni b/chrome/android/chrome_java_sources.gni +--- a/chrome/android/chrome_java_sources.gni ++++ b/chrome/android/chrome_java_sources.gni +@@ -292,6 +292,7 @@ chrome_java_sources = [ + "java/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataFragmentAdvanced.java", + "java/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataFragmentBasic.java", + "java/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataTabsFragment.java", ++ "java/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataFragmentAtStart.java", + "java/src/org/chromium/chrome/browser/browsing_data/ConfirmImportantSitesDialogFragment.java", + "java/src/org/chromium/chrome/browser/browsing_data/OtherFormsOfHistoryDialogFragment.java", + "java/src/org/chromium/chrome/browser/browsing_data/UrlFilter.java", +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java +@@ -138,6 +138,7 @@ import org.chromium.chrome.browser.profiles.ProfileManager; + import org.chromium.chrome.browser.quick_delete.QuickDeleteController; + import org.chromium.chrome.browser.quick_delete.QuickDeleteDelegateImpl; + import org.chromium.chrome.browser.quick_delete.QuickDeleteMetricsDelegate; ++import org.chromium.chrome.browser.profiles.ProfileManagerUtils; + import org.chromium.chrome.browser.read_later.ReadingListBackPressHandler; + import org.chromium.chrome.browser.read_later.ReadingListUtils; + import org.chromium.chrome.browser.reengagement.ReengagementNotificationController; +@@ -1318,7 +1319,11 @@ public class ChromeTabbedActivity extends ChromeActivity. ++*/ ++ ++package org.chromium.chrome.browser.browsing_data; ++ ++import android.content.Context; ++import android.os.Bundle; ++import android.view.View; ++ ++import androidx.annotation.IntDef; ++import androidx.preference.Preference; ++ ++import org.chromium.base.Callback; ++import org.chromium.chrome.R; ++import org.chromium.chrome.browser.profiles.Profile; ++import org.chromium.components.browser_ui.settings.SpinnerPreference; ++ ++import java.lang.annotation.Retention; ++import java.lang.annotation.RetentionPolicy; ++import java.util.Arrays; ++import java.util.List; ++ ++public class ClearBrowsingDataFragmentAtStart extends ClearBrowsingDataFragment { ++ static final String PREF_TIME_RANGE = "time_period_spinner"; ++ ++ @Override ++ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { ++ super.onCreatePreferences(savedInstanceState, rootKey); ++ ++ SpinnerPreference spinner = (SpinnerPreference) findPreference(PREF_TIME_RANGE); ++ if (spinner != null) { ++ getPreferenceScreen().removePreference(spinner); ++ } ++ } ++ ++ private boolean isHistorySyncEnabled() { ++ return false; ++ } ++ ++ @Override ++ protected int getClearBrowsingDataTabType() { ++ return ClearBrowsingDataTab.AT_START; ++ } ++ ++ @Override ++ protected List getDialogOptions() { ++ return Arrays.asList(DialogOption.CLEAR_HISTORY, DialogOption.CLEAR_COOKIES_AND_SITE_DATA, ++ DialogOption.CLEAR_CACHE, DialogOption.CLEAR_PASSWORDS, ++ DialogOption.CLEAR_FORM_DATA, DialogOption.CLEAR_SITE_SETTINGS); ++ } ++ ++ @Override ++ protected void onClearBrowsingData() { ++ } ++ ++ @Override ++ protected boolean shouldClearBrowsingData() { ++ return false; ++ } ++} +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataTabsFragment.java b/chrome/android/java/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataTabsFragment.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataTabsFragment.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/browsing_data/ClearBrowsingDataTabsFragment.java +@@ -34,7 +34,7 @@ import org.chromium.components.browser_ui.util.TraceEventVectorDrawableCompat; + */ + public class ClearBrowsingDataTabsFragment + extends Fragment implements FragmentHelpAndFeedbackLauncher { +- public static final int CBD_TAB_COUNT = 2; ++ public static final int CBD_TAB_COUNT = 3; + + private ClearBrowsingDataFetcher mFetcher; + private HelpAndFeedbackLauncher mHelpAndFeedbackLauncher; +@@ -93,6 +93,8 @@ public class ClearBrowsingDataTabsFragment + return getActivity().getString(R.string.clear_browsing_data_basic_tab_title); + case 1: + return getActivity().getString(R.string.prefs_section_advanced); ++ case 2: ++ return getActivity().getString(R.string.clear_browsing_data_atstart_tab_title); + default: + throw new RuntimeException("invalid position: " + position); + } +@@ -130,6 +132,9 @@ public class ClearBrowsingDataTabsFragment + case 1: + fragment = new ClearBrowsingDataFragmentAdvanced(); + break; ++ case 2: ++ fragment = new ClearBrowsingDataFragmentAtStart(); ++ break; + default: + throw new RuntimeException("invalid position: " + position); + } +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 +@@ -2694,6 +2694,16 @@ + + Clear browsing data + ++ ++ ++ At Close ++ ++ ++ ++ ++ At Startup ++ ++ + + Clear history, cookies, cache, and more + +diff --git a/chrome/browser/android/browsing_data/browsing_data_bridge.cc b/chrome/browser/android/browsing_data/browsing_data_bridge.cc +--- a/chrome/browser/android/browsing_data/browsing_data_bridge.cc ++++ b/chrome/browser/android/browsing_data/browsing_data_bridge.cc +@@ -326,7 +326,7 @@ static void JNI_BrowsingDataBridge_SetLastClearBrowsingDataTab( + const JavaParamRef& obj, + jint tab_index) { + DCHECK_GE(tab_index, 0); +- DCHECK_LT(tab_index, 2); ++ DCHECK_LT(tab_index, 3); + GetPrefService()->SetInteger(browsing_data::prefs::kLastClearBrowsingDataTab, + tab_index); + } +diff --git a/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager.cc b/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager.cc +--- a/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager.cc ++++ b/chrome/browser/browsing_data/chrome_browsing_data_lifetime_manager.cc +@@ -326,8 +326,25 @@ void ChromeBrowsingDataLifetimeManager::Shutdown() { + + void ChromeBrowsingDataLifetimeManager::ClearBrowsingDataForOnExitPolicy( + bool keep_browser_alive) { +- const base::Value::List& data_types = profile_->GetPrefs()->GetList( +- browsing_data::prefs::kClearBrowsingDataOnExitList); ++ base::Value::List data_types = profile_->GetPrefs()->GetList( ++ browsing_data::prefs::kClearBrowsingDataOnExitList).Clone(); ++ ++ if (profile_->GetPrefs()->GetBoolean(browsing_data::prefs::kDeleteBrowsingHistoryAtStart)) ++ data_types.Append(browsing_data::policy_data_types::kBrowsingHistoryName); ++ if (profile_->GetPrefs()->GetBoolean(browsing_data::prefs::kDeleteDownloadHistoryAtStart)) ++ data_types.Append(browsing_data::policy_data_types::kDownloadHistoryName); ++ if (profile_->GetPrefs()->GetBoolean(browsing_data::prefs::kDeleteCacheAtStart)) ++ data_types.Append(browsing_data::policy_data_types::kCachedImagesAndFilesName); ++ if (profile_->GetPrefs()->GetBoolean(browsing_data::prefs::kDeleteCookiesAtStart)) ++ data_types.Append(browsing_data::policy_data_types::kCookiesAndOtherSiteDataName); ++ if (profile_->GetPrefs()->GetBoolean(browsing_data::prefs::kDeletePasswordsAtStart)) ++ data_types.Append(browsing_data::policy_data_types::kPasswordSigninName); ++ if (profile_->GetPrefs()->GetBoolean(browsing_data::prefs::kDeleteFormDataAtStart)) ++ data_types.Append(browsing_data::policy_data_types::kAutofillName); ++ if (profile_->GetPrefs()->GetBoolean(browsing_data::prefs::kDeleteHostedAppsDataAtStart)) ++ data_types.Append(browsing_data::policy_data_types::kHostedAppDataName); ++ if (profile_->GetPrefs()->GetBoolean(browsing_data::prefs::kDeleteSiteSettingsAtStart)) ++ data_types.Append(browsing_data::policy_data_types::kSiteSettingsName); + + if (IsConditionSatisfiedForBrowsingDataRemoval(GetSyncTypesForPolicyPref( + profile_, browsing_data::prefs::kClearBrowsingDataOnExitList))) { +@@ -426,6 +443,7 @@ void ChromeBrowsingDataLifetimeManager::StartScheduledBrowsingDataRemoval() { + bool ChromeBrowsingDataLifetimeManager:: + IsConditionSatisfiedForBrowsingDataRemoval( + const syncer::UserSelectableTypeSet sync_types) { ++ if ((true)) return true; + bool sync_disabled = !SyncServiceFactory::IsSyncAllowed(profile_); + // Return the state of sync if + // `features::kDataRetentionPoliciesDisableSyncTypesNeeded` is disabled or if +diff --git a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc +--- a/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc ++++ b/chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.cc +@@ -421,6 +421,9 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData( + delete_end_, CreateTaskCompletionClosure(TracingDataType::kHistory), + &history_task_tracker_); + } ++ } ++ ++ if (remove_mask & content::BrowsingDataRemover::DATA_TYPE_CACHE) { + if (ClipboardRecentContent::GetInstance()) + ClipboardRecentContent::GetInstance()->SuppressClipboardContent(); + +@@ -471,7 +474,9 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData( + prerender::NoStatePrefetchManager::CLEAR_PRERENDER_CONTENTS | + prerender::NoStatePrefetchManager::CLEAR_PRERENDER_HISTORY); + } ++ } + ++ if ((remove_mask & constants::DATA_TYPE_HISTORY) && may_delete_history) { + // The saved Autofill profiles and credit cards can include the origin from + // which these profiles and credit cards were learned. These are a form of + // history, so clear them as well. +@@ -492,7 +497,9 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData( + if (data_manager) + data_manager->Refresh(); + } ++ } + ++ if (remove_mask & content::BrowsingDataRemover::DATA_TYPE_CACHE) { + base::ThreadPool::PostTaskAndReply( + FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()}, + base::BindOnce( +@@ -578,9 +585,13 @@ void ChromeBrowsingDataRemoverDelegate::RemoveEmbedderData( + CreateTaskCompletionClosure(TracingDataType::kExploreSites)); + } + #endif ++ } + ++ if ((remove_mask & constants::DATA_TYPE_HISTORY) && may_delete_history) { + CreateCrashUploadList()->Clear(delete_begin_, delete_end_); ++ } + ++ if (remove_mask & content::BrowsingDataRemover::DATA_TYPE_CACHE) { + FindBarStateFactory::GetForBrowserContext(profile_)->SetLastSearchText( + std::u16string()); + +diff --git a/chrome/browser/extensions/api/settings_private/prefs_util.cc b/chrome/browser/extensions/api/settings_private/prefs_util.cc +--- a/chrome/browser/extensions/api/settings_private/prefs_util.cc ++++ b/chrome/browser/extensions/api/settings_private/prefs_util.cc +@@ -497,6 +497,23 @@ const PrefsUtil::TypedPrefMap& PrefsUtil::GetAllowlistedKeys() { + (*s_allowlist)[browsing_data::prefs::kLastClearBrowsingDataTab] = + settings_api::PrefType::PREF_TYPE_NUMBER; + ++ (*s_allowlist)[browsing_data::prefs::kDeleteBrowsingHistoryAtStart] = ++ settings_api::PrefType::PREF_TYPE_BOOLEAN; ++ (*s_allowlist)[browsing_data::prefs::kDeleteDownloadHistoryAtStart] = ++ settings_api::PrefType::PREF_TYPE_BOOLEAN; ++ (*s_allowlist)[browsing_data::prefs::kDeleteCacheAtStart] = ++ settings_api::PrefType::PREF_TYPE_BOOLEAN; ++ (*s_allowlist)[browsing_data::prefs::kDeleteCookiesAtStart] = ++ settings_api::PrefType::PREF_TYPE_BOOLEAN; ++ (*s_allowlist)[browsing_data::prefs::kDeletePasswordsAtStart] = ++ settings_api::PrefType::PREF_TYPE_BOOLEAN; ++ (*s_allowlist)[browsing_data::prefs::kDeleteFormDataAtStart] = ++ settings_api::PrefType::PREF_TYPE_BOOLEAN; ++ (*s_allowlist)[browsing_data::prefs::kDeleteSiteSettingsAtStart] = ++ settings_api::PrefType::PREF_TYPE_BOOLEAN; ++ (*s_allowlist)[browsing_data::prefs::kDeleteHostedAppsDataAtStart] = ++ settings_api::PrefType::PREF_TYPE_BOOLEAN; ++ + // Accessibility. + (*s_allowlist)[::prefs::kAccessibilityImageLabelsEnabled] = + settings_api::PrefType::PREF_TYPE_BOOLEAN; +diff --git a/chrome/browser/profiles/android/java/src/org/chromium/chrome/browser/profiles/ProfileManagerUtils.java b/chrome/browser/profiles/android/java/src/org/chromium/chrome/browser/profiles/ProfileManagerUtils.java +--- a/chrome/browser/profiles/android/java/src/org/chromium/chrome/browser/profiles/ProfileManagerUtils.java ++++ b/chrome/browser/profiles/android/java/src/org/chromium/chrome/browser/profiles/ProfileManagerUtils.java +@@ -52,9 +52,14 @@ public class ProfileManagerUtils { + } + } + ++ public static void removeBrowsingDataAtStart() { ++ ProfileManagerUtilsJni.get().removeBrowsingDataAtStart(); ++ } ++ + @NativeMethods + interface Natives { + void flushPersistentDataForAllProfiles(); + void removeSessionCookiesForAllProfiles(); ++ void removeBrowsingDataAtStart(); + } + } +diff --git a/chrome/browser/profiles/android/profile_manager_utils.cc b/chrome/browser/profiles/android/profile_manager_utils.cc +--- a/chrome/browser/profiles/android/profile_manager_utils.cc ++++ b/chrome/browser/profiles/android/profile_manager_utils.cc +@@ -67,3 +67,8 @@ static void JNI_ProfileManagerUtils_RemoveSessionCookiesForAllProfiles( + g_browser_process->profile_manager()->GetLoadedProfiles(), + RemoveSessionCookiesForProfile); + } ++ ++static void JNI_ProfileManagerUtils_RemoveBrowsingDataAtStart( ++ JNIEnv* env) { ++ g_browser_process->profile_manager()->RemoveBrowsingDataAtStart(); ++} +diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc +--- a/chrome/browser/profiles/profile_manager.cc ++++ b/chrome/browser/profiles/profile_manager.cc +@@ -1444,6 +1444,19 @@ void ProfileManager::DoFinalInit(ProfileInfo* profile_info, + } + } + ++void ProfileManager::RemoveBrowsingDataAtStart() { ++ base::ranges::for_each( ++ GetLoadedProfiles(), ++ [](Profile* profile) { ++ auto* browsing_data_lifetime_manager = ++ ChromeBrowsingDataLifetimeManagerFactory::GetForProfile(profile); ++ if (browsing_data_lifetime_manager && !profile->IsOffTheRecord()) { ++ browsing_data_lifetime_manager->ClearBrowsingDataForOnExitPolicy( ++ /*keep_browser_alive=*/false); ++ } ++ }); ++} ++ + void ProfileManager::DoFinalInitForServices(Profile* profile, + bool go_off_the_record) { + if (!do_final_services_init_ || +diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h +--- a/chrome/browser/profiles/profile_manager.h ++++ b/chrome/browser/profiles/profile_manager.h +@@ -198,6 +198,8 @@ class ProfileManager : public Profile::Delegate { + // profiles. + std::vector GetLoadedProfiles() const; + ++ void RemoveBrowsingDataAtStart(); ++ + // If a profile with the given path is currently managed by this object and + // fully initialized, return a pointer to the corresponding Profile object; + // otherwise return null. +diff --git a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.html b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.html +--- a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.html ++++ b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.html +@@ -285,6 +285,50 @@ + disabled="[[clearingInProgress_]]" no-set-pref> + + ++
++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++
+ + +
+diff --git a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.ts b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.ts +--- a/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.ts ++++ b/chrome/browser/resources/settings/clear_browsing_data_dialog/clear_browsing_data_dialog.ts +@@ -202,6 +202,7 @@ export class SettingsClearBrowsingDataDialogElement extends + value: () => + [loadTimeData.getString('basicPageTitle'), + loadTimeData.getString('advancedPageTitle'), ++ loadTimeData.getString('atStartPageTitle'), + ], + }, + +diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd +--- a/chrome/browser/ui/android/strings/android_chrome_strings.grd ++++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd +@@ -1547,6 +1547,9 @@ Your Google account may have other forms of browsing history like searches and a + + Basic + ++ ++ At Startup ++ + + Your Google Account may have other forms of browsing history at <link>myactivity.google.com</link>. + +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 +@@ -1716,6 +1716,7 @@ void AddPrivacyStrings(content::WebUIDataSource* html_source, + {"clearedData", IDS_SETTINGS_CLEARED_DATA}, + {"clearBrowsingData", IDS_SETTINGS_CLEAR_BROWSING_DATA}, + {"clearBrowsingDataDescription", IDS_SETTINGS_CLEAR_DATA_DESCRIPTION}, ++ {"atStartPageTitle", IDS_CLEAR_BROWSING_DATA_ATSTART_TAB_TITLE}, + {"titleAndCount", IDS_SETTINGS_TITLE_AND_COUNT}, + {"safeBrowsingEnableExtendedReportingDesc", + IDS_SETTINGS_SAFEBROWSING_ENABLE_REPORTING_DESC}, +diff --git a/components/browsing_data/core/browsing_data_policies_utils.cc b/components/browsing_data/core/browsing_data_policies_utils.cc +--- a/components/browsing_data/core/browsing_data_policies_utils.cc ++++ b/components/browsing_data/core/browsing_data_policies_utils.cc +@@ -19,15 +19,15 @@ namespace browsing_data { + + namespace policy_data_types { + // Data retention policy types that require sync to be disabled. +-const char kBrowsingHistoryName[] = "browsing_history"; +-const char kPasswordSigninName[] = "password_signin"; +-const char kAutofillName[] = "autofill"; +-const char kSiteSettingsName[] = "site_settings"; ++extern const char kBrowsingHistoryName[] = "browsing_history"; ++extern const char kPasswordSigninName[] = "password_signin"; ++extern const char kAutofillName[] = "autofill"; ++extern const char kSiteSettingsName[] = "site_settings"; + // Data retention policy types that do not require sync to be disabled. +-const char kHostedAppDataName[] = "hosted_app_data"; +-const char kDownloadHistoryName[] = "download_history"; +-const char kCookiesAndOtherSiteDataName[] = "cookies_and_other_site_data"; +-const char kCachedImagesAndFilesName[] = "cached_images_and_files"; ++extern const char kHostedAppDataName[] = "hosted_app_data"; ++extern const char kDownloadHistoryName[] = "download_history"; ++extern const char kCookiesAndOtherSiteDataName[] = "cookies_and_other_site_data"; ++extern const char kCachedImagesAndFilesName[] = "cached_images_and_files"; + } // namespace policy_data_types + + namespace { +diff --git a/components/browsing_data/core/browsing_data_policies_utils.h b/components/browsing_data/core/browsing_data_policies_utils.h +--- a/components/browsing_data/core/browsing_data_policies_utils.h ++++ b/components/browsing_data/core/browsing_data_policies_utils.h +@@ -12,6 +12,17 @@ + + namespace browsing_data { + ++namespace policy_data_types { ++extern const char kBrowsingHistoryName[]; ++extern const char kDownloadHistoryName[]; ++extern const char kCookiesAndOtherSiteDataName[]; ++extern const char kCachedImagesAndFilesName[]; ++extern const char kPasswordSigninName[]; ++extern const char kAutofillName[]; ++extern const char kSiteSettingsName[]; ++extern const char kHostedAppDataName[]; ++} // namespace policy_data_types ++ + // The data types of the BrowsingDataSettings policy. + enum class PolicyDataType { + kBrowsingHistory = 0, +diff --git a/components/browsing_data/core/browsing_data_utils.cc b/components/browsing_data/core/browsing_data_utils.cc +--- a/components/browsing_data/core/browsing_data_utils.cc ++++ b/components/browsing_data/core/browsing_data_utils.cc +@@ -318,6 +318,40 @@ bool GetDeletionPreferenceFromDataType( + BrowsingDataType data_type, + ClearBrowsingDataTab clear_browsing_data_tab, + std::string* out_pref) { ++ if (clear_browsing_data_tab == ClearBrowsingDataTab::AT_START) { ++ switch (data_type) { ++ case BrowsingDataType::HISTORY: ++ *out_pref = prefs::kDeleteBrowsingHistoryAtStart; ++ return true; ++ case BrowsingDataType::CACHE: ++ *out_pref = prefs::kDeleteCacheAtStart; ++ return true; ++ case BrowsingDataType::COOKIES: ++ *out_pref = prefs::kDeleteCookiesAtStart; ++ return true; ++ case BrowsingDataType::PASSWORDS: ++ *out_pref = prefs::kDeletePasswordsAtStart; ++ return true; ++ case BrowsingDataType::FORM_DATA: ++ *out_pref = prefs::kDeleteFormDataAtStart; ++ return true; ++ case BrowsingDataType::BOOKMARKS: ++ return false; ++ case BrowsingDataType::SITE_SETTINGS: ++ *out_pref = prefs::kDeleteSiteSettingsAtStart; ++ return true; ++ case BrowsingDataType::DOWNLOADS: ++ *out_pref = prefs::kDeleteDownloadHistoryAtStart; ++ return true; ++ case BrowsingDataType::HOSTED_APPS_DATA: ++ *out_pref = prefs::kDeleteHostedAppsDataAtStart; ++ return true; ++ case BrowsingDataType::NUM_TYPES: ++ NOTREACHED(); // This is not an actual type. ++ return false; ++ } ++ } ++ + if (clear_browsing_data_tab == ClearBrowsingDataTab::BASIC) { + switch (data_type) { + case BrowsingDataType::HISTORY: +diff --git a/components/browsing_data/core/clear_browsing_data_tab.h b/components/browsing_data/core/clear_browsing_data_tab.h +--- a/components/browsing_data/core/clear_browsing_data_tab.h ++++ b/components/browsing_data/core/clear_browsing_data_tab.h +@@ -18,7 +18,7 @@ namespace browsing_data { + // + // A Java counterpart will be generated for this enum. + // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.chrome.browser.browsing_data +-enum class ClearBrowsingDataTab { BASIC, ADVANCED, NUM_TYPES }; ++enum class ClearBrowsingDataTab { BASIC, ADVANCED, AT_START, NUM_TYPES }; + + } // namespace browsing_data + +diff --git a/components/browsing_data/core/pref_names.cc b/components/browsing_data/core/pref_names.cc +--- a/components/browsing_data/core/pref_names.cc ++++ b/components/browsing_data/core/pref_names.cc +@@ -26,6 +26,16 @@ const char kClearBrowsingDataOnExitDeletionPending[] = + // delete just before browser shutdown. + const char kClearBrowsingDataOnExitList[] = "browser.clear_data.clear_on_exit"; + ++// Clear Browsing Data dialog datatype preferences. ++const char kDeleteBrowsingHistoryAtStart[] = "browser.clear_data.browsing_history_at_start"; ++const char kDeleteDownloadHistoryAtStart[] = "browser.clear_data.download_history_at_start"; ++const char kDeleteCacheAtStart[] = "browser.clear_data.cache_at_start"; ++const char kDeleteCookiesAtStart[] = "browser.clear_data.cookies_at_start"; ++const char kDeletePasswordsAtStart[] = "browser.clear_data.passwords_at_start"; ++const char kDeleteFormDataAtStart[] = "browser.clear_data.form_data_at_start"; ++const char kDeleteHostedAppsDataAtStart[] = "browser.clear_data.hosted_apps_data_at_start"; ++const char kDeleteSiteSettingsAtStart[] = "browser.clear_data.site_settings_at_start"; ++ + // Clear browsing data deletion time period. + const char kDeleteTimePeriod[] = "browser.clear_data.time_period"; + const char kDeleteTimePeriodBasic[] = "browser.clear_data.time_period_basic"; +@@ -85,6 +95,23 @@ void RegisterBrowserUserPrefs(user_prefs::PrefRegistrySyncable* registry) { + registry->RegisterIntegerPref( + kClearBrowsingDataHistoryNoticeShownTimes, 0); + ++ registry->RegisterBooleanPref( ++ kDeleteBrowsingHistoryAtStart, false); ++ registry->RegisterBooleanPref( ++ kDeleteDownloadHistoryAtStart, false); ++ registry->RegisterBooleanPref( ++ kDeleteCacheAtStart, false); ++ registry->RegisterBooleanPref( ++ kDeleteCookiesAtStart, false); ++ registry->RegisterBooleanPref( ++ kDeletePasswordsAtStart, false); ++ registry->RegisterBooleanPref( ++ kDeleteFormDataAtStart, false); ++ registry->RegisterBooleanPref( ++ kDeleteHostedAppsDataAtStart, false); ++ registry->RegisterBooleanPref( ++ kDeleteSiteSettingsAtStart, false); ++ + #if !BUILDFLAG(IS_IOS) + registry->RegisterBooleanPref( + kDeleteDownloadHistory, true, +diff --git a/components/browsing_data/core/pref_names.h b/components/browsing_data/core/pref_names.h +--- a/components/browsing_data/core/pref_names.h ++++ b/components/browsing_data/core/pref_names.h +@@ -17,6 +17,15 @@ extern const char kBrowsingDataLifetime[]; + extern const char kClearBrowsingDataOnExitDeletionPending[]; + extern const char kClearBrowsingDataOnExitList[]; + ++extern const char kDeleteBrowsingHistoryAtStart[]; ++extern const char kDeleteDownloadHistoryAtStart[]; ++extern const char kDeleteCacheAtStart[]; ++extern const char kDeleteCookiesAtStart[]; ++extern const char kDeletePasswordsAtStart[]; ++extern const char kDeleteFormDataAtStart[]; ++extern const char kDeleteHostedAppsDataAtStart[]; ++extern const char kDeleteSiteSettingsAtStart[]; ++ + extern const char kDeleteTimePeriod[]; + extern const char kDeleteTimePeriodBasic[]; + +-- +2.25.1 diff --git a/build/patches/00Add-setting-to-invert-tap-and-long-tap.patch b/build/patches/00Add-setting-to-invert-tap-and-long-tap.patch new file mode 100644 index 0000000000000000000000000000000000000000..6da14f8fed8927ec3f264c6833c6f5cfb3ef43f9 --- /dev/null +++ b/build/patches/00Add-setting-to-invert-tap-and-long-tap.patch @@ -0,0 +1,536 @@ +From: uazo +Date: Wed, 12 Apr 2023 08:22:00 +0000 +Subject: Add setting to invert tap and long tap + +Reverses single tap to long tap in android for accessibility reasons. +The feature can be activated from the accessibility settings. +--- + chrome/android/java/res/values/ids.xml | 1 + + .../ChromeAccessibilitySettingsDelegate.java | 18 +++++++++++ + .../contextmenu/ChromeContextMenuItem.java | 5 ++- + .../ChromeContextMenuPopulator.java | 5 +++ + .../tab/TabContextMenuItemDelegate.java | 8 +++++ + chrome/browser/about_flags.cc | 5 +++ + .../contextmenu/ContextMenuItemDelegate.java | 2 ++ + chrome/browser/flag_descriptions.cc | 4 +++ + chrome/browser/flag_descriptions.h | 3 ++ + .../browser/flags/ChromeFeatureList.java | 4 +++ + .../strings/android_chrome_strings.grd | 9 ++++++ + .../res/xml/accessibility_preferences.xml | 5 +++ + .../accessibility/AccessibilitySettings.java | 11 +++++++ + .../AccessibilitySettingsDelegate.java | 2 ++ + third_party/blink/common/features.cc | 4 +++ + third_party/blink/public/common/features.h | 2 ++ + .../renderer/core/html/html_anchor_element.cc | 12 ++++++- + .../renderer/core/html/html_anchor_element.h | 2 +- + .../renderer/core/html/html_image_element.cc | 17 ++++++++++ + .../renderer/core/html/html_image_element.h | 2 ++ + .../core/page/context_menu_controller.cc | 32 +++++++++++++------ + .../core/page/context_menu_controller.h | 5 +-- + 22 files changed, 144 insertions(+), 14 deletions(-) + +diff --git a/chrome/android/java/res/values/ids.xml b/chrome/android/java/res/values/ids.xml +--- a/chrome/android/java/res/values/ids.xml ++++ b/chrome/android/java/res/values/ids.xml +@@ -91,6 +91,7 @@ found in the LICENSE file. + + + ++ + + + +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/ChromeAccessibilitySettingsDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/ChromeAccessibilitySettingsDelegate.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/ChromeAccessibilitySettingsDelegate.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/accessibility/settings/ChromeAccessibilitySettingsDelegate.java +@@ -148,6 +148,24 @@ public class ChromeAccessibilitySettingsDelegate implements AccessibilitySetting + mSnackbarManager.showSnackbar(mSnackbar); + } + ++ private static class ShowAlwaysContextMenuOnLinksDelegate implements BooleanPreferenceDelegate { ++ @Override ++ public boolean isEnabled() { ++ return ChromeFeatureList.sShowAlwaysContextMenuOnLinks.isEnabled(); ++ } ++ ++ @Override ++ public void setEnabled(boolean value) { ++ CachedFeatureFlags.setFlagEnabled(ChromeFeatureList.SHOW_ALWAYS_CONTEXT_MENU_ON_LINKS, ++ "show-always-context-menu-on-links", value); ++ } ++ } ++ ++ @Override ++ public BooleanPreferenceDelegate getShowAlwaysContextMenuOnLinksDelegate() { ++ return new ShowAlwaysContextMenuOnLinksDelegate(); ++ } ++ + @Override + public void addExtraPreferences(PreferenceFragmentCompat fragment) { + if (ImageDescriptionsController.getInstance().shouldShowImageDescriptionsMenuItem()) { +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuItem.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuItem.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuItem.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuItem.java +@@ -89,8 +89,9 @@ class ChromeContextMenuItem { + int SHARE_HIGHLIGHT = 32; + int REMOVE_HIGHLIGHT = 33; + int LEARN_MORE = 34; ++ int FOLLOW_LINK = 35; + // ALWAYS UPDATE! +- int NUM_ENTRIES = 35; ++ int NUM_ENTRIES = 36; + } + + /** +@@ -132,6 +133,7 @@ class ChromeContextMenuItem { + R.id.contextmenu_share_highlight, // Item.SHARE_HIGHLIGHT + R.id.contextmenu_remove_highlight, // Item.REMOVE_HIGHLIGHT + R.id.contextmenu_learn_more, // Item.LEARN_MORE ++ R.id.contextmenu_open_in_tab, // Item.OPEN_IN_NEW_CHROME_TAB + }; + + /** +@@ -173,6 +175,7 @@ class ChromeContextMenuItem { + R.string.contextmenu_share_highlight, // Item.SHARE_HIGHLIGHT + R.string.contextmenu_remove_highlight, // Item.REMOVE_HIGHLIGHT + R.string.contextmenu_learn_more, // Item.LEARN_MORE ++ R.string.contextmenu_open_in_tab, // Item.OPEN_IN_NEW_CHROME_TAB: + }; + + /** +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java +@@ -243,6 +243,9 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { + + if (mParams.isAnchor()) { + ModelList linkGroup = new ModelList(); ++ if (ChromeFeatureList.sShowAlwaysContextMenuOnLinks.isEnabled()) { ++ linkGroup.add(createListItem(Item.FOLLOW_LINK)); ++ } + if (FirstRunStatus.getFirstRunFlowComplete() && !isEmptyUrl(mParams.getUrl()) + && UrlUtilities.isAcceptedScheme(mParams.getUrl())) { + if (mMode == ContextMenuMode.NORMAL) { +@@ -601,6 +604,8 @@ public class ChromeContextMenuPopulator implements ContextMenuPopulator { + ShareHelper.shareDirectly( + params, ShareHelper.getLastShareComponentName(), getProfile(), false); + }); ++ } else if (itemId == R.id.contextmenu_open_in_tab) { ++ mItemDelegate.onOpenUrl(mParams.getUrl(), mParams.getReferrer()); + } else if (itemId == R.id.contextmenu_open_in_chrome) { + recordContextMenuSelection(ContextMenuUma.Action.OPEN_IN_CHROME); + mItemDelegate.onOpenInChrome(mParams.getUrl(), mParams.getPageUrl()); +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java +@@ -249,6 +249,14 @@ public class TabContextMenuItemDelegate implements ContextMenuItemDelegate { + mTab.loadUrl(loadUrlParams); + } + ++ @Override ++ public void onOpenUrl(GURL url, Referrer referrer) { ++ LoadUrlParams loadUrlParams = new LoadUrlParams(url.getSpec()); ++ loadUrlParams.setTransitionType(PageTransition.LINK); ++ loadUrlParams.setReferrer(referrer); ++ mTab.loadUrl(loadUrlParams); ++ } ++ + @Override + public void onOpenImageInNewTab(GURL url, Referrer referrer) { + LoadUrlParams loadUrlParams = new LoadUrlParams(url.getSpec()); +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 +@@ -7874,6 +7874,11 @@ const FeatureEntry kFeatureEntries[] = { + flag_descriptions::kMoveTopToolbarToBottomDescription, kOsAndroid, + FEATURE_VALUE_TYPE(features::kMoveTopToolbarToBottom)}, + ++ {"show-always-context-menu-on-links", ++ flag_descriptions::kShowAlwaysContextMenuOnLinksName, ++ flag_descriptions::kShowAlwaysContextMenuOnLinksDescription, kOsAndroid, ++ FEATURE_VALUE_TYPE(blink::features::kShowAlwaysContextMenuOnLinks)}, ++ + {"scroll-unification", flag_descriptions::kScrollUnificationName, + flag_descriptions::kScrollUnificationDescription, kOsAll, + FEATURE_VALUE_TYPE(features::kScrollUnification)}, +diff --git a/chrome/browser/contextmenu/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuItemDelegate.java b/chrome/browser/contextmenu/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuItemDelegate.java +--- a/chrome/browser/contextmenu/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuItemDelegate.java ++++ b/chrome/browser/contextmenu/java/src/org/chromium/chrome/browser/contextmenu/ContextMenuItemDelegate.java +@@ -109,6 +109,8 @@ public interface ContextMenuItemDelegate { + */ + void onOpenImageUrl(GURL url, Referrer referrer); + ++ void onOpenUrl(GURL url, Referrer referrer); ++ + /** + * Called when the {@code url} is of an image and should be opened in a new tab. + * @param url The image URL to open. +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 +@@ -1880,6 +1880,10 @@ const char kMoveTopToolbarToBottomName[] = "Move top toolbar to bottom"; + const char kMoveTopToolbarToBottomDescription[] = + "Move the top toolbar to the bottom."; + ++const char kShowAlwaysContextMenuOnLinksName[] = "Always show contextmenu on links"; ++const char kShowAlwaysContextMenuOnLinksDescription[] = ++ "Use accessibility settings to set it."; ++ + const char kIncognitoDownloadsWarningName[] = + "Enable Incognito downloads warning"; + const char kIncognitoDownloadsWarningDescription[] = +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 +@@ -1053,6 +1053,9 @@ extern const char kImprovedKeyboardShortcutsDescription[]; + extern const char kMoveTopToolbarToBottomName[]; + extern const char kMoveTopToolbarToBottomDescription[]; + ++extern const char kShowAlwaysContextMenuOnLinksName[]; ++extern const char kShowAlwaysContextMenuOnLinksDescription[]; ++ + extern const char kIncognitoReauthenticationForAndroidName[]; + extern const char kIncognitoReauthenticationForAndroidDescription[]; + +diff --git a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java +--- a/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java ++++ b/chrome/browser/flags/android/java/src/org/chromium/chrome/browser/flags/ChromeFeatureList.java +@@ -306,6 +306,8 @@ public abstract class ChromeFeatureList { + public static final String METRICS_SETTINGS_ANDROID = "MetricsSettingsAndroid"; + public static final String MOVE_TOP_TOOLBAR_TO_BOTTOM = + "MoveTopToolbarToBottom"; ++ public static final String SHOW_ALWAYS_CONTEXT_MENU_ON_LINKS = ++ "ShowAlwaysContextMenuOnLinks"; + public static final String NOTIFICATION_PERMISSION_VARIANT = "NotificationPermissionVariant"; + public static final String NOTIFICATION_PERMISSION_BOTTOM_SHEET = + "NotificationPermissionBottomSheet"; +@@ -557,6 +559,8 @@ public abstract class ChromeFeatureList { + new CachedFlag(OMNIBOX_MATCH_TOOLBAR_AND_STATUS_BAR_COLOR, false); + public static final CachedFlag sMoveTopToolbarToBottom = + new CachedFlag(MOVE_TOP_TOOLBAR_TO_BOTTOM, false); ++ public static final CachedFlag sShowAlwaysContextMenuOnLinks = ++ new CachedFlag(SHOW_ALWAYS_CONTEXT_MENU_ON_LINKS, false); + public static final CachedFlag sOmniboxModernizeVisualUpdate = + new CachedFlag(OMNIBOX_MODERNIZE_VISUAL_UPDATE, false); + public static final CachedFlag sOmniboxMostVisitedTilesAddRecycledViewPool = +diff --git a/chrome/browser/ui/android/strings/android_chrome_strings.grd b/chrome/browser/ui/android/strings/android_chrome_strings.grd +--- a/chrome/browser/ui/android/strings/android_chrome_strings.grd ++++ b/chrome/browser/ui/android/strings/android_chrome_strings.grd +@@ -1714,6 +1714,12 @@ Your Google account may have other forms of browsing history like searches and a + + Move toolbar to bottom + ++ ++ Always open the context menu in the links ++ ++ ++ Allows the context menu to be opened with a tap and follow the link with long press ++ + + + +@@ -2715,6 +2721,9 @@ To change this setting, <resetlink>reset sync

+ Open in new Chrome tab + ++ ++ Open in current tab ++ + + Open in Incognito tab + +diff --git a/components/browser_ui/accessibility/android/java/res/xml/accessibility_preferences.xml b/components/browser_ui/accessibility/android/java/res/xml/accessibility_preferences.xml +--- a/components/browser_ui/accessibility/android/java/res/xml/accessibility_preferences.xml ++++ b/components/browser_ui/accessibility/android/java/res/xml/accessibility_preferences.xml +@@ -26,6 +26,11 @@ found in the LICENSE file. + android:summary="@string/page_zoom_always_show_preference_summary" + android:title="@string/page_zoom_always_show_preference_title" /> + ++ ++ + { + Intent intent = new Intent(Settings.ACTION_CAPTIONING_SETTINGS); +@@ -205,6 +213,9 @@ public class AccessibilitySettings extends PreferenceFragmentCompat + } else if (PREF_MOVE_TOOLBAR_TO_BOTTOM.equals(preference.getKey())) { + mMoveTopToolbarToBottomDelegate.setEnabled((Boolean) newValue); + mDelegate.requestRestart(getActivity()); ++ } else if (PREF_ALWAYS_SHOW_CONTEXTMENU_ON_LINKS.equals(preference.getKey())) { ++ mShowAlwaysContextMenuOnLinksDelegate.setEnabled((Boolean) newValue); ++ mDelegate.requestRestart(getActivity()); + } + + return true; +diff --git a/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettingsDelegate.java b/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettingsDelegate.java +--- a/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettingsDelegate.java ++++ b/components/browser_ui/accessibility/android/java/src/org/chromium/components/browser_ui/accessibility/AccessibilitySettingsDelegate.java +@@ -33,6 +33,8 @@ public interface AccessibilitySettingsDelegate { + + BooleanPreferenceDelegate getMoveTopToolbarToBottomDelegate(); + ++ BooleanPreferenceDelegate getShowAlwaysContextMenuOnLinksDelegate(); ++ + /** + * @return The BrowserContextHandle that should be used to read and update settings. + */ +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 +@@ -1031,6 +1031,10 @@ BASE_FEATURE(kScopeMemoryCachePerContext, + "ScopeMemoryCachePerContext", + base::FEATURE_DISABLED_BY_DEFAULT); + ++BASE_FEATURE(kShowAlwaysContextMenuOnLinks, ++ "ShowAlwaysContextMenuOnLinks", ++ base::FEATURE_DISABLED_BY_DEFAULT); ++ + // Used to configure a per-origin allowlist of performance.mark events that are + // permitted to be included in slow reports traces. See crbug.com/1181774. + BASE_FEATURE(kBackgroundTracingPerformanceMark, +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 +@@ -434,6 +434,8 @@ BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kScopeMemoryCachePerContext); + + BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kEnablePenetratingImageSelection); + ++BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kShowAlwaysContextMenuOnLinks); ++ + // Used to configure a per-origin allowlist of performance.mark events that are + // permitted to be included in slow reports traces. See crbug.com/1181774. + BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kBackgroundTracingPerformanceMark); +diff --git a/third_party/blink/renderer/core/html/html_anchor_element.cc b/third_party/blink/renderer/core/html/html_anchor_element.cc +--- a/third_party/blink/renderer/core/html/html_anchor_element.cc ++++ b/third_party/blink/renderer/core/html/html_anchor_element.cc +@@ -55,6 +55,7 @@ + #include "third_party/blink/renderer/core/loader/ping_loader.h" + #include "third_party/blink/renderer/core/navigation_api/navigation_api.h" + #include "third_party/blink/renderer/core/page/chrome_client.h" ++#include "third_party/blink/renderer/core/page/context_menu_controller.h" + #include "third_party/blink/renderer/core/page/page.h" + #include "third_party/blink/renderer/core/speculation_rules/document_speculation_rules.h" + #include "third_party/blink/renderer/platform/heap/garbage_collected.h" +@@ -425,7 +426,7 @@ void HTMLAnchorElement::SendPings(const KURL& destination_url) const { + } + } + +-void HTMLAnchorElement::HandleClick(Event& event) { ++void HTMLAnchorElement::HandleClick(Event& event, bool do_not_show_context_menu) { + event.SetDefaultHandled(); + + LocalDOMWindow* window = GetDocument().domWindow(); +@@ -566,6 +567,15 @@ void HTMLAnchorElement::HandleClick(Event& event) { + /*element=*/this)); + } + ++ if (!do_not_show_context_menu && ++ base::FeatureList::IsEnabled(features::kShowAlwaysContextMenuOnLinks)) { ++ if (Page* page = GetDocument().GetPage()) { ++ page->GetContextMenuController().HandleContextMenuEvent( ++ To(&event), /*do_not_show_context_menu*/true); ++ return; ++ } ++ } ++ + Frame* target_frame = + frame->Tree().FindOrCreateFrameForNavigation(frame_request, target).frame; + +diff --git a/third_party/blink/renderer/core/html/html_anchor_element.h b/third_party/blink/renderer/core/html/html_anchor_element.h +--- a/third_party/blink/renderer/core/html/html_anchor_element.h ++++ b/third_party/blink/renderer/core/html/html_anchor_element.h +@@ -98,6 +98,7 @@ class CORE_EXPORT HTMLAnchorElement : public HTMLElement, public DOMURLUtils { + void SendPings(const KURL& destination_url) const; + + void Trace(Visitor*) const override; ++ void HandleClick(Event&, bool do_not_show_context_menu = false); + + protected: + void ParseAttribute(const AttributeModificationParams&) override; +@@ -119,7 +120,6 @@ class CORE_EXPORT HTMLAnchorElement : public HTMLElement, public DOMURLUtils { + bool IsInteractiveContent() const final; + InsertionNotificationRequest InsertedInto(ContainerNode&) override; + void RemovedFrom(ContainerNode&) override; +- void HandleClick(Event&); + + unsigned link_relations_ : 31; + mutable LinkHash cached_visited_link_hash_; +diff --git a/third_party/blink/renderer/core/html/html_image_element.cc b/third_party/blink/renderer/core/html/html_image_element.cc +--- a/third_party/blink/renderer/core/html/html_image_element.cc ++++ b/third_party/blink/renderer/core/html/html_image_element.cc +@@ -36,6 +36,7 @@ + #include "third_party/blink/renderer/core/dom/events/event_dispatch_forbidden_scope.h" + #include "third_party/blink/renderer/core/dom/node_traversal.h" + #include "third_party/blink/renderer/core/dom/shadow_root.h" ++#include "third_party/blink/renderer/core/events/mouse_event.h" + #include "third_party/blink/renderer/core/frame/attribution_src_loader.h" + #include "third_party/blink/renderer/core/frame/deprecation/deprecation.h" + #include "third_party/blink/renderer/core/frame/local_dom_window.h" +@@ -62,6 +63,7 @@ + #include "third_party/blink/renderer/core/media_type_names.h" + #include "third_party/blink/renderer/core/page/chrome_client.h" + #include "third_party/blink/renderer/core/page/page.h" ++#include "third_party/blink/renderer/core/page/context_menu_controller.h" + #include "third_party/blink/renderer/core/paint/timing/paint_timing.h" + #include "third_party/blink/renderer/core/probe/core_probes.h" + #include "third_party/blink/renderer/core/style/content_data.h" +@@ -719,6 +721,21 @@ void HTMLImageElement::DidFinishLifecycleUpdate( + } + } + ++void HTMLImageElement::DefaultEventHandler(Event& event) { ++ if (base::FeatureList::IsEnabled(features::kShowAlwaysContextMenuOnLinks)) { ++ auto* mouse_event = DynamicTo(&event); ++ if (mouse_event && mouse_event->type() == event_type_names::kClick) { ++ if (Page* page = GetDocument().GetPage()) { ++ page->GetContextMenuController().HandleContextMenuEvent( ++ mouse_event, /*do_not_show_context_menu*/true); ++ return; ++ } ++ } ++ } ++ ++ HTMLElement::DefaultEventHandler(event); ++} ++ + bool HTMLImageElement::draggable() const { + // Image elements are draggable by default. + return !EqualIgnoringASCIICase(FastGetAttribute(html_names::kDraggableAttr), +diff --git a/third_party/blink/renderer/core/html/html_image_element.h b/third_party/blink/renderer/core/html/html_image_element.h +--- a/third_party/blink/renderer/core/html/html_image_element.h ++++ b/third_party/blink/renderer/core/html/html_image_element.h +@@ -217,6 +217,8 @@ class CORE_EXPORT HTMLImageElement final + void DidAddUserAgentShadowRoot(ShadowRoot&) override; + void AdjustStyle(ComputedStyleBuilder&) override; + ++ void DefaultEventHandler(Event&) override; ++ + private: + bool AreAuthorShadowsAllowed() const override { return false; } + +diff --git a/third_party/blink/renderer/core/page/context_menu_controller.cc b/third_party/blink/renderer/core/page/context_menu_controller.cc +--- a/third_party/blink/renderer/core/page/context_menu_controller.cc ++++ b/third_party/blink/renderer/core/page/context_menu_controller.cc +@@ -171,14 +171,16 @@ void ContextMenuController::DocumentDetached(Document* document) { + } + } + +-void ContextMenuController::HandleContextMenuEvent(MouseEvent* mouse_event) { +- DCHECK(mouse_event->type() == event_type_names::kContextmenu); ++void ContextMenuController::HandleContextMenuEvent(MouseEvent* mouse_event, bool do_not_show_context_menu) { ++ if (!base::FeatureList::IsEnabled(features::kShowAlwaysContextMenuOnLinks)) { ++ DCHECK(mouse_event->type() == event_type_names::kContextmenu); ++ } + LocalFrame* frame = mouse_event->target()->ToNode()->GetDocument().GetFrame(); + PhysicalOffset location = + PhysicalOffset::FromPointFRound(mouse_event->AbsoluteLocation()); + + if (ShowContextMenu(frame, location, mouse_event->GetMenuSourceType(), +- mouse_event)) ++ mouse_event, do_not_show_context_menu)) + mouse_event->SetDefaultHandled(); + } + +@@ -414,7 +416,8 @@ bool ContextMenuController::ShouldShowContextMenuFromTouch( + bool ContextMenuController::ShowContextMenu(LocalFrame* frame, + const PhysicalOffset& point, + WebMenuSourceType source_type, +- const MouseEvent* mouse_event) { ++ const MouseEvent* mouse_event, ++ bool do_not_show_context_menu) { + // Displaying the context menu in this function is a big hack as we don't + // have context, i.e. whether this is being invoked via a script or in + // response to user input (Mouse event WM_RBUTTONDOWN, +@@ -437,6 +440,15 @@ bool ContextMenuController::ShowContextMenu(LocalFrame* frame, + if (!result.InnerNodeOrImageMapImage()) + return false; + ++ if (!do_not_show_context_menu && ++ base::FeatureList::IsEnabled(features::kShowAlwaysContextMenuOnLinks)) { ++ if (auto* anchor_element = DynamicTo(result.URLElement())) { ++ Event event; ++ anchor_element->HandleClick(event, /*do_not_show_context_menu*/true); ++ return true; ++ } ++ } ++ + // Clear any previously set cached results if we are resetting the hit test + // result. + image_selection_cached_result_ = nullptr; +@@ -776,11 +788,13 @@ bool ContextMenuController::ShowContextMenu(LocalFrame* frame, + data.form_renderer_id = GetFormRendererId(result); + data.field_renderer_id = GetFieldRendererId(result); + +- const bool from_touch = source_type == kMenuSourceTouch || +- source_type == kMenuSourceLongPress || +- source_type == kMenuSourceLongTap; +- if (from_touch && !ShouldShowContextMenuFromTouch(data)) +- return false; ++ if (!base::FeatureList::IsEnabled(features::kShowAlwaysContextMenuOnLinks)) { ++ const bool from_touch = source_type == kMenuSourceTouch || ++ source_type == kMenuSourceLongPress || ++ source_type == kMenuSourceLongTap; ++ if (from_touch && !ShouldShowContextMenuFromTouch(data)) ++ return false; ++ } + + WebLocalFrameImpl* selected_web_frame = + WebLocalFrameImpl::FromFrame(selected_frame); +diff --git a/third_party/blink/renderer/core/page/context_menu_controller.h b/third_party/blink/renderer/core/page/context_menu_controller.h +--- a/third_party/blink/renderer/core/page/context_menu_controller.h ++++ b/third_party/blink/renderer/core/page/context_menu_controller.h +@@ -57,7 +57,7 @@ class CORE_EXPORT ContextMenuController final + + void DocumentDetached(Document*); + +- void HandleContextMenuEvent(MouseEvent*); ++ void HandleContextMenuEvent(MouseEvent*, bool do_not_show_context_menu = false); + void ShowContextMenuAtPoint(LocalFrame*, + float x, + float y, +@@ -123,7 +123,8 @@ class CORE_EXPORT ContextMenuController final + bool ShowContextMenu(LocalFrame*, + const PhysicalOffset&, + WebMenuSourceType, +- const MouseEvent* mouse_event = nullptr); ++ const MouseEvent* mouse_event = nullptr, ++ bool do_not_show_context_menu = false); + + bool ShouldShowContextMenuFromTouch(const ContextMenuData&); + +-- +2.25.1 diff --git a/build/patches/00Always-open-browser-controls-in-new-tab.patch b/build/patches/00Always-open-browser-controls-in-new-tab.patch new file mode 100644 index 0000000000000000000000000000000000000000..c8499113a6bb6c861ed5255a5113222e4e63cad0 --- /dev/null +++ b/build/patches/00Always-open-browser-controls-in-new-tab.patch @@ -0,0 +1,45 @@ +From: Your Name +Date: Wed, 28 Dec 2022 07:19:58 +0000 +Subject: Always open browser controls in new tab + +--- + .../chrome/browser/tab/TabContextMenuItemDelegate.java | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/tab/TabContextMenuItemDelegate.java +@@ -20,6 +20,7 @@ import org.chromium.base.IntentUtils; + import org.chromium.base.PackageManagerUtils; + import org.chromium.base.metrics.RecordUserAction; + import org.chromium.base.supplier.Supplier; ++import org.chromium.cc.input.BrowserControlsState; + import org.chromium.chrome.browser.DefaultBrowserInfo; + import org.chromium.chrome.browser.IntentHandler; + import org.chromium.chrome.browser.bookmarks.BookmarkModel; +@@ -34,6 +35,7 @@ import org.chromium.chrome.browser.multiwindow.MultiWindowUtils; + import org.chromium.chrome.browser.offlinepages.OfflinePageBridge; + import org.chromium.chrome.browser.offlinepages.RequestCoordinatorBridge; + import org.chromium.chrome.browser.profiles.Profile; ++import org.chromium.chrome.browser.tab.TabBrowserControlsConstraintsHelper; + import org.chromium.chrome.browser.tab.state.CriticalPersistedTabData; + import org.chromium.chrome.browser.tabmodel.TabModelSelector; + import org.chromium.chrome.browser.tabmodel.document.TabDelegate; +@@ -204,6 +206,7 @@ public class TabContextMenuItemDelegate implements ContextMenuItemDelegate { + @Override + public void onOpenInNewTab( + GURL url, Referrer referrer, boolean navigateToTab, @Nullable Impression impression) { ++ TabBrowserControlsConstraintsHelper.get(mTab).update(BrowserControlsState.SHOWN, true); + RecordUserAction.record("MobileNewTabOpened"); + RecordUserAction.record("LinkOpenedInNewTab"); + LoadUrlParams loadUrlParams = new LoadUrlParams(url.getSpec()); +@@ -217,6 +220,7 @@ public class TabContextMenuItemDelegate implements ContextMenuItemDelegate { + + @Override + public void onOpenInNewTabInGroup(GURL url, Referrer referrer) { ++ TabBrowserControlsConstraintsHelper.get(mTab).update(BrowserControlsState.SHOWN, true); + RecordUserAction.record("MobileNewTabOpened"); + RecordUserAction.record("LinkOpenedInNewTab"); + LoadUrlParams loadUrlParams = new LoadUrlParams(url.getSpec()); +-- +2.25.1 diff --git a/build/patches/00Clear-CORS-Preflight-Cache-on-clearing-data.patch b/build/patches/00Clear-CORS-Preflight-Cache-on-clearing-data.patch new file mode 100644 index 0000000000000000000000000000000000000000..f06d6446a47a5db2a1cf08bd41ee967240dea195 --- /dev/null +++ b/build/patches/00Clear-CORS-Preflight-Cache-on-clearing-data.patch @@ -0,0 +1,91 @@ +From: uazo +Date: Wed, 19 Apr 2023 09:59:18 +0000 +Subject: Clear CORS Preflight Cache on clearing data + +--- + services/network/cors/preflight_cache.cc | 4 ++++ + services/network/cors/preflight_cache.h | 2 ++ + services/network/cors/preflight_controller.cc | 4 ++++ + services/network/cors/preflight_controller.h | 2 ++ + services/network/cors/preflight_result.cc | 2 +- + services/network/network_context.cc | 2 ++ + 6 files changed, 15 insertions(+), 1 deletion(-) + +diff --git a/services/network/cors/preflight_cache.cc b/services/network/cors/preflight_cache.cc +--- a/services/network/cors/preflight_cache.cc ++++ b/services/network/cors/preflight_cache.cc +@@ -201,6 +201,10 @@ void PreflightCache::MayPurgeForTesting(size_t max_entries, size_t purge_unit) { + MayPurge(max_entries, purge_unit); + } + ++void PreflightCache::ClearAll() { ++ cache_.clear(); ++} ++ + void PreflightCache::MayPurge(size_t max_entries, size_t purge_unit) { + if (cache_.size() <= max_entries) { + return; +diff --git a/services/network/cors/preflight_cache.h b/services/network/cors/preflight_cache.h +--- a/services/network/cors/preflight_cache.h ++++ b/services/network/cors/preflight_cache.h +@@ -78,6 +78,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) PreflightCache final { + // `max_entries` for testing. + void MayPurgeForTesting(size_t max_entries, size_t purge_unit); + ++ void ClearAll(); ++ + private: + void MayPurge(size_t max_entries, size_t purge_unit); + +diff --git a/services/network/cors/preflight_controller.cc b/services/network/cors/preflight_controller.cc +--- a/services/network/cors/preflight_controller.cc ++++ b/services/network/cors/preflight_controller.cc +@@ -674,6 +674,10 @@ void PreflightController::ClearCorsPreflightCache( + cache_.ClearCache(std::move(url_filter)); + } + ++void PreflightController::ClearCache() { ++ cache_.ClearAll(); ++} ++ + void PreflightController::RemoveLoader(PreflightLoader* loader) { + auto it = loaders_.find(loader); + DCHECK(it != loaders_.end()); +diff --git a/services/network/cors/preflight_controller.h b/services/network/cors/preflight_controller.h +--- a/services/network/cors/preflight_controller.h ++++ b/services/network/cors/preflight_controller.h +@@ -139,6 +139,8 @@ class COMPONENT_EXPORT(NETWORK_SERVICE) PreflightController final { + const net::NetLogWithSource& net_log, + bool acam_preflight_spec_conformant); + ++ void ClearCache(); ++ + // Clears the CORS preflight cache. The time range is always "all time" as + // the preflight cache max age is capped to 2hrs. in Chrome. + // It clears origins selectively when the url filter is not null, otherwise +diff --git a/services/network/cors/preflight_result.cc b/services/network/cors/preflight_result.cc +--- a/services/network/cors/preflight_result.cc ++++ b/services/network/cors/preflight_result.cc +@@ -37,7 +37,7 @@ constexpr base::TimeDelta kDefaultTimeout = base::Seconds(5); + // Maximum cache expiry time. Even if a CORS-preflight response contains + // Access-Control-Max-Age header that specifies a longer expiry time, this + // maximum time is applied. +-constexpr base::TimeDelta kMaxTimeout = base::Hours(2); ++constexpr base::TimeDelta kMaxTimeout = base::Seconds(600); + + // Holds TickClock instance to overwrite TimeTicks::Now() for testing. + const base::TickClock* tick_clock_for_testing = nullptr; +diff --git a/services/network/network_context.cc b/services/network/network_context.cc +--- a/services/network/network_context.cc ++++ b/services/network/network_context.cc +@@ -1041,6 +1041,8 @@ void NetworkContext::ClearHttpCache(base::Time start_time, + base::BindOnce(&NetworkContext::OnHttpCacheCleared, + base::Unretained(this), std::move(callback)))); + ++ cors_preflight_controller_.ClearCache(); ++ + NetworkServiceMemoryCache* memory_cache = GetMemoryCache(); + if (memory_cache) + memory_cache->Clear(); +-- +2.25.1 diff --git a/build/patches/00Deprecate-Data-URL-in-SVGUseElement.patch b/build/patches/00Deprecate-Data-URL-in-SVGUseElement.patch new file mode 100644 index 0000000000000000000000000000000000000000..14c07a7efd37d9534f5e3905af737c04b2be4a6f --- /dev/null +++ b/build/patches/00Deprecate-Data-URL-in-SVGUseElement.patch @@ -0,0 +1,25 @@ +From: uazo +Date: Mon, 5 Jun 2023 17:02:33 +0000 +Subject: Deprecate Data URL in SVGUseElement + +--- + .../blink/renderer/platform/runtime_enabled_features.json5 | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +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 +@@ -2939,9 +2939,8 @@ + status: "stable", + }, + { +- name: "RemoveDataUrlInSvgUse", +- status: "experimental", +- base_feature: "none", ++ name: "RemoveDataUrlInSvgUse", // enabled by default ++ status: "stable", + }, + { + name: "RemoveLegacySizeComputation", +-- +2.25.1 diff --git a/build/patches/00Disable-BackForwardCache.patch b/build/patches/00Disable-BackForwardCache.patch new file mode 100644 index 0000000000000000000000000000000000000000..565418544cfc8effe7c56f345a87717e1e81df5e --- /dev/null +++ b/build/patches/00Disable-BackForwardCache.patch @@ -0,0 +1,26 @@ +From: Your Name +Date: Tue, 14 Feb 2023 16:29:12 +0000 +Subject: Disable BackForwardCache + +--- + content/public/common/content_features.cc | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc +--- a/content/public/common/content_features.cc ++++ b/content/public/common/content_features.cc +@@ -97,9 +97,9 @@ BASE_FEATURE(kBackgroundFetch, + base::FEATURE_ENABLED_BY_DEFAULT); + + // Enable using the BackForwardCache. +-BASE_FEATURE(kBackForwardCache, +- "BackForwardCache", +- base::FEATURE_ENABLED_BY_DEFAULT); ++BASE_FEATURE(kBackForwardCache, // **** ++ "BackForwardCache", // always disabled ++ base::FEATURE_DISABLED_BY_DEFAULT); // in bromite + + // Enable showing a page preview during back/forward navigations. + BASE_FEATURE(kBackForwardTransitions, +-- +2.25.1 diff --git a/build/patches/00Disable-Component-Updates.patch b/build/patches/00Disable-Component-Updates.patch new file mode 100644 index 0000000000000000000000000000000000000000..575d74f0988c4029db567c9f0e09db03e70ba753 --- /dev/null +++ b/build/patches/00Disable-Component-Updates.patch @@ -0,0 +1,46 @@ +From: Your Name +Date: Tue, 8 Nov 2022 12:41:22 +0000 +Subject: Disable Component Updates + +--- + chrome/browser/component_updater/registration.cc | 1 + + components/component_updater/component_installer.cc | 1 + + components/component_updater/component_updater_service.cc | 2 +- + 3 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/chrome/browser/component_updater/registration.cc b/chrome/browser/component_updater/registration.cc +--- a/chrome/browser/component_updater/registration.cc ++++ b/chrome/browser/component_updater/registration.cc +@@ -101,6 +101,7 @@ + namespace component_updater { + + void RegisterComponentsForUpdate() { ++ if ((true)) return; + auto* const cus = g_browser_process->component_updater(); + + #if BUILDFLAG(IS_WIN) +diff --git a/components/component_updater/component_installer.cc b/components/component_updater/component_installer.cc +--- a/components/component_updater/component_installer.cc ++++ b/components/component_updater/component_installer.cc +@@ -88,6 +88,7 @@ void ComponentInstaller::Register(RegisterCallback register_callback, + base::OnceClosure callback, + base::TaskPriority task_priority, + const base::Version& registered_version) { ++ if ((true)) return; + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); + + task_runner_ = base::ThreadPool::CreateSequencedTaskRunner( +diff --git a/components/component_updater/component_updater_service.cc b/components/component_updater/component_updater_service.cc +--- a/components/component_updater/component_updater_service.cc ++++ b/components/component_updater/component_updater_service.cc +@@ -521,7 +521,7 @@ std::unique_ptr ComponentUpdateServiceFactory( + // Register prefs required by the component update service. + void RegisterComponentUpdateServicePrefs(PrefRegistrySimple* registry) { + // The component updates are enabled by default, if the preference is not set. +- registry->RegisterBooleanPref(prefs::kComponentUpdatesEnabled, true); ++ registry->RegisterBooleanPref(prefs::kComponentUpdatesEnabled, false); + } + + } // namespace component_updater +-- +2.25.1 diff --git a/build/patches/00Disable-Compression-Dictionary-Transport.patch b/build/patches/00Disable-Compression-Dictionary-Transport.patch new file mode 100644 index 0000000000000000000000000000000000000000..cd9314cc1f7dd5b9121862d0fd2f2af23ce95079 --- /dev/null +++ b/build/patches/00Disable-Compression-Dictionary-Transport.patch @@ -0,0 +1,34 @@ +From: uazo +Date: Sat, 3 Jun 2023 15:04:55 +0000 +Subject: Disable Compression Dictionary Transport + +--- + .../renderer/platform/runtime_enabled_features.json5 | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +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 +@@ -677,16 +677,16 @@ + status: "experimental", + }, + { +- name: "CompressionDictionaryTransport", +- base_feature_status: "enabled", +- copied_from_base_feature_if: "overridden", ++ name: "CompressionDictionaryTransport", // need to be disabled + origin_trial_feature_name: "CompressionDictionaryTransport", + public: true, ++ status: "experimental", + }, + { +- name: "CompressionDictionaryTransportBackend", ++ name: "CompressionDictionaryTransportBackend", // need to be disabled + base_feature_status: "disabled", + public: true, ++ status: "experimental", + }, + { + name: "ComputedAccessibilityInfo", +-- +2.25.1 diff --git a/build/patches/00Disable-FedCm.patch b/build/patches/00Disable-FedCm.patch new file mode 100644 index 0000000000000000000000000000000000000000..69da4dae4062a1a085dbb1cd74d4a418a5b47f83 --- /dev/null +++ b/build/patches/00Disable-FedCm.patch @@ -0,0 +1,35 @@ +From: Your Name +Date: Tue, 14 Feb 2023 16:26:17 +0000 +Subject: Disable FedCm + +--- + content/public/common/content_features.cc | 2 +- + .../blink/renderer/platform/runtime_enabled_features.json5 | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc +--- a/content/public/common/content_features.cc ++++ b/content/public/common/content_features.cc +@@ -395,7 +395,7 @@ BASE_FEATURE(kExtraSafelistedRequestHeadersForOutOfBlinkCors, + // by the flag in RuntimeEnabledFeatures on the blink side. See also + // the use of kSetOnlyIfOverridden in content/child/runtime_features.cc. + // We enable it here by default to support use in origin trials. +-BASE_FEATURE(kFedCm, "FedCm", base::FEATURE_ENABLED_BY_DEFAULT); ++BASE_FEATURE(kFedCm, "FedCm", base::FEATURE_DISABLED_BY_DEFAULT); + + // Field trial boolean parameter which indicates whether FedCM IDP sign-out + // is enabled. +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 +@@ -1574,7 +1574,7 @@ + { + name: "FedCm", + public: true, +- status: "stable", ++ status: "test", + base_feature: "none", + }, + { +-- +2.25.1 diff --git a/build/patches/00Disable-FirstPartySets-and-StorageAccessAPI.patch b/build/patches/00Disable-FirstPartySets-and-StorageAccessAPI.patch new file mode 100644 index 0000000000000000000000000000000000000000..16c1d409c5809483b3b76d2d32bead40979c09a4 --- /dev/null +++ b/build/patches/00Disable-FirstPartySets-and-StorageAccessAPI.patch @@ -0,0 +1,39 @@ +From: uazo +Date: Tue, 2 May 2023 15:26:46 +0000 +Subject: Disable FirstPartySets and StorageAccessAPI + +--- + components/privacy_sandbox/privacy_sandbox_prefs.cc | 2 +- + content/public/common/content_features.cc | 6 +++--- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/components/privacy_sandbox/privacy_sandbox_prefs.cc b/components/privacy_sandbox/privacy_sandbox_prefs.cc +--- a/components/privacy_sandbox/privacy_sandbox_prefs.cc ++++ b/components/privacy_sandbox/privacy_sandbox_prefs.cc +@@ -155,7 +155,7 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) { + registry->RegisterBooleanPref( + prefs::kPrivacySandboxFirstPartySetsDataAccessAllowedInitialized, false); + registry->RegisterBooleanPref( +- prefs::kPrivacySandboxFirstPartySetsEnabled, true, ++ prefs::kPrivacySandboxFirstPartySetsEnabled, false, + user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); + + registry->RegisterBooleanPref(prefs::kPrivacySandboxTopicsConsentGiven, +diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc +--- a/content/public/common/content_features.cc ++++ b/content/public/common/content_features.cc +@@ -474,9 +474,9 @@ BASE_FEATURE(kWebIdentityMDocs, + base::FEATURE_DISABLED_BY_DEFAULT); + + // Enables usage of First Party Sets to determine cookie availability. +-BASE_FEATURE(kFirstPartySets, +- "FirstPartySets", +- base::FEATURE_DISABLED_BY_DEFAULT); ++BASE_FEATURE(kFirstPartySets, // always ++ "FirstPartySets", // disabled ++ base::FEATURE_DISABLED_BY_DEFAULT); // in bromite + + // Controls whether to clear sites data on FPS transitions. + const base::FeatureParam kFirstPartySetsClearSiteDataOnChangedSets{ +-- +2.25.1 diff --git a/build/patches/00Disable-GSA-by-default.patch b/build/patches/00Disable-GSA-by-default.patch new file mode 100644 index 0000000000000000000000000000000000000000..52eaf7a8d9611ef4ef483d46487b9272d6421ece --- /dev/null +++ b/build/patches/00Disable-GSA-by-default.patch @@ -0,0 +1,160 @@ +From: uazo +Date: Sun, 7 May 2023 14:01:56 +0000 +Subject: Disable GSA by default + +--- + .../org/chromium/chrome/browser/IntentHandler.java | 5 ----- + .../org/chromium/chrome/browser/share/LensUtils.java | 12 +----------- + chrome/browser/flags/android/chrome_feature_list.cc | 8 ++++---- + .../org/chromium/chrome/browser/gsa/GSAState.java | 11 +++++------ + 4 files changed, 10 insertions(+), 26 deletions(-) + +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java +@@ -44,7 +44,6 @@ import org.chromium.chrome.browser.document.ChromeLauncherActivity; + import org.chromium.chrome.browser.externalnav.IntentWithRequestMetadataHandler; + import org.chromium.chrome.browser.externalnav.IntentWithRequestMetadataHandler.RequestMetadata; + import org.chromium.chrome.browser.flags.ChromeFeatureList; +-import org.chromium.chrome.browser.gsa.GSAState; + import org.chromium.chrome.browser.offlinepages.OfflinePageUtils; + import org.chromium.chrome.browser.omnibox.suggestions.AutocompleteControllerProvider; + import org.chromium.chrome.browser.profiles.Profile; +@@ -265,8 +264,6 @@ public class IntentHandler { + private static int sReferrerId; + private static String sPendingIncognitoUrl; + +- public static final String PACKAGE_GSA = GSAState.PACKAGE_NAME; +- + private static final String PACKAGE_GMAIL = "com.google.android.gm"; + private static final String PACKAGE_PLUS = "com.google.android.apps.plus"; + private static final String PACKAGE_HANGOUTS = "com.google.android.talk"; +@@ -498,8 +495,6 @@ public class IntentHandler { + return ExternalAppId.LINE; + } else if (packageName.equals(PACKAGE_WHATSAPP)) { + return ExternalAppId.WHATSAPP; +- } else if (packageName.equals(PACKAGE_GSA)) { +- return ExternalAppId.GSA; + } else if (packageName.equals(ContextUtils.getApplicationContext().getPackageName())) { + return ExternalAppId.CHROME; + } else if (packageName.startsWith(WEBAPK_PACKAGE_PREFIX)) { +diff --git a/chrome/android/java/src/org/chromium/chrome/browser/share/LensUtils.java b/chrome/android/java/src/org/chromium/chrome/browser/share/LensUtils.java +--- a/chrome/android/java/src/org/chromium/chrome/browser/share/LensUtils.java ++++ b/chrome/android/java/src/org/chromium/chrome/browser/share/LensUtils.java +@@ -11,7 +11,6 @@ import android.text.TextUtils; + import org.chromium.chrome.R; + import org.chromium.chrome.browser.IntentHandler; + import org.chromium.chrome.browser.flags.ChromeFeatureList; +-import org.chromium.chrome.browser.gsa.GSAState; + import org.chromium.components.externalauth.ExternalAuthUtils; + + /** +@@ -62,12 +61,7 @@ public class LensUtils { + if (context == null) { + return ""; + } +- String agsaVersion = GSAState.getInstance().getAgsaVersionName(); +- if (agsaVersion == null) { + return ""; +- } else { +- return agsaVersion; +- } + } + } + +@@ -119,11 +113,7 @@ public class LensUtils { + * @return Whether the package is valid. + */ + public static boolean isValidAgsaPackage(final ExternalAuthUtils externalAuthUtils) { +- if (sFakePassableLensEnvironmentForTesting) { +- return true; +- } +- +- return externalAuthUtils.isGoogleSigned(IntentHandler.PACKAGE_GSA); ++ return false; + } + + public static boolean isGoogleLensFeatureEnabled(boolean isIncognito) { +diff --git a/chrome/browser/flags/android/chrome_feature_list.cc b/chrome/browser/flags/android/chrome_feature_list.cc +--- a/chrome/browser/flags/android/chrome_feature_list.cc ++++ b/chrome/browser/flags/android/chrome_feature_list.cc +@@ -677,8 +677,8 @@ BASE_FEATURE(kContextMenuGoogleLensSearchOptimizations, + base::FEATURE_DISABLED_BY_DEFAULT); + + BASE_FEATURE(kContextMenuSearchWithGoogleLens, +- "ContextMenuSearchWithGoogleLens", +- base::FEATURE_ENABLED_BY_DEFAULT); ++ "ContextMenuSearchWithGoogleLens", // always disabled ++ base::FEATURE_DISABLED_BY_DEFAULT); // in bromite + + BASE_FEATURE(kContextMenuShopWithGoogleLens, + "ContextMenuShopWithGoogleLens", +@@ -759,8 +759,8 @@ BASE_FEATURE(kOfflineIndicatorV2, + base::FEATURE_ENABLED_BY_DEFAULT); + + BASE_FEATURE(kExperimentsForAgsa, +- "ExperimentsForAgsa", +- base::FEATURE_ENABLED_BY_DEFAULT); ++ "ExperimentsForAgsa", // disabled by default ++ base::FEATURE_DISABLED_BY_DEFAULT); // in Bromite + + BASE_FEATURE(kExploreSites, "ExploreSites", base::FEATURE_DISABLED_BY_DEFAULT); + +diff --git a/chrome/browser/gsa/java/src/org/chromium/chrome/browser/gsa/GSAState.java b/chrome/browser/gsa/java/src/org/chromium/chrome/browser/gsa/GSAState.java +--- a/chrome/browser/gsa/java/src/org/chromium/chrome/browser/gsa/GSAState.java ++++ b/chrome/browser/gsa/java/src/org/chromium/chrome/browser/gsa/GSAState.java +@@ -33,8 +33,6 @@ import java.util.regex.Pattern; + * A class responsible for representing the current state of Chrome's integration with GSA. + */ + public class GSAState { +- public static final String PACKAGE_NAME = "com.google.android.googlequicksearchbox"; +- + /** Used to observe state changes in the class. */ + public interface Observer { + /** Called when the GSA account name is set. */ +@@ -74,7 +72,7 @@ public class GSAState { + /** + * Caches the result of a computation on whether GSA is available. + */ +- private Boolean mGsaAvailable; ++ private Boolean mGsaAvailable = false; + + /** + * The Google account email address being used by GSA according to the latest update we have +@@ -155,7 +153,7 @@ public class GSAState { + + /** Returns whether the GSA package is installed on device. */ + public boolean isGsaInstalled() { +- return PackageUtils.isPackageInstalled(PACKAGE_NAME); ++ return false; + } + + /** +@@ -178,6 +176,7 @@ public class GSAState { + */ + public boolean isAgsaVersionBelowMinimum( + String installedVersionName, String minimumVersionName) { ++ if ((true)) return true; + if (TextUtils.isEmpty(installedVersionName) || TextUtils.isEmpty(minimumVersionName)) { + return true; + } +@@ -209,7 +208,7 @@ public class GSAState { + * @return Whether the given intent can be handled by Agsa. + */ + public boolean canAgsaHandleIntent(@NonNull Intent intent) { +- if (!intent.getPackage().equals(PACKAGE_NAME)) return false; ++ if ((true)) return false; + + ComponentName activity = + intent.resolveActivity(ContextUtils.getApplicationContext().getPackageManager()); +@@ -223,7 +222,7 @@ public class GSAState { + * @return The version name of the Agsa package or null if it can't be found. + */ + public @Nullable String getAgsaVersionName() { +- PackageInfo packageInfo = PackageUtils.getPackageInfo(PACKAGE_NAME, 0); ++ PackageInfo packageInfo = null; + return packageInfo == null ? null : packageInfo.versionName; + } + +-- +2.25.1 diff --git a/build/patches/00Disable-GetInstalledRelatedApps-API.patch b/build/patches/00Disable-GetInstalledRelatedApps-API.patch new file mode 100644 index 0000000000000000000000000000000000000000..5050673dfa4de0a1f54eaaf5a59d47c5620ec374 --- /dev/null +++ b/build/patches/00Disable-GetInstalledRelatedApps-API.patch @@ -0,0 +1,67 @@ +From: uazo +Date: Sun, 7 May 2023 13:13:47 +0000 +Subject: Disable GetInstalledRelatedApps API + +--- + .../components/installedapp/InstalledAppProviderImpl.java | 1 + + .../browser/installedapp/installed_app_provider_impl_win.cc | 1 + + content/public/common/content_features.cc | 4 ++-- + .../blink/renderer/platform/runtime_enabled_features.json5 | 2 +- + 4 files changed, 5 insertions(+), 3 deletions(-) + +diff --git a/components/installedapp/android/java/src/org/chromium/components/installedapp/InstalledAppProviderImpl.java b/components/installedapp/android/java/src/org/chromium/components/installedapp/InstalledAppProviderImpl.java +--- a/components/installedapp/android/java/src/org/chromium/components/installedapp/InstalledAppProviderImpl.java ++++ b/components/installedapp/android/java/src/org/chromium/components/installedapp/InstalledAppProviderImpl.java +@@ -155,6 +155,7 @@ public class InstalledAppProviderImpl implements InstalledAppProvider { + @UiThread + public void filterInstalledApps(final RelatedApplication[] relatedApps, final Url manifestUrl, + final FilterInstalledApps_Response callback) { ++ assert false; + GURL url = mRenderFrameHost.getLastCommittedURL(); + final GURL frameUrl = url == null ? GURL.emptyGURL() : url; + int delayMillis = 0; +diff --git a/content/browser/installedapp/installed_app_provider_impl_win.cc b/content/browser/installedapp/installed_app_provider_impl_win.cc +--- a/content/browser/installedapp/installed_app_provider_impl_win.cc ++++ b/content/browser/installedapp/installed_app_provider_impl_win.cc +@@ -112,6 +112,7 @@ void FilterInstalledAppsForWin( + std::vector related_apps, + blink::mojom::InstalledAppProvider::FilterInstalledAppsCallback callback, + const GURL frame_url) { ++ CHECK(true); + ComPtr launcher_statics; + HRESULT hr = base::win::RoActivateInstance( + base::win::ScopedHString::Create(RuntimeClass_Windows_System_Launcher) +diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc +--- a/content/public/common/content_features.cc ++++ b/content/public/common/content_features.cc +@@ -573,12 +573,12 @@ BASE_FEATURE(kInnerFrameCompositorSurfaceEviction, + base::FEATURE_ENABLED_BY_DEFAULT); // guard this + + // Kill switch for the GetInstalledRelatedApps API. +-BASE_FEATURE(kInstalledApp, "InstalledApp", base::FEATURE_ENABLED_BY_DEFAULT); ++BASE_FEATURE(kInstalledApp, "InstalledApp", base::FEATURE_DISABLED_BY_DEFAULT); + + // Allow Windows specific implementation for the GetInstalledRelatedApps API. + BASE_FEATURE(kInstalledAppProvider, + "InstalledAppProvider", +- base::FEATURE_ENABLED_BY_DEFAULT); ++ base::FEATURE_DISABLED_BY_DEFAULT); + + // Enable support for isolated web apps. This will guard features like serving + // isolated web apps via the isolated-app:// scheme, and other advanced isolated +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 +@@ -2050,9 +2050,9 @@ + name: "FingerprintingCanvasImageDataNoise", + }, + { ++ // disable GetInstalledRelatedApps + name: "InstalledApp", + public: true, +- status: "stable", + base_feature: "none", + }, + { +-- +2.25.1 diff --git a/build/patches/00Disable-PrivateStateTokens-API.patch b/build/patches/00Disable-PrivateStateTokens-API.patch new file mode 100644 index 0000000000000000000000000000000000000000..6d189e88d6698ca8925f7ea951193d3af996e4f6 --- /dev/null +++ b/build/patches/00Disable-PrivateStateTokens-API.patch @@ -0,0 +1,29 @@ +From: uazo +Date: Mon, 15 May 2023 12:33:18 +0000 +Subject: Disable PrivateStateTokens API + +--- + services/network/public/cpp/features.cc | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/services/network/public/cpp/features.cc b/services/network/public/cpp/features.cc +--- a/services/network/public/cpp/features.cc ++++ b/services/network/public/cpp/features.cc +@@ -147,12 +147,12 @@ BASE_FEATURE(kAttributionReportingCrossAppWeb, + // set, and handling their responses, according to the protocol. + // (See https://github.com/WICG/trust-token-api.) + BASE_FEATURE(kPrivateStateTokens, +- "PrivateStateTokens", +- base::FEATURE_DISABLED_BY_DEFAULT); ++ "PrivateStateTokens", // must be disabled ++ base::FEATURE_DISABLED_BY_DEFAULT); // in bromite + + // Secondary flag used by the FLEDGE ads experiment in the interim before + // PSTs are fully rolled out to stable. +-BASE_FEATURE(kFledgePst, "TrustTokens", base::FEATURE_DISABLED_BY_DEFAULT); ++BASE_FEATURE(kFledgePst, "TrustTokens", base::FEATURE_DISABLED_BY_DEFAULT); // must be disabled + + // Determines which Trust Tokens operations require the TrustTokens origin trial + // active in order to be used. This is runtime-configurable so that the Trust +-- +2.25.1 diff --git a/build/patches/00Disable-SHA1-Server-Signature.patch b/build/patches/00Disable-SHA1-Server-Signature.patch new file mode 100644 index 0000000000000000000000000000000000000000..8f4b3cf2a124bc37ac1609e90e3865016ffef6c8 --- /dev/null +++ b/build/patches/00Disable-SHA1-Server-Signature.patch @@ -0,0 +1,24 @@ +From: uazo +Date: Tue, 18 Apr 2023 14:17:19 +0000 +Subject: Disable SHA1 Server Signature + +--- + net/base/features.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/net/base/features.cc b/net/base/features.cc +--- a/net/base/features.cc ++++ b/net/base/features.cc +@@ -79,8 +79,8 @@ BASE_FEATURE(kUseDnsHttpsSvcbAlpn, + base::FEATURE_DISABLED_BY_DEFAULT); + + BASE_FEATURE(kSHA1ServerSignature, +- "SHA1ServerSignature", +- base::FEATURE_ENABLED_BY_DEFAULT); ++ "SHA1ServerSignature", // disabled ++ base::FEATURE_DISABLED_BY_DEFAULT); // in bromite + + BASE_FEATURE(kEnableTLS13EarlyData, + "EnableTLS13EarlyData", +-- +2.25.1 diff --git a/build/patches/00Disable-WebGPU.patch b/build/patches/00Disable-WebGPU.patch new file mode 100644 index 0000000000000000000000000000000000000000..310c94194f0e097cd77a3ba39c1d4e1c031e5ed8 --- /dev/null +++ b/build/patches/00Disable-WebGPU.patch @@ -0,0 +1,35 @@ +From: uazo +Date: Mon, 1 May 2023 12:07:49 +0000 +Subject: Disable WebGPU + +--- + gpu/config/gpu_finch_features.cc | 2 +- + .../blink/renderer/platform/runtime_enabled_features.json5 | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/gpu/config/gpu_finch_features.cc b/gpu/config/gpu_finch_features.cc +--- a/gpu/config/gpu_finch_features.cc ++++ b/gpu/config/gpu_finch_features.cc +@@ -267,7 +267,7 @@ BASE_FEATURE(kEnableDrDcVulkan, + BASE_FEATURE(kWebGPUService, + "WebGPUService", + #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN) || BUILDFLAG(IS_CHROMEOS_ASH) +- base::FEATURE_ENABLED_BY_DEFAULT ++ base::FEATURE_DISABLED_BY_DEFAULT + #else + base::FEATURE_DISABLED_BY_DEFAULT + #endif +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 +@@ -3957,7 +3957,7 @@ + // Note that this isn't enough to enable WebGPU and that access to + // WebGPU is further gated on the "WebGPUService" feature exposing GPU + // process access to WebGPU to the renderer process. +- status: "stable", ++ status: "test", + }, + { + // WebGPU developer features are deliberately not enabled by experimental +-- +2.25.1 diff --git a/build/patches/00Disable-csp-reports.patch b/build/patches/00Disable-csp-reports.patch new file mode 100644 index 0000000000000000000000000000000000000000..ba96e64cdddfc4a00d461f43c26c5c0648693fcd --- /dev/null +++ b/build/patches/00Disable-csp-reports.patch @@ -0,0 +1,37 @@ +From: Your Name +Date: Sun, 26 Feb 2023 19:46:04 +0000 +Subject: Disable csp reports + +--- + third_party/blink/renderer/core/loader/ping_loader.cc | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/third_party/blink/renderer/core/loader/ping_loader.cc b/third_party/blink/renderer/core/loader/ping_loader.cc +--- a/third_party/blink/renderer/core/loader/ping_loader.cc ++++ b/third_party/blink/renderer/core/loader/ping_loader.cc +@@ -68,6 +68,7 @@ bool SendBeaconCommon(const ScriptState& state, + LocalFrame* frame, + const KURL& url, + const BeaconData& beacon) { ++ if ((true)) return true; + if (!frame->DomWindow() + ->GetContentSecurityPolicyForWorld(&state.World()) + ->AllowConnectToSource(url, url, RedirectStatus::kNoRedirect)) { +@@ -103,6 +104,7 @@ bool SendBeaconCommon(const ScriptState& state, + void PingLoader::SendLinkAuditPing(LocalFrame* frame, + const KURL& ping_url, + const KURL& destination_url) { ++ if ((true)) return; + if (!ping_url.ProtocolIsInHTTPFamily()) + return; + +@@ -139,6 +141,7 @@ void PingLoader::SendLinkAuditPing(LocalFrame* frame, + void PingLoader::SendViolationReport(ExecutionContext* execution_context, + const KURL& report_url, + scoped_refptr report) { ++ if ((true)) return; + ResourceRequest request(report_url); + request.SetHttpMethod(http_names::kPOST); + request.SetHTTPContentType("application/csp-report"); +-- +2.25.1 diff --git a/build/patches/00Disable-devtools-remote-and-custom-protocols.patch b/build/patches/00Disable-devtools-remote-and-custom-protocols.patch new file mode 100644 index 0000000000000000000000000000000000000000..c94039e296ca5f6909818c2c86e2bce7f9e44b65 --- /dev/null +++ b/build/patches/00Disable-devtools-remote-and-custom-protocols.patch @@ -0,0 +1,31 @@ +From: uazo +Date: Mon, 17 Apr 2023 12:38:44 +0000 +Subject: Disable devtools remote and custom protocols + +--- + chrome/browser/ui/webui/devtools_ui_data_source.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/chrome/browser/ui/webui/devtools_ui_data_source.cc b/chrome/browser/ui/webui/devtools_ui_data_source.cc +--- a/chrome/browser/ui/webui/devtools_ui_data_source.cc ++++ b/chrome/browser/ui/webui/devtools_ui_data_source.cc +@@ -175,7 +175,7 @@ void DevToolsDataSource::StartDataRequest( + // Serve request to devtools://remote from remote location. + std::string remote_path_prefix(chrome::kChromeUIDevToolsRemotePath); + remote_path_prefix += "/"; +- if (base::StartsWith(path, remote_path_prefix, ++ if ((false) && base::StartsWith(path, remote_path_prefix, + base::CompareCase::INSENSITIVE_ASCII)) { + if (MaybeHandleCustomRequest(path.substr(remote_path_prefix.length()), + &callback)) { +@@ -198,7 +198,7 @@ void DevToolsDataSource::StartDataRequest( + // Serve request to devtools://custom from custom URL. + std::string custom_path_prefix(chrome::kChromeUIDevToolsCustomPath); + custom_path_prefix += "/"; +- if (base::StartsWith(path, custom_path_prefix, ++ if ((false) && base::StartsWith(path, custom_path_prefix, + base::CompareCase::INSENSITIVE_ASCII)) { + GURL custom_devtools_frontend = GetCustomDevToolsFrontendURL(); + if (!custom_devtools_frontend.is_empty()) { +-- +2.25.1 diff --git a/build/patches/00Disable-privacy-issues-in-password-manager.patch b/build/patches/00Disable-privacy-issues-in-password-manager.patch new file mode 100644 index 0000000000000000000000000000000000000000..af1ece4178af755092ef3a471424c6ff468cda64 --- /dev/null +++ b/build/patches/00Disable-privacy-issues-in-password-manager.patch @@ -0,0 +1,157 @@ +From: uazo +Date: Tue, 14 Mar 2023 15:59:38 +0000 +Subject: Disable privacy issues in password manager + +--- + chrome/android/java/AndroidManifest.xml | 9 -------- + .../generated_password_leak_detection_pref.cc | 3 +-- + .../affiliation/affiliation_backend.cc | 1 + + .../affiliation/affiliation_service_impl.cc | 4 ++++ + .../core/browser/affiliation/facet_manager.cc | 23 +++---------------- + .../leak_detection_check_factory_impl.cc | 5 ++++ + .../leak_detection_check_impl.cc | 4 +--- + .../core/common/password_manager_features.cc | 4 ++-- + 8 files changed, 17 insertions(+), 36 deletions(-) + +diff --git a/chrome/android/java/AndroidManifest.xml b/chrome/android/java/AndroidManifest.xml +--- a/chrome/android/java/AndroidManifest.xml ++++ b/chrome/android/java/AndroidManifest.xml +@@ -468,15 +468,6 @@ by a child template that "extends" this file. + + + +- +- +- +- +- +- +- + + +diff --git a/chrome/browser/password_manager/generated_password_leak_detection_pref.cc b/chrome/browser/password_manager/generated_password_leak_detection_pref.cc +--- a/chrome/browser/password_manager/generated_password_leak_detection_pref.cc ++++ b/chrome/browser/password_manager/generated_password_leak_detection_pref.cc +@@ -20,8 +20,7 @@ namespace { + + // Returns whether the user can use the leak detection feature. + bool IsUserAllowedToUseLeakDetection(Profile* profile) { +- return !profile->IsGuestSession() && +- IdentityManagerFactory::GetForProfileIfExists(profile); ++ return false; + } + + // Returns whether the effective value of the Safe Browsing preferences for +diff --git a/components/password_manager/core/browser/affiliation/affiliation_backend.cc b/components/password_manager/core/browser/affiliation/affiliation_backend.cc +--- a/components/password_manager/core/browser/affiliation/affiliation_backend.cc ++++ b/components/password_manager/core/browser/affiliation/affiliation_backend.cc +@@ -403,6 +403,7 @@ void AffiliationBackend::OnMalformedResponse( + } + + bool AffiliationBackend::OnCanSendNetworkRequest() { ++ if ((true)) return false; + DCHECK(!fetcher_); + std::vector requested_facet_uris; + for (const auto& facet_manager_pair : facet_managers_) { +diff --git a/components/password_manager/core/browser/affiliation/affiliation_service_impl.cc b/components/password_manager/core/browser/affiliation/affiliation_service_impl.cc +--- a/components/password_manager/core/browser/affiliation/affiliation_service_impl.cc ++++ b/components/password_manager/core/browser/affiliation/affiliation_service_impl.cc +@@ -138,6 +138,10 @@ void AffiliationServiceImpl::Shutdown() { + void AffiliationServiceImpl::PrefetchChangePasswordURLs( + const std::vector& urls, + base::OnceClosure callback) { ++ if ((true)) { ++ std::move(callback).Run(); ++ return; ++ } + std::vector facets; + std::vector tuple_origins; + for (const auto& url : urls) { +diff --git a/components/password_manager/core/browser/affiliation/facet_manager.cc b/components/password_manager/core/browser/affiliation/facet_manager.cc +--- a/components/password_manager/core/browser/affiliation/facet_manager.cc ++++ b/components/password_manager/core/browser/affiliation/facet_manager.cc +@@ -117,25 +117,7 @@ void FacetManager::GetAffiliationsAndBranding( + RequestInfo request_info; + request_info.callback = std::move(callback); + request_info.callback_task_runner = callback_task_runner; +- if (IsCachedDataFresh()) { +- AffiliatedFacetsWithUpdateTime affiliation; +- if (!backend_->ReadAffiliationsAndBrandingFromDatabase(facet_uri_, +- &affiliation)) { +- ServeRequestWithFailure(std::move(request_info)); +- return; +- } +- DCHECK_EQ(affiliation.last_update_time, last_update_time_) << facet_uri_; +- ServeRequestWithSuccess(std::move(request_info), affiliation.facets); +- } else if (cache_miss_strategy == StrategyOnCacheMiss::FETCH_OVER_NETWORK) { +- pending_requests_.push_back(std::move(request_info)); +- backend_->SignalNeedNetworkRequest(); +- } else if (cache_miss_strategy == +- StrategyOnCacheMiss::TRY_ONCE_OVER_NETWORK) { +- pending_one_time_requests_.push_back(std::move(request_info)); +- backend_->SignalNeedNetworkRequest(); +- } else { +- ServeRequestWithFailure(std::move(request_info)); +- } ++ ServeRequestWithFailure(std::move(request_info)); + } + + void FacetManager::Prefetch(const base::Time& keep_fresh_until) { +@@ -254,7 +236,8 @@ void FacetManager::ServeRequestWithSuccess( + const AffiliatedFacets& affiliation) { + request_info.callback_task_runner->PostTask( + FROM_HERE, +- base::BindOnce(std::move(request_info.callback), affiliation, true)); ++ base::BindOnce(std::move(request_info.callback), ++ AffiliatedFacets(), false)); + } + + // static +diff --git a/components/password_manager/core/browser/leak_detection/leak_detection_check_factory_impl.cc b/components/password_manager/core/browser/leak_detection/leak_detection_check_factory_impl.cc +--- a/components/password_manager/core/browser/leak_detection/leak_detection_check_factory_impl.cc ++++ b/components/password_manager/core/browser/leak_detection/leak_detection_check_factory_impl.cc +@@ -46,6 +46,11 @@ LeakDetectionCheckFactoryImpl::TryCreateLeakCheck( + version_info::Channel channel) const { + CHECK(identity_manager); + ++ if ((true)) { ++ delegate->OnError(LeakDetectionError::kNotSignIn); ++ return nullptr; ++ } ++ + return std::make_unique( + delegate, identity_manager, std::move(url_loader_factory), + GetAPIKey(LeakDetectionCheckImpl::HasAccountForRequest(identity_manager), +diff --git a/components/password_manager/core/browser/leak_detection/leak_detection_check_impl.cc b/components/password_manager/core/browser/leak_detection/leak_detection_check_impl.cc +--- a/components/password_manager/core/browser/leak_detection/leak_detection_check_impl.cc ++++ b/components/password_manager/core/browser/leak_detection/leak_detection_check_impl.cc +@@ -190,9 +190,7 @@ bool LeakDetectionCheckImpl::HasAccountForRequest( + // always return something if the user is signed in. + // On Android it will be empty if the user isn't syncing. Thus, + // GetAccountsWithRefreshTokens() check is necessary. +- return identity_manager && +- (identity_manager->HasPrimaryAccount(signin::ConsentLevel::kSignin) || +- !identity_manager->GetAccountsWithRefreshTokens().empty()); ++ return false; + } + + void LeakDetectionCheckImpl::Start(LeakDetectionInitiator initiator, +diff --git a/components/password_manager/core/common/password_manager_features.cc b/components/password_manager/core/common/password_manager_features.cc +--- a/components/password_manager/core/common/password_manager_features.cc ++++ b/components/password_manager/core/common/password_manager_features.cc +@@ -87,8 +87,8 @@ BASE_FEATURE(kFillingAcrossGroupedSites, + // Enables the experiment for the password manager to only fill on account + // selection, rather than autofilling on page load, with highlighting of fields. + BASE_FEATURE(kFillOnAccountSelect, +- "fill-on-account-select", +- base::FEATURE_DISABLED_BY_DEFAULT); ++ "fill-on-account-select", // always enabled ++ base::FEATURE_ENABLED_BY_DEFAULT); // in bromite + + // Enables logging the content of chrome://password-manager-internals to the + // terminal. +-- +2.25.1 diff --git a/build/patches/00Disable-speechSynthesis-getVoices-API.patch b/build/patches/00Disable-speechSynthesis-getVoices-API.patch new file mode 100644 index 0000000000000000000000000000000000000000..e69059c1d8e00c93b5a10d62b9d48baf804b8288 --- /dev/null +++ b/build/patches/00Disable-speechSynthesis-getVoices-API.patch @@ -0,0 +1,186 @@ +From: uazo +Date: Thu, 20 Apr 2023 15:03:13 +0000 +Subject: Disable speechSynthesis getVoices API + +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. +Disable LiveCaption +Require: Timezone-customization.patch +--- + chrome/browser/about_flags.cc | 5 +++++ + .../renderer/chrome_content_renderer_client.cc | 2 +- + .../renderer/content_settings_agent_impl.cc | 9 ++++++++- + .../renderer/content_settings_agent_impl.h | 2 ++ + media/base/media_switches.cc | 8 ++++---- + 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 ++++++++++++++--- + 9 files changed, 42 insertions(+), 9 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 +@@ -7444,6 +7444,11 @@ const FeatureEntry kFeatureEntries[] = { + flag_descriptions::kFileHandlingIconsDescription, kOsDesktop, + FEATURE_VALUE_TYPE(blink::features::kFileHandlingIcons)}, + ++ {"disable-speechsynthesis-voice-list", ++ "Disable speechSynthesis.getVoices()", ++ "Disables access to the list of items installed on the device", kOsAll, ++ FEATURE_VALUE_TYPE(blink::features::kDisableSpeechSynthesisVoiceList)}, ++ + {"strict-origin-isolation", flag_descriptions::kStrictOriginIsolationName, + flag_descriptions::kStrictOriginIsolationDescription, kOsAll, + FEATURE_VALUE_TYPE(features::kStrictOriginIsolation)}, +diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc +--- a/chrome/renderer/chrome_content_renderer_client.cc ++++ b/chrome/renderer/chrome_content_renderer_client.cc +@@ -1585,7 +1585,7 @@ ChromeContentRendererClient::CreateWorkerContentSettingsClient( + std::unique_ptr + ChromeContentRendererClient::CreateSpeechRecognitionClient( + content::RenderFrame* render_frame) { +- return std::make_unique(render_frame); ++ return nullptr; + } + #endif // BUILDFLAG(ENABLE_SPEECH_SERVICE) + +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 +@@ -496,6 +496,14 @@ bool ContentSettingsAgentImpl::IsAllowlistedForContentSettings() const { + return false; + } + ++bool ContentSettingsAgentImpl::IsTimezoneChanged() { ++ if (!content_setting_rules_) ++ return false; ++ // CONTENT_SETTING_ALLOW = use system time ++ return CONTENT_SETTING_ALLOW != GetContentSetting( ++ ContentSettingsType::TIMEZONE_OVERRIDE, CONTENT_SETTING_ALLOW); ++} ++ + bool ContentSettingsAgentImpl::UpdateOverrides() { + // Evaluate the content setting rules + ContentSetting setting = CONTENT_SETTING_ALLOW; +@@ -506,7 +514,6 @@ bool ContentSettingsAgentImpl::UpdateOverrides() { + } + return UpdateTimeZoneOverride( + setting, content_setting_rules_->timezone_override_value); +- //&& UpdateLocaleOverride(setting); + } + + bool ContentSettingsAgentImpl::UpdateTimeZoneOverride( +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 +@@ -117,6 +117,8 @@ class ContentSettingsAgentImpl + void SetRendererContentSettingRulesForTest( + const RendererContentSettingRules& rules); + ++ bool IsTimezoneChanged() override; ++ + protected: + // Allow this to be overridden by tests. + virtual void BindContentSettingsManager( +diff --git a/media/base/media_switches.cc b/media/base/media_switches.cc +--- a/media/base/media_switches.cc ++++ b/media/base/media_switches.cc +@@ -840,7 +840,7 @@ const base::FeatureParam kMediaFoundationClearKeyCdmPathForTesting{ + #endif // BUILDFLAG(IS_WIN) + + // Enables the Live Caption feature on supported devices. +-BASE_FEATURE(kLiveCaption, "LiveCaption", base::FEATURE_ENABLED_BY_DEFAULT); ++BASE_FEATURE(kLiveCaption, "LiveCaption", base::FEATURE_DISABLED_BY_DEFAULT); + + // Controls whether a "Share this tab instead" button should be shown for + // getDisplayMedia captures. Note: This flag does not control if the "Share this +@@ -877,9 +877,9 @@ BASE_FEATURE(kLiveCaptionRightClick, + base::FEATURE_DISABLED_BY_DEFAULT); + + // Enable or disable Live Caption support for WebAudio. +-BASE_FEATURE(kLiveCaptionWebAudio, +- "LiveCaptionWebAudio", +- base::FEATURE_ENABLED_BY_DEFAULT); ++BASE_FEATURE(kLiveCaptionWebAudio, // disabled by ++ "LiveCaptionWebAudio", // default ++ base::FEATURE_DISABLED_BY_DEFAULT); // in bromite + + // Live Caption runs system-wide on ChromeOS, as opposed to just in the browser. + BASE_FEATURE(kLiveCaptionSystemWideOnChromeOS, +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 +@@ -1611,6 +1611,10 @@ BASE_FEATURE(kStylusPointerAdjustment, + "StylusPointerAdjustment", + base::FEATURE_DISABLED_BY_DEFAULT); + ++BASE_FEATURE(kDisableSpeechSynthesisVoiceList, ++ "DisableSpeechSynthesisVoiceList", ++ base::FEATURE_ENABLED_BY_DEFAULT); ++ + BASE_FEATURE(kDisableArrayBufferSizeLimitsForTesting, + "DisableArrayBufferSizeLimitsForTesting", + base::FEATURE_DISABLED_BY_DEFAULT); +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 +@@ -823,6 +823,8 @@ BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kAndroidExtendedKeyboardShortcuts); + // enabling functions like writing into a nearby input element. + BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kStylusPointerAdjustment); + ++BLINK_COMMON_EXPORT BASE_DECLARE_FEATURE(kDisableSpeechSynthesisVoiceList); ++ + // TODO(https://crbug.com/1201109): temporary flag to disable new ArrayBuffer + // size limits, so that tests can be written against code receiving these + // buffers. Remove when the bindings code instituting these limits is removed. +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 +@@ -119,6 +119,8 @@ class WebContentSettingsClient { + // frame. + virtual bool ShouldAutoupgradeMixedContent() { return true; } + ++ virtual bool IsTimezoneChanged() { return false; } ++ + // Controls whether the ViewTransition callback needs to be larger than + // default. + virtual bool IncreaseViewTransitionCallbackTimeout() const { return false; } +diff --git a/third_party/blink/renderer/modules/speech/speech_synthesis.cc b/third_party/blink/renderer/modules/speech/speech_synthesis.cc +--- a/third_party/blink/renderer/modules/speech/speech_synthesis.cc ++++ b/third_party/blink/renderer/modules/speech/speech_synthesis.cc +@@ -35,6 +35,7 @@ + #include "third_party/blink/public/common/privacy_budget/identifiable_token_builder.h" + #include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h" + #include "third_party/blink/public/platform/platform.h" ++#include "third_party/blink/public/platform/web_content_settings_client.h" + #include "third_party/blink/renderer/bindings/modules/v8/v8_speech_synthesis_error_event_init.h" + #include "third_party/blink/renderer/bindings/modules/v8/v8_speech_synthesis_event_init.h" + #include "third_party/blink/renderer/core/dom/document.h" +@@ -93,9 +94,19 @@ SpeechSynthesis::SpeechSynthesis(LocalDOMWindow& window) + void SpeechSynthesis::OnSetVoiceList( + Vector mojom_voices) { + voice_list_.clear(); +- for (auto& mojom_voice : mojom_voices) { +- voice_list_.push_back( +- MakeGarbageCollected(std::move(mojom_voice))); ++ bool allowed = !base::FeatureList::IsEnabled(features::kDisableSpeechSynthesisVoiceList); ++ if (allowed) { ++ auto* frame = GetSupplementable()->GetFrame(); ++ if (frame) { ++ blink::WebContentSettingsClient* settings = frame->GetContentSettingsClient(); ++ if (settings) allowed = !settings->IsTimezoneChanged(); ++ } ++ } ++ if (allowed) { ++ for (auto& mojom_voice : mojom_voices) { ++ voice_list_.push_back( ++ MakeGarbageCollected(std::move(mojom_voice))); ++ } + } + VoicesDidChange(); + } +-- +2.25.1 diff --git a/build/patches/00Disable-visited-pseudo-class.patch b/build/patches/00Disable-visited-pseudo-class.patch new file mode 100644 index 0000000000000000000000000000000000000000..1be807f249090c95ec4249d546bbb904ab9be603 --- /dev/null +++ b/build/patches/00Disable-visited-pseudo-class.patch @@ -0,0 +1,64 @@ +From: uazo +Date: Tue, 14 Feb 2023 16:41:42 +0000 +Subject: Disable visited pseudo class + +Disable support for pseduo css visited class +--- + components/visitedlink/browser/visitedlink_writer.cc | 8 ++++---- + components/visitedlink/common/visitedlink_common.cc | 1 + + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/components/visitedlink/browser/visitedlink_writer.cc b/components/visitedlink/browser/visitedlink_writer.cc +--- a/components/visitedlink/browser/visitedlink_writer.cc ++++ b/components/visitedlink/browser/visitedlink_writer.cc +@@ -234,7 +234,7 @@ VisitedLinkWriter::VisitedLinkWriter(content::BrowserContext* browser_context, + : browser_context_(browser_context), + delegate_(delegate), + listener_(std::make_unique(browser_context)), +- persist_to_disk_(persist_to_disk) {} ++ persist_to_disk_(false) {} + + VisitedLinkWriter::VisitedLinkWriter(Listener* listener, + VisitedLinkDelegate* delegate, +@@ -244,10 +244,10 @@ VisitedLinkWriter::VisitedLinkWriter(Listener* listener, + int32_t default_table_size) + : delegate_(delegate), + listener_(listener), +- persist_to_disk_(persist_to_disk), ++ persist_to_disk_(false), + database_name_override_(filename), + table_size_override_(default_table_size), +- suppress_rebuild_(suppress_rebuild) { ++ suppress_rebuild_(false) { + DCHECK(listener_); + } + +@@ -317,6 +317,7 @@ void VisitedLinkWriter::AddURL(const GURL& url, bool update_file) { + } + + VisitedLinkWriter::Hash VisitedLinkWriter::TryToAddURL(const GURL& url) { ++ if ((true)) return null_hash_; + // Extra check that we are not incognito. This should not happen. + // TODO(boliu): Move this check to HistoryService when IsOffTheRecord is + // removed from BrowserContext. +@@ -1032,7 +1033,6 @@ bool VisitedLinkWriter::RebuildTableFromDelegate() { + + // TODO(brettw) make sure we have reasonable salt! + table_builder_ = new TableBuilder(this, salt_); +- delegate_->RebuildTable(table_builder_); + return true; + } + +diff --git a/components/visitedlink/common/visitedlink_common.cc b/components/visitedlink/common/visitedlink_common.cc +--- a/components/visitedlink/common/visitedlink_common.cc ++++ b/components/visitedlink/common/visitedlink_common.cc +@@ -43,6 +43,7 @@ bool VisitedLinkCommon::IsVisited(const GURL& url) const { + } + + bool VisitedLinkCommon::IsVisited(Fingerprint fingerprint) const { ++ if ((true)) return false; + // Go through the table until we find the item or an empty spot (meaning it + // wasn't found). This loop will terminate as long as the table isn't full, + // which should be enforced by AddFingerprint. +-- +2.25.1 diff --git a/build/patches/00Disallow-Android-App-Scheme-as-referrer.patch b/build/patches/00Disallow-Android-App-Scheme-as-referrer.patch new file mode 100644 index 0000000000000000000000000000000000000000..44c2bf1ec4b5c057eb3991acbfe5d94ff8c25b4d --- /dev/null +++ b/build/patches/00Disallow-Android-App-Scheme-as-referrer.patch @@ -0,0 +1,25 @@ +From: uazo +Date: Sat, 3 Jun 2023 15:09:26 +0000 +Subject: Disallow Android App Scheme as referrer + +--- + chrome/renderer/chrome_content_renderer_client.cc | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc +--- a/chrome/renderer/chrome_content_renderer_client.cc ++++ b/chrome/renderer/chrome_content_renderer_client.cc +@@ -525,11 +525,6 @@ void ChromeContentRendererClient::RenderThreadStarted() { + // TODO(nyquist): Add test to ensure this happens when the flag is set. + WebSecurityPolicy::RegisterURLSchemeAsDisplayIsolated(dom_distiller_scheme); + +-#if BUILDFLAG(IS_ANDROID) +- WebSecurityPolicy::RegisterURLSchemeAsAllowedForReferrer( +- WebString::FromUTF8(content::kAndroidAppScheme)); +-#endif +- + // chrome-search: pages should not be accessible by bookmarklets + // or javascript: URLs typed in the omnibox. + WebSecurityPolicy::RegisterURLSchemeAsNotAllowingJavascriptURLs( +-- +2.25.1 diff --git a/build/patches/00Disallowing-MIDI-permission-by-default.patch b/build/patches/00Disallowing-MIDI-permission-by-default.patch new file mode 100644 index 0000000000000000000000000000000000000000..4e70d6e01179e53f90b8ca789a71ca6fbdbd48ab --- /dev/null +++ b/build/patches/00Disallowing-MIDI-permission-by-default.patch @@ -0,0 +1,22 @@ +From: uazo +Date: Sat, 3 Jun 2023 13:11:22 +0000 +Subject: Disallowing MIDI permission by default + +--- + components/permissions/features.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/components/permissions/features.cc b/components/permissions/features.cc +--- a/components/permissions/features.cc ++++ b/components/permissions/features.cc +@@ -145,7 +145,7 @@ BASE_FEATURE(kWindowManagementPermissionAlias, + // Enables disallowing MIDI permission by default. + BASE_FEATURE(kBlockMidiByDefault, + "BlockMidiByDefault", +- base::FEATURE_DISABLED_BY_DEFAULT); ++ base::FEATURE_ENABLED_BY_DEFAULT); + + } // namespace features + namespace feature_params { +-- +2.25.1 diff --git a/build/patches/00Enable-Document-Open-Inheritance-Removal.patch b/build/patches/00Enable-Document-Open-Inheritance-Removal.patch new file mode 100644 index 0000000000000000000000000000000000000000..0b34c56ee915ad336a9c25bab94471a586efe42d --- /dev/null +++ b/build/patches/00Enable-Document-Open-Inheritance-Removal.patch @@ -0,0 +1,85 @@ +From: uazo +Date: Tue, 28 Mar 2023 15:43:18 +0000 +Subject: Enable Document Open Inheritance Removal + +--- + .../blink/renderer/core/dom/document.cc | 51 ------------------- + .../platform/runtime_enabled_features.json5 | 3 +- + 2 files changed, 1 insertion(+), 53 deletions(-) + +diff --git a/third_party/blink/renderer/core/dom/document.cc b/third_party/blink/renderer/core/dom/document.cc +--- a/third_party/blink/renderer/core/dom/document.cc ++++ b/third_party/blink/renderer/core/dom/document.cc +@@ -3359,57 +3359,6 @@ void Document::open(LocalDOMWindow* entered_window, + // https://chromestatus.com/metrics/feature/timeline/popularity/4375 + CountUse(WebFeature::kDocumentOpenMutateSandbox); + } +- +- if (!RuntimeEnabledFeatures:: +- DocumentOpenSandboxInheritanceRemovalEnabled()) { +- // We inherit the sandbox flags of the entered document, so mask on +- // the ones contained in the CSP. The operator| is a bitwise operation +- // on the sandbox flags bits. It makes the sandbox policy stricter (or +- // as strict) as both policy. +- // +- // TODO(arthursonzogni): Why merging sandbox flags? +- // This doesn't look great at many levels: +- // - The browser process won't be notified of the update. +- // - The origin won't be made opaque, despite the new flags. +- // - The sandbox flags of the document can't be considered to be an +- // immutable property anymore. +- // +- // Ideally: +- // - javascript-url document. +- // - XSLT document. +- // - document.open. +- // should not mutate the security properties of the current document. +- // From the browser process point of view, all of those operations are +- // not considered to produce new documents. No IPCs are sent, it is as +- // if it was a no-op. +- // +- // TODO(https://crbug.com/1360795) Remove this +- dom_window_->GetSecurityContext().SetSandboxFlags( +- dom_window_->GetSecurityContext().GetSandboxFlags() | +- entered_window->GetSandboxFlags()); +- +- dom_window_->GetSecurityContext().SetSecurityOrigin( +- entered_window->GetMutableSecurityOrigin()); +- +- // The SecurityOrigin is now shared in between two different window. It +- // means mutating one can have side effect on the other. +- entered_window->GetMutableSecurityOrigin() +- ->set_aliased_by_document_open(); +- } +- +- // Question: Should we remove the inheritance of the CookieURL via +- // document.open? +- // +- // Arguments in favor of maintaining this behavior include the fact that +- // document.open can be used to alter the document's URL. According to +- // prior talks, this is necessary for web compatibility. It looks nicer if +- // all URL variations change uniformly and simultaneously. +- // +- // Arguments in favor of eliminating this behavior include the fact that +- // cookie URLs are extremely particular pieces of state that resemble the +- // origin more than they do actual URLs. The less we inherit via +- // document.open, the better. +- cookie_url_ = entered_window->document()->CookieURL(); + } + } + +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 +@@ -1419,8 +1419,7 @@ + }, + { + name: "DocumentOpenSandboxInheritanceRemoval", +- status: "experimental", +- copied_from_base_feature_if: "overridden", ++ status: "stable", + }, + { + name: "DocumentPictureInPictureAPI", +-- +2.25.1 diff --git a/build/patches/00Evict-the-entire-FrameTree-like-desktop.patch b/build/patches/00Evict-the-entire-FrameTree-like-desktop.patch new file mode 100644 index 0000000000000000000000000000000000000000..c22de042812eb2b5b5397a6ca42bed7123f11155 --- /dev/null +++ b/build/patches/00Evict-the-entire-FrameTree-like-desktop.patch @@ -0,0 +1,37 @@ +From: Your Name +Date: Tue, 14 Feb 2023 16:23:08 +0000 +Subject: Evict the entire FrameTree like desktop + +--- + components/viz/common/features.cc | 2 +- + content/public/common/content_features.cc | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/components/viz/common/features.cc b/components/viz/common/features.cc +--- a/components/viz/common/features.cc ++++ b/components/viz/common/features.cc +@@ -233,7 +233,7 @@ BASE_FEATURE(kRendererAllocatesImages, + // evicts itself. This differs from Destkop platforms which evict the entire + // FrameTree along with the topmost viz::Surface. When this feature is enabled, + // Android will begin also evicting the entire FrameTree. +-BASE_FEATURE(kEvictSubtree, "EvictSubtree", base::FEATURE_DISABLED_BY_DEFAULT); ++BASE_FEATURE(kEvictSubtree, "EvictSubtree", base::FEATURE_ENABLED_BY_DEFAULT); + + // If enabled, CompositorFrameSinkClient::OnBeginFrame is also treated as the + // DidReceiveCompositorFrameAck. Both in providing the Ack for the previous +diff --git a/content/public/common/content_features.cc b/content/public/common/content_features.cc +--- a/content/public/common/content_features.cc ++++ b/content/public/common/content_features.cc +@@ -569,8 +569,8 @@ BASE_FEATURE(kInMemoryCodeCache, + // frames. Otherwise only toplevel frames and OOPIF are handled, and other + // cases, e.g. PDF tiles are ignored. See https://crbug.com/1360351 for details. + BASE_FEATURE(kInnerFrameCompositorSurfaceEviction, +- "InnerFrameCompositorSurfaceEviction", +- base::FEATURE_ENABLED_BY_DEFAULT); ++ "InnerFrameCompositorSurfaceEviction", // guard this ++ base::FEATURE_ENABLED_BY_DEFAULT); // guard this + + // Kill switch for the GetInstalledRelatedApps API. + BASE_FEATURE(kInstalledApp, "InstalledApp", base::FEATURE_ENABLED_BY_DEFAULT); +-- +2.25.1 diff --git a/build/patches/00Eyeo-Adblock-Remove-Privacy-Issues.patch b/build/patches/00Eyeo-Adblock-Remove-Privacy-Issues.patch new file mode 100644 index 0000000000000000000000000000000000000000..e89854b6becf011883c8534fd7774674e7edf16c --- /dev/null +++ b/build/patches/00Eyeo-Adblock-Remove-Privacy-Issues.patch @@ -0,0 +1,8323 @@ +From: uazo +Date: Thu, 29 Sep 2022 11:27:35 +0000 +Subject: Eyeo Adblock for Bromite + +Change the normal behaviour of Eyeo Chromium SDK to +suit Bromite logic +--- + .../android/java/res/xml/main_preferences.xml | 11 +- + chrome/browser/BUILD.gn | 2 - + .../adblock/adblock_content_browser_client.cc | 26 +- + .../adblock/adblock_controller_factory.cc | 3 +- + .../adblock_telemetry_service_factory.cc | 127 - + .../adblock_telemetry_service_factory.h | 56 - + .../adblock/subscription_service_factory.cc | 11 +- + .../adblock/subscription_service_factory.h | 1 + + chrome/browser/android/adblock/adblock_jni.cc | 50 +- + .../adblock_private/adblock_private_api.cc | 70 +- + .../api/adblock_private/adblock_private_api.h | 49 + + .../eyeo_filtering_private_api.cc | 20 +- + ...hrome_browser_main_extra_parts_profiles.cc | 2 - + chrome/browser/resources/settings/BUILD.gn | 2 + + .../settings/adblock_page/adblock_page.html | 207 + + .../settings/adblock_page/adblock_page.ts | 286 ++ + .../settings/basic_page/basic_page.html | 7 + + .../settings/basic_page/basic_page.ts | 1 + + .../resources/settings/page_visibility.ts | 1 + + chrome/browser/resources/settings/route.ts | 4 + + chrome/browser/resources/settings/router.ts | 1 + + chrome/browser/resources/settings/settings.ts | 1 + + .../settings/settings_menu/settings_menu.html | 5 + + chrome/browser/ui/tab_helpers.cc | 5 +- + .../extensions/api/_permission_features.json | 8 - + .../common/extensions/api/adblock_private.idl | 8 + + chrome/test/BUILD.gn | 5 - + components/adblock/android/BUILD.gn | 2 +- + .../adblock/android/adblock_strings.grd | 48 +- + .../java/res/layout/adblock_custom_item.xml | 14 +- + .../layout/adblock_filter_lists_list_item.xml | 15 + + ...ences.xml => eyeo_adblock_preferences.xml} | 39 +- + .../components/adblock/AdblockController.java | 56 +- + .../AdblockAllowedDomainsFragment.java | 7 +- + .../AdblockCustomFilterListsFragment.java | 32 +- + .../AdblockCustomFiltersFragment.java | 7 +- + .../settings/AdblockCustomItemFragment.java | 20 +- + .../settings/AdblockFilterListsAdapter.java | 6 + + .../settings/AdblockSettingsFragment.java | 45 +- + components/adblock/content/browser/BUILD.gn | 16 +- + .../browser/adblock_webcontents_observer.cc | 25 +- + .../browser/adblock_webcontents_observer.h | 5 +- + .../content_security_policy_injector_impl.cc | 1 + + components/adblock/core/BUILD.gn | 39 - + .../activeping_telemetry_topic_provider.cc | 242 -- + .../activeping_telemetry_topic_provider.h | 84 - + components/adblock/core/adblock_controller.h | 6 + + .../adblock/core/adblock_controller_impl.cc | 35 +- + .../adblock/core/adblock_controller_impl.h | 5 + + components/adblock/core/adblock_switches.cc | 1 - + components/adblock/core/adblock_switches.h | 1 - + .../adblock/core/adblock_telemetry_service.cc | 244 -- + .../adblock/core/adblock_telemetry_service.h | 107 - + components/adblock/core/common/BUILD.gn | 10 - + .../adblock/core/common/adblock_constants.cc | 2 - + .../adblock/core/common/adblock_constants.h | 1 - + .../adblock/core/common/adblock_prefs.cc | 47 +- + .../adblock/core/common/adblock_prefs.h | 1 + + .../adblock/core/common/adblock_utils.cc | 23 - + .../configuration/filtering_configuration.h | 3 + + .../persistent_filtering_configuration.cc | 10 + + .../persistent_filtering_configuration.h | 3 + + .../core/converter/flatbuffer_converter.cc | 2 +- + .../adblock/core/converter/parser/metadata.cc | 10 +- + .../core/converter/parser/test/test_rules.txt | 21 + + .../core/converter/parser/url_filter.cc | 10 +- + .../converter/parser/url_filter_options.cc | 21 +- + .../serializer/flatbuffer_serializer.cc | 75 +- + .../adblock/core/sitekey_storage_impl.cc | 7 + + .../core/subscription/conversion_executors.h | 1 + + .../filtering_configuration_maintainer.h | 4 + + ...filtering_configuration_maintainer_impl.cc | 31 +- + .../filtering_configuration_maintainer_impl.h | 4 +- + .../ongoing_subscription_request_impl.cc | 33 +- + .../preloaded_subscription_provider_impl.cc | 4 +- + .../adblock/core/subscription/subscription.cc | 19 + + .../adblock/core/subscription/subscription.h | 3 + + .../subscription_collection_impl.cc | 1 + + .../core/subscription/subscription_config.cc | 20 +- + .../core/subscription/subscription_config.h | 6 +- + .../subscription_downloader_impl.cc | 21 +- + .../subscription_persistent_metadata.h | 1 + + .../subscription_persistent_metadata_impl.cc | 7 + + .../subscription_persistent_metadata_impl.h | 1 + + .../subscription_persistent_storage_impl.cc | 11 +- + .../core/subscription/subscription_service.h | 3 + + .../subscription/subscription_service_impl.cc | 23 +- + .../subscription/subscription_service_impl.h | 3 + + .../subscription/subscription_updater_impl.cc | 8 +- + .../subscription_validator_impl.cc | 4 +- + components/adblock/features.gni | 44 - + components/resources/BUILD.gn | 1 - + components/resources/adblock_resources.grdp | 3 - + components/resources/adblocking/.gitignore | 2 +- + components/resources/adblocking/BUILD.gn | 30 +- + .../adblocking/elemhide_for_selector.jst | 2 +- + .../resources/adblocking/elemhideemu.jst | 2 + + .../snippets/dist/isolated-first.jst | 65 + + .../snippets/dist/isolated-first.source.jst | 3624 +++++++++++++++++ + .../blink/renderer/core/css/style_engine.cc | 8 + + .../blink/renderer/core/css/style_engine.h | 1 + + .../renderer/core/exported/web_document.cc | 13 +- + .../definitions/adblock_private.d.ts | 14 + + 103 files changed, 5038 insertions(+), 1296 deletions(-) + delete mode 100644 chrome/browser/adblock/adblock_telemetry_service_factory.cc + delete mode 100644 chrome/browser/adblock/adblock_telemetry_service_factory.h + create mode 100644 chrome/browser/resources/settings/adblock_page/adblock_page.html + create mode 100644 chrome/browser/resources/settings/adblock_page/adblock_page.ts + rename components/adblock/android/java/res/xml/{adblock_preferences.xml => eyeo_adblock_preferences.xml} (56%) + delete mode 100644 components/adblock/core/activeping_telemetry_topic_provider.cc + delete mode 100644 components/adblock/core/activeping_telemetry_topic_provider.h + delete mode 100644 components/adblock/core/adblock_telemetry_service.cc + delete mode 100644 components/adblock/core/adblock_telemetry_service.h + create mode 100644 components/adblock/core/converter/parser/test/test_rules.txt + delete mode 100644 components/adblock/features.gni + create mode 100755 components/resources/adblocking/snippets/dist/isolated-first.jst + create mode 100755 components/resources/adblocking/snippets/dist/isolated-first.source.jst + +diff --git a/chrome/android/java/res/xml/main_preferences.xml b/chrome/android/java/res/xml/main_preferences.xml +--- a/chrome/android/java/res/xml/main_preferences.xml ++++ b/chrome/android/java/res/xml/main_preferences.xml +@@ -1,13 +1,4 @@ + +- +- + +@@ -106,7 +97,7 @@ Use of this source code is governed by the GPLv3 that can be found in the compon + android:title="@string/prefs_accessibility"/> + + GetProcess()->GetBrowserContext()); + if (profile) { ++ content::RenderFrameHost* embedder = frame->GetOutermostMainFrameOrEmbedder(); ++ const auto& embedder_url = embedder->GetLastCommittedURL(); ++ HostContentSettingsMap* settings_map = HostContentSettingsMapFactory::GetForProfile(profile); ++ if (settings_map->GetContentSetting(embedder_url, GURL(), ContentSettingsType::ADS) ++ == CONTENT_SETTING_ALLOW) { ++ return false; ++ } + // Filtering may be needed if there's at least one enabled + // FilteringConfiguration. + return base::ranges::any_of( +@@ -104,23 +113,6 @@ class AdblockContextData : public base::SupportsUserData::Data { + adblock::SitekeyStorageFactory::GetForBrowserContext(browser_context), + adblock::ContentSecurityPolicyInjectorFactory::GetForBrowserContext( + browser_context)}; +-#ifdef EYEO_INTERCEPT_DEBUG_URL +- if (use_test_loader) { +- auto proxy = std::make_unique( +- std::move(config), +- content::GlobalRenderFrameHostId(render_process_id, +- frame->GetRoutingID()), +- std::move(receiver), std::move(target_factory), +- embedder_support::GetUserAgent(), +- base::BindOnce(&AdblockContextData::RemoveProxy, +- self->weak_factory_.GetWeakPtr()), +- adblock::AdblockControllerFactory::GetForBrowserContext( +- Profile::FromBrowserContext( +- frame->GetProcess()->GetBrowserContext()))); +- self->proxies_.emplace(std::move(proxy)); +- return; +- } +-#endif + auto proxy = std::make_unique( + std::move(config), + content::GlobalRenderFrameHostId(render_process_id, +diff --git a/chrome/browser/adblock/adblock_controller_factory.cc b/chrome/browser/adblock/adblock_controller_factory.cc +--- a/chrome/browser/adblock/adblock_controller_factory.cc ++++ b/chrome/browser/adblock/adblock_controller_factory.cc +@@ -65,8 +65,7 @@ KeyedService* AdblockControllerFactory::BuildServiceInstanceFor( + std::make_unique( + prefs, kAdblockFilteringConfigurationName); + +- if (base::CommandLine::ForCurrentProcess()->HasSwitch( +- adblock::switches::kDisableAcceptableAds)) { ++ if ((true)) { + adblock_filtering_configuration->RemoveFilterList(AcceptableAdsUrl()); + } + if (base::CommandLine::ForCurrentProcess()->HasSwitch( +diff --git a/chrome/browser/adblock/adblock_telemetry_service_factory.cc b/chrome/browser/adblock/adblock_telemetry_service_factory.cc +deleted file mode 100644 +--- a/chrome/browser/adblock/adblock_telemetry_service_factory.cc ++++ /dev/null +@@ -1,127 +0,0 @@ +-/* +- * This file is part of eyeo Chromium SDK, +- * Copyright (C) 2006-present eyeo GmbH +- * +- * eyeo Chromium SDK is free software: you can redistribute it and/or modify +- * it under the terms of the GNU General Public License version 3 as +- * published by the Free Software Foundation. +- * +- * eyeo Chromium SDK 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 eyeo Chromium SDK. If not, see . +- */ +- +-#include "chrome/browser/adblock/adblock_telemetry_service_factory.h" +- +-#include +- +-#include "base/no_destructor.h" +-#include "chrome/browser/adblock/adblock_controller_factory.h" +-#include "chrome/browser/adblock/subscription_service_factory.h" +-#include "chrome/browser/profiles/incognito_helpers.h" +-#include "chrome/browser/profiles/profile.h" +-#include "chrome/common/pref_names.h" +-#include "components/adblock/core/activeping_telemetry_topic_provider.h" +-#include "components/adblock/core/adblock_telemetry_service.h" +-#include "components/adblock/core/common/adblock_utils.h" +-#include "components/adblock/core/configuration/filtering_configuration.h" +-#include "components/keyed_service/content/browser_context_dependency_manager.h" +-#include "content/public/browser/storage_partition.h" +- +-namespace adblock { +-namespace { +-std::optional g_check_interval_for_testing; +-std::optional g_initial_delay_for_testing; +- +-base::TimeDelta GetInitialDelay() { +- static base::TimeDelta kInitialDelay = +- g_initial_delay_for_testing ? g_initial_delay_for_testing.value() +- : base::Seconds(30); +- return kInitialDelay; +-} +- +-base::TimeDelta GetCheckInterval() { +- static base::TimeDelta kCheckInterval = +- g_check_interval_for_testing ? g_check_interval_for_testing.value() +- : base::Minutes(5); +- return kCheckInterval; +-} +- +-} // namespace +- +-// static +-AdblockTelemetryService* AdblockTelemetryServiceFactory::GetForProfile( +- Profile* profile) { +- return static_cast( +- GetInstance()->GetServiceForBrowserContext(profile, true)); +-} +-// static +-AdblockTelemetryServiceFactory* AdblockTelemetryServiceFactory::GetInstance() { +- static base::NoDestructor instance; +- return instance.get(); +-} +- +-AdblockTelemetryServiceFactory::AdblockTelemetryServiceFactory() +- : BrowserContextKeyedServiceFactory( +- "AdblockTelemetryService", +- BrowserContextDependencyManager::GetInstance()) { +- // AdblockController creates Adblock Filtering Configuration required by +- // AdblockTelemetryService +- DependsOn(AdblockControllerFactory::GetInstance()); +-} +- +-AdblockTelemetryServiceFactory::~AdblockTelemetryServiceFactory() = default; +- +-KeyedService* AdblockTelemetryServiceFactory::BuildServiceInstanceFor( +- content::BrowserContext* context) const { +- // Need to use a URLLoaderFactory specific to the browser context, not from +- // system_network_context_manager(), because the required Accept-Language +- // header depends on user's language settings and is not present in requests +- // made from the System network context. +- scoped_refptr url_loader_factory = +- context->GetDefaultStoragePartition() +- ->GetURLLoaderFactoryForBrowserProcess(); +- auto* prefs = Profile::FromBrowserContext(context)->GetPrefs(); +- auto service = std::make_unique( +- SubscriptionServiceFactory::GetForBrowserContext(context) +- ->GetAdblockFilteringConfiguration(), +- url_loader_factory, GetInitialDelay(), GetCheckInterval()); +- service->AddTopicProvider(std::make_unique( +- utils::GetAppInfo(), prefs, +- AdblockControllerFactory::GetForBrowserContext(context), +- ActivepingTelemetryTopicProvider::DefaultBaseUrl(), +- ActivepingTelemetryTopicProvider::DefaultAuthToken())); +- +- if (url_loader_factory) { +- service->Start(); +- } +- +- return service.release(); +-} +- +-content::BrowserContext* AdblockTelemetryServiceFactory::GetBrowserContextToUse( +- content::BrowserContext* context) const { +- return chrome::GetBrowserContextRedirectedInIncognito(context); +-} +- +-bool AdblockTelemetryServiceFactory::ServiceIsNULLWhileTesting() const { +- return true; +-} +- +-bool AdblockTelemetryServiceFactory::ServiceIsCreatedWithBrowserContext() +- const { +- return true; +-} +- +-void AdblockTelemetryServiceFactory::SetCheckAndDelayIntervalsForTesting( +- base::TimeDelta check_interval, +- base::TimeDelta initial_delay) { +- g_check_interval_for_testing = check_interval; +- g_initial_delay_for_testing = initial_delay; +-} +- +-} // namespace adblock +diff --git a/chrome/browser/adblock/adblock_telemetry_service_factory.h b/chrome/browser/adblock/adblock_telemetry_service_factory.h +deleted file mode 100644 +--- a/chrome/browser/adblock/adblock_telemetry_service_factory.h ++++ /dev/null +@@ -1,56 +0,0 @@ +-/* +- * This file is part of eyeo Chromium SDK, +- * Copyright (C) 2006-present eyeo GmbH +- * +- * eyeo Chromium SDK is free software: you can redistribute it and/or modify +- * it under the terms of the GNU General Public License version 3 as +- * published by the Free Software Foundation. +- * +- * eyeo Chromium SDK 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 eyeo Chromium SDK. If not, see . +- */ +- +-#ifndef CHROME_BROWSER_ADBLOCK_ADBLOCK_TELEMETRY_SERVICE_FACTORY_H_ +-#define CHROME_BROWSER_ADBLOCK_ADBLOCK_TELEMETRY_SERVICE_FACTORY_H_ +- +-#include "base/no_destructor.h" +-#include "base/time/time.h" +-#include "components/keyed_service/content/browser_context_keyed_service_factory.h" +- +-class Profile; +- +-namespace adblock { +-class AdblockTelemetryService; +-class AdblockTelemetryServiceFactory +- : public BrowserContextKeyedServiceFactory { +- public: +- static AdblockTelemetryService* GetForProfile(Profile* profile); +- static AdblockTelemetryServiceFactory* GetInstance(); +- +- // Sets the initial delay and interval checks required for browser tests. +- // Must be called before BuildServiceInstanceFor(). +- void SetCheckAndDelayIntervalsForTesting(base::TimeDelta check_interval, +- base::TimeDelta initial_delay); +- +- private: +- friend class base::NoDestructor; +- AdblockTelemetryServiceFactory(); +- ~AdblockTelemetryServiceFactory() override; +- +- // BrowserContextKeyedServiceFactory: +- KeyedService* BuildServiceInstanceFor( +- content::BrowserContext* context) const override; +- content::BrowserContext* GetBrowserContextToUse( +- content::BrowserContext* context) const override; +- bool ServiceIsNULLWhileTesting() const override; +- bool ServiceIsCreatedWithBrowserContext() const override; +-}; +- +-} // namespace adblock +- +-#endif // CHROME_BROWSER_ADBLOCK_ADBLOCK_TELEMETRY_SERVICE_FACTORY_H_ +diff --git a/chrome/browser/adblock/subscription_service_factory.cc b/chrome/browser/adblock/subscription_service_factory.cc +--- a/chrome/browser/adblock/subscription_service_factory.cc ++++ b/chrome/browser/adblock/subscription_service_factory.cc +@@ -25,6 +25,7 @@ + #include "base/functional/bind.h" + #include "base/task/thread_pool.h" + #include "base/trace_event/trace_event.h" ++#include "base/rand_util.h" + #include "chrome/browser/adblock/subscription_persistent_metadata_factory.h" + #include "chrome/browser/profiles/incognito_helpers.h" + #include "chrome/browser/profiles/profile.h" +@@ -66,7 +67,7 @@ base::TimeDelta GetUpdateCheckInterval() { + static base::TimeDelta kCheckInterval = + g_update_check_interval_for_testing + ? g_update_check_interval_for_testing.value() +- : base::Hours(1); ++ : base::Hours(24) + base::Minutes(base::RandInt(-60,60)); + return kCheckInterval; + } + +@@ -87,7 +88,8 @@ std::unique_ptr MakeOngoingSubscriptionRequest( + } + + ConversionResult ConvertFilterFile(const GURL& subscription_url, +- const base::FilePath& path) { ++ const base::FilePath& path, ++ bool allow_privileged_filter) { + TRACE_EVENT1("eyeo", "ConvertFileToFlatbuffer", "url", + subscription_url.spec()); + ConversionResult result; +@@ -97,7 +99,7 @@ ConversionResult ConvertFilterFile(const GURL& subscription_url, + } else { + result = FlatbufferConverter::Convert( + input_stream, subscription_url, +- config::AllowPrivilegedFilters(subscription_url)); ++ allow_privileged_filter && config::AllowPrivilegedFilters(subscription_url)); + } + base::DeleteFile(path); + return result; +@@ -162,10 +164,11 @@ SubscriptionServiceFactory::ConvertCustomFilters( + void SubscriptionServiceFactory::ConvertFilterListFile( + const GURL& subscription_url, + const base::FilePath& path, ++ bool allow_privileged_filter, + base::OnceCallback result_callback) const { + base::ThreadPool::PostTaskAndReplyWithResult( + FROM_HERE, {base::MayBlock()}, +- base::BindOnce(&ConvertFilterFile, subscription_url, path), ++ base::BindOnce(&ConvertFilterFile, subscription_url, path, allow_privileged_filter), + std::move(result_callback)); + } + +diff --git a/chrome/browser/adblock/subscription_service_factory.h b/chrome/browser/adblock/subscription_service_factory.h +--- a/chrome/browser/adblock/subscription_service_factory.h ++++ b/chrome/browser/adblock/subscription_service_factory.h +@@ -42,6 +42,7 @@ class SubscriptionServiceFactory : public BrowserContextKeyedServiceFactory, + void ConvertFilterListFile( + const GURL& subscription_url, + const base::FilePath& path, ++ bool allow_privileged_filter, + base::OnceCallback) const override; + + private: +diff --git a/chrome/browser/android/adblock/adblock_jni.cc b/chrome/browser/android/adblock/adblock_jni.cc +--- a/chrome/browser/android/adblock/adblock_jni.cc ++++ b/chrome/browser/android/adblock/adblock_jni.cc +@@ -24,6 +24,7 @@ + #include "base/android/jni_array.h" + #include "base/android/jni_string.h" + #include "base/android/jni_weak_ref.h" ++#include "base/time/time_to_iso8601.h" + #include "base/logging.h" + #include "chrome/browser/adblock/adblock_controller_factory.h" + #include "chrome/browser/android/adblock/adblock_jni_factory.h" +@@ -71,6 +72,10 @@ ScopedJavaLocalRef ToJava(JNIEnv* env, + const std::string& url, + const std::string& title, + const std::string& version, ++ adblock::Subscription::InstallationState state, ++ const std::string& installation_time, ++ long download_success_count, ++ long download_error_count, + const std::vector& languages) { + ScopedJavaLocalRef url_param( + env, env->NewObject(url_class.obj(), url_constructor, +@@ -79,12 +84,19 @@ ScopedJavaLocalRef ToJava(JNIEnv* env, + return Java_Subscription_Constructor(env, url_param, + ConvertUTF8ToJavaString(env, title), + ConvertUTF8ToJavaString(env, version), ++ ConvertUTF8ToJavaString(env, Subscription::SubscriptionInstallationStateToString(state)), ++ ConvertUTF8ToJavaString(env, installation_time), ++ download_success_count, ++ download_error_count, + ToJavaArrayOfStrings(env, languages)); + } + + std::vector> CSubscriptionsToJObjects( + JNIEnv* env, + const std::vector>& subscriptions) { ++ auto* controller = adblock::GetController(); ++ raw_ptr metadata = ++ controller->GetMetadata(); + ScopedJavaLocalRef url_class = GetClass(env, "java/net/URL"); + jmethodID url_constructor = MethodID::Get( + env, url_class.obj(), "", "(Ljava/lang/String;)V"); +@@ -93,7 +105,11 @@ std::vector> CSubscriptionsToJObjects( + for (auto& sub : subscriptions) { + jobjects.push_back(ToJava( + env, url_class, url_constructor, sub->GetSourceUrl().spec(), +- sub->GetTitle(), sub->GetCurrentVersion(), std::vector{})); ++ sub->GetTitle(), sub->GetCurrentVersion(), ++ sub->GetInstallationState(), base::TimeToISO8601(sub->GetInstallationTime()), ++ metadata ? metadata->GetDownloadSuccessCount(sub->GetSourceUrl()) : 0, ++ metadata ? metadata->GetDownloadErrorCount(sub->GetSourceUrl()) : 0, ++ std::vector{})); + } + return jobjects; + } +@@ -113,6 +129,9 @@ std::vector> CSubscriptionsToJObjects( + if (sub.url.is_valid()) { + jobjects.push_back(ToJava(env, url_class, url_constructor, + sub.url.spec(), sub.title, "", ++ adblock::Subscription::InstallationState::Unknown, ++ /*installation_time*/ "", ++ /*download_success_count*/ 0, /*download_error_count*/ 0, + sub.languages)); + } + } +@@ -167,6 +186,35 @@ static void JNI_AdblockController_Bind( + adblock::GetJNI()->Bind(weak_controller_ref); + } + ++static void ++JNI_AdblockController_StartUpdate(JNIEnv* env) { ++ adblock::GetController()->StartUpdate(); ++} ++ ++static base::android::ScopedJavaLocalRef ++JNI_AdblockController_GetCustomSubscriptions(JNIEnv* env) { ++ DCHECK_CURRENTLY_ON(content::BrowserThread::UI); ++ if (!adblock::GetController()) { ++ return ToJavaArrayOfObjects(env, ++ std::vector>{}); ++ } ++ ++ return ToJavaArrayOfObjects( ++ env, adblock::CSubscriptionsToJObjects( ++ env, adblock::GetController()->GetCustomSubscriptions())); ++} ++ ++static jboolean JNI_AdblockController_IsPrivilegedFiltersEnabled( ++ JNIEnv* env) { ++ return adblock::GetController()->IsPrivilegedFiltersEnabled() ? JNI_TRUE : JNI_FALSE; ++} ++ ++static void JNI_AdblockController_SetPrivilegedFiltersEnabled( ++ JNIEnv* env, ++ jboolean j_enabled) { ++ adblock::GetController()->SetPrivilegedFiltersEnabled(j_enabled == JNI_TRUE); ++} ++ + static base::android::ScopedJavaLocalRef + JNI_AdblockController_GetInstalledSubscriptions(JNIEnv* env) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); +diff --git a/chrome/browser/extensions/api/adblock_private/adblock_private_api.cc b/chrome/browser/extensions/api/adblock_private/adblock_private_api.cc +--- a/chrome/browser/extensions/api/adblock_private/adblock_private_api.cc ++++ b/chrome/browser/extensions/api/adblock_private/adblock_private_api.cc +@@ -137,26 +137,12 @@ std::vector CopySessionsStats( + return result; + } + +-std::string SubscriptionInstallationStateToString( +- adblock::Subscription::InstallationState state) { +- using State = adblock::Subscription::InstallationState; +- switch (state) { +- case State::Installed: +- return "Installed"; +- case State::Installing: +- return "Installing"; +- case State::Preloaded: +- return "Preloaded"; +- case State::Unknown: +- return "Unknown"; +- } +- NOTREACHED(); +- return ""; +-} +- + std::vector CopySubscriptions( ++ raw_ptr controller, + const std::vector> + current_subscriptions) { ++ raw_ptr metadata = ++ controller->GetMetadata(); + std::vector result; + for (auto& sub : current_subscriptions) { + api::adblock_private::Subscription js_sub; +@@ -164,9 +150,13 @@ std::vector CopySubscriptions( + js_sub.title = sub->GetTitle(); + js_sub.current_version = sub->GetCurrentVersion(); + js_sub.installation_state = +- SubscriptionInstallationStateToString(sub->GetInstallationState()); ++ adblock::Subscription::SubscriptionInstallationStateToString(sub->GetInstallationState()); + js_sub.last_installation_time = + base::TimeToISO8601(sub->GetInstallationTime()); ++ if (metadata) { ++ js_sub.download_success_count = metadata->GetDownloadSuccessCount(sub->GetSourceUrl()); ++ js_sub.download_error_count = metadata->GetDownloadErrorCount(sub->GetSourceUrl()); ++ } + result.emplace_back(std::move(js_sub)); + } + return result; +@@ -402,6 +392,44 @@ void AdblockPrivateAPI::OnListenerAdded( + + namespace api { + ++AdblockPrivateStartUpdateFunction::AdblockPrivateStartUpdateFunction() {} ++ ++AdblockPrivateStartUpdateFunction::~AdblockPrivateStartUpdateFunction() {} ++ ++ExtensionFunction::ResponseAction AdblockPrivateStartUpdateFunction::Run() { ++ auto* controller = adblock::AdblockControllerFactory::GetForBrowserContext( ++ browser_context()); ++ controller->StartUpdate(); ++ return RespondNow(NoArguments()); ++} ++ ++AdblockPrivateSetPrivilegedFiltersEnabledFunction::AdblockPrivateSetPrivilegedFiltersEnabledFunction() {} ++ ++AdblockPrivateSetPrivilegedFiltersEnabledFunction::~AdblockPrivateSetPrivilegedFiltersEnabledFunction() {} ++ ++ExtensionFunction::ResponseAction AdblockPrivateSetPrivilegedFiltersEnabledFunction::Run() { ++ absl::optional params = ++ api::adblock_private::SetEnabled::Params::Create(args()); ++ EXTENSION_FUNCTION_VALIDATE(params); ++ ++ auto* controller = adblock::AdblockControllerFactory::GetForBrowserContext( ++ browser_context()); ++ controller->SetPrivilegedFiltersEnabled(params->enabled); ++ return RespondNow(NoArguments()); ++} ++ ++AdblockPrivateIsPrivilegedFiltersEnabledFunction::AdblockPrivateIsPrivilegedFiltersEnabledFunction() {} ++ ++AdblockPrivateIsPrivilegedFiltersEnabledFunction::~AdblockPrivateIsPrivilegedFiltersEnabledFunction() {} ++ ++ExtensionFunction::ResponseAction AdblockPrivateIsPrivilegedFiltersEnabledFunction::Run() { ++ auto* controller = adblock::AdblockControllerFactory::GetForBrowserContext( ++ browser_context()); ++ return RespondNow( ++ ArgumentList(api::adblock_private::IsEnabled::Results::Create( ++ controller->IsPrivilegedFiltersEnabled()))); ++} ++ + AdblockPrivateSetEnabledFunction::AdblockPrivateSetEnabledFunction() {} + + AdblockPrivateSetEnabledFunction::~AdblockPrivateSetEnabledFunction() {} +@@ -547,7 +575,7 @@ AdblockPrivateGetSelectedBuiltInSubscriptionsFunction::Run() { + + return RespondNow(ArgumentList( + api::adblock_private::GetSelectedBuiltInSubscriptions::Results::Create( +- CopySubscriptions(controller->GetSelectedBuiltInSubscriptions())))); ++ CopySubscriptions(controller, controller->GetSelectedBuiltInSubscriptions())))); + } + + AdblockPrivateAddCustomSubscriptionFunction:: +@@ -605,7 +633,7 @@ AdblockPrivateGetCustomSubscriptionsFunction::Run() { + browser_context()); + return RespondNow(ArgumentList( + api::adblock_private::GetCustomSubscriptions::Results::Create( +- CopySubscriptions(controller->GetCustomSubscriptions())))); ++ CopySubscriptions(controller, controller->GetCustomSubscriptions())))); + } + + AdblockPrivateInstallSubscriptionFunction:: +@@ -662,7 +690,7 @@ AdblockPrivateGetInstalledSubscriptionsFunction::Run() { + browser_context()); + return RespondNow(ArgumentList( + api::adblock_private::GetInstalledSubscriptions::Results::Create( +- CopySubscriptions(controller->GetInstalledSubscriptions())))); ++ CopySubscriptions(controller, controller->GetInstalledSubscriptions())))); + } + + AdblockPrivateAddAllowedDomainFunction:: +diff --git a/chrome/browser/extensions/api/adblock_private/adblock_private_api.h b/chrome/browser/extensions/api/adblock_private/adblock_private_api.h +--- a/chrome/browser/extensions/api/adblock_private/adblock_private_api.h ++++ b/chrome/browser/extensions/api/adblock_private/adblock_private_api.h +@@ -58,6 +58,55 @@ void BrowserContextKeyedAPIFactory< + + namespace api { + ++class AdblockPrivateStartUpdateFunction : public ExtensionFunction { ++ public: ++ DECLARE_EXTENSION_FUNCTION("adblockPrivate.startUpdate", UNKNOWN) ++ AdblockPrivateStartUpdateFunction(); ++ ++ private: ++ ~AdblockPrivateStartUpdateFunction() override; ++ ++ ResponseAction Run() override; ++ ++ AdblockPrivateStartUpdateFunction(const AdblockPrivateStartUpdateFunction&) = ++ delete; ++ AdblockPrivateStartUpdateFunction& operator=( ++ const AdblockPrivateStartUpdateFunction&) = delete; ++}; ++ ++ ++class AdblockPrivateSetPrivilegedFiltersEnabledFunction : public ExtensionFunction { ++ public: ++ DECLARE_EXTENSION_FUNCTION("adblockPrivate.setPrivilegedFiltersEnabled", UNKNOWN) ++ AdblockPrivateSetPrivilegedFiltersEnabledFunction(); ++ ++ private: ++ ~AdblockPrivateSetPrivilegedFiltersEnabledFunction() override; ++ ++ ResponseAction Run() override; ++ ++ AdblockPrivateSetPrivilegedFiltersEnabledFunction(const AdblockPrivateSetPrivilegedFiltersEnabledFunction&) = ++ delete; ++ AdblockPrivateSetPrivilegedFiltersEnabledFunction& operator=( ++ const AdblockPrivateSetPrivilegedFiltersEnabledFunction&) = delete; ++}; ++ ++class AdblockPrivateIsPrivilegedFiltersEnabledFunction : public ExtensionFunction { ++ public: ++ DECLARE_EXTENSION_FUNCTION("adblockPrivate.isPrivilegedFiltersEnabled", UNKNOWN) ++ AdblockPrivateIsPrivilegedFiltersEnabledFunction(); ++ ++ private: ++ ~AdblockPrivateIsPrivilegedFiltersEnabledFunction() override; ++ ++ ResponseAction Run() override; ++ ++ AdblockPrivateIsPrivilegedFiltersEnabledFunction(const AdblockPrivateIsPrivilegedFiltersEnabledFunction&) = ++ delete; ++ AdblockPrivateIsPrivilegedFiltersEnabledFunction& operator=( ++ const AdblockPrivateIsPrivilegedFiltersEnabledFunction&) = delete; ++}; ++ + class AdblockPrivateSetEnabledFunction : public ExtensionFunction { + public: + DECLARE_EXTENSION_FUNCTION("adblockPrivate.setEnabled", UNKNOWN) +diff --git a/chrome/browser/extensions/api/eyeo_filtering_private/eyeo_filtering_private_api.cc b/chrome/browser/extensions/api/eyeo_filtering_private/eyeo_filtering_private_api.cc +--- a/chrome/browser/extensions/api/eyeo_filtering_private/eyeo_filtering_private_api.cc ++++ b/chrome/browser/extensions/api/eyeo_filtering_private/eyeo_filtering_private_api.cc +@@ -29,6 +29,7 @@ + #include "components/adblock/content/browser/resource_classification_runner.h" + #include "components/adblock/core/common/adblock_utils.h" + #include "components/adblock/core/common/content_type.h" ++#include "components/adblock/core/subscription/subscription.h" + #include "components/adblock/core/configuration/filtering_configuration.h" + #include "components/adblock/core/configuration/persistent_filtering_configuration.h" + #include "components/adblock/core/session_stats.h" +@@ -94,23 +95,6 @@ std::vector CopySessionsStats( + return result; + } + +-std::string SubscriptionInstallationStateToString( +- adblock::Subscription::InstallationState state) { +- using State = adblock::Subscription::InstallationState; +- switch (state) { +- case State::Installed: +- return "Installed"; +- case State::Installing: +- return "Installing"; +- case State::Preloaded: +- return "Preloaded"; +- case State::Unknown: +- return "Unknown"; +- } +- NOTREACHED(); +- return ""; +-} +- + std::vector CopySubscriptions( + const std::vector> + current_subscriptions) { +@@ -121,7 +105,7 @@ std::vector CopySubscriptions( + js_sub.title = sub->GetTitle(); + js_sub.current_version = sub->GetCurrentVersion(); + js_sub.installation_state = +- SubscriptionInstallationStateToString(sub->GetInstallationState()); ++ adblock::Subscription::SubscriptionInstallationStateToString(sub->GetInstallationState()); + js_sub.last_installation_time = + base::TimeToISO8601(sub->GetInstallationTime()); + result.emplace_back(std::move(js_sub)); +diff --git a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc +--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc ++++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc +@@ -17,7 +17,6 @@ + #include "chrome/browser/accessibility/accessibility_labels_service_factory.h" + #include "chrome/browser/accessibility/page_colors_factory.h" + #include "chrome/browser/adblock/adblock_controller_factory.h" +-#include "chrome/browser/adblock/adblock_telemetry_service_factory.h" + #include "chrome/browser/adblock/content_security_policy_injector_factory.h" + #include "chrome/browser/adblock/element_hider_factory.h" + #include "chrome/browser/adblock/resource_classification_runner_factory.h" +@@ -652,7 +651,6 @@ void ChromeBrowserMainExtraPartsProfiles:: + ExitTypeServiceFactory::GetInstance(); + #endif + adblock::AdblockControllerFactory::GetInstance(); +- adblock::AdblockTelemetryServiceFactory::GetInstance(); + adblock::ContentSecurityPolicyInjectorFactory::GetInstance(); + adblock::ElementHiderFactory::GetInstance(); + adblock::ResourceClassificationRunnerFactory::GetInstance(); +diff --git a/chrome/browser/resources/settings/BUILD.gn b/chrome/browser/resources/settings/BUILD.gn +--- a/chrome/browser/resources/settings/BUILD.gn ++++ b/chrome/browser/resources/settings/BUILD.gn +@@ -70,6 +70,7 @@ build_webui("build") { + web_component_files = [ + "a11y_page/a11y_page.ts", + "about_page/about_page.ts", ++ "adblock_page/adblock_page.ts", + "appearance_page/appearance_fonts_page.ts", + "appearance_page/appearance_page.ts", + "appearance_page/home_url_input.ts", +@@ -375,6 +376,7 @@ build_webui("build") { + ts_composite = true + ts_definitions = [ + "//tools/typescript/definitions/autofill_private.d.ts", ++ "//tools/typescript/definitions/adblock_private.d.ts", + "//tools/typescript/definitions/chrome_send.d.ts", + "//tools/typescript/definitions/language_settings_private.d.ts", + "//tools/typescript/definitions/management.d.ts", +diff --git a/chrome/browser/resources/settings/adblock_page/adblock_page.html b/chrome/browser/resources/settings/adblock_page/adblock_page.html +new file mode 100644 +--- /dev/null ++++ b/chrome/browser/resources/settings/adblock_page/adblock_page.html +@@ -0,0 +1,207 @@ ++ ++ ++ ++ ++ ++ ++

++ ++
++
++
Enable anti-circumvention and snippets
++
++ Snippets are pieces of JavaScript code, injected by the Adblock Plus, that execute within the context of a website and combat advanced ads that circumvent ordinary blocking. ++ The functionality is ONLY allowed for the list ++ abp-filters-anti-cv.txt ++ which is activated by this setting. ++
Open ABP anti-circumvention filter list repo ++
Open ABP Snippets Overview ++
++
++
++ ++ ++
++ ++
++
++
++ ++ Check for updates now ++ ++
++ ++
++ ++
++
Built in Subscriptions ([[countEnabled]] selected)
++
++ Add the languages in which you regularly browse websites in ++
++
++
++ ++
++ ++
++
++
++
++ ++
++ Allowed Domains ([[allowedDomainsCount]] added) ++
++
++ Support your favorite websites by adding them to this list. You might see ads on them. ++
++
++ ++
++ ++
++
++ ++ ++ Add ++ ++ ++
++
++
++
++
++
++ ++
++ Custom Subscriptions ([[customSubscriptions.length]] added) ++
++
++ Add custom filter urls ++
++
++ ++
++ ++
++
++ ++ ++ Add ++ ++ ++
++
++
++
++
++
++ ++
++ Custom Filters ([[customFilters.length]] added) ++
++
++ Add custom filter commands ++
++
++ ++
++ ++
++
++ ++ ++ Add ++ ++ ++
++
++
++
++
++ ++
++ +diff --git a/chrome/browser/resources/settings/adblock_page/adblock_page.ts b/chrome/browser/resources/settings/adblock_page/adblock_page.ts +new file mode 100644 +--- /dev/null ++++ b/chrome/browser/resources/settings/adblock_page/adblock_page.ts +@@ -0,0 +1,286 @@ ++/* ++ 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 . ++*/ ++import 'chrome://resources/cr_elements/cr_button/cr_button.js'; ++import 'chrome://resources/cr_elements/cr_shared_style.css.js'; ++import 'chrome://resources/polymer/v3_0/iron-collapse/iron-collapse.js'; ++import 'chrome://resources/polymer/v3_0/iron-flex-layout/iron-flex-layout-classes.js'; ++import 'chrome://resources/polymer/v3_0/iron-icon/iron-icon.js'; ++import '../settings_shared.css.js'; ++ ++import { I18nMixin } from 'chrome://resources/cr_elements/i18n_mixin.js'; ++import { BaseMixin } from '../base_mixin.js'; ++import { PolymerElement } from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; ++import { SettingsToggleButtonElement } from '/shared/settings/controls/settings_toggle_button.js'; ++import { PrefsMixin } from 'chrome://resources/cr_components/settings_prefs/prefs_mixin.js'; ++import { CrCheckboxElement } from 'chrome://resources/cr_elements/cr_checkbox/cr_checkbox.js'; ++import { getTemplate } from './adblock_page.html.js'; ++import { getToastManager } from 'chrome://resources/cr_elements/cr_toast/cr_toast_manager.js'; ++ ++const SettingsAdblockPageElementBase = ++ I18nMixin(PrefsMixin(BaseMixin((PolymerElement)))); ++ ++interface Subscription { ++ url: string; ++ title: string; ++ enabled: boolean; ++ current_version: string; ++ download_error_count: number; ++ download_success_count: number; ++ installation_state: string; ++ last_installation_time: string; ++} ++ ++export class SettingsAdblockPageElement extends ++ SettingsAdblockPageElementBase { ++ static get is() { ++ return 'settings-adblock-page'; ++ } ++ ++ static get template() { ++ return getTemplate(); ++ } ++ ++ // input fields updated by html ++ public customSubscriptionInput: string; ++ public customFilterInput: string; ++ public allowedDomainInput: string; ++ public additionalMessage: string; ++ public additionalMessageIcon: string; ++ public countEnabled: number; ++ public allowedDomainsCount: number; ++ public isEnablePrivilegedFiltersToggle_: boolean; ++ ++ // models that will fill templates lists in html ++ public customSubscriptions: Subscription[] = []; ++ public customFilters: Array = []; ++ public allowedDomains: Array = []; ++ public subscriptions: Subscription[] = []; ++ ++ private syncSubscriptions() { ++ this.subscriptions = [] ++ this.customSubscriptions = []; ++ ++ chrome.adblockPrivate.getBuiltInSubscriptions(list => { ++ chrome.adblockPrivate.getInstalledSubscriptions(activelist => { ++ let new_subscriptions: Subscription[] = []; ++ let custom_subscriptions: Subscription[] = []; ++ ++ list.forEach(obj => { ++ new_subscriptions.push({ ++ title: obj.title, ++ enabled: false, ++ url: obj.url, ++ current_version: '', ++ download_error_count: 0, ++ download_success_count: 0, ++ installation_state: '', ++ last_installation_time: '' ++ }) ++ }) ++ ++ activelist.forEach(obj => { ++ var found = new_subscriptions.find(element => element.url == obj.url); ++ if (found === undefined) { ++ found = { ++ title: obj.title, ++ enabled: false, ++ url: obj.url, ++ current_version: '', ++ download_error_count: 0, ++ download_success_count: 0, ++ installation_state: '', ++ last_installation_time: '' ++ } ++ custom_subscriptions.push(found) ++ } ++ found.enabled = true; ++ found.current_version = obj.current_version; ++ found.download_error_count = obj.download_error_count; ++ found.download_success_count = obj.download_success_count; ++ found.installation_state = obj.installation_state; ++ found.last_installation_time = new Date(obj.last_installation_time).toLocaleString(); ++ }) ++ ++ this.subscriptions = new_subscriptions; ++ this.customSubscriptions = custom_subscriptions; ++ this.updateUI(); ++ }) ++ }); ++ } ++ ++ private updateUI() { ++ this.additionalMessage = ""; ++ this.additionalMessageIcon = ""; ++ this.countEnabled = 0; ++ ++ chrome.adblockPrivate.isEnabled(enabled => { ++ if (!enabled) return; ++ ++ let c = 0; ++ this.subscriptions.forEach(obj => { ++ if (obj.enabled) c++; ++ }); ++ this.countEnabled = c; ++ if (this.countEnabled == 0 && ++ this.customSubscriptions.length == 0 && ++ this.customFilters.length == 0) { ++ this.additionalMessage = "No subscriptions selected. Adblock is not active."; ++ this.additionalMessageIcon = "cr:warning"; ++ } ++ }); ++ ++ chrome.adblockPrivate.isPrivilegedFiltersEnabled(enabled => { ++ this.isEnablePrivilegedFiltersToggle_ = enabled; ++ }); ++ } ++ ++ private syncCustomFilters() { ++ chrome.adblockPrivate.getCustomFilters(domain => { ++ this.customFilters = []; ++ domain.forEach(value => { ++ this.customFilters.push(value); ++ }) ++ this.updateUI(); ++ }); ++ } ++ ++ private syncAllowedDomains() { ++ this.allowedDomainsCount = 0; ++ chrome.adblockPrivate.getAllowedDomains(domain => { ++ this.allowedDomains = []; ++ domain.forEach(value => { ++ this.allowedDomains.push(value); ++ }) ++ this.allowedDomainsCount = this.allowedDomains.length; ++ this.updateUI(); ++ }); ++ } ++ ++ public override ready() { ++ super.ready(); ++ ++ this.syncSubscriptions(); ++ this.syncCustomFilters(); ++ this.syncAllowedDomains(); ++ } ++ ++ private onAdblockEnabled_(event: Event) { ++ if ((event.target as SettingsToggleButtonElement).checked) { ++ chrome.adblockPrivate.setEnabled(true); ++ } else { ++ chrome.adblockPrivate.setEnabled(false); ++ } ++ this.updateUI(); ++ } ++ ++ private onEnablePrivilegedFiltersToggle_(_evt: any, enabled: boolean) { ++ chrome.adblockPrivate.setPrivilegedFiltersEnabled(enabled); ++ this.syncSubscriptions(); ++ } ++ ++ private cleanUrl(url: string) : string { ++ let cleanedUrl : string = ""; ++ try { ++ cleanedUrl = new URL(url).host; ++ } catch (err) { ++ try { ++ // one last try by adding schema ++ cleanedUrl = new URL("https://" + url).host; ++ } ++ catch (err) { ++ console.log("malformed url " + url); ++ return ""; ++ } ++ } ++ return cleanedUrl; ++ } ++ ++ private selectRecommendedSubscription(e: Event) { ++ const url = ((e.target as CrCheckboxElement).id); ++ const enabled = ((e.target as CrCheckboxElement).checked); ++ if (enabled) { ++ chrome.adblockPrivate.installSubscription(url); ++ } else { ++ chrome.adblockPrivate.uninstallSubscription(url); ++ } ++ this.updateUI(); ++ } ++ ++ private removeCustomFilter(e: Event) { ++ const filter = ((e.target as HTMLElement).id); ++ chrome.adblockPrivate.removeCustomFilter(filter); ++ const i = this.customFilters.indexOf(filter); ++ this.splice('customFilters', i, 1); ++ this.updateUI(); ++ } ++ ++ private addCustomFilter() { ++ if (this.customFilterInput == undefined || this.customFilterInput == "") return; ++ chrome.adblockPrivate.addCustomFilter(this.customFilterInput); ++ this.customFilterInput = ""; ++ this.syncCustomFilters(); ++ } ++ ++ private removeAllowedDomain(e: Event) { ++ const allowedDomain = ((e.target as HTMLElement).id); ++ chrome.adblockPrivate.removeAllowedDomain(allowedDomain); ++ const i = this.allowedDomains.indexOf(allowedDomain); ++ this.splice('allowedDomains', i, 1); ++ this.allowedDomainsCount = this.allowedDomains.length; ++ this.updateUI(); ++ } ++ ++ private addAllowedDomain() { ++ if (this.allowedDomainInput == undefined || this.allowedDomainInput == "") return; ++ const cleanedUrl = this.cleanUrl(this.allowedDomainInput); ++ if (cleanedUrl == "") return; ++ chrome.adblockPrivate.addAllowedDomain(cleanedUrl); ++ this.allowedDomainInput = ""; ++ this.syncAllowedDomains(); ++ } ++ ++ private removeCustomSubscription(e: Event) { ++ const url = ((e.target as HTMLElement).id); ++ const subscription = this.customSubscriptions.find( x => x.url = url); ++ chrome.adblockPrivate.uninstallSubscription(subscription!.url); ++ this.splice('customSubscriptions', this.customSubscriptions.indexOf(subscription!), 1); ++ this.updateUI(); ++ } ++ ++ private addCustomSubscription() { ++ if (this.customSubscriptionInput == undefined || this.customSubscriptionInput == "") return; ++ chrome.adblockPrivate.installSubscription(this.customSubscriptionInput); ++ this.customSubscriptionInput = ""; ++ this.syncSubscriptions(); ++ } ++ ++ private startUpdateCycle() { ++ const toastManager = getToastManager(); ++ chrome.adblockPrivate.startUpdate(); ++ toastManager.duration = 5000; ++ toastManager.show("Starting update..."); ++ } ++} ++ ++declare global { ++ interface HTMLElementTagNameMap { ++ 'settings-adblock-page': SettingsAdblockPageElement; ++ } ++} ++ ++customElements.define( ++ SettingsAdblockPageElement.is, SettingsAdblockPageElement); +diff --git a/chrome/browser/resources/settings/basic_page/basic_page.html b/chrome/browser/resources/settings/basic_page/basic_page.html +--- a/chrome/browser/resources/settings/basic_page/basic_page.html ++++ b/chrome/browser/resources/settings/basic_page/basic_page.html +@@ -24,6 +24,13 @@ + + + ++ +