From 217a1e20a2a23803385d6a8f8e0ed230acfe3ed3 Mon Sep 17 00:00:00 2001 From: Torsten Kurbad Date: Thu, 10 Jul 2025 11:02:22 +0200 Subject: [PATCH] Thorium Browser added --- www-client/thorium/Manifest | 66 + .../files/chromium-109-system-openh264.patch | 20 + .../files/chromium-109-system-zlib.patch | 10 + .../chromium-111-InkDropHost-crash.patch | 25 + .../thorium/files/chromium-118-ffmpeg.patch | 40 + .../thorium/files/chromium-123-qrcode.patch | 68 + .../chromium-125-cloud_authenticator.patch | 19 + .../chromium-126-oauth2-client-switches.patch | 45 + .../files/chromium-127-cargo_crate.patch | 12 + .../thorium/files/chromium-127-crabby.patch | 49 + ...8-gtk-fix-prefers-color-scheme-query.patch | 53 + ...-130-fix-building-without-tflite-lib.patch | 63 + .../files/chromium-130-fix-includes.patch | 56 + .../files/chromium-130-fontations.patch | 93 + .../files/chromium-130-libstdc++.patch | 82 + .../thorium/files/chromium-131-compiler.patch | 288 ++ .../thorium/files/chromium-132-mold.patch | 175 + .../files/chromium-132-no-link-builtins.patch | 16 + .../files/chromium-134-qt5-optional.patch | 133 + .../thorium/files/chromium-135-gperf.patch | 28 + .../files/chromium-137-fix-for-kde.patch | 12 + .../thorium/files/chromium-99-opus.patch | 12 + .../files/chromium-cross-compile.patch | 12 + ...dd0620a72aa73ea521c682fb246067f2c14d.patch | 12 + .../thorium/files/chromium-system-av1.patch | 22 + .../files/chromium-system-libvpx.patch | 23 + .../files/chromium-system-openjpeg-r4.patch | 35 + .../files/chromium-ucf-dict-utility-r1.patch | 112 + .../thorium/files/disable-bluez-r1.patch | 92 + .../ffmpeg-nb_coded_side_data-dolby.diff | 24 + .../files/ffmpeg-nb_coded_side_data-r1.patch | 224 + .../fix-building-without-safebrowsing.patch | 3981 +++++++++++++++++ www-client/thorium/files/font-gc-r2.patch | 69 + www-client/thorium/files/libusb.gn | 24 + ...4608c84d2d2d8d684f40a110d0a6f4eddc51.patch | 89 + .../thorium/files/perfetto-system-zlib.patch | 11 + .../reverse-roll-src-third_party-ffmpeg.patch | 287 ++ ...roll-src-third_party-ffmpeg_duration.patch | 15 + ...rium-130-fix-building-without-libjxl.patch | 29 + www-client/thorium/files/thorium-browser.xml | 13 + www-client/thorium/files/thorium-launcher.sh | 59 + .../thorium/files/thorium-shell-launcher.sh | 42 + .../thorium/files/thorium-shell.default | 7 + .../thorium/files/thorium-shell.desktop | 15 + www-client/thorium/files/thorium.default | 7 + ...undle-ffmpeg-av_stream_get_first_dts.patch | 12 + www-client/thorium/files/update-dicts.sh | 58 + www-client/thorium/metadata.xml | 53 + .../thorium/thorium-130.0.6723.174.ebuild | 1958 ++++++++ 49 files changed, 8650 insertions(+) create mode 100644 www-client/thorium/Manifest create mode 100644 www-client/thorium/files/chromium-109-system-openh264.patch create mode 100644 www-client/thorium/files/chromium-109-system-zlib.patch create mode 100644 www-client/thorium/files/chromium-111-InkDropHost-crash.patch create mode 100644 www-client/thorium/files/chromium-118-ffmpeg.patch create mode 100644 www-client/thorium/files/chromium-123-qrcode.patch create mode 100644 www-client/thorium/files/chromium-125-cloud_authenticator.patch create mode 100644 www-client/thorium/files/chromium-126-oauth2-client-switches.patch create mode 100644 www-client/thorium/files/chromium-127-cargo_crate.patch create mode 100644 www-client/thorium/files/chromium-127-crabby.patch create mode 100644 www-client/thorium/files/chromium-128-gtk-fix-prefers-color-scheme-query.patch create mode 100644 www-client/thorium/files/chromium-130-fix-building-without-tflite-lib.patch create mode 100644 www-client/thorium/files/chromium-130-fix-includes.patch create mode 100644 www-client/thorium/files/chromium-130-fontations.patch create mode 100644 www-client/thorium/files/chromium-130-libstdc++.patch create mode 100644 www-client/thorium/files/chromium-131-compiler.patch create mode 100644 www-client/thorium/files/chromium-132-mold.patch create mode 100644 www-client/thorium/files/chromium-132-no-link-builtins.patch create mode 100644 www-client/thorium/files/chromium-134-qt5-optional.patch create mode 100644 www-client/thorium/files/chromium-135-gperf.patch create mode 100644 www-client/thorium/files/chromium-137-fix-for-kde.patch create mode 100644 www-client/thorium/files/chromium-99-opus.patch create mode 100644 www-client/thorium/files/chromium-cross-compile.patch create mode 100644 www-client/thorium/files/chromium-revert-84fcdd0620a72aa73ea521c682fb246067f2c14d.patch create mode 100644 www-client/thorium/files/chromium-system-av1.patch create mode 100644 www-client/thorium/files/chromium-system-libvpx.patch create mode 100644 www-client/thorium/files/chromium-system-openjpeg-r4.patch create mode 100644 www-client/thorium/files/chromium-ucf-dict-utility-r1.patch create mode 100644 www-client/thorium/files/disable-bluez-r1.patch create mode 100644 www-client/thorium/files/ffmpeg-nb_coded_side_data-dolby.diff create mode 100644 www-client/thorium/files/ffmpeg-nb_coded_side_data-r1.patch create mode 100644 www-client/thorium/files/fix-building-without-safebrowsing.patch create mode 100644 www-client/thorium/files/font-gc-r2.patch create mode 100644 www-client/thorium/files/libusb.gn create mode 100644 www-client/thorium/files/perfetto-acc24608c84d2d2d8d684f40a110d0a6f4eddc51.patch create mode 100644 www-client/thorium/files/perfetto-system-zlib.patch create mode 100644 www-client/thorium/files/reverse-roll-src-third_party-ffmpeg.patch create mode 100644 www-client/thorium/files/reverse-roll-src-third_party-ffmpeg_duration.patch create mode 100644 www-client/thorium/files/thorium-130-fix-building-without-libjxl.patch create mode 100644 www-client/thorium/files/thorium-browser.xml create mode 100644 www-client/thorium/files/thorium-launcher.sh create mode 100644 www-client/thorium/files/thorium-shell-launcher.sh create mode 100644 www-client/thorium/files/thorium-shell.default create mode 100644 www-client/thorium/files/thorium-shell.desktop create mode 100644 www-client/thorium/files/thorium.default create mode 100644 www-client/thorium/files/unbundle-ffmpeg-av_stream_get_first_dts.patch create mode 100644 www-client/thorium/files/update-dicts.sh create mode 100644 www-client/thorium/metadata.xml create mode 100644 www-client/thorium/thorium-130.0.6723.174.ebuild diff --git a/www-client/thorium/Manifest b/www-client/thorium/Manifest new file mode 100644 index 0000000..2a024e2 --- /dev/null +++ b/www-client/thorium/Manifest @@ -0,0 +1,66 @@ +AUX chromium-109-system-openh264.patch 577 BLAKE2B ec83d9a72a163683d791893e6b72fd5a6ffaa18d611bc6e6785819292370cc9f4fd37d8d3a33ecb5621beb33a3271df00d7a1b629300fdfa8db6e4e4eb196f1e SHA512 5ea73c8522619d83047fcd429988b24687e928e01c2915ef4145469fbb1238ef4a72beca73493794e2275b855f95412355700579a31649d64d74133ed815f1cb +AUX chromium-109-system-zlib.patch 440 BLAKE2B 95bb1099055e3e0e122d4d8a77cddec0a3417b3d87ef252d7a475f6be23b16f587ec627c90bac41d743bd9dc07488edccb0946ed465f2244b61adc44cd19761d SHA512 b4e386613eb2a0dd61af40bb29621356085e183b97d830661e5157e4f22c2ada5606d80e56d5a65fb2985cdffb505a878c32bdafb081b1fa24cbe976c7b60b86 +AUX chromium-111-InkDropHost-crash.patch 1066 BLAKE2B ee0b42803a59ef4731e4f316849c2062870b92040ff4e339c3f3f2562999b54fa3176b27e432f31ada76559087631fd623d9f57f1961a42acd0684041c322a01 SHA512 dfa3ab6a84b57b6e66053be2597f0d6c7f4caf54b0e45a359774a56dfbe1e65bdea91120134e77b1e7c38c336a4fd8d05a7c26e9d3bf4bdc0fe40ad7cd832a54 +AUX chromium-118-ffmpeg.patch 1684 BLAKE2B 01fc5b3f3a4c6b68aa03327e49847462567ceed09ce42db93106f13558bc358116a85cc22812ab1b060e5d5b8e9913ffb74485e76af533382eeaa90a4e71a0e5 SHA512 cab524c7030e8d01921450eb9c00eaa678fd06073b60fc29a973bc7fa19a878666ad812b1e99863cc947fe1037cfce7216333eae52943e90f53f1277fc6642c5 +AUX chromium-123-qrcode.patch 2100 BLAKE2B d42df3fd72d1930aceef3f9e3633167573f7d0cde7907b27cdc3d7a100e37f822a557baf2d9f9687cc11e1a4160e09535226437bf2d724df039a58f796408ade SHA512 339499323bc55a755618035f1f2b56472127c8b467031400d63569e5f9300782d3a5e655cb7a191e9759e90d3d27475f22fde6f5f63ab348af7a9f2829e7b715 +AUX chromium-125-cloud_authenticator.patch 627 BLAKE2B 0517aba87901e0c318fee6a0ac7e4317eb4ea18807841bc89b761b1da8938cb4266ea5e6ea7aee629ae16ab622ff966cbe2a3f6dcd7871ff516fc1477db26226 SHA512 e6afae2766bcbffa5f259a0bd8fb3b1b6078b9f61102023229bb7b2d619a9b3911beabd39b1c88b04e3ec8c80a98843733881ed53039b6d98f764bbb4ec9d124 +AUX chromium-126-oauth2-client-switches.patch 2214 BLAKE2B 0dfc0dcd585bcd12793033292b1e10f448b84a65ee9354803237aca225a5de8b40a56f78cc806353d5240d41bed2efe82bc1b39ebea8ae4db2f79855f6ce1eaf SHA512 77e4e5609b9191160c73681020defd2d3e6fc3874837611e1febef538d3997fccea267ed87f6bbff6bd140f98d8e909d935ce3e3e0d53bf597882bb2282ab72c +AUX chromium-127-cargo_crate.patch 299 BLAKE2B b9998c8681738ffa9b846c581df8084ae627163070498576b762da7aa6654b3e40a4c341280763cc7ab7c40f86190187aa18bf1f3246e0012cb1af42690283f5 SHA512 73b8708077ba106f1c44f29a52bc403e54df424587ca7ff1c662f24ae32b83bc90608a43dbb9beca4ccd1aea8200791e9f9f42287415d6e6f8c795ef0adeaa7c +AUX chromium-127-crabby.patch 1894 BLAKE2B 9132792722b911867079caa808d923a9168f784f5e1c1ccb66efd0a8c15c4f0d388716469e78b9780b90083ff41895ae00e34b8c5b1ab2c1464d7732e2108ac4 SHA512 bae8e58c55b45d45cac192995109fd3554989e54676fd175cecb895f000336bdca51f80affe9d87f3951a587cb719485d44100e48131e07fb4e70563c29b0321 +AUX chromium-128-gtk-fix-prefers-color-scheme-query.patch 1986 BLAKE2B 8a7f4a99672e834b1b673476ca7428939f710adeebb0507ab65783d419e1d213be08cc17f188ccc7923a2b07da3a2791f2f122e11c5735726f6a72d7d6938b39 SHA512 d89ea59ddd1e0525994def0f6d1b8e5dec79c9e3fd920323231c2ebd946e74f8241f48efcb307c41339e01f4faa065e224e25ffc7780d1869203d6e58fc7ebc9 +AUX chromium-130-fix-building-without-tflite-lib.patch 2535 BLAKE2B 2495b705966180cf034504559e440a9157b99df654e98572ba68c6c5a856ecfb914e08e53bea8134531d28584ffe19609b3c9db254fb4bbec80c03d9e545d531 SHA512 73913c527083d682638c28dbec5477a1847e393d638b985e9e3962b5fbb2b0e6c72078851a7b32d6b8433a5ac685dc6ab431b48e092a2558d426d3a5c751e308 +AUX chromium-130-fix-includes.patch 3375 BLAKE2B df286cb1069414a5ba0207bd2815f42f0947d0f547c19308ce0f44ba8c5705931cac4d115ee33df66bad15ad97c87eb2743abfa749c8cd6c43b63dd6a3d271f9 SHA512 4951147efd4fbbe936e2184b2f92b69cb19e95d6c96b73e4df0bbbcdcbe7c1e0abcc86b318abdba034c23df9c58978ff257a2ae420bdd486846b79bbafe07e4f +AUX chromium-130-fontations.patch 3040 BLAKE2B e0379c940bb8fdfa28fd1973c11d5bb7d1fda56e4a76169bc7c4a2b1cdb83792b3de142f8f4d594f462dec1735fe4afddb32b962a6319a6aeacd36c5737e4e47 SHA512 aee5c88e97b2afe3ef4218bab859702a12e0f503df797bc03f594df47664105c758d8b1c869574ee25f32cc94e2de3c84dae0d89cb614011e94d54c3da53ce69 +AUX chromium-130-libstdc++.patch 4618 BLAKE2B 175d64d4367b68d6ecd9d7d4f9c796a1c026066cbc61cdecdf1570ba069ebb9cf81b3be3f3cc4c62594a0bca89bce5b9f89b0903193d6eab8e86d80c166fa79f SHA512 85d08144423e9545a9bdc98eeb70bc8cbae23fe78a771b13abeb2dd7d324b197731bf64162b8b4bed0d88a055d9edcb9905a929c8a6f6ac0cf79c4a2ea296269 +AUX chromium-131-compiler.patch 9766 BLAKE2B 70c472390bbb99ffb0a5c1b5b23c0deac4624c43b18bed06d15e9ea467b22f365aafd785c8abc4102d81cabb8ed56e6385da3e438ceea708c86094ef10baafa8 SHA512 336e4e90e831e58fe06b63c4b3d276a79a38d0e777c33e70c4050f41ac8b0c5044d57225fa45f41a1f6bfd9d8d2d6bb3e01759b77bfb39bb490801ea7fcca282 +AUX chromium-132-mold.patch 6134 BLAKE2B 71dbc254343be868c31f542f564547d8c090d4a1b0729b6f75d0d518b80010bba63cb1b6af0af9d7be4971611305eec25e11fa18b048ba5bd3bfccb10b787a49 SHA512 c753a5eed66d86070da4d18096c6c3a5c7d8ed5982f5fee2bc48172362cbdb983090b921a743e78639eb21041aaaf77653222cd057cc4941d7a761d29d234280 +AUX chromium-132-no-link-builtins.patch 550 BLAKE2B f838540e21afb61d3041ba8690e1d71269cdd0f165618b12ef8c3fb24e5e3f846c1bb56a36ac19738e17246d02d75937416a53fb4bb789153f76f6f7fe9bbf28 SHA512 6b685dccd8e833e22c4be4be14e6fece5db13e7635bba0442b0fc8000da7e921e7bc479726569e587c9ea8338fa95cf795f0f1912ca3cf37bc2622dc4a07ca19 +AUX chromium-134-qt5-optional.patch 4140 BLAKE2B 2a5879384a95fa0a9edf2e6506b2f374f6366ef0bd5f248b14333cbe721c5ad85d04101cf7a15a207c476525a8ba22645d8446c684363b3fa8b9c642c89b8fbf SHA512 b9fba4b3d33430a9565a6605f8d525618e6691622095bfe17f781e030e4395cb5ed25242625761ca16b19da8014e4afa1335fc6719cae78c8b3594c9e9092978 +AUX chromium-135-gperf.patch 1539 BLAKE2B 59ddd646ae97f8b77e6f4852ff4d1c50b0910f48199508935ad855719a6ad4081fd1c088a89e7e19c906aa98842fef7bbe97f219c10d7c4d279563650e4b65fc SHA512 3a66cdd30a9a2bd69d6d1bcf06602290830509910b37a9a96b3f4df1525fcda3b6b5c683d255ad976228cbc8a215bc3746985ab4d8096b1f48740ec0eb9247a5 +AUX chromium-137-fix-for-kde.patch 718 BLAKE2B 0f511723c4712563b8db97db9fcb0c54575a4f757c2d5a44ff265cddfd11e37fa89f2865d5c3f2956d6680bc67b2cc8c399bf57d591d3ad37ae2297b9a18b9b7 SHA512 669b35bd5204f50c0e06718435a92f000e9f692b084f8ce1154465b0fc4d3f5796953f72b480e3e55ed66f122827275cb9358fc6a58a522855adb7781ab940b3 +AUX chromium-99-opus.patch 556 BLAKE2B cad43be94fab004267ea1311f329f38b032a49374691a639a871feac1b1fb304768ac40659c0c72b0705738791b4ce774bca5591e7a19546d0ca4f76bec5f369 SHA512 8e5691104f6d724b59ae6e73fe0720bf483ff95bd80a4e66116d1555fa786c1e4ab813d9479a26d363c5a36da39dc31b56c69d3d84eff39bf0c2deee1cf632e7 +AUX chromium-cross-compile.patch 323 BLAKE2B 8d5091ce5287422c9688ede2563360a96b8bd34b9750dc1c8f0b6ca9aeff2c066fac2da169396baa131d971c087c78f9af53999df0e102d1f57176f5e8d3dd57 SHA512 06d3afc1aa19e57daac0e4bad37e1f365a68408240430e5e818e5a4f12e3b7519214eafa463633e447e7029f4ae13ea864ca347ad1fac117702a0be88718a954 +AUX chromium-revert-84fcdd0620a72aa73ea521c682fb246067f2c14d.patch 563 BLAKE2B b15d3f70f8cf6bf94c9c52f17e90b9d989a035903d70f8e10fe09c388522b9ab6b9959da003996cce6e308cdc9abc0631805ff40efe5805cd99076713c27c34f SHA512 d0618255f8bcf0429f7dbb94ec8f2972e8b09568a4c5b10df2e5bebf99d8eaae2d0be3217c48d97e655c9a617025211b2610117797820609442c376d93aacd78 +AUX chromium-system-av1.patch 787 BLAKE2B 1b7925c4923bc559890c04626d12c813816516aa593a6ddbb195c4be0135f55fc255194b60927a21f0348a65f84ed0239630fcdada6e90fae5ae2b9b3ce37058 SHA512 67fa937ac254656277ea0d75c742437db0313ee05fa03c7a53efb0880be6aaaaf1a813c11a5838d1f0f8e696f3ebcaf774f02f9b87d13655e6acd223e20d4a45 +AUX chromium-system-libvpx.patch 764 BLAKE2B bc73407a255da53f45b471a9407cbdad7d64c47f5780dc58bd92e35255c87bea1f4738ade04f3dad4aa14f8db76f66ea37aea351c8b198575d3127985b6e2766 SHA512 436f8df62e1ac7c87c6f998870cbc68b71e321859d384c91e144c4c5b80df498d75f162975ddb11e2c4e336ac80e576161e2bc4ca7765edd75082233071503ea +AUX chromium-system-openjpeg-r4.patch 1035 BLAKE2B d269a25bb13b42929a6ddd73a8d1f367b557b58c6a81af9c52e6ad2fbe70810fdde065c6d909c83ea42d9cf485d3a68f490510c695a4c2de3f963bc5a23df828 SHA512 913d164bb094b3a1d467fd129fd817b3be345869a9d7949c42f25f2c1a02edea501c1a42adb4e5f083bae9ccda16f2368e05c00b170ef3facc31ae90c1a2410c +AUX chromium-ucf-dict-utility-r1.patch 3843 BLAKE2B c9da2ed82f6113f810a430f09fc584aebc27ba7174c82c0b773d5387a03d7220a400cc24733886ef3e6d6040c03e04796f19dde342b11765ea8ea1c872b381da SHA512 47ac0d83f097a66370049babcb78cc70387865a33c8a679ce7380234544d0f0f5ed1a01afad7d5b8a6e4622c9c7c4f45c9254ed3241a991b634f60cc3a3ac724 +AUX disable-bluez-r1.patch 3265 BLAKE2B 72465c584899c3f277155931b75487edc7ce61d7b251446264cf0f33af4afcd9a2227a68af68101c07346e3b5dc1b3b1937c68fee3cad902fed6b6e2a8654c8c SHA512 d8d8d60a2f689919d9254da3530ff5fd362415ae979db6651bc45f4fb0f9d7b6aabdb7ec0190bb9d95d23986dedde37a94a9907a9a26be6cc4535787306ae674 +AUX ffmpeg-nb_coded_side_data-dolby.diff 896 BLAKE2B a90921aa94edc200c08bcf0ddeab962e17f73a22a699166fdf7011bee36bc9b42730727e1d59003dc2f3b798bbeeaa1ebffada3d7801e68e1e0ec8739360b392 SHA512 c627eebcc05a674978201e4b27cfbfa17780260526bcb5d441a3a5dbf9c6006a1f1c3ad14a538bcb288eb01a0595085fe2a13eb1a1500b0254777968493490a0 +AUX ffmpeg-nb_coded_side_data-r1.patch 9732 BLAKE2B 3d71f7e2acc4b5db098fd5e052081297a5894263857dc53111814deb73acc075cd0e30276723b3d934d05004c94675d4a1f72a363ea3e3da2a0beec06aa8a7e3 SHA512 ecfdeb14ee9ce794cff2695da99aa818cc2f00d013f78fd9878769f0c941fb63256cac281b3d69612d79e4d12985219ffe4f428382ec650017645d2fe2c0a187 +AUX fix-building-without-safebrowsing.patch 175026 BLAKE2B 14a4071ea5d6896594c6cd6d8ebd6940c29203447713767f03db06c7e61627c7aada5f415fc28f5a60cf5e55c1ac98ae0e2f79fe72413cb2b9cf08e808c05e00 SHA512 8f8e4b92845cd487fee676a4aa1b21084a60514b4e5d0cd0804bdb435a24b914194c0c572fdf74247fb9f2e286e58a731fd2e219eb89a95d748e15f466f97770 +AUX font-gc-r2.patch 2692 BLAKE2B cd1085fe89cc7446c52d9b1a68bca57811eeb21b3fbad2318752fe7434fcaf96a2708557c90884f286becc6b300ff21a8b6bd3107a69bddbde24a68df0be3e9f SHA512 3575a769a77f25734603105693bfe97343050f7d2b9f7d6df4e81c3a8643c3f7b49c5b6bafe4f09594551968c5a941deb5862da6409d3a1ce9120a55909321ea +AUX libusb.gn 502 BLAKE2B 8971df95ef9690762eeb41eda4814fa57488a840751f21671bed01291dd0d840b8028737f7a59b4cd0858b57bbfdad4feb65485805fb50934bd339358b952659 SHA512 b2667fd1751b871f935ead6e7388f5046aaeea2a5b393cab27af6170be690e82f679bdc44c932de03d2c1b2bf51abc75b0fac16dd702f84cdc8c078befcec49b +AUX perfetto-acc24608c84d2d2d8d684f40a110d0a6f4eddc51.patch 3584 BLAKE2B ce9b6b5cadd5cfeb77af9e4c6728aaf01b9e137c5ac026608310f784832c937270ab02bdfc7113b70c714907cc03d04c244cb2193643301552d5372645effbd3 SHA512 4c9c50efabed768acecf571e2f5e142959a2d2c3dce793771719cda3a878afa8fa6ff47180e0d90f1d8dc1ff863fe46855a5ddefa1dd8bd24fbf895ec1d60562 +AUX perfetto-system-zlib.patch 433 BLAKE2B 4cd2883262ab5b52b3bc78fe4b1ac000682a7d9bbfd0e29af424a088dcdad262c4d09a6098317698c8f554d015abdb7cf63f03f2f708f10f9ce01bbe5c116d21 SHA512 dc5320ec9fd991aaf47bd021010ca54f033e1514d1b551378c7b0dbb9cf5b8effc4aa895d180eb9b81634c363098f4c85e944089024cd9c32fa0ee4bb4589d5b +AUX reverse-roll-src-third_party-ffmpeg.patch 12334 BLAKE2B 3764501173a12429b6a526af4cd5bce4c53f44aa35286f26776c7e7b436361106ec3e93ffb5e8110cbe27e118e4c145d4f0e1ad0c7acec192d51419cb7202cf9 SHA512 d7fe1952004669c2ce1928d3fcf9ff2bb0bb6c594a2ac903aca66a725cf72a9e4b4a2bd7ea532d8b4029e68b756c112d76bc290acfa3385371b223083a6268db +AUX reverse-roll-src-third_party-ffmpeg_duration.patch 902 BLAKE2B 1852c817a247393c1574781d32e41b154de25c542ac767f95bfdfd3380f99438b8e97fbc08fb5a2cf5b84eb68cf049a1cd02cc5f60bea4adb702037a3a46cb07 SHA512 550c8d4d29562e846ed793e6a434396202a7cfea09361a0544a0539d60cad807e4e052bf9a3d000ef8af02f4bb213525542e73560651b7b89f2b59cbb9539a3b +AUX thorium-130-fix-building-without-libjxl.patch 978 BLAKE2B d0290a82fe67d0c43ea1194f95e5dc15caa8559f1e20ff63eafe7a20e8254a61ab45235010dd630c4a9e41707459c479c4ba9c6f1e4e3084cca3c7b1e7a2c477 SHA512 5e030a41c5a6e7190e4d254ee42528ed842fd37d8ccdda33657293449c1f954440624d1bb71238b93fc63324b25c5f8f52f49e90b0ef9baa0fb28f5d8ef72782 +AUX thorium-browser.xml 403 BLAKE2B ddf0e198b06e84b787d5920ac0adaa2e1e532a03fa8673ca6542784cd19e668599acc01c67efde445bbdf8790dafae9e0f2ec272ab4d759e2a8b5cf10ade4c38 SHA512 8474477ffaffd92013f8121e4318f7cc183db63baa4dbd2c78cddda5a9d3876dd451405374154ba40a17b7a8cdea78b485ef89b0ac4283ff9670f5a08fb53fc6 +AUX thorium-launcher.sh 1626 BLAKE2B 615fce7563f12f7907eda4bca861f2345b0b03ddc0529857fb13050ff3a0b837ef04f26730fa12cdc6345e87e1d1bd46f6307df399896e3ccee620c0e157bf47 SHA512 af6e9f89e988c3c58be9bf93603835a2f610f45a9a73b0500abc49141d0836409b118a6838935737aeeb011318584381c146812eed25914e3b4147e3353376ca +AUX thorium-shell-launcher.sh 1281 BLAKE2B 7224eeed73a3a58a4cb7123953f23f4e54b4257e73c32f566bae0908c39e3114985131c6f8ffe056b224ddab7f36f013d273f17b60376a9d4e2d01534f9b2a95 SHA512 7f5d9f43ba8002ee69f136ea76932b23058d6fc5e80a7c0d010178f04b912685bae6c45df17f501ba168bb7e8a0e8251ed0a7a959a4bfc3572acacbcc124a0f1 +AUX thorium-shell.default 273 BLAKE2B 478437d707a7346a17af1db104e02ebed43d508ae2c9901a9773e5d1393cd5d2e90ce2ef43ee8313e349d79c69dbf12e6860c6f00bf273c29e9dcaacdc2854f0 SHA512 2c27040b79c8d1c76c323ca6561f697f00876b0c3be6edf0888b17df14a502a09f01de61f3de77778d4b1d29bcf4dc39883173b34212a4f5500eff1ccff12362 +AUX thorium-shell.desktop 431 BLAKE2B f9ff55e270b01646d87b1f9236c27490c06003a249bf04ec22160701fa2e5cd680ede7d4dc3e0fd9733ce6c6de1f6eefbb7d2102edf99507a1c212dae484b9d4 SHA512 294295d13c7347771dc5f7c8be50b5eb5b43f830d2b0e52b94ae6fd454a04852734cfabaea8afd63874035485afa9c8ad4d3466a5a6783b7d291300a176b5e08 +AUX thorium.default 256 BLAKE2B dd7a3c12f068d416917accf01b4c670251c62b987480c05588ec54e33d199ec899d6d3dbe4e8a92870119f0a057e60cfdef340947dc73ba2bd5005f6da84ff0c SHA512 c28e30a9838fbb3653288adb474b499050e193c29d48e6929de7c1360bd593a19f95180d55cf6bb561bc5a50c67efe9397096c2315be24e91b48735bcc3c4626 +AUX unbundle-ffmpeg-av_stream_get_first_dts.patch 393 BLAKE2B fed72675027a27c852936559272ec88e18ccf6fe73cd4562270427005682e1d2dd184f9b51c470ab4e96dbb9751cbff1ae0c102d287c16294800d39b44a11f75 SHA512 4d184faf083a82e2a51480b8513b14c81a8d03a821fd25bd41523093e064bc2ced8e23fdc37da548d9e1e171784263436b82be373aa7307b4da41ee8b3b26a89 +AUX update-dicts.sh 1680 BLAKE2B 8d3e8e90f62cde763256c0d3e48aa075776e8c21df9df60a23e788eed992ce12446fd1c92b3a9207793eeb8f7c4537e322845e728d35d0b57a2c83bffa5251a9 SHA512 c9868aadfa5a905b94e749074fe98a29489947f9aeecd728498918697a39b4bf77970c7b40f0b53f8de56985bd47ee17a3550ee5239d00e166e35d32f585cf4e +DIST chromium-130.0.6723.174-testdata-gentoo.tar.xz 97492 BLAKE2B 997562de242b14a99aa6998c41ce9f77d1fd36a73f48deff1c57ce90c6dac7c04a7a74493e1ea3c2206f0706dcbd24ed4be7d2283fa267cb628168b5eb38b176 SHA512 2e9d46f83a5649c0f06ea67df779a6f46f011636be08a0a3c0623f7ffcbc27af1e269d49319535b4c5f89e72ae0949736b6c0cd705a2890453ebea1b361253d7 +DIST chromium-130.0.6723.174.tar.xz 1316010876 BLAKE2B 88ba934d72ffc9b40f456af925a46c94d6ff2378c6d246f686b258360a64c12590db7f92ccb5591430e79f33c10f7ca17cf4c17fd5903699b6e31c6a359c1392 SHA512 12c458560183965d1457147167f3ef598e9c83b9332a9bc27303647ef7f580849563351e6644d34aa78960db028780d834c3364a7e662f38d5b516ca2a2a287a +DIST chromium-39583ff118920284de516d262979960e7159bcfc.patch 1391 BLAKE2B 28815a2a49a78791c74462442863e26c10fbe770e883d82a36b8793f2900c4feea0053f116d9029bfb66b53f2df133fbe8f92635dcd460e3405d34dc9afb5329 SHA512 0ade99c4c8c4acff35502b195b0c46b944f31f2e2c5beb0e9f63a345cceebb1c4dd21e9e3410484f40d75e3ebae170536f651edcaa0b5c8d50edb7272b62a492 +DIST chromium-40c273b2c0f5f26e16e67428ceaafd8b339bb61f.patch 1745 BLAKE2B 8df526e88bd22bc27a00ad5fafabcda20865c5fa2bd0ac91523c3b22709a725c010e4290bbb400c3f96f4bce61ca4b13f472fc27e2da34a7a2afa57e912a3f75 SHA512 4debcfe22af457bc3606bb7e394abaf3efd8f6e544f86da4bd3e0e0be81a7201ff038253e8d54fea5765cd1cfb52950e21f98685cf79c5c1a22f8e448b9e894c +DIST chromium-47fb59539e5744467eb6f7aae52f5a169910d56c.patch 1405 BLAKE2B e72e76133ef9e75eee65d5e7e840337912f93148ab6bc04d12d64c6d4b58c80fd4f3dfd9f033649948357e3956c6dac04561f9198d5bf443f03438a1dc72bc2e SHA512 714feb8e53b7510072407ac5c0d9026e978805d65a754d62dd53605f2d7dcdb8c5da1634c4a84614872c10f31d6ee2a5c15bb4d621a426ea939b38e42d5e39b8 +DIST chromium-4c49d7f04f43ab4757637cac21cfef7c0cd060fc.patch 1172 BLAKE2B 346027f24009cccdbb479055567aae9e327ea88163d5cc25becc1512b7035c809ec8089b69b6084e6278b9a6029123dabbe824b7ffd988aa244ba84dceff629f SHA512 63028b4e747b92fd462d2663fc317bec8f3ee1e3fc486a9135fef7fd5f68eaae9d883144024f8ddebbce5f053ccfe8ef142b3f6d0dfbd785310fd40bbb060f6a +DIST chromium-7e28832cd3320d2b603e6ef9468581e1c65c14f1.patch 1339 BLAKE2B 8b8c9daa68f981b70627a07d9f7638c33158802d3ece8e7ab4e25734332944407810e8a2aa4f701d8153ccdd72138525598e23660feeb4b8a8e69893cc523d8d SHA512 10298ad3a257488add2e942e5522ac43e7979162acaf037122e437fe0a9734893e9bc03bd6a528d3052bb3ae2efe94fe61fb1fa051307db544e507d17603e4c3 +DIST chromium-8739a5b33176e82e06a746163c0c76de4908ced9.patch 1635 BLAKE2B 3c8a62403bf90e3e35f237f0774196b8a15669717a4ece79f5d8306fd2bdfe01f7c1f1715609578185c236a12d5cf9c4b4438a6400fc16e4a89e6f7f681c8820 SHA512 0323edb3fb4f34e50035588423af412c16d95ea06fdbc6ff82758b4e640cad803d40989195a2c9782b87759374e42f3d38110ff929224f8e3dce3dfef9a7fae1 +DIST chromium-b51da416e04ecc9edafff531f9678c6404e654b7.patch 1346 BLAKE2B f1215a48fcaf36b70b4cc1430f78d43e84d51089cc4cdfa8508e37574e0aa198bfd99ef99a627ca4b98e79547549a2844dac5debc7b8c026964db15bdaf849aa SHA512 7d1f79184e69d927e025371d3c50a997fe82ce9a328af7be4f7e459a92bb74b5cdc545c7d65974242ae084835cd59f3e1ce7924252cf79e5e698940052bd11d5 +DIST chromium-c502d310d8cb91f1c1098a7287e75114023e57f0.patch 1391 BLAKE2B 4d7dbe9c2173d01756f99208804bafa2732d8992c9a9132905964a600103e8b8018aa188a2dfe96e0cf688686b585fffe05930cb3af734c26c648ccb9ad211df SHA512 0c3f681d8cf971511cc325db17bb36e81589c12404e70858a6f41dc3b41d1b0eb4ac8ccb02904218739625275683cd5fd94b7426c57e3d43ae8753303ef1d6aa +DIST chromium-dc9db222b929f5da415216134b77d7f3bf141813.patch 1253 BLAKE2B f0480b418bc2b4f0a0a21a10a139f304760b1ffad093a22fca3618afffc452e2bd22e9139751508ef00814f1a5c78391a845632dbdffc205bf73ed2bcf35666e SHA512 929004b1286f15916a4d21b6b7c4f73a6da9d7ed704ad2d52fbc37fe0f967615be0a774890cd4cbc377f99bd8ea3e1560bc837e4dcc9527c4d052195265e5490 +DIST chromium-openpower-a85b64f07b.tar.bz2 387899 BLAKE2B b01fda2d64ce73068d1536a10cc0896f07a4b714cdb25698b1df8b3252baa0c21c4209b307cf1cb554854f6d0bfe3cd35e06aaa8d02ac5d409a119335084c324 SHA512 05eee81677e8766808441c939bee68e2e6c58ec91f471d88a40181d2eda78614a0a6d27d92ff8f9dda564d12f3451bace4ff2727594748c5c238a3533038019b +DIST chromium-patches-130-2.tar.bz2 10151 BLAKE2B b46515a3e01153d8c4e5c3ee1f6e9f905265bf88b698d46c8ceed0f90d36a057b8bb30a860e8d934bf0b85f9c0a671bef2c9a00349228fa076b7aec37ff62ca0 SHA512 e1ecca666c3998ee285426751be3220a5b67a057f2c92b1f45c7b786efb8d0b0e1d49ba70471fa74155f79f22811d240af636f61007191756c9981b53d3b23de +DIST chromium-testfonts-f26f29c9d3.tar.gz 32750602 BLAKE2B 498f8b2e0811c98dc3d4aaa75559e69c782afb4bd12328cfdb7244ddba5cae7ee47becd27b2549d7b36bed417601f70f4c192934b0f08496cef1547d0502d93c SHA512 96b090446862997c8134e2971f0e38793ecc1208d547e554c9b651ccfb4127c4de86754903fea57a7292a2823c45117bae0ec13ed87aed20c248fb779579fbde +DIST ruy-587c2cf8b11d3c32fa26887063eda3171a3d353e.patch 684 BLAKE2B d00895efda90c4254ceb875e52d2959cb0d4c95cfc98775a02a6430f60f038c7da701316de40888e5f63ad907f087bff105d79ee9c9bd386bae5053de9517a64 SHA512 93c78353c0f3d50d4ebfcbf34b0b5d2c2bc3e1a38bc0e545d2e547010f540dbe2e0e284362810a554f58e300d3c770d35ec49ff87e565dc4b66537ac515109a5 +DIST thorium-6a89d88a334d8df585ce07f9a56254ef85fc8956.tar.gz 158609045 BLAKE2B 74173fc5373aa0ea975c944a1fe6683d86120f9476918b4cfe176deb6b892c32e27af5e060eff6d4b5eb0f0f7bc62a9c2a43bcfc07eb80da9a85c6bfb88f29b6 SHA512 cb9211ce25248345ca2f7d410686e9cdc7c6de5ba5871760f2564177749c5961990dce95da3e83e8aad9b58da2e7176d526d6da1b89cba6649f4a0be9414b9a0 +DIST thorium-libjxl-059d2253e91e3c8af7cc860f1c633f18ac19eb67.tar.gz 3610533 BLAKE2B 019cce40f13fb163436a5d2a90c11f9d25836103ea7bdb508492138d9eeaa2f895e520bbc70ea54290b1d110283411ea4a70e427c75958bc4ade8467b254e132 SHA512 40634e8124f039d461984ce1929f36cb6d1a02ceb11c207390f7968a270bf4f513b45f588da607848edb9023c6f4795440e621f8d79366f70cbf5a6d90bf723d +DIST ungoogled-chromium-130.0.6723.116-1.tar.gz 1247229 BLAKE2B eaf49861d5a58854ccfb95d35fdb24c9adbee1d9c14ee5d51c1c2e14a8a41dc807c94b949e3f20f87c92c1f859a6a4c331f748367b08b9fd251ca3969a1e8da7 SHA512 aaf2bea58ee2a7689ed6df68f7b311df404f9d7a2b34e3101fb0689ffff158a4e7a6c6eed43e256183696eb6a3f6fe527162b37323015168ffbe279ed1638efb +EBUILD thorium-130.0.6723.174.ebuild 67354 BLAKE2B e077a826feed3de8f2612c44fef4510d0d42c9f87d95d151de61f51a185bd7633113d02454ba1700c84ce1db5afeb8865dc38da4c63f65bda0281d50a2e303fa SHA512 b1c21b36d707a20c5ac9583bceddacbd2d2b99c1458dd6dfa5265d01bdbc67769296952deb0e4e5ddc14db2bcda198d4ba22a62132cb445113e595525c3e8233 +MISC metadata.xml 4711 BLAKE2B 47daffd026624b61a2da6bfb3d02b77f92e6b4f774a5d96994f01d02d84077b4f577b70b10d728f57f269ea9a5e75518d27650f3134120656cce24eb5bb493a3 SHA512 23917be73dd857421f3d9fb0d6b36940e8f7a215042219c48f0f1a91d5b0c8ae33d3078fc68b9ab4a5298c822a5ca141de9c21815ab1808206b7643502128ce8 diff --git a/www-client/thorium/files/chromium-109-system-openh264.patch b/www-client/thorium/files/chromium-109-system-openh264.patch new file mode 100644 index 0000000..6be816b --- /dev/null +++ b/www-client/thorium/files/chromium-109-system-openh264.patch @@ -0,0 +1,20 @@ +--- a/build/linux/unbundle/openh264.gn ++++ b/build/linux/unbundle/openh264.gn +@@ -2,6 +2,7 @@ + # Use of this source code is governed by a BSD-style license that can be + # found in the LICENSE file. + ++import("//build/buildflag_header.gni") + import("//build/config/linux/pkg_config.gni") + import("//build/shim_headers.gni") + +@@ -34,3 +35,9 @@ source_set("encoder") { + deps = [ ":openh264_shim" ] + public_configs = [ ":config" ] + } ++ ++buildflag_header("buildflags") { ++ header = "buildflags.h" ++ header_dir = "third_party/openh264" ++ flags = [ "OPENH264_API_WELS=1" ] ++} diff --git a/www-client/thorium/files/chromium-109-system-zlib.patch b/www-client/thorium/files/chromium-109-system-zlib.patch new file mode 100644 index 0000000..5e8b2d8 --- /dev/null +++ b/www-client/thorium/files/chromium-109-system-zlib.patch @@ -0,0 +1,10 @@ +--- a/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc ++++ b/third_party/tflite_support/src/tensorflow_lite_support/metadata/cc/utils/zip_readonly_mem_file.cc +@@ -19,7 +19,6 @@ limitations under the License. + #include + + #include "absl/strings/string_view.h" // from @com_google_absl +-#include "third_party/zlib/contrib/minizip/ioapi.h" + + namespace tflite { + namespace metadata { diff --git a/www-client/thorium/files/chromium-111-InkDropHost-crash.patch b/www-client/thorium/files/chromium-111-InkDropHost-crash.patch new file mode 100644 index 0000000..21dd8e4 --- /dev/null +++ b/www-client/thorium/files/chromium-111-InkDropHost-crash.patch @@ -0,0 +1,25 @@ +https://chromium-review.googlesource.com/c/chromium/src/+/2959890 + +--- a/ui/views/animation/ink_drop_host.h ++++ b/ui/views/animation/ink_drop_host.h +@@ -238,6 +238,11 @@ class VIEWS_EXPORT InkDropHost { + // Used to observe View and inform the InkDrop of host-transform changes. + ViewLayerTransformObserver host_view_transform_observer_; + ++ // Declared before |ink_drop_|, because InkDropImpl may call ++ // RemoveInkDropLayer on partly destructed InkDropHost. In ++ // that case |ink_drop_mask_| must be still valid. ++ std::unique_ptr ink_drop_mask_; ++ + // Should not be accessed directly. Use GetInkDrop() instead. + std::unique_ptr ink_drop_; + +@@ -261,8 +266,6 @@ class VIEWS_EXPORT InkDropHost { + int ink_drop_small_corner_radius_ = 2; + int ink_drop_large_corner_radius_ = 4; + +- std::unique_ptr ink_drop_mask_; +- + base::RepeatingCallback()> create_ink_drop_callback_; + base::RepeatingCallback()> + create_ink_drop_ripple_callback_; diff --git a/www-client/thorium/files/chromium-118-ffmpeg.patch b/www-client/thorium/files/chromium-118-ffmpeg.patch new file mode 100644 index 0000000..aeeeb54 --- /dev/null +++ b/www-client/thorium/files/chromium-118-ffmpeg.patch @@ -0,0 +1,40 @@ +--- chromium-118.0.5993.54/media/filters/ffmpeg_demuxer.cc.orig 2023-10-04 23:53:53.691762700 +0200 ++++ chromium-118.0.5993.54/media/filters/ffmpeg_demuxer.cc 2023-10-08 16:56:57.616681160 +0200 +@@ -398,7 +398,11 @@ + // TODO(crbug.com/1471504): This is now broken without side data; remove. + buffer = DecoderBuffer::CopyFrom(packet->data, packet->size); + } else { ++#if defined FF_API_BUFFER_SIZE_T && ! FF_API_BUFFER_SIZE_T + size_t side_data_size = 0; ++#else ++ int side_data_size = 0; ++#endif + uint8_t* side_data = av_packet_get_side_data( + packet.get(), AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, &side_data_size); + +@@ -461,7 +465,11 @@ + packet->size - data_offset); + } + ++#if defined FF_API_BUFFER_SIZE_T && ! FF_API_BUFFER_SIZE_T + size_t skip_samples_size = 0; ++#else ++ int skip_samples_size = 0; ++#endif + const uint32_t* skip_samples_ptr = + reinterpret_cast(av_packet_get_side_data( + packet.get(), AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size)); +--- chromium-118.0.5993.54/media/filters/audio_decoder_unittest.cc.orig 2023-10-04 23:53:53.683762000 +0200 ++++ chromium-118.0.5993.54/media/filters/audio_decoder_unittest.cc 2023-10-08 16:58:23.727519824 +0200 +@@ -108,7 +108,11 @@ + } + + // If the timestamp is positive, try to use FFmpeg's discard data. ++#if defined FF_API_BUFFER_SIZE_T && ! FF_API_BUFFER_SIZE_T + size_t skip_samples_size = 0; ++#else ++ int skip_samples_size = 0; ++#endif + const uint32_t* skip_samples_ptr = + reinterpret_cast(av_packet_get_side_data( + packet, AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size)); diff --git a/www-client/thorium/files/chromium-123-qrcode.patch b/www-client/thorium/files/chromium-123-qrcode.patch new file mode 100644 index 0000000..ab59175 --- /dev/null +++ b/www-client/thorium/files/chromium-123-qrcode.patch @@ -0,0 +1,68 @@ +--- a/components/qr_code_generator/BUILD.gn ++++ b/components/qr_code_generator/BUILD.gn +@@ -38,24 +38,11 @@ + "qr_code_generator.h", + ] + deps = [ +- ":qr_code_generator_ffi_glue", + "//base", + ] + public_deps = [ + ":error", + "//base", +- ] +-} +- +-rust_static_library("qr_code_generator_ffi_glue") { +- allow_unsafe = true # Needed for FFI that underpins the `cxx` crate. +- crate_root = "qr_code_generator_ffi_glue.rs" +- sources = [ "qr_code_generator_ffi_glue.rs" ] +- cxx_bindings = [ "qr_code_generator_ffi_glue.rs" ] +- visibility = [ ":qr_code_generator" ] +- deps = [ +- ":error", +- "//third_party/rust/qr_code/v2:lib", + ] + } + +--- a/components/qr_code_generator/qr_code_generator.cc ++++ b/components/qr_code_generator/qr_code_generator.cc +@@ -8,9 +8,7 @@ + #include + + #include "base/check_op.h" +-#include "base/containers/span_rust.h" + #include "base/numerics/safe_conversions.h" +-#include "components/qr_code_generator/qr_code_generator_ffi_glue.rs.h" + + namespace qr_code_generator { + +@@ -22,27 +20,7 @@ + base::expected GenerateCode( + base::span in, + std::optional min_version) { +- rust::Slice rs_in = base::SpanToRustSlice(in); +- +- // `min_version` might come from a fuzzer and therefore we use a lenient +- // `saturated_cast` instead of a `checked_cast`. +- int16_t rs_min_version = +- base::saturated_cast(min_version.value_or(0)); +- +- std::vector result_pixels; +- size_t result_width = 0; +- Error result_error = Error::kUnknownError; +- bool result_is_success = generate_qr_code_using_rust( +- rs_in, rs_min_version, result_pixels, result_width, result_error); +- +- if (!result_is_success) { +- return base::unexpected(result_error); +- } +- GeneratedCode code; +- code.data = std::move(result_pixels); +- code.qr_size = base::checked_cast(result_width); +- CHECK_EQ(code.data.size(), static_cast(code.qr_size * code.qr_size)); +- return code; ++ return base::unexpected(Error::kUnknownError); + } + + } // namespace qr_code_generator diff --git a/www-client/thorium/files/chromium-125-cloud_authenticator.patch b/www-client/thorium/files/chromium-125-cloud_authenticator.patch new file mode 100644 index 0000000..ee79efd --- /dev/null +++ b/www-client/thorium/files/chromium-125-cloud_authenticator.patch @@ -0,0 +1,19 @@ +--- a/chrome/browser/webauthn/BUILD.gn ++++ b/chrome/browser/webauthn/BUILD.gn +@@ -26,6 +26,5 @@ + "//url", + ] + +- data_deps = [ "//third_party/cloud_authenticator/test/local_service:cloud_authenticator_test_service" ] + } + } +--- a/chrome/test/BUILD.gn ++++ b/chrome/test/BUILD.gn +@@ -7112,7 +7112,6 @@ + "//third_party/metrics_proto", + "//third_party/microsoft_webauthn", + "//third_party/re2", +- "//third_party/rust/fend_core/v1/wrapper:unit_tests", + "//third_party/webrtc_overrides:webrtc_component", + "//third_party/widevine/cdm:headers", + "//third_party/zlib/google:compression_utils", diff --git a/www-client/thorium/files/chromium-126-oauth2-client-switches.patch b/www-client/thorium/files/chromium-126-oauth2-client-switches.patch new file mode 100644 index 0000000..b7ddf79 --- /dev/null +++ b/www-client/thorium/files/chromium-126-oauth2-client-switches.patch @@ -0,0 +1,45 @@ +From b6cda4bc2283a02a5b5209c0f4282a8365f6f33e Mon Sep 17 00:00:00 2001 +From: Matt Jolly +Date: Tue, 21 May 2024 10:04:24 +1000 +Subject: [PATCH] www-client/chromium: work around dead oauth2 credentials - + 126 update + +126 changed the function proto; patch rebased. + +Google doesn't let us bake in OAuth2 credentials, and for some time, +Google sign-in has been broken. Arch dealt with this in March, and so +did we to some degree, but in the last few months, our sign-in +credentials have been broken. It appears that we actually did remove API +credentials in March around Chrome 89, but they got added back, perhaps +when rotating newer versions to replace older versions. Work around this +by following Arch's lead: we remove the predefined credentials, as +before, but also we patch Chromium so that people can use their own +easily, using Arch's patch for that. + +For more info, see: + +https://archlinux.org/news/chromium-losing-sync-support-in-early-march/ +https://bodhi.fedoraproject.org/updates/FEDORA-2021-48866282e5 +https://hackaday.com/2021/01/26/whats-the-deal-with-chromium-on-linux-google-at-odds-with-package-maintainers/ + +Bug: https://bugs.gentoo.org/791871 +Signed-off-by: Matt Jolly +--- a/google_apis/google_api_keys-inc.cc ++++ b/google_apis/google_api_keys-inc.cc +@@ -193,11 +193,11 @@ class APIKeyCache { + std::string default_client_id = CalculateKeyValue( + GOOGLE_DEFAULT_CLIENT_ID, + STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID), std::string(), +- nullptr, std::string(), environment.get(), command_line, gaia_config); ++ ::switches::kOAuth2ClientID, std::string(), environment.get(), command_line, gaia_config); + std::string default_client_secret = CalculateKeyValue( + GOOGLE_DEFAULT_CLIENT_SECRET, + STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET), std::string(), +- nullptr, std::string(), environment.get(), command_line, gaia_config); ++ ::switches::kOAuth2ClientSecret, std::string(), environment.get(), command_line, gaia_config); + + // We currently only allow overriding the baked-in values for the + // default OAuth2 client ID and secret using a command-line +-- +2.45.1 + diff --git a/www-client/thorium/files/chromium-127-cargo_crate.patch b/www-client/thorium/files/chromium-127-cargo_crate.patch new file mode 100644 index 0000000..b13b7cb --- /dev/null +++ b/www-client/thorium/files/chromium-127-cargo_crate.patch @@ -0,0 +1,12 @@ +--- a/build/rust/cargo_crate.gni ++++ b/build/rust/cargo_crate.gni +@@ -5,6 +5,8 @@ + import("//build/rust/rust_executable.gni") + import("//build/rust/rust_macro.gni") + import("//build/rust/rust_static_library.gni") ++ ++rust_sysroot="" + + # This template allows for building Cargo crates within gn. + # + diff --git a/www-client/thorium/files/chromium-127-crabby.patch b/www-client/thorium/files/chromium-127-crabby.patch new file mode 100644 index 0000000..f77ba9c --- /dev/null +++ b/www-client/thorium/files/chromium-127-crabby.patch @@ -0,0 +1,49 @@ +--- a/third_party/blink/renderer/platform/image-decoders/BUILD.gn ++++ b/third_party/blink/renderer/platform/image-decoders/BUILD.gn +@@ -74,12 +74,9 @@ + sources += [ + "avif/avif_image_decoder.cc", + "avif/avif_image_decoder.h", +- "avif/crabbyavif_image_decoder.cc", +- "avif/crabbyavif_image_decoder.h", + ] + + deps += [ +- "//third_party/crabbyavif", + "//third_party/libavif", + "//third_party/libavifinfo", + ] +--- a/third_party/blink/renderer/platform/image-decoders/image_decoder.cc ++++ b/third_party/blink/renderer/platform/image-decoders/image_decoder.cc +@@ -47,7 +47,6 @@ + + #if BUILDFLAG(ENABLE_AV1_DECODER) + #include "third_party/blink/renderer/platform/image-decoders/avif/avif_image_decoder.h" +-#include "third_party/blink/renderer/platform/image-decoders/avif/crabbyavif_image_decoder.h" + #endif + + namespace blink { +@@ -192,9 +191,7 @@ + return "image/bmp"; + } + #if BUILDFLAG(ENABLE_AV1_DECODER) +- if (base::FeatureList::IsEnabled(blink::features::kCrabbyAvif) +- ? CrabbyAVIFImageDecoder::MatchesAVIFSignature(fast_reader) +- : AVIFImageDecoder::MatchesAVIFSignature(fast_reader)) { ++ if (AVIFImageDecoder::MatchesAVIFSignature(fast_reader)) { + return "image/avif"; + } + #endif +@@ -300,11 +300,7 @@ + max_decoded_bytes); + #if BUILDFLAG(ENABLE_AV1_DECODER) + } else if (mime_type == "image/avif") { +- if (base::FeatureList::IsEnabled(blink::features::kCrabbyAvif)) { +- decoder = std::make_unique( +- alpha_option, high_bit_depth_decoding_option, color_behavior, +- max_decoded_bytes, animation_option); +- } else { ++ if (true) { + decoder = std::make_unique( + alpha_option, high_bit_depth_decoding_option, color_behavior, + max_decoded_bytes, animation_option); diff --git a/www-client/thorium/files/chromium-128-gtk-fix-prefers-color-scheme-query.patch b/www-client/thorium/files/chromium-128-gtk-fix-prefers-color-scheme-query.patch new file mode 100644 index 0000000..59765d0 --- /dev/null +++ b/www-client/thorium/files/chromium-128-gtk-fix-prefers-color-scheme-query.patch @@ -0,0 +1,53 @@ +From 1c8472c1a44e63c96da7b7cb3873a2822635c18b Mon Sep 17 00:00:00 2001 +From: Rune Lillesveen +Date: Fri, 03 Dec 2021 12:28:22 +0100 +Subject: [PATCH] Make dark theme Gtk affect preferred color scheme. + +Selecting a dark Gtk theme gives a dark NativeThemeGtk and UI, but it +didn't affect the preferred color scheme on the web instance. Hence, the +prefers-color-scheme media query still matched 'light', not 'dark'. + +Observe the ui native theme instance to propagate any theme changes to +the web instance. Code copied from the NativeThemeWin implementation. + +This is a reland of: + +https://chromium-review.googlesource.com/c/chromium/src/+/1774922 + +Bug: 998903 +Change-Id: Id8147ecfbda1f3f5899a1e35b97f36382e63e899 +--- + +diff --git a/ui/gtk/native_theme_gtk.cc b/ui/gtk/native_theme_gtk.cc +index 4afa399..fbaaf06e 100644 +--- a/ui/gtk/native_theme_gtk.cc ++++ b/ui/gtk/native_theme_gtk.cc +@@ -96,6 +96,12 @@ + NativeThemeGtk::NativeThemeGtk() + : NativeThemeBase(/*should_only_use_dark_colors=*/false, + ui::SystemTheme::kGtk) { ++ // Add the web native theme as an observer to stay in sync with dark mode, ++ // high contrast, and preferred color scheme changes. ++ color_scheme_observer_ = ++ std::make_unique( ++ NativeTheme::GetInstanceForWeb()); ++ AddObserver(color_scheme_observer_.get()); + OnThemeChanged(gtk_settings_get_default(), nullptr); + } + +diff --git a/ui/gtk/native_theme_gtk.h b/ui/gtk/native_theme_gtk.h +index 876a738..ad3b88d41 100644 +--- a/ui/gtk/native_theme_gtk.h ++++ b/ui/gtk/native_theme_gtk.h +@@ -93,6 +93,11 @@ + mutable absl::optional color_cache_[kColorId_NumColors]; + + ScopedCssProvider theme_css_override_; ++ ++ // Used to notify the web native theme of changes to dark mode, high ++ // contrast, and preferred color scheme. ++ std::unique_ptr ++ color_scheme_observer_; + }; + + } // namespace gtk diff --git a/www-client/thorium/files/chromium-130-fix-building-without-tflite-lib.patch b/www-client/thorium/files/chromium-130-fix-building-without-tflite-lib.patch new file mode 100644 index 0000000..1b71546 --- /dev/null +++ b/www-client/thorium/files/chromium-130-fix-building-without-tflite-lib.patch @@ -0,0 +1,63 @@ +--- a/chrome/renderer/chrome_render_frame_observer.cc ++++ b/chrome/renderer/chrome_render_frame_observer.cc +@@ -69,7 +69,6 @@ + #include "url/gurl.h" + + #if !BUILDFLAG(IS_ANDROID) +-#include "chrome/renderer/accessibility/read_anything_app_controller.h" + #include "chrome/renderer/searchbox/searchbox_extension.h" + #endif // !BUILDFLAG(IS_ANDROID) + +@@ -320,21 +319,6 @@ void ChromeRenderFrameObserver::DidCommi + } + + void ChromeRenderFrameObserver::DidClearWindowObject() { +-#if !BUILDFLAG(IS_ANDROID) +- const base::CommandLine& command_line = +- *base::CommandLine::ForCurrentProcess(); +- if (command_line.HasSwitch(switches::kInstantProcess)) +- SearchBoxExtension::Install(render_frame()->GetWebFrame()); +- +- // Install ReadAnythingAppController on render frames with the Read Anything +- // url, which is chrome-untrusted. ReadAnythingAppController installs v8 +- // bindings in the chrome.readingMode namespace which are consumed by +- // read_anything/app.ts, the resource of the Read Anything WebUI. +- if (render_frame()->GetWebFrame()->GetDocument().Url() == +- chrome::kChromeUIUntrustedReadAnythingSidePanelURL) { +- ReadAnythingAppController::Install(render_frame()); +- } +-#endif // !BUILDFLAG(IS_ANDROID) + } + + void ChromeRenderFrameObserver::DidMeaningfulLayout( +--- a/chrome/renderer/BUILD.gn ++++ b/chrome/renderer/BUILD.gn +@@ -383,18 +383,6 @@ static_library("renderer") { + ] + } else { + sources += [ +- "accessibility/ax_tree_distiller.cc", +- "accessibility/ax_tree_distiller.h", +- "accessibility/read_aloud_app_model.cc", +- "accessibility/read_aloud_app_model.h", +- "accessibility/read_aloud_traversal_utils.cc", +- "accessibility/read_aloud_traversal_utils.h", +- "accessibility/read_anything_app_controller.cc", +- "accessibility/read_anything_app_controller.h", +- "accessibility/read_anything_app_model.cc", +- "accessibility/read_anything_app_model.h", +- "accessibility/read_anything_node_utils.cc", +- "accessibility/read_anything_node_utils.h", + "media/chrome_speech_recognition_client.cc", + "media/chrome_speech_recognition_client.h", + "searchbox/searchbox.cc", +--- a/services/passage_embeddings/passage_embeddings_service.cc ++++ b/services/passage_embeddings/passage_embeddings_service.cc +@@ -6,7 +6,6 @@ + + #include "base/files/file.h" + #include "components/optimization_guide/machine_learning_tflite_buildflags.h" +-#include "services/passage_embeddings/passage_embedder.h" + + namespace passage_embeddings { + diff --git a/www-client/thorium/files/chromium-130-fix-includes.patch b/www-client/thorium/files/chromium-130-fix-includes.patch new file mode 100644 index 0000000..d11f51b --- /dev/null +++ b/www-client/thorium/files/chromium-130-fix-includes.patch @@ -0,0 +1,56 @@ +diff '--color=auto' -urN chromium-130.0.6723.174.orig/chrome/browser/ui/browser_commands.cc chromium-130.0.6723.174/chrome/browser/ui/browser_commands.cc +--- chromium-130.0.6723.174.orig/chrome/browser/ui/browser_commands.cc 2024-12-20 16:23:12.000000000 +0100 ++++ chromium-130.0.6723.174/chrome/browser/ui/browser_commands.cc 2025-07-08 16:23:07.925563618 +0200 +@@ -5,6 +5,7 @@ + #include "chrome/browser/ui/browser_commands.h" + + #include ++#include + #include + #include + #include +diff '--color=auto' -urN chromium-130.0.6723.174.orig/chrome/browser/ui/lens/lens_overlay_controller.cc chromium-130.0.6723.174/chrome/browser/ui/lens/lens_overlay_controller.cc +--- chromium-130.0.6723.174.orig/chrome/browser/ui/lens/lens_overlay_controller.cc 2024-12-20 16:23:12.000000000 +0100 ++++ chromium-130.0.6723.174/chrome/browser/ui/lens/lens_overlay_controller.cc 2025-07-08 16:23:07.925373915 +0200 +@@ -12,6 +12,7 @@ + #include "base/system/sys_info.h" + #include "base/task/bind_post_task.h" + #include "base/task/sequenced_task_runner.h" ++#include "base/task/thread_pool.h" + #include "chrome/browser/feedback/show_feedback_page.h" + #include "chrome/browser/lens/core/mojom/geometry.mojom.h" + #include "chrome/browser/lens/core/mojom/overlay_object.mojom.h" +diff '--color=auto' -urN chromium-130.0.6723.174.orig/chrome/browser/ui/views/webid/fedcm_account_selection_view_desktop.cc chromium-130.0.6723.174/chrome/browser/ui/views/webid/fedcm_account_selection_view_desktop.cc +--- chromium-130.0.6723.174.orig/chrome/browser/ui/views/webid/fedcm_account_selection_view_desktop.cc 2024-12-20 16:23:12.000000000 +0100 ++++ chromium-130.0.6723.174/chrome/browser/ui/views/webid/fedcm_account_selection_view_desktop.cc 2025-07-08 16:23:07.925657709 +0200 +@@ -6,6 +6,7 @@ + + #include "base/debug/dump_without_crashing.h" + #include "base/functional/bind.h" ++#include "base/metrics/histogram_functions.h" + #include "base/metrics/histogram_macros.h" + #include "chrome/browser/accessibility/accessibility_state_utils.h" + #include "chrome/browser/net/system_network_context_manager.h" +diff '--color=auto' -urN chromium-130.0.6723.174.orig/chrome/browser/ui/webui/searchbox/searchbox_handler.cc chromium-130.0.6723.174/chrome/browser/ui/webui/searchbox/searchbox_handler.cc +--- chromium-130.0.6723.174.orig/chrome/browser/ui/webui/searchbox/searchbox_handler.cc 2024-12-20 16:23:12.000000000 +0100 ++++ chromium-130.0.6723.174/chrome/browser/ui/webui/searchbox/searchbox_handler.cc 2025-07-08 16:23:07.925476942 +0200 +@@ -6,6 +6,7 @@ + + #include "base/base64.h" + #include "base/base64url.h" ++#include "base/containers/contains.h" + #include "build/branding_buildflags.h" + #include "chrome/browser/bookmarks/bookmark_model_factory.h" + #include "chrome/browser/browser_process.h" +diff '--color=auto' -urN chromium-130.0.6723.174.orig/third_party/re2/src/re2/re2.h chromium-130.0.6723.174/third_party/re2/src/re2/re2.h +--- chromium-130.0.6723.174.orig/third_party/re2/src/re2/re2.h 2024-12-20 16:23:12.000000000 +0100 ++++ chromium-130.0.6723.174/third_party/re2/src/re2/re2.h 2025-07-08 16:20:41.135306190 +0200 +@@ -220,7 +220,7 @@ + #include "absl/base/call_once.h" + #include "absl/strings/string_view.h" + #include "absl/types/optional.h" +-#include "re2/stringpiece.h" ++#include "stringpiece.h" + + #if defined(__APPLE__) + #include diff --git a/www-client/thorium/files/chromium-130-fontations.patch b/www-client/thorium/files/chromium-130-fontations.patch new file mode 100644 index 0000000..ce0d54a --- /dev/null +++ b/www-client/thorium/files/chromium-130-fontations.patch @@ -0,0 +1,93 @@ +--- a/skia/BUILD.gn ++++ b/skia/BUILD.gn +@@ -8,7 +8,6 @@ + import("//build/config/freetype/freetype.gni") + import("//build/config/rust.gni") + import("//build/config/sanitizers/sanitizers.gni") +-import("//build/rust/rust_static_library.gni") + import("//gpu/vulkan/features.gni") + import("//testing/test.gni") + import("//third_party/skia/gn/shared_sources.gni") +@@ -47,27 +46,6 @@ + ] + } + +-source_set("path_bridge") { +- sources = skia_fontations_path_bridge_sources +-} +- +-rust_static_library("bridge_rust_side") { +- allow_unsafe = true +- crate_root = skia_fontations_bridge_root +- sources = skia_fontations_bridge_sources +- cxx_bindings = skia_fontations_bridge_sources +- deps = [ +- ":path_bridge", +- "//third_party/rust/font_types/v0_7:lib", +- "//third_party/rust/read_fonts/v0_22:lib", +- "//third_party/rust/skrifa/v0_22:lib", +- ] +- configs -= [ "//build/config/compiler:chromium_code" ] +- configs += [ +- ":skia_config", +- "//build/config/compiler:no_chromium_code", +- ] +-} + + # External-facing config for dependent code. + config("skia_config") { +@@ -394,15 +373,9 @@ + # See SK_TYPEFACE_FACTORY_FREETYPE + sources += skia_ports_freetype_sources + sources += skia_ports_fontmgr_custom_sources +- sources += skia_ports_typeface_fontations_sources + sources += skia_ports_fontmgr_empty_sources + public += skia_ports_fontmgr_empty_public + +- # Fontations Rust/C++ bridge interfaces. +- deps += [ +- ":bridge_rust_side", +- ":path_bridge", +- ] + } + + if (is_win) { +--- a/third_party/blink/renderer/platform/fonts/web_font_typeface_factory.cc ++++ b/third_party/blink/renderer/platform/fonts/web_font_typeface_factory.cc +@@ -12,7 +12,6 @@ + #include "third_party/blink/renderer/platform/fonts/opentype/font_format_check.h" + #include "third_party/skia/include/core/SkStream.h" + #include "third_party/skia/include/core/SkTypeface.h" +-#include "third_party/skia/include/ports/SkTypeface_fontations.h" + + #if BUILDFLAG(IS_WIN) + #include "third_party/blink/renderer/platform/fonts/win/dwrite_font_format_support.h" +@@ -54,7 +53,7 @@ + } + + sk_sp MakeTypefaceDefaultFontMgr(sk_sp data) { +-#if !(BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE)) ++#if (BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE)) + if (RuntimeEnabledFeatures::FontationsFontBackendEnabled()) { + std::unique_ptr stream(new SkMemoryStream(data)); + return SkTypeface_Make_Fontations(std::move(stream), SkFontArguments()); +@@ -82,10 +81,6 @@ + } + #endif + +-sk_sp MakeTypefaceFontations(sk_sp data) { +- std::unique_ptr stream(new SkMemoryStream(data)); +- return SkTypeface_Make_Fontations(std::move(stream), SkFontArguments()); +-} + + sk_sp MakeVariationsTypeface( + sk_sp data, +@@ -187,7 +182,6 @@ + const FontFormatCheck format_check(data); + const FontInstantiator instantiator = { + MakeTypefaceDefaultFontMgr, +- MakeTypefaceFontations, + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_APPLE) + MakeTypefaceFallback, + #endif + diff --git a/www-client/thorium/files/chromium-130-libstdc++.patch b/www-client/thorium/files/chromium-130-libstdc++.patch new file mode 100644 index 0000000..1c3a93f --- /dev/null +++ b/www-client/thorium/files/chromium-130-libstdc++.patch @@ -0,0 +1,82 @@ +diff -r -u chromium-120.0.6099.129old/components/viz/service/display/surface_aggregator.cc chromium-120.0.6099.129/components/viz/service/display/surface_aggregator.cc +--- chromium-120.0.6099.129old/components/viz/service/display/surface_aggregator.cc 2023-12-21 01:49:05.646315300 +0100 ++++ chromium-120.0.6099.129/components/viz/service/display/surface_aggregator.cc 2023-12-21 15:28:15.668850824 +0100 +@@ -2228,7 +2228,7 @@ + root_surface_id_ = surface_id; + + // Start recording new stats for this aggregation. +- stats_.emplace(); ++ stats_.emplace(AggregateStatistics{}); + + base::ElapsedTimer prewalk_timer; + ResolvedFrameData* resolved_frame = GetResolvedFrame(surface_id); +diff -r -u chromium-120.0.6099.129old/gpu/command_buffer/service/shared_image/shared_image_backing.cc chromium-120.0.6099.129/gpu/command_buffer/service/shared_image/shared_image_backing.cc +--- chromium-120.0.6099.129old/gpu/command_buffer/service/shared_image/shared_image_backing.cc 2023-12-21 01:49:08.186538700 +0100 ++++ chromium-120.0.6099.129/gpu/command_buffer/service/shared_image/shared_image_backing.cc 2023-12-21 15:59:04.210747172 +0100 +@@ -343,7 +343,7 @@ + + void SharedImageBacking::OnWriteSucceeded() { + AutoLock auto_lock(this); +- scoped_write_uma_.emplace(); ++ scoped_write_uma_.emplace(gpu::SharedImageBacking::ScopedWriteUMA{}); + } + + size_t SharedImageBacking::GetEstimatedSize() const { +diff -r -u chromium-120.0.6099.129old/gpu/command_buffer/service/shared_image/shared_image_backing.h chromium-120.0.6099.129/gpu/command_buffer/service/shared_image/shared_image_backing.h +--- chromium-120.0.6099.129old/gpu/command_buffer/service/shared_image/shared_image_backing.h 2023-12-21 01:49:08.186538700 +0100 ++++ chromium-120.0.6099.129/gpu/command_buffer/service/shared_image/shared_image_backing.h 2023-12-21 15:57:27.336515319 +0100 +@@ -340,8 +340,8 @@ + public: + ScopedWriteUMA() = default; + +- ScopedWriteUMA(const ScopedWriteUMA&) = delete; +- ScopedWriteUMA& operator=(const ScopedWriteUMA&) = delete; ++ ScopedWriteUMA(const ScopedWriteUMA&) = default; ++ ScopedWriteUMA& operator=(const ScopedWriteUMA&) = default; + + ~ScopedWriteUMA() { + UMA_HISTOGRAM_BOOLEAN("GPU.SharedImage.ContentConsumed", +diff -r -u chromium-120.0.6099.129old/mojo/public/cpp/bindings/lib/multiplex_router.cc chromium-120.0.6099.129/mojo/public/cpp/bindings/lib/multiplex_router.cc +--- chromium-120.0.6099.129old/mojo/public/cpp/bindings/lib/multiplex_router.cc 2023-12-21 01:49:10.754764600 +0100 ++++ chromium-120.0.6099.129/mojo/public/cpp/bindings/lib/multiplex_router.cc 2023-12-21 13:19:27.412481231 +0100 +@@ -870,7 +870,7 @@ + DCHECK(!exclusive_sync_wait_); + + scoped_refptr keep_alive(this); +- exclusive_sync_wait_.emplace(); ++ exclusive_sync_wait_.emplace(ExclusiveSyncWaitInfo{}); + exclusive_sync_wait_->interface_id = interface_id; + exclusive_sync_wait_->request_id = request_id; + while (!exclusive_sync_wait_->finished) { +--- a/third_party/blink/common/interest_group/auction_config_mojom_traits.cc ++++ b/third_party/blink/common/interest_group/auction_config_mojom_traits.cc +@@ -207,8 +207,6 @@ + !data.ReadAllBuyersPrioritySignals(&out->all_buyers_priority_signals) || + !data.ReadAuctionReportBuyerKeys(&out->auction_report_buyer_keys) || + !data.ReadAuctionReportBuyers(&out->auction_report_buyers) || +- !data.ReadAuctionReportBuyerDebugModeConfig( +- &out->auction_report_buyer_debug_mode_config) || + !data.ReadRequiredSellerCapabilities( + &out->required_seller_capabilities) || + !data.ReadRequestedSize(&out->requested_size) || +--- a/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h ++++ b/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.h +@@ -594,7 +594,7 @@ + mojom::blink::ScrollBehavior scroll_behavior) override { + if (!should_restore_scroll) + return; +- pending_view_state_.emplace(); ++ pending_view_state_.emplace(PendingViewState{}); + pending_view_state_->state = view_state; + pending_view_state_->scroll_behavior = scroll_behavior; + } +--- a/third_party/blink/renderer/platform/wtf/text/string_view.h ++++ b/third_party/blink/renderer/platform/wtf/text/string_view.h +@@ -20,6 +20,7 @@ + #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h" + #include "third_party/blink/renderer/platform/wtf/get_ptr.h" + #include "third_party/blink/renderer/platform/wtf/text/string_impl.h" ++#include "third_party/blink/renderer/platform/wtf/text/code_point_iterator.h" + + #if DCHECK_IS_ON() + #include "base/memory/scoped_refptr.h" diff --git a/www-client/thorium/files/chromium-131-compiler.patch b/www-client/thorium/files/chromium-131-compiler.patch new file mode 100644 index 0000000..6e64f58 --- /dev/null +++ b/www-client/thorium/files/chromium-131-compiler.patch @@ -0,0 +1,288 @@ +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -311,9 +311,6 @@ + + configs += [ + # See the definitions below. +- ":clang_revision", +- ":rustc_revision", +- ":compiler_cpu_abi", + ":compiler_codegen", + ":compiler_deterministic", + ] +@@ -587,63 +584,6 @@ + ldflags += [ "-Wl,-z,keep-text-section-prefix" ] + } + +- if (is_clang && !is_nacl) { +- cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ] +- if (save_reproducers_on_lld_crash && use_lld) { +- ldflags += [ +- "-fcrash-diagnostics=all", +- "-fcrash-diagnostics-dir=" + clang_diagnostic_dir, +- ] +- } +- +- # TODO(hans): Remove this once Clang generates better optimized debug info +- # by default. https://crbug.com/765793 +- cflags += [ +- "-mllvm", +- "-instcombine-lower-dbg-declare=0", +- ] +- if (!is_debug && use_thin_lto && is_a_target_toolchain) { +- if (is_win) { +- ldflags += [ "-mllvm:-instcombine-lower-dbg-declare=0" ] +- } else { +- ldflags += [ "-Wl,-mllvm,-instcombine-lower-dbg-declare=0" ] +- } +- } +- +- # TODO(crbug.com/40283598): This causes binary size growth and potentially +- # other problems. +- # TODO(crbug.com/40284925): This isn't supported by Cronet's mainline llvm version. +- if (default_toolchain != "//build/toolchain/cros:target" && +- !llvm_android_mainline) { +- cflags += [ +- # "-mllvm", +- # "-split-threshold-for-reg-with-hint=0", +- ] +- if (use_thin_lto && is_a_target_toolchain) { +- if (is_win) { +- # ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ] +- } else { +- # ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ] +- } +- } +- } +- +- if (use_avx2 || use_avx512 || use_fma || current_cpu == "arm64" || is_mac) { +- if (is_win) { +- cflags += [ "/clang:-ffp-contract=fast" ] +- } else { +- cflags += [ "-ffp-contract=fast" ] +- } +- } else { +- # TODO(crbug.com/40192287): Investigate why/if this should be needed. +- if (is_win) { +- cflags += [ "/clang:-ffp-contract=off" ] +- } else { +- cflags += [ "-ffp-contract=off" ] +- } +- } +- } +- + # C11/C++11 compiler flags setup. + # --------------------------- + if (is_linux || is_chromeos || is_android || (is_nacl && is_clang) || +@@ -1748,52 +1688,6 @@ + } + } + +- # Makes builds independent of absolute file path. +- if (is_clang && strip_absolute_paths_from_debug_symbols) { +- # If debug option is given, clang includes $cwd in debug info by default. +- # For such build, this flag generates reproducible obj files even we use +- # different build directory like "out/feature_a" and "out/feature_b" if +- # we build same files with same compile flag. +- # Other paths are already given in relative, no need to normalize them. +- if (is_nacl) { +- # TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here. +- cflags += [ +- "-Xclang", +- "-fdebug-compilation-dir", +- "-Xclang", +- ".", +- ] +- } else { +- # -ffile-compilation-dir is an alias for both -fdebug-compilation-dir= +- # and -fcoverage-compilation-dir=. +- cflags += [ "-ffile-compilation-dir=." ] +- +- # Convert absolute paths to relative paths. Expands to, for example: +- # -file-prefix-map /path/to/chromium/src=../.. +- swiftflags += [ +- "-file-prefix-map", +- rebase_path("//.", "") + "=" + rebase_path("//.", root_build_dir), +- ] +- } +- if (!is_win) { +- # We don't use clang -cc1as on Windows (yet? https://crbug.com/762167) +- asmflags = [ "-Wa,-fdebug-compilation-dir,." ] +- } +- +- if (is_win && use_lld) { +- if (symbol_level == 2 || (is_clang && using_sanitizer)) { +- # Absolutize source file paths for PDB. Pass the real build directory +- # if the pdb contains source-level debug information and if linker +- # reproducibility is not critical. +- ldflags += [ "/PDBSourcePath:" + rebase_path(root_build_dir) ] +- } else { +- # Use a fake fixed base directory for paths in the pdb to make the pdb +- # output fully deterministic and independent of the build directory. +- ldflags += [ "/PDBSourcePath:o:\fake\prefix" ] +- } +- } +- } +- + # Tells the compiler not to use absolute paths when passing the default + # paths to the tools it invokes. We don't want this because we don't + # really need it and it can mess up the RBE cache entries. +@@ -1812,40 +1706,6 @@ + } + } + +-config("clang_revision") { +- if (is_clang && clang_base_path == default_clang_base_path && +- current_os != "zos") { +- update_args = [ +- "--print-revision", +- "--verify-version=$clang_version", +- ] +- if (llvm_force_head_revision) { +- update_args += [ "--llvm-force-head-revision" ] +- } +- clang_revision = exec_script("//tools/clang/scripts/update.py", +- update_args, +- "trim string") +- +- # This is here so that all files get recompiled after a clang roll and +- # when turning clang on or off. (defines are passed via the command line, +- # and build system rebuild things when their commandline changes). Nothing +- # should ever read this define. +- defines = [ "CR_CLANG_REVISION=\"$clang_revision\"" ] +- } +-} +- +-config("rustc_revision") { +- if (rustc_revision != "") { +- # Similar to the above config, this is here so that all files get recompiled +- # after a rustc roll. Nothing should ever read this cfg. This will not be +- # set if a custom toolchain is used. +- rustflags = [ +- "--cfg", +- "cr_rustc_revision=\"$rustc_revision\"", +- ] +- } +-} +- + config("compiler_arm_fpu") { + if (current_cpu == "arm" && !is_ios && !is_nacl) { + cflags = [ "-mfpu=$arm_fpu" ] +@@ -2252,11 +2112,7 @@ + defines = [ "_HAS_NODISCARD" ] + } + } else { +- cflags = [ "-Wall" ] +- if (is_clang) { +- # Enable extra warnings for chromium_code when we control the compiler. +- cflags += [ "-Wextra" ] +- } ++ cflags = [] + + # In Chromium code, we define __STDC_foo_MACROS in order to get the + # C99 macros on Mac and Linux. +@@ -2265,24 +2121,6 @@ + "__STDC_FORMAT_MACROS", + ] + +- if (!is_debug && !using_sanitizer && current_cpu != "s390x" && +- current_cpu != "s390" && current_cpu != "ppc64" && +- current_cpu != "mips" && current_cpu != "mips64" && +- current_cpu != "riscv64" && current_cpu != "loong64") { +- # Non-chromium code is not guaranteed to compile cleanly with +- # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are +- # disabled, so only do that for Release build. +- fortify_level = "2" +- +- # ChromeOS's toolchain supports a high-quality _FORTIFY_SOURCE=3 +- # implementation with a few custom glibc patches. Use that if it's +- # available. +- if (is_chromeos_device && !lacros_use_chromium_toolchain) { +- fortify_level = "3" +- } +- defines += [ "_FORTIFY_SOURCE=" + fortify_level ] +- } +- + if (is_apple) { + cflags_objc = [ "-Wimplicit-retain-self" ] + cflags_objcc = [ "-Wimplicit-retain-self" ] +@@ -2950,7 +2788,8 @@ + # [0]: https://pinpoint-dot-chromeperf.appspot.com/job/147634a8be0000 + # [1]: https://pinpoint-dot-chromeperf.appspot.com/job/132bc772be0000 + # [2]: https://crrev.com/c/5447532 +-config("optimize") { ++config("optimize") { } ++config("xoptimize") { + if (is_win) { + # clang-cl's /O2 corresponds to clang's -O3, and really want -O2 for + # consistency with the other platforms. +@@ -3000,7 +2839,8 @@ + } + + # Turn off optimizations. +-config("no_optimize") { ++config("no_optimize") { } ++config("xno_optimize") { + if (is_win) { + cflags = [ + "/Od", # Disable optimization. +@@ -3040,7 +2880,8 @@ + # Turns up the optimization level. Used to explicitly enable -O2 instead of + # -Os for select targets on platforms that use optimize_for_size. No-op + # elsewhere. +-config("optimize_max") { ++config("optimize_max") { } ++config("xoptimize_max") { + if (is_nacl && is_nacl_irt) { + # The NaCl IRT is a special case and always wants its own config. + # Various components do: +@@ -3076,7 +2917,8 @@ + # + # TODO(crbug.com/41259697) - rework how all of these configs are related + # so that we don't need this disclaimer. +-config("optimize_speed") { ++config("optimize_speed") { } ++config("xoptimize_speed") { + if (is_nacl && is_nacl_irt) { + # The NaCl IRT is a special case and always wants its own config. + # Various components do: +@@ -3105,7 +2947,8 @@ + } + } + +-config("optimize_fuzzing") { ++config("optimize_fuzzing") { } ++config("xoptimize_fuzzing") { + cflags = [ "-O3" ] + common_optimize_on_cflags + rustflags = [ "-Copt-level=3", ] + ldflags = common_optimize_on_ldflags +@@ -3271,7 +3114,8 @@ + } + + # Full symbols. +-config("symbols") { ++config("symbols") { } ++config("xsymbols") { + rustflags = [] + configs = [] + if (is_win) { +@@ -3433,7 +3277,8 @@ + # Minimal symbols. + # This config guarantees to hold symbol for stack trace which are shown to user + # when crash happens in unittests running on buildbot. +-config("minimal_symbols") { ++config("minimal_symbols") { } ++config("xminimal_symbols") { + rustflags = [] + if (is_win) { + # Functions, files, and line tables only. +@@ -3518,7 +3363,8 @@ + # This configuration contains function names only. That is, the compiler is + # told to not generate debug information and the linker then just puts function + # names in the final debug information. +-config("no_symbols") { ++config("no_symbols") { } ++config("xno_symbols") { + if (is_win) { + ldflags = [ "/DEBUG" ] + diff --git a/www-client/thorium/files/chromium-132-mold.patch b/www-client/thorium/files/chromium-132-mold.patch new file mode 100644 index 0000000..4de6830 --- /dev/null +++ b/www-client/thorium/files/chromium-132-mold.patch @@ -0,0 +1,175 @@ +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -206,7 +206,7 @@ + # Set to true to use icf, Identical Code Folding. + use_icf = (is_posix || is_fuchsia) && !is_debug && !using_sanitizer && + !use_clang_coverage && current_os != "zos" && +- !(is_android && use_order_profiling) && use_lld ++ !(is_android && use_order_profiling) && (use_lld || use_mold) + } + + if (is_android) { +@@ -377,7 +377,9 @@ + } + } + +- if (use_lld) { ++ if (use_mold) { ++ ldflags += [ "-fuse-ld=mold" ] ++ } else if (use_lld) { + ldflags += [ "-fuse-ld=lld" ] + if (lld_path != "") { + ldflags += [ "-B$lld_path" ] +@@ -430,7 +432,7 @@ + # links. + ldflags += [ "-Wl,--build-id=sha1" ] + } else if (current_os != "aix" && current_os != "zos") { +- if (use_lld && !is_nacl) { ++ if ((use_lld || use_mold) && !is_nacl) { + ldflags += [ "-Wl,--build-id=fast" ] + } else { + ldflags += [ "-Wl,--build-id" ] +@@ -511,7 +513,7 @@ + + # Linux-specific compiler flags setup. + # ------------------------------------ +- if (use_icf && (!is_apple || use_lld)) { ++ if (use_icf && (!is_apple || use_lld || use_mold)) { + ldflags += [ "-Wl,--icf=all" ] + } + +@@ -549,7 +551,7 @@ + } + } + +- if (use_lld) { ++ if (use_lld || use_mold) { + # TODO(thakis): Make the driver pass --color-diagnostics to the linker + # if -fcolor-diagnostics is passed to it, and pass -fcolor-diagnostics + # in ldflags instead. +@@ -564,7 +566,7 @@ + + # Enable text section splitting only on linux when using lld for now. Other + # platforms can be added later if needed. +- if ((is_linux || is_chromeos) && use_lld && use_text_section_splitting) { ++ if ((is_linux || is_chromeos) && (use_lld || use_mold) && use_text_section_splitting) { + ldflags += [ "-Wl,-z,keep-text-section-prefix" ] + } + +@@ -732,7 +734,7 @@ + # [0]: https://pinpoint-dot-chromeperf.appspot.com/job/15efb0313e0000 + # [1]: https://pinpoint-dot-chromeperf.appspot.com/job/157f0b42be0000 + if (!is_debug && use_thin_lto && is_a_target_toolchain) { +- assert(use_lld, "LTO is only supported with lld") ++ assert(use_lld || use_mold, "LTO is only supported with lld or mold") + + cflags += [ + "-flto=thin", +@@ -774,7 +776,9 @@ + # [0]: https://pinpoint-dot-chromeperf.appspot.com/job/16984a18be0000 + # [1]: https://pinpoint-dot-chromeperf.appspot.com/job/11984a18be0000 + # [2]: https://ci.chromium.org/ui/p/chromium/builders/try/android-binary-size/1848442 ++ if (!use_mold) { + import_instr_limit = 100 ++ } + + if (is_win) { + ldflags += [ +@@ -807,7 +811,9 @@ + import_instr_limit = 5 + } + ++ if (!use_mold) { + ldflags += [ "-Wl,-mllvm,-import-instr-limit=$import_instr_limit" ] ++ } + + if (is_apple) { + ldflags += [ "-Wcrl,object_path_lto" ] +@@ -815,7 +821,9 @@ + + # We only use one version of LLVM within a build so there's no need to + # upgrade debug info, which can be expensive since it runs the verifier. ++ if (!use_mold) { + ldflags += [ "-Wl,-mllvm,-disable-auto-upgrade-debug-info" ] ++ } + } + + if (!optimize_for_size) { +@@ -827,7 +835,7 @@ + ] + if (is_win) { + ldflags += [ "-mllvm:-inlinehint-threshold=360" ] +- } else { ++ } else if (!use_mold) { + ldflags += [ "-Wl,-mllvm,-inlinehint-threshold=360" ] + } + } +@@ -888,7 +896,7 @@ + + # TODO(crbug.com/40242425): Cleanup undefined symbol errors caught by + # --no-undefined-version. +- if (use_lld && !is_win && !is_mac && !is_ios) { ++ if ((use_lld || use_mold) && !is_win && !is_mac && !is_ios) { + ldflags += [ "-Wl,--undefined-version" ] + } + +@@ -948,7 +956,7 @@ + assert( + is_android && host_os == "linux", + "MLGO is currently only supported for targeting Android on a linux host") +- if (use_thin_lto) { ++ if (use_thin_lto && !use_mold ) { + ldflags += [ "-Wl,-mllvm,-enable-ml-inliner=release" ] + if (is_high_end_android) { + # Besides using the arm64 - trained model, instruct the inline advisor +@@ -1545,7 +1553,9 @@ + # This can be removed once https://bugs.llvm.org/show_bug.cgi?id=40348 + # has been resolved, and -mno-outline is obeyed by the linker during + # ThinLTO. ++ if (!use_mold) { + ldflags += [ "-Wl,-mllvm,-enable-machine-outliner=never" ] ++ } + } + + asmflags = cflags +@@ -2928,7 +2938,7 @@ + # sections" there. Maybe just a bug in nacl_switch_32.S. + _enable_gdb_index = + symbol_level == 2 && !is_apple && !is_nacl && current_cpu != "x86" && +- current_os != "zos" && use_lld && ++ current_os != "zos" && (use_lld || use_mold) && + # Disable on non-fission 32-bit Android because it pushes + # libcomponents_unittests over the 4gb size limit. + !(is_android && !use_debug_fission && current_cpu != "x64" && +--- a/build/config/compiler/pgo/BUILD.gn ++++ b/build/config/compiler/pgo/BUILD.gn +@@ -150,7 +150,7 @@ + if (use_thin_lto) { + if (is_win) { + ldflags = [ "-mllvm:-enable-ext-tsp-block-placement=1" ] +- } else { ++ } else if (!use_mold) { + ldflags = [ "-Wl,-mllvm,-enable-ext-tsp-block-placement=1" ] + } + } else { +--- a/build/config/compiler/compiler.gni.orig ++++ b/build/config/compiler/compiler.gni +@@ -36,6 +36,9 @@ + # The default linker everywhere else. + use_lld = is_clang && current_os != "zos" + ++ # Set to true to use mold, the modern linker. ++ use_mold = false ++ + # If true, optimize for size. + # Default to favoring speed over size for platforms not listed below. + optimize_for_size = +@@ -74,7 +77,7 @@ + # gcc >= 4.8 or clang. + # http://gcc.gnu.org/wiki/DebugFission + use_debug_fission = !is_android && !is_fuchsia && !is_apple && !is_win && +- use_lld && cc_wrapper == "" ++ (use_lld || use_mold) && cc_wrapper == "" + + # Enables support for ThinLTO, which links 3x-10x faster than full LTO. See + # also http://blog.llvm.org/2016/06/thinlto-scalable-and-incremental-lto.html diff --git a/www-client/thorium/files/chromium-132-no-link-builtins.patch b/www-client/thorium/files/chromium-132-no-link-builtins.patch new file mode 100644 index 0000000..a93bc24 --- /dev/null +++ b/www-client/thorium/files/chromium-132-no-link-builtins.patch @@ -0,0 +1,16 @@ +--- a/build/config/clang/BUILD.gn ++++ b/build/config/clang/BUILD.gn +@@ -237,7 +237,12 @@ + + # Adds a dependency on the Clang runtime library clang_rt.builtins. + clang_lib("compiler_builtins") { +- if (is_mac) { ++ if (!toolchain_has_rust) { ++ # Since there's no Rust in the toolchain, there's no concern that we'll use ++ # the Rust stdlib's intrinsics here. ++ # ++ # Don't define libname which makes this target do nothing. ++ } else if (is_mac) { + libname = "osx" + } else if (is_ios) { + if (target_environment == "simulator") { diff --git a/www-client/thorium/files/chromium-134-qt5-optional.patch b/www-client/thorium/files/chromium-134-qt5-optional.patch new file mode 100644 index 0000000..57606f8 --- /dev/null +++ b/www-client/thorium/files/chromium-134-qt5-optional.patch @@ -0,0 +1,133 @@ +https://chromium.googlesource.com/chromium/src/+/0d8d0e0943489b59e452b4d0214959821880ad7f +From: Matt Jolly +Date: Tue, 28 Jan 2025 12:00:57 -0800 +Subject: [PATCH] UI: make QT5 optional + +To build with `use_qt6`, QT5 (`use_qt`) is also required. +This is undesirable for downstreams who are actively working +to drop support for QT5 (e.g. Gentoo). + +To resolve this: + +- Add `use_qt5` +- Replace most `use_qt` conditionals with this option; + these appear to be from before QT6 support was added. +- Use `use_qt5` to gate some previously unconditional QT5-related + items in chrome/installer/linux +- Remove `use_qt` as an argument, instead set to `use_qt5 || use_qt6`. + +This change should not impact the current behaviour; if no options +are selected QT5 and QT6 support will be enabled, using existing logic +unless one is explicitly disabled with `use_qt{x}=false`. + +See-also: https://bugs.gentoo.org/926166, https://bugs.gentoo.org/948836 +Signed-off-by: Matt Jolly +Fixed: 328182252 +Change-Id: I22ec7a068356412d3f9fce68a19aee4f8c89892c +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6205488 +Reviewed-by: Thomas Anderson +Commit-Queue: Lei Zhang +Reviewed-by: Lei Zhang +Cr-Commit-Position: refs/heads/main@{#1412471} +--- a/chrome/installer/linux/BUILD.gn ++++ b/chrome/installer/linux/BUILD.gn +@@ -77,10 +77,10 @@ if (enable_swiftshader) { + packaging_files += [ "$root_out_dir/vk_swiftshader_icd.json" ] + } + +-if (use_qt) { +- # Even though this is a shared library, add it to `packaging_files` instead of +- # `packaging_files_shlibs` to skip the dependency check. This is intentional +- # to prevent a hard dependency on QT for the package. ++# Even though this is a shared library, add it to `packaging_files` instead of ++# `packaging_files_shlibs` to skip the dependency check. This is intentional ++# to prevent a hard dependency on QT for the package. ++if (use_qt5) { + packaging_files += [ "$root_out_dir/libqt5_shim.so" ] + } + if (use_qt6) { +@@ -206,7 +206,7 @@ if (build_with_internal_optimization_guide) { + } + } + +-if (use_qt) { ++if (use_qt5) { + strip_binary("strip_qt5_shim") { + binary_input = "$root_out_dir/libqt5_shim.so" + deps = [ "//ui/qt:qt5_shim" ] +@@ -399,7 +399,7 @@ group("installer_deps") { + "//components/optimization_guide/internal:optimization_guide_internal", + ] + } +- if (use_qt) { ++ if (use_qt5) { + public_deps += [ + ":strip_qt5_shim", + "//ui/qt:qt5_shim", +--- a/ui/qt/BUILD.gn ++++ b/ui/qt/BUILD.gn +@@ -101,10 +101,12 @@ template("qt_shim") { + } + } + } +-qt_shim("qt5_shim") { +- qt_version = "5" +- if (!use_sysroot) { +- moc_qt_path = "$moc_qt5_path" ++if (use_qt5) { ++ qt_shim("qt5_shim") { ++ qt_version = "5" ++ if (!use_sysroot) { ++ moc_qt_path = "$moc_qt5_path" ++ } + } + } + if (use_qt6) { +@@ -122,7 +124,10 @@ component("qt") { + defines = [ "IS_QT_IMPL" ] + + # qt_shim is in data_deps since we want to load it manually. +- data_deps = [ ":qt5_shim" ] ++ data_deps = [] ++ if (use_qt5) { ++ data_deps += [ ":qt5_shim" ] ++ } + if (use_qt6) { + data_deps += [ ":qt6_shim" ] + } +--- a/ui/qt/qt.gni ++++ b/ui/qt/qt.gni +@@ -6,27 +6,20 @@ import("//build/config/cast.gni") + import("//build/config/sanitizers/sanitizers.gni") + import("//build/config/sysroot.gni") + ++# TODO(crbug.com/40260415): Allow QT in MSAN builds once QT is ++# added to the instrumented libraries. + declare_args() { +- # TODO(crbug.com/40260415): Allow QT in MSAN builds once QT is +- # added to the instrumented libraries. +- use_qt = is_linux && !is_castos && !is_msan ++ use_qt5 = use_sysroot && is_linux && !is_castos && !is_msan ++ use_qt6 = use_sysroot && is_linux && !is_castos && !is_msan + } + + declare_args() { +- if (!use_sysroot && use_qt) { ++ if (!use_sysroot && use_qt5) { + moc_qt5_path = "" + } +-} +- +-declare_args() { +- use_qt6 = use_qt && use_sysroot +-} +- +-declare_args() { + if (!use_sysroot && use_qt6) { + moc_qt6_path = "" + } + } + +-# use_qt6 => use_qt +-assert(!use_qt6 || use_qt) ++use_qt = use_qt5 || use_qt6 diff --git a/www-client/thorium/files/chromium-135-gperf.patch b/www-client/thorium/files/chromium-135-gperf.patch new file mode 100644 index 0000000..85e4706 --- /dev/null +++ b/www-client/thorium/files/chromium-135-gperf.patch @@ -0,0 +1,28 @@ +https://bugs.gentoo.org/953436#c5 +--- a/third_party/blink/renderer/build/scripts/gperf.py ++++ b/third_party/blink/renderer/build/scripts/gperf.py +@@ -28,24 +28,6 @@ + stdout=subprocess.PIPE, + universal_newlines=True) + gperf_output = gperf.communicate(gperf_input)[0] +- # Massage gperf output to be more palatable for modern compilers. +- # TODO(thakis): Upstream these to gperf so we don't need massaging. +- # `register` is deprecated in C++11 and removed in C++17, so remove +- # it from gperf's output. +- # https://savannah.gnu.org/bugs/index.php?53028 +- gperf_output = re.sub(r'\bregister ', '', gperf_output) +- # -Wimplicit-fallthrough needs an explicit fallthrough statement, +- # so replace gperf's /*FALLTHROUGH*/ comment with the statement. +- # https://savannah.gnu.org/bugs/index.php?53029 +- gperf_output = gperf_output.replace('/*FALLTHROUGH*/', +- ' [[fallthrough]];') +- # -Wpointer-to-int-cast warns about casting pointers to smaller ints +- # Replace {(int)(long)&(foo), bar} with +- # {static_cast(reinterpret_cast(&(foo)), bar} +- gperf_output = re.sub( +- r'\(int\)\(long\)(.*?),', +- r'static_cast(reinterpret_cast(\1)),', +- gperf_output) + script = 'third_party/blink/renderer/build/scripts/gperf.py' + return '// Generated by %s\n' % script + gperf_output + except OSError: diff --git a/www-client/thorium/files/chromium-137-fix-for-kde.patch b/www-client/thorium/files/chromium-137-fix-for-kde.patch new file mode 100644 index 0000000..91e7aa2 --- /dev/null +++ b/www-client/thorium/files/chromium-137-fix-for-kde.patch @@ -0,0 +1,12 @@ +--- a/chrome/browser/renderer_preferences_util.cc 2025-06-09 23:43:12.302027536 +0700 ++++ b/chrome/browser/renderer_preferences_util.cc 2025-06-09 23:43:38.084028322 +0700 +@@ -183,7 +183,8 @@ + #if defined(USE_AURA) && BUILDFLAG(IS_LINUX) + auto* linux_ui_theme = ui::LinuxUiTheme::GetForProfile(profile); + if (linux_ui_theme) { +- if (ThemeServiceFactory::GetForProfile(profile)->UsingSystemTheme()) { ++ if (ThemeServiceFactory::GetForProfile(profile) && ++ ThemeServiceFactory::GetForProfile(profile)->UsingSystemTheme()) { + linux_ui_theme->GetFocusRingColor(&prefs->focus_ring_color); + linux_ui_theme->GetActiveSelectionBgColor( + &prefs->active_selection_bg_color); diff --git a/www-client/thorium/files/chromium-99-opus.patch b/www-client/thorium/files/chromium-99-opus.patch new file mode 100644 index 0000000..d4ecf8e --- /dev/null +++ b/www-client/thorium/files/chromium-99-opus.patch @@ -0,0 +1,12 @@ +diff -up chromium-99.0.4818.0/media/audio/audio_opus_encoder.h.omv~ chromium-99.0.4818.0/media/audio/audio_opus_encoder.h +--- chromium-99.0.4818.0/media/audio/audio_opus_encoder.h.omv~ 2022-01-13 05:42:57.571250471 +0100 ++++ chromium-99.0.4818.0/media/audio/audio_opus_encoder.h 2022-01-13 05:43:06.233291236 +0100 +@@ -13,7 +13,7 @@ + #include "media/base/audio_encoder.h" + #include "media/base/audio_push_fifo.h" + #include "media/base/audio_timestamp_helper.h" +-#include "third_party/opus/src/include/opus.h" ++#include + + namespace media { + diff --git a/www-client/thorium/files/chromium-cross-compile.patch b/www-client/thorium/files/chromium-cross-compile.patch new file mode 100644 index 0000000..430ceb7 --- /dev/null +++ b/www-client/thorium/files/chromium-cross-compile.patch @@ -0,0 +1,12 @@ +--- a/build/toolchain/linux/unbundle/BUILD.gn ++++ b/build/toolchain/linux/unbundle/BUILD.gn +@@ -35,7 +35,7 @@ gcc_toolchain("host") { + extra_ldflags = getenv("BUILD_LDFLAGS") + + toolchain_args = { +- current_cpu = current_cpu +- current_os = current_os ++ current_cpu = host_cpu ++ current_os = host_os + } + } diff --git a/www-client/thorium/files/chromium-revert-84fcdd0620a72aa73ea521c682fb246067f2c14d.patch b/www-client/thorium/files/chromium-revert-84fcdd0620a72aa73ea521c682fb246067f2c14d.patch new file mode 100644 index 0000000..53b62e5 --- /dev/null +++ b/www-client/thorium/files/chromium-revert-84fcdd0620a72aa73ea521c682fb246067f2c14d.patch @@ -0,0 +1,12 @@ +--- a/media/filters/ffmpeg_glue.cc ++++ b/media/filters/ffmpeg_glue.cc +@@ -123,7 +123,8 @@ + // We don't allow H.264 parsing during demuxing since we have our own parser + // and the ffmpeg one increases memory usage unnecessarily. + if (base::FeatureList::IsEnabled(kForbidH264ParsingDuringDemuxing)) { +- format_context_->flags |= AVFMT_FLAG_NOH264PARSE; ++ // TODO(crbug.com/355485812): Re-enable this flag. ++ // format_context_->flags |= AVFMT_FLAG_NOH264PARSE; + } + + // Ensures format parsing errors will bail out. From an audit on 11/2017, all diff --git a/www-client/thorium/files/chromium-system-av1.patch b/www-client/thorium/files/chromium-system-av1.patch new file mode 100644 index 0000000..46acff2 --- /dev/null +++ b/www-client/thorium/files/chromium-system-av1.patch @@ -0,0 +1,22 @@ +=================================================================== +--- a/media/base/libaom_thread_wrapper.cc ++++ b/media/base/libaom_thread_wrapper.cc +@@ -4,18 +4,11 @@ + + #include "base/logging.h" + #include "media/base/codec_worker_impl.h" + #include "media/base/libvpx_thread_wrapper.h" +-#include "third_party/libaom/source/libaom/aom_util/aom_thread.h" + + namespace media { + + void InitLibAomThreadWrapper() { +- const AVxWorkerInterface interface = +- CodecWorkerImpl::GetCodecWorkerInterface(); +- CHECK(aom_set_worker_interface(&interface)); + } + + } // namespace media diff --git a/www-client/thorium/files/chromium-system-libvpx.patch b/www-client/thorium/files/chromium-system-libvpx.patch new file mode 100644 index 0000000..fe0d1f3 --- /dev/null +++ b/www-client/thorium/files/chromium-system-libvpx.patch @@ -0,0 +1,23 @@ +=================================================================== +--- a/media/base/libvpx_thread_wrapper.cc ++++ b/media/base/libvpx_thread_wrapper.cc +@@ -4,19 +4,11 @@ + + #include "media/base/libvpx_thread_wrapper.h" + + #include "media/base/codec_worker_impl.h" +-#include "third_party/libvpx/source/libvpx/vpx_util/vpx_thread.h" + + namespace media { + + void InitLibVpxThreadWrapper() { +- const VPxWorkerInterface interface = +- CodecWorkerImpl::GetCodecWorkerInterface(); +- +- CHECK(vpx_set_worker_interface(&interface)); + } + + } // namespace media diff --git a/www-client/thorium/files/chromium-system-openjpeg-r4.patch b/www-client/thorium/files/chromium-system-openjpeg-r4.patch new file mode 100644 index 0000000..64c6121 --- /dev/null +++ b/www-client/thorium/files/chromium-system-openjpeg-r4.patch @@ -0,0 +1,35 @@ +description: build using system openjpeg +author: Michael Gilbert + +--- a/third_party/pdfium/BUILD.gn ++++ b/third_party/pdfium/BUILD.gn +@@ -25,7 +25,7 @@ + cflags = [] + cflags_cc = [] + ldflags = [] +- include_dirs = [ "." ] ++ include_dirs = [ ".", "/usr/include/openjpeg-2.4", "/usr/include/openjpeg-2.5" ] + defines = [] + + if (!use_system_libopenjpeg2) { +--- a/third_party/pdfium/core/fpdfapi/render/BUILD.gn ++++ b/third_party/pdfium/core/fpdfapi/render/BUILD.gn +@@ -49,6 +49,7 @@ source_set("render") { + "../../../:pdfium_noshorten_config", + ] + deps = [ ++ "../../../third_party:libopenjpeg2", + "../../../constants", + "../../fxcodec", + "../../fxcrt", +--- a/third_party/pdfium/core/fxcodec/jpx/cjpx_decoder.h ++++ b/third_party/pdfium/core/fxcodec/jpx/cjpx_decoder.h +@@ -12,7 +12,7 @@ + #include "core/fxcrt/unowned_ptr.h" + #include "third_party/base/span.h" + +-#if defined(USE_SYSTEM_LIBOPENJPEG2) ++#if 1 + #include + #else + #include "third_party/libopenjpeg20/openjpeg.h" diff --git a/www-client/thorium/files/chromium-ucf-dict-utility-r1.patch b/www-client/thorium/files/chromium-ucf-dict-utility-r1.patch new file mode 100644 index 0000000..6d949b3 --- /dev/null +++ b/www-client/thorium/files/chromium-ucf-dict-utility-r1.patch @@ -0,0 +1,112 @@ +Taken from +https://github.com/qvint/ungoogled-chromium-fedora/commit/a68fdd679566da5134d916776f14e00c8e6a8042 + +--- a/chrome/tools/convert_dict/convert_dict.cc ++++ b/chrome/tools/convert_dict/convert_dict.cc +@@ -24,6 +24,7 @@ + #include "build/build_config.h" + #include "chrome/tools/convert_dict/aff_reader.h" + #include "chrome/tools/convert_dict/dic_reader.h" ++#include "components/spellcheck/common/spellcheck_common.h" + #include "third_party/hunspell/google/bdict_reader.h" + #include "third_party/hunspell/google/bdict_writer.h" + +@@ -76,13 +77,32 @@ bool VerifyWords(const convert_dict::Dic + } + + int PrintHelp() { +- printf("Usage: convert_dict \n\n"); +- printf("Example:\n"); +- printf(" convert_dict en-US\nwill read en-US.dic, en-US.dic_delta, and " +- "en-US.aff from the current directory and generate en-US.bdic\n\n"); ++ printf( ++ "Usage:\n" ++ " dict-utility list\n" ++ " dict-utility convert \n"); + return 1; + } + ++int PrintList() { ++ base::FilePath root("/"); ++ std::vector languages = spellcheck::SpellCheckLanguages(); ++ ++ for (auto &language : languages) { ++ std::string language_region = ++ spellcheck::GetSpellCheckLanguageRegion(language); ++ base::FilePath language_bdic_path = ++ spellcheck::GetVersionedFileName(language, root).BaseName(); ++ ++ printf("%s\t%s\t%s\n", ++ language.c_str(), ++ language_region.c_str(), ++ language_bdic_path.value().c_str()); ++ } ++ ++ return 0; ++} ++ + } // namespace + + #if defined(OS_WIN) +@@ -91,16 +111,15 @@ int wmain(int argc, wchar_t* argv[]) { + int main(int argc, char* argv[]) { + #endif + base::EnableTerminationOnHeapCorruption(); +- if (argc != 2) ++ if (argc == 2 && strcmp(argv[1], "list") == 0) ++ return PrintList(); ++ if (argc != 5 || strcmp(argv[1], "convert") != 0) + return PrintHelp(); + + base::AtExitManager exit_manager; + base::i18n::InitializeICU(); + +- base::FilePath file_base = base::FilePath(argv[1]); +- +- base::FilePath aff_path = +- file_base.ReplaceExtension(FILE_PATH_LITERAL(".aff")); ++ base::FilePath aff_path = base::FilePath(argv[2]); + printf("Reading %" PRFilePath " ...\n", aff_path.value().c_str()); + convert_dict::AffReader aff_reader(aff_path); + if (!aff_reader.Read()) { +@@ -108,8 +127,7 @@ int main(int argc, char* argv[]) { + return 1; + } + +- base::FilePath dic_path = +- file_base.ReplaceExtension(FILE_PATH_LITERAL(".dic")); ++ base::FilePath dic_path = base::FilePath(argv[3]); + printf("Reading %" PRFilePath " ...\n", dic_path.value().c_str()); + // DicReader will also read the .dic_delta file. + convert_dict::DicReader dic_reader(dic_path); +@@ -135,8 +153,7 @@ int main(int argc, char* argv[]) { + return 1; + } + +- base::FilePath out_path = +- file_base.ReplaceExtension(FILE_PATH_LITERAL(".bdic")); ++ base::FilePath out_path = base::FilePath(argv[4]); + printf("Writing %" PRFilePath " ...\n", out_path.value().c_str()); + FILE* out_file = base::OpenFile(out_path, "wb"); + if (!out_file) { +--- a/chrome/tools/convert_dict/BUILD.gn ++++ b/chrome/tools/convert_dict/BUILD.gn +@@ -34,6 +34,7 @@ executable("convert_dict") { + "//base", + "//base:i18n", + "//build/win:default_exe_manifest", ++ "//components/spellcheck/common", + "//third_party/hunspell", + ] + } +--- a/components/spellcheck/common/spellcheck_common.h ++++ b/components/spellcheck/common/spellcheck_common.h +@@ -34,6 +34,8 @@ + // chrome/browser/resources/settings/languages_page/edit_dictionary_page.js + static const size_t kMaxCustomDictionaryWordBytes = 99; + ++std::string GetSpellCheckLanguageRegion(std::string_view input_language); ++ + base::FilePath GetVersionedFileName(std::string_view input_language, + const base::FilePath& dict_dir); + diff --git a/www-client/thorium/files/disable-bluez-r1.patch b/www-client/thorium/files/disable-bluez-r1.patch new file mode 100644 index 0000000..6e39b38 --- /dev/null +++ b/www-client/thorium/files/disable-bluez-r1.patch @@ -0,0 +1,92 @@ +From: PF4Public@users.noreply.github.com +License: BSD +Subject: Fix building with use_bluez=false + +This is a quick and dirty fix for building chromium with use_bluez=false +It prevents initialization and usage of Bluetooth by the browser +It is not supposed to be applied for use_bluez=true +The browser will SEGFAULT upon accessing chrome://bluetooth-internals/ +It also breaks WebAuthn: https://github.com/PF4Public/gentoo-overlay/issues/254 + +--- +--- a/headless/lib/browser/headless_browser_main_parts_posix.cc ++++ b/headless/lib/browser/headless_browser_main_parts_posix.cc +@@ -25,9 +25,8 @@ + #include "components/os_crypt/sync/os_crypt.h" + #include "headless/public/switches.h" + +-#if defined(USE_DBUS) +-#include "device/bluetooth/dbus/bluez_dbus_manager.h" +-#endif ++#include "device/bluetooth/bluetooth_adapter_factory.h" ++#include "device/bluetooth/dbus/dbus_bluez_manager_wrapper_linux.h" + + #endif // BUILDFLAG(IS_LINUX) + +@@ -134,7 +133,7 @@ + #if BUILDFLAG(IS_LINUX) + + #if defined(USE_DBUS) +- bluez::BluezDBusManager::Initialize(/*system_bus=*/nullptr); ++ bluez::DBusBluezManagerWrapperLinux::Initialize(); + #endif + + // Set up crypt config. This needs to be done before anything starts the +--- a/chrome/browser/chrome_browser_main_linux.cc ++++ b/chrome/browser/chrome_browser_main_linux.cc +@@ -35,6 +35,11 @@ + #include "chrome/browser/dbus_memory_pressure_evaluator_linux.h" + #endif + ++#if BUILDFLAG(IS_LINUX) ++#include "device/bluetooth/bluetooth_adapter_factory.h" ++#include "device/bluetooth/dbus/dbus_bluez_manager_wrapper_linux.h" ++#endif ++ + #if !BUILDFLAG(IS_CHROMEOS_ASH) + #include "base/command_line.h" + #include "base/linux_util.h" +@@ -59,7 +64,9 @@ + #endif // BUILDFLAG(IS_CHROMEOS) + + #if !BUILDFLAG(IS_CHROMEOS) +- bluez::BluezDBusManager::Initialize(nullptr /* system_bus */); ++ #if BUILDFLAG(IS_LINUX) ++ bluez::DBusBluezManagerWrapperLinux::Initialize(); ++ #endif + + // Set up crypt config. This needs to be done before anything starts the + // network service, as the raw encryption key needs to be shared with the +@@ -117,7 +124,7 @@ + #endif // defined(USE_DBUS) && !BUILDFLAG(IS_CHROMEOS) + + void ChromeBrowserMainPartsLinux::PostDestroyThreads() { +-#if BUILDFLAG(IS_CHROMEOS) ++#if BUILDFLAG(IS_LINUX) + // No-op; per PostBrowserStart() comment, this is done elsewhere. + #else + bluez::BluezDBusManager::Shutdown(); +--- a/chrome/browser/metrics/bluetooth_metrics_provider.cc ++++ b/chrome/browser/metrics/bluetooth_metrics_provider.cc +@@ -16,9 +16,7 @@ + + bool BluetoothMetricsProvider::ProvideHistograms() { + base::UmaHistogramEnumeration("Bluetooth.StackName", +- floss::features::IsFlossEnabled() +- ? BluetoothStackName::kFloss +- : BluetoothStackName::kBlueZ); ++ BluetoothStackName::kBlueZ); + return true; + } + +--- a/device/bluetooth/adapter.cc ++++ b/device/bluetooth/adapter.cc +@@ -115,7 +115,7 @@ + adapter_info->system_name = adapter_->GetSystemName(); + #endif + #if BUILDFLAG(IS_CHROMEOS) +- adapter_info->floss = floss::features::IsFlossEnabled(); ++ adapter_info->floss = false; + adapter_info->extended_advertisement_support = + adapter_->IsExtendedAdvertisementsAvailable(); + #endif diff --git a/www-client/thorium/files/ffmpeg-nb_coded_side_data-dolby.diff b/www-client/thorium/files/ffmpeg-nb_coded_side_data-dolby.diff new file mode 100644 index 0000000..0862cba --- /dev/null +++ b/www-client/thorium/files/ffmpeg-nb_coded_side_data-dolby.diff @@ -0,0 +1,24 @@ +diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc +index a55e4ab51d5b353..6049c6edb6a1ff3 100644 +--- a/media/ffmpeg/ffmpeg_common.cc ++++ b/media/ffmpeg/ffmpeg_common.cc +@@ -762,7 +762,7 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream, + type.codec = VideoCodec::kDolbyVision; + type.level = dovi->dv_level; + type.color_space = color_space; +- type.hdr_metadata_type = gfx::HdrMetadataType::kSmpteSt2094_10; ++ type.hdr_metadata_type = gfx::HdrMetadataType::kNone; + switch (dovi->dv_profile) { + case 0: + type.profile = VideoCodecProfile::DOLBYVISION_PROFILE0; +@@ -796,8 +796,8 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream, + break; + } + #endif // BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION) +- default: +- break; ++ default: ++ break; + } + } + diff --git a/www-client/thorium/files/ffmpeg-nb_coded_side_data-r1.patch b/www-client/thorium/files/ffmpeg-nb_coded_side_data-r1.patch new file mode 100644 index 0000000..4f3e540 --- /dev/null +++ b/www-client/thorium/files/ffmpeg-nb_coded_side_data-r1.patch @@ -0,0 +1,224 @@ +From 84d1d7adcd1697348e3f821811179c525d3b5717 Mon Sep 17 00:00:00 2001 +From: Dale Curtis +Date: Tue, 28 Nov 2023 00:41:42 +0000 +Subject: [PATCH] Roll src/third_party/ffmpeg/ c1d0dc413..866768f35 (492 + commits) + + +--- +diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc +index 3c97e4a6cf4c781..a55e4ab51d5b353 100644 +--- a/media/ffmpeg/ffmpeg_common.cc ++++ b/media/ffmpeg/ffmpeg_common.cc +@@ -653,15 +653,6 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream, + profile = ProfileIDToVideoCodecProfile(codec_context->profile); + } + +- void* display_matrix = +- av_stream_get_side_data(stream, AV_PKT_DATA_DISPLAYMATRIX, nullptr); +- +- VideoTransformation video_transformation = VideoTransformation(); +- if (display_matrix) { +- video_transformation = VideoTransformation::FromFFmpegDisplayMatrix( +- static_cast(display_matrix)); +- } +- + if (!color_space.IsSpecified()) { + // VP9 frames may have color information, but that information cannot + // express new color spaces, like HDR. For that reason, color space +@@ -718,88 +709,92 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream, + codec_context->extradata + codec_context->extradata_size); + } + +- if (stream->nb_side_data) { +- for (int i = 0; i < stream->nb_side_data; ++i) { +- AVPacketSideData side_data = stream->side_data[i]; +- switch (side_data.type) { +- case AV_PKT_DATA_MASTERING_DISPLAY_METADATA: { +- AVMasteringDisplayMetadata* mdcv = +- reinterpret_cast(side_data.data); +- gfx::HdrMetadataSmpteSt2086 smpte_st_2086; +- if (mdcv->has_primaries) { +- smpte_st_2086.primaries = { +- static_cast(av_q2d(mdcv->display_primaries[0][0])), +- static_cast(av_q2d(mdcv->display_primaries[0][1])), +- static_cast(av_q2d(mdcv->display_primaries[1][0])), +- static_cast(av_q2d(mdcv->display_primaries[1][1])), +- static_cast(av_q2d(mdcv->display_primaries[2][0])), +- static_cast(av_q2d(mdcv->display_primaries[2][1])), +- static_cast(av_q2d(mdcv->white_point[0])), +- static_cast(av_q2d(mdcv->white_point[1])), +- }; +- } +- if (mdcv->has_luminance) { +- smpte_st_2086.luminance_max = av_q2d(mdcv->max_luminance); +- smpte_st_2086.luminance_min = av_q2d(mdcv->min_luminance); +- } +- +- // TODO(https://crbug.com/1446302): Consider rejecting metadata that +- // does not specify all values. +- if (mdcv->has_primaries || mdcv->has_luminance) { +- hdr_metadata.smpte_st_2086 = smpte_st_2086; +- } +- break; ++ VideoTransformation video_transformation = VideoTransformation(); ++ for (int i = 0; i < stream->codecpar->nb_coded_side_data; ++i) { ++ const auto& side_data = stream->codecpar->coded_side_data[i]; ++ switch (side_data.type) { ++ case AV_PKT_DATA_DISPLAYMATRIX: { ++ CHECK_EQ(side_data.size, sizeof(int32_t) * 3 * 3); ++ video_transformation = VideoTransformation::FromFFmpegDisplayMatrix( ++ reinterpret_cast(side_data.data)); ++ break; ++ } ++ case AV_PKT_DATA_MASTERING_DISPLAY_METADATA: { ++ AVMasteringDisplayMetadata* mdcv = ++ reinterpret_cast(side_data.data); ++ gfx::HdrMetadataSmpteSt2086 smpte_st_2086; ++ if (mdcv->has_primaries) { ++ smpte_st_2086.primaries = { ++ static_cast(av_q2d(mdcv->display_primaries[0][0])), ++ static_cast(av_q2d(mdcv->display_primaries[0][1])), ++ static_cast(av_q2d(mdcv->display_primaries[1][0])), ++ static_cast(av_q2d(mdcv->display_primaries[1][1])), ++ static_cast(av_q2d(mdcv->display_primaries[2][0])), ++ static_cast(av_q2d(mdcv->display_primaries[2][1])), ++ static_cast(av_q2d(mdcv->white_point[0])), ++ static_cast(av_q2d(mdcv->white_point[1])), ++ }; + } +- case AV_PKT_DATA_CONTENT_LIGHT_LEVEL: { +- AVContentLightMetadata* clli = +- reinterpret_cast(side_data.data); +- hdr_metadata.cta_861_3 = +- gfx::HdrMetadataCta861_3(clli->MaxCLL, clli->MaxFALL); +- break; ++ if (mdcv->has_luminance) { ++ smpte_st_2086.luminance_max = av_q2d(mdcv->max_luminance); ++ smpte_st_2086.luminance_min = av_q2d(mdcv->min_luminance); ++ } ++ ++ // TODO(https://crbug.com/1446302): Consider rejecting metadata that ++ // does not specify all values. ++ if (mdcv->has_primaries || mdcv->has_luminance) { ++ hdr_metadata.smpte_st_2086 = smpte_st_2086; + } ++ break; ++ } ++ case AV_PKT_DATA_CONTENT_LIGHT_LEVEL: { ++ AVContentLightMetadata* clli = ++ reinterpret_cast(side_data.data); ++ hdr_metadata.cta_861_3 = ++ gfx::HdrMetadataCta861_3(clli->MaxCLL, clli->MaxFALL); ++ break; ++ } + #if BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION) +- case AV_PKT_DATA_DOVI_CONF: { +- AVDOVIDecoderConfigurationRecord* dovi = +- reinterpret_cast( +- side_data.data); +- VideoType type; +- type.codec = VideoCodec::kDolbyVision; +- type.level = dovi->dv_level; +- type.color_space = color_space; +- type.hdr_metadata_type = gfx::HdrMetadataType::kSmpteSt2094_10; +- switch (dovi->dv_profile) { +- case 0: +- type.profile = VideoCodecProfile::DOLBYVISION_PROFILE0; +- break; +- case 5: +- type.profile = VideoCodecProfile::DOLBYVISION_PROFILE5; +- break; +- case 7: +- type.profile = VideoCodecProfile::DOLBYVISION_PROFILE7; +- break; +- case 8: +- type.profile = VideoCodecProfile::DOLBYVISION_PROFILE8; +- break; +- case 9: +- type.profile = VideoCodecProfile::DOLBYVISION_PROFILE9; +- break; +- default: +- type.profile = VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN; +- break; +- } +- // Treat dolby vision contents as dolby vision codec only if the +- // device support clear DV decoding, otherwise use the original +- // HEVC or AVC codec and profile. +- if (media::IsSupportedVideoType(type)) { +- codec = type.codec; +- profile = type.profile; +- } +- break; ++ case AV_PKT_DATA_DOVI_CONF: { ++ AVDOVIDecoderConfigurationRecord* dovi = ++ reinterpret_cast(side_data.data); ++ VideoType type; ++ type.codec = VideoCodec::kDolbyVision; ++ type.level = dovi->dv_level; ++ type.color_space = color_space; ++ type.hdr_metadata_type = gfx::HdrMetadataType::kSmpteSt2094_10; ++ switch (dovi->dv_profile) { ++ case 0: ++ type.profile = VideoCodecProfile::DOLBYVISION_PROFILE0; ++ break; ++ case 5: ++ type.profile = VideoCodecProfile::DOLBYVISION_PROFILE5; ++ break; ++ case 7: ++ type.profile = VideoCodecProfile::DOLBYVISION_PROFILE7; ++ break; ++ case 8: ++ type.profile = VideoCodecProfile::DOLBYVISION_PROFILE8; ++ break; ++ case 9: ++ type.profile = VideoCodecProfile::DOLBYVISION_PROFILE9; ++ break; ++ default: ++ type.profile = VideoCodecProfile::VIDEO_CODEC_PROFILE_UNKNOWN; ++ break; ++ } ++ // Treat dolby vision contents as dolby vision codec only if the ++ // device support clear DV decoding, otherwise use the original ++ // HEVC or AVC codec and profile. ++ if (media::IsSupportedVideoType(type)) { ++ codec = type.codec; ++ profile = type.profile; + } ++ break; ++ } + #endif // BUILDFLAG(ENABLE_PLATFORM_DOLBY_VISION) + default: + break; +- } + } + } + +diff --git a/media/filters/audio_video_metadata_extractor.cc b/media/filters/audio_video_metadata_extractor.cc +index cb002490a6322bf..e841b4ad13383ac 100644 +--- a/media/filters/audio_video_metadata_extractor.cc ++++ b/media/filters/audio_video_metadata_extractor.cc +@@ -113,13 +113,16 @@ bool AudioVideoMetadataExtractor::Extract(DataSource* source, + if (!stream) + continue; + +- void* display_matrix = +- av_stream_get_side_data(stream, AV_PKT_DATA_DISPLAYMATRIX, nullptr); +- if (display_matrix) { +- rotation_ = VideoTransformation::FromFFmpegDisplayMatrix( +- static_cast(display_matrix)) +- .rotation; +- info.tags["rotate"] = base::NumberToString(rotation_); ++ for (int j = 0; j < stream->codecpar->nb_coded_side_data; j++) { ++ const AVPacketSideData& sd = stream->codecpar->coded_side_data[j]; ++ if (sd.type == AV_PKT_DATA_DISPLAYMATRIX) { ++ CHECK_EQ(sd.size, sizeof(int32_t) * 3 * 3); ++ rotation_ = VideoTransformation::FromFFmpegDisplayMatrix( ++ reinterpret_cast(sd.data)) ++ .rotation; ++ info.tags["rotate"] = base::NumberToString(rotation_); ++ break; ++ } + } + + // Extract dictionary from streams also. Needed for containers that attach diff --git a/www-client/thorium/files/fix-building-without-safebrowsing.patch b/www-client/thorium/files/fix-building-without-safebrowsing.patch new file mode 100644 index 0000000..4f165fb --- /dev/null +++ b/www-client/thorium/files/fix-building-without-safebrowsing.patch @@ -0,0 +1,3981 @@ +# Additional changes to Inox's fix-building-without-safebrowsing.patch + +--- a/chrome/browser/BUILD.gn ++++ b/chrome/browser/BUILD.gn +@@ -625,8 +625,6 @@ static_library("browser") { + "internal_auth.h", + "interstitials/chrome_settings_page_helper.cc", + "interstitials/chrome_settings_page_helper.h", +- "interstitials/enterprise_util.cc", +- "interstitials/enterprise_util.h", + "invalidation/profile_invalidation_provider_factory.cc", + "invalidation/profile_invalidation_provider_factory.h", + "k_anonymity_service/k_anonymity_service_client.cc", +@@ -3853,10 +3851,6 @@ static_library("browser") { + "new_tab_page/modules/modules_util.h", + "new_tab_page/modules/new_tab_page_modules.cc", + "new_tab_page/modules/new_tab_page_modules.h", +- "new_tab_page/modules/safe_browsing/safe_browsing_handler.cc", +- "new_tab_page/modules/safe_browsing/safe_browsing_handler.h", +- "new_tab_page/modules/safe_browsing/safe_browsing_prefs.cc", +- "new_tab_page/modules/safe_browsing/safe_browsing_prefs.h", + "new_tab_page/modules/v2/calendar/google_calendar_page_handler.cc", + "new_tab_page/modules/v2/calendar/google_calendar_page_handler.h", + "new_tab_page/modules/v2/most_relevant_tab_resumption/most_relevant_tab_resumption_page_handler.cc", +@@ -6712,8 +6706,6 @@ static_library("browser") { + + if (enterprise_cloud_content_analysis) { + sources += [ +- "enterprise/connectors/analysis/content_analysis_delegate.cc", +- "enterprise/connectors/analysis/content_analysis_delegate.h", + "enterprise/connectors/analysis/content_analysis_delegate_base.h", + "enterprise/connectors/analysis/content_analysis_dialog.cc", + "enterprise/connectors/analysis/content_analysis_dialog.h", +@@ -6721,8 +6713,6 @@ static_library("browser") { + "enterprise/connectors/analysis/content_analysis_downloads_delegate.h", + "enterprise/connectors/analysis/files_request_handler.cc", + "enterprise/connectors/analysis/files_request_handler.h", +- "enterprise/connectors/analysis/page_print_analysis_request.cc", +- "enterprise/connectors/analysis/page_print_analysis_request.h", + "enterprise/connectors/analysis/request_handler_base.cc", + "enterprise/connectors/analysis/request_handler_base.h", + "enterprise/connectors/reporting/browser_crash_event_router.cc", +@@ -7333,12 +7323,6 @@ static_library("browser") { + } + } + +- if (enterprise_content_analysis) { +- sources += [ +- "enterprise/data_protection/print_utils.cc", +- "enterprise/data_protection/print_utils.h", +- ] +- } + + if (enable_captive_portal_detection) { + sources += [ +@@ -8221,9 +8205,14 @@ static_library("browser") { + "//components/safe_browsing/content/browser:safe_browsing_blocking_page", + "//components/safe_browsing/content/browser/download:download_stats", + "//components/safe_browsing/content/common:file_type_policies", +- "//components/safe_browsing/content/common/proto:download_file_types_proto", ++ # "//components/safe_browsing/content/common/proto:download_file_types_proto", + ] + } ++ # Use download_file_types_proto regardless of safe_browsing_mode, for ++ # now... ++ deps += [ ++ "//components/safe_browsing/content/common/proto:download_file_types_proto", ++ ] + + if (build_with_tflite_lib) { + sources += [ +@@ -8518,7 +8507,6 @@ static_library("browser_generated_files" + "//chrome/browser/new_tab_page/chrome_colors:generate_chrome_colors_info", + "//chrome/browser/new_tab_page/chrome_colors:generate_colors_info", + "//chrome/browser/new_tab_page/modules/file_suggestion:mojo_bindings", +- "//chrome/browser/new_tab_page/modules/safe_browsing:mojo_bindings", + "//chrome/browser/new_tab_page/modules/v2/calendar:mojo_bindings", + "//chrome/browser/new_tab_page/modules/v2/most_relevant_tab_resumption:mojo_bindings", + "//chrome/browser/profile_resetter:profile_reset_report_proto", +--- a/chrome/browser/chrome_content_browser_client.cc ++++ b/chrome/browser/chrome_content_browser_client.cc +@@ -5545,11 +5545,13 @@ ChromeContentBrowserClient::CreateThrott + &throttles); + #endif + ++#if BUILDFLAG(FULL_SAFE_BROWSING) + if (base::FeatureList::IsEnabled(safe_browsing::kDelayedWarnings)) { + throttles.push_back( + std::make_unique( + handle)); + } ++#endif + + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) + MaybeAddThrottle(browser_switcher::BrowserSwitcherNavigationThrottle:: +@@ -7361,26 +7363,7 @@ ChromeContentBrowserClient::GetSafeBrows + const std::vector& allowlist_domains) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + +- // Should not bypass safe browsing check if the check is for enterprise +- // lookup. +- if (!safe_browsing_enabled_for_profile && !should_check_on_sb_disabled) +- return nullptr; +- +- // |safe_browsing_service_| may be unavailable in tests. +- if (safe_browsing_service_ && !safe_browsing_url_checker_delegate_) { +- safe_browsing_url_checker_delegate_ = +- base::MakeRefCounted( +- safe_browsing_service_->database_manager(), +- safe_browsing_service_->ui_manager()); +- } +- +- // Update allowlist domains. +- if (safe_browsing_url_checker_delegate_) { +- safe_browsing_url_checker_delegate_->SetPolicyAllowlistDomains( +- allowlist_domains); +- } +- +- return safe_browsing_url_checker_delegate_; ++ return nullptr; + } + + safe_browsing::RealTimeUrlLookupServiceBase* +@@ -7401,11 +7384,6 @@ ChromeContentBrowserClient::GetUrlLookup + GetForProfile(profile); + } + #endif +- +- if (is_consumer_lookup_enabled) { +- return safe_browsing::RealTimeUrlLookupServiceFactory::GetForProfile( +- profile); +- } + return nullptr; + } + +@@ -7417,34 +7395,7 @@ ChromeContentBrowserClient::GetAsyncChec + safe_browsing::hash_realtime_utils::HashRealTimeSelection + hash_realtime_selection, + content::FrameTreeNodeId frame_tree_node_id) { +- content::WebContents* contents = wc_getter.Run(); +- if (!contents || !safe_browsing_service_ || +- !safe_browsing_service_->ui_manager()) { + return nullptr; +- } +- if (is_enterprise_lookup_enabled) { +- // No async checks for enterprise real-time checks. URL filtering rules +- // need to be applied before the navigation is completed. +- return nullptr; +- } +- if (!is_consumer_lookup_enabled && +- hash_realtime_selection == +- safe_browsing::hash_realtime_utils::HashRealTimeSelection::kNone) { +- return nullptr; +- } +- if (prerender::ChromeNoStatePrefetchContentsDelegate::FromWebContents( +- contents) || +- contents->IsPrerenderedFrame(frame_tree_node_id)) { +- return nullptr; +- } +- if (!base::FeatureList::IsEnabled( +- safe_browsing::kSafeBrowsingAsyncRealTimeCheck)) { +- return nullptr; +- } +- return safe_browsing::AsyncCheckTracker::GetOrCreateForWebContents( +- contents, safe_browsing_service_->ui_manager().get(), +- safe_browsing::AsyncCheckTracker:: +- IsPlatformEligibleForSyncCheckerCheckAllowlist()); + } + + void ChromeContentBrowserClient::ReportLegacyTechEvent( +--- a/chrome/browser/download/bubble/download_bubble_ui_controller.cc ++++ b/chrome/browser/download/bubble/download_bubble_ui_controller.cc +@@ -31,7 +31,6 @@ + #include "chrome/browser/feature_engagement/tracker_factory.h" + #include "chrome/browser/offline_items_collection/offline_content_aggregator_factory.h" + #include "chrome/browser/profiles/profile_key.h" +-#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h" + #include "chrome/browser/safe_browsing/safe_browsing_service.h" + #include "chrome/browser/ui/browser.h" + #include "chrome/browser/ui/browser_finder.h" +@@ -46,7 +45,6 @@ + #include "components/feature_engagement/public/tracker.h" + #include "components/offline_items_collection/core/offline_content_aggregator.h" + #include "components/safe_browsing/core/common/features.h" +-#include "components/safe_browsing/core/common/safe_browsing_prefs.h" + #include "content/public/browser/download_item_utils.h" + #include "content/public/browser/download_manager.h" + +@@ -267,14 +265,6 @@ void DownloadBubbleUIController::Process + switch (command) { + case DownloadCommands::KEEP: + case DownloadCommands::DISCARD: { +- if (safe_browsing::IsSafeBrowsingSurveysEnabled(*profile_->GetPrefs())) { +- TrustSafetySentimentService* trust_safety_sentiment_service = +- TrustSafetySentimentServiceFactory::GetForProfile(profile_); +- if (trust_safety_sentiment_service) { +- trust_safety_sentiment_service->InteractedWithDownloadWarningUI( +- warning_surface, warning_action); +- } +- } + DownloadItemWarningData::AddWarningActionEvent(item, warning_surface, + warning_action); + // Launch a HaTS survey. Note this needs to come before the command is +@@ -293,8 +283,6 @@ void DownloadBubbleUIController::Process + break; + } + case DownloadCommands::REVIEW: +- model->ReviewScanningVerdict( +- browser_->tab_strip_model()->GetActiveWebContents()); + break; + case DownloadCommands::RETRY: + RetryDownload(model.get(), command); +@@ -439,6 +427,4 @@ DownloadBubbleUIController::GetWeakPtr() + } + + void DownloadBubbleUIController::SetDeepScanNoticeSeen() { +- profile_->GetPrefs()->SetBoolean( +- prefs::kSafeBrowsingAutomaticDeepScanningIPHSeen, true); + } +--- a/chrome/browser/download/chrome_download_manager_delegate.cc ++++ b/chrome/browser/download/chrome_download_manager_delegate.cc +@@ -163,7 +163,6 @@ using content::DownloadManager; + using download::DownloadItem; + using download::DownloadPathReservationTracker; + using download::PathValidationResult; +-using safe_browsing::DownloadFileType; + using ConnectionType = net::NetworkChangeNotifier::ConnectionType; + + #if BUILDFLAG(FULL_SAFE_BROWSING) +@@ -697,15 +696,6 @@ bool ChromeDownloadManagerDelegate::Shou + #endif + + bool should_open = download_prefs_->IsAutoOpenEnabled(url, path); +- int64_t file_type_uma_value = +- safe_browsing::FileTypePolicies::GetInstance()->UmaValueForFile(path); +- if (should_open) { +- base::UmaHistogramSparse("SBClientDownload.AutoOpenEnabledFileType", +- file_type_uma_value); +- } else { +- base::UmaHistogramSparse("SBClientDownload.AutoOpenDisabledFileType", +- file_type_uma_value); +- } + + return should_open; + } +@@ -1729,7 +1719,6 @@ void ChromeDownloadManagerDelegate::OnDo + DownloadItemModel model(item); + model.DetermineAndSetShouldPreferOpeningInBrowser( + target_info.target_path, target_info.is_filetype_handled_safely); +- model.SetDangerLevel(danger_level); + } + if (ShouldBlockFile(item, target_info.danger_type)) { + MaybeReportDangerousDownloadBlocked( +@@ -1816,49 +1805,21 @@ bool ChromeDownloadManagerDelegate::IsOp + if (allow_insecure_downloads_) { + return false; + } +- // Chrome-initiated background downloads should not be blocked. +- if (item && !item->RequireSafetyChecks()) { +- return false; +- } + + DownloadPrefs::DownloadRestriction download_restriction = + download_prefs_->download_restriction(); + +- if (IsDangerTypeBlocked(danger_type)) +- return true; +- +- bool file_type_dangerous = +- (item && DownloadItemModel(item).GetDangerLevel() != +- DownloadFileType::NOT_DANGEROUS); +- + switch (download_restriction) { + case (DownloadPrefs::DownloadRestriction::NONE): + return false; + +- case (DownloadPrefs::DownloadRestriction::POTENTIALLY_DANGEROUS_FILES): +- return danger_type != download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS || +- file_type_dangerous; +- +- case (DownloadPrefs::DownloadRestriction::DANGEROUS_FILES): { +- return (danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT || +- danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE || +- danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL || +- danger_type == +- download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE || +- file_type_dangerous); +- } +- +- case (DownloadPrefs::DownloadRestriction::MALICIOUS_FILES): { +- return (danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT || +- danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST || +- danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL || +- danger_type == +- download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE); +- } +- + case (DownloadPrefs::DownloadRestriction::ALL_FILES): + return true; + ++ // DownloadRestrictions policy key values 1, 2 and 4 treated as invalid ++ case (DownloadPrefs::DownloadRestriction::POTENTIALLY_DANGEROUS_FILES): ++ case (DownloadPrefs::DownloadRestriction::DANGEROUS_FILES): ++ case (DownloadPrefs::DownloadRestriction::MALICIOUS_FILES): + default: + LOG(ERROR) << "Invalid download restriction value: " + << static_cast(download_restriction); +@@ -1968,8 +1929,7 @@ void ChromeDownloadManagerDelegate::Chec + DCHECK(download_item); + DCHECK(download_item->IsSavePackageDownload()); + +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \ +- BUILDFLAG(IS_MAC) ++#if 0 + std::optional settings = + safe_browsing::DeepScanningRequest::ShouldUploadBinary(download_item); + +--- a/chrome/browser/download/download_item_model.cc ++++ b/chrome/browser/download/download_item_model.cc +@@ -952,30 +952,6 @@ void DownloadItemModel::ExecuteCommand(D + } + + TailoredWarningType DownloadItemModel::GetTailoredWarningType() const { +- if (!base::FeatureList::IsEnabled(safe_browsing::kDownloadTailoredWarnings)) { +- return TailoredWarningType::kNoTailoredWarning; +- } +- +- download::DownloadDangerType danger_type = GetDangerType(); +- TailoredVerdict tailored_verdict = safe_browsing::DownloadProtectionService:: +- GetDownloadProtectionTailoredVerdict(download_); +- if (danger_type == download::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT && +- tailored_verdict.tailored_verdict_type() == +- TailoredVerdict::SUSPICIOUS_ARCHIVE) { +- return TailoredWarningType::kSuspiciousArchive; +- } +- +- if (danger_type == +- download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE && +- tailored_verdict.tailored_verdict_type() == +- TailoredVerdict::COOKIE_THEFT) { +- if (base::Contains(tailored_verdict.adjustments(), +- TailoredVerdict::ACCOUNT_INFO_STRING)) { +- return TailoredWarningType::kCookieTheftWithAccountInfo; +- } +- return TailoredWarningType::kCookieTheft; +- } +- + return TailoredWarningType::kNoTailoredWarning; + } + +--- a/chrome/browser/download/download_stats.cc ++++ b/chrome/browser/download/download_stats.cc +@@ -11,6 +11,7 @@ + #include "chrome/browser/download/download_ui_model.h" + #include "components/download/public/common/download_content.h" + #include "components/profile_metrics/browser_profile_type.h" ++#include "components/safe_browsing/buildflags.h" + #include "components/safe_browsing/content/browser/download/download_stats.h" + + void RecordDownloadSource(ChromeDownloadSource source) { +@@ -33,9 +34,6 @@ void MaybeRecordDangerousDownloadWarning + base::UmaHistogramEnumeration("SBClientDownload.TailoredWarningType", + model.GetTailoredWarningType()); + #endif // BUILDFLAG(IS_ANDROID) +- safe_browsing::RecordDangerousDownloadWarningShown( +- model.GetDangerType(), model.GetTargetFilePath(), +- model.GetURL().SchemeIs(url::kHttpsScheme), model.HasUserGesture()); + + model.SetWasUIWarningShown(true); + } +--- a/chrome/browser/download/download_target_determiner.cc ++++ b/chrome/browser/download/download_target_determiner.cc +@@ -1024,12 +1024,6 @@ void DownloadTargetDeterminer::CheckVisi + bool visited_referrer_before) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); + DCHECK_EQ(STATE_DETERMINE_INTERMEDIATE_PATH, next_state_); +- safe_browsing::RecordDownloadFileTypeAttributes( +- safe_browsing::FileTypePolicies::GetInstance()->GetFileDangerLevel( +- virtual_path_.BaseName(), download_->GetURL(), +- GetProfile()->GetPrefs()), +- download_->HasUserGesture(), visited_referrer_before, +- GetLastDownloadBypassTimestamp()); + danger_level_ = GetDangerLevel( + visited_referrer_before ? VISITED_REFERRER : NO_VISITS_TO_REFERRER); + if (danger_level_ != DownloadFileType::NOT_DANGEROUS && +@@ -1314,14 +1308,7 @@ DownloadFileType::DangerLevel DownloadTa + + std::optional + DownloadTargetDeterminer::GetLastDownloadBypassTimestamp() const { +- safe_browsing::SafeBrowsingMetricsCollector* metrics_collector = +- safe_browsing::SafeBrowsingMetricsCollectorFactory::GetForProfile( +- GetProfile()); +- // metrics_collector can be null in incognito. +- return metrics_collector ? metrics_collector->GetLatestEventTimestamp( +- safe_browsing::SafeBrowsingMetricsCollector:: +- EventType::DANGEROUS_DOWNLOAD_BYPASS) +- : std::nullopt; ++ return std::nullopt; + } + + void DownloadTargetDeterminer::OnDownloadDestroyed( +--- a/chrome/browser/download/download_ui_safe_browsing_util.cc ++++ b/chrome/browser/download/download_ui_safe_browsing_util.cc +@@ -68,12 +68,6 @@ bool CanUserTurnOnSafeBrowsing(Profile* + void RecordDownloadDangerPromptHistogram( + const std::string& proceed_or_shown_suffix, + const download::DownloadItem& item) { +- int64_t file_type_uma_value = +- safe_browsing::FileTypePolicies::GetInstance()->UmaValueForFile( +- item.GetTargetFilePath()); +- base::UmaHistogramSparse( +- GetDangerPromptHistogramName(proceed_or_shown_suffix, item), +- file_type_uma_value); + } + + #if BUILDFLAG(FULL_SAFE_BROWSING) +@@ -98,23 +92,5 @@ void SendSafeBrowsingDownloadReport( + + bool ShouldShowDeepScanPromptNotice(Profile* profile, + download::DownloadDangerType danger_type) { +- if (danger_type != download::DOWNLOAD_DANGER_TYPE_PROMPT_FOR_SCANNING) { + return false; +- } +- +- if (!safe_browsing::IsEnhancedProtectionEnabled(*profile->GetPrefs())) { +- return false; +- } +- +- if (!base::FeatureList::IsEnabled( +- safe_browsing::kDeepScanningPromptRemoval)) { +- return false; +- } +- +- if (profile->GetPrefs()->GetBoolean( +- prefs::kSafeBrowsingAutomaticDeepScanPerformed)) { +- return false; +- } +- +- return true; + } +--- a/chrome/browser/download/download_warning_desktop_hats_utils.cc ++++ b/chrome/browser/download/download_warning_desktop_hats_utils.cc +@@ -33,7 +33,6 @@ + #include "components/prefs/pref_service.h" + #include "components/safe_browsing/buildflags.h" + #include "components/safe_browsing/core/common/features.h" +-#include "components/safe_browsing/core/common/safe_browsing_prefs.h" + #include "content/public/browser/download_item_utils.h" + + namespace { +@@ -111,17 +110,6 @@ std::string ElapsedTimeToSecondsString(b + return base::NumberToString(elapsed_time.InSeconds()); + } + +-std::string SafeBrowsingStateToString( +- safe_browsing::SafeBrowsingState sb_state) { +- switch (sb_state) { +- case safe_browsing::SafeBrowsingState::NO_SAFE_BROWSING: +- return "No Safe Browsing"; +- case safe_browsing::SafeBrowsingState::STANDARD_PROTECTION: +- return "Standard Protection"; +- case safe_browsing::SafeBrowsingState::ENHANCED_PROTECTION: +- return "Enhanced Protection"; +- } +-} + + // Produces a string consisting of comma-separated action events, each of which + // consists of the surface, action, and relative timestamp (ms) separated by +@@ -248,49 +236,21 @@ DownloadWarningHatsProductSpecificData:: + return psd; + } + +- psd.string_data_.insert( +- {Fields::kSafeBrowsingState, +- SafeBrowsingStateToString( +- safe_browsing::GetSafeBrowsingState(*profile->GetPrefs()))}); + + psd.bits_data_.insert({Fields::kPartialViewEnabled, + profile->GetPrefs()->GetBoolean( + prefs::kDownloadBubblePartialViewEnabled)}); + +- // URL and filename logged only for Safe Browsing users. +- if (safe_browsing::IsSafeBrowsingEnabled(*profile->GetPrefs())) { +- psd.string_data_.insert({Fields::kUrlDownload, +- download_item->GetURL().possibly_invalid_spec()}); +- psd.string_data_.insert( +- {Fields::kUrlReferrer, +- download_item->GetReferrerUrl().possibly_invalid_spec()}); +- psd.string_data_.insert( +- {Fields::kFilename, +- base::UTF16ToUTF8( +- download_item->GetFileNameToReportUser().LossyDisplayName())}); +- } else { + psd.string_data_.insert({Fields::kUrlDownload, kNotLoggedNoSafeBrowsing}); + psd.string_data_.insert({Fields::kUrlReferrer, kNotLoggedNoSafeBrowsing}); + psd.string_data_.insert({Fields::kFilename, kNotLoggedNoSafeBrowsing}); +- } + + // Interaction details logged only for ESB users. + std::optional + warning_first_shown_surface = + DownloadItemWarningData::WarningFirstShownSurface(download_item); +- if (warning_first_shown_surface && +- safe_browsing::IsEnhancedProtectionEnabled(*profile->GetPrefs())) { +- std::vector +- warning_action_events = +- DownloadItemWarningData::GetWarningActionEvents(download_item); +- psd.string_data_.insert( +- {Fields::kWarningInteractions, +- SerializeWarningActionEvents(*warning_first_shown_surface, +- warning_action_events)}); +- } else { + psd.string_data_.insert( + {Fields::kWarningInteractions, kNotLoggedNoEnhancedProtection}); +- } + + return psd; + } +@@ -482,40 +442,7 @@ bool CanShowDownloadWarningHatsSurvey(do + + std::optional MaybeGetDownloadWarningHatsTrigger( + DownloadWarningHatsType survey_type) { +- if (!base::FeatureList::IsEnabled(safe_browsing::kDownloadWarningSurvey)) { +- return std::nullopt; +- } +- +- const int eligible_survey_type = +- safe_browsing::kDownloadWarningSurveyType.Get(); +- +- // Configuration error. +- if (eligible_survey_type < 0 || +- eligible_survey_type > +- static_cast(DownloadWarningHatsType::kMaxValue)) { +- return std::nullopt; +- } +- +- // User is not assigned to be eligible for this type. +- if (static_cast(eligible_survey_type) != +- survey_type) { + return std::nullopt; +- } +- +- switch (survey_type) { +- case DownloadWarningHatsType::kDownloadBubbleBypass: +- return kHatsSurveyTriggerDownloadWarningBubbleBypass; +- case DownloadWarningHatsType::kDownloadBubbleHeed: +- return kHatsSurveyTriggerDownloadWarningBubbleHeed; +- case DownloadWarningHatsType::kDownloadBubbleIgnore: +- return kHatsSurveyTriggerDownloadWarningBubbleIgnore; +- case DownloadWarningHatsType::kDownloadsPageBypass: +- return kHatsSurveyTriggerDownloadWarningPageBypass; +- case DownloadWarningHatsType::kDownloadsPageHeed: +- return kHatsSurveyTriggerDownloadWarningPageHeed; +- case DownloadWarningHatsType::kDownloadsPageIgnore: +- return kHatsSurveyTriggerDownloadWarningPageIgnore; +- } + } + + base::TimeDelta GetIgnoreDownloadBubbleWarningDelay() { +--- a/chrome/browser/enterprise/connectors/analysis/analysis_service_settings.cc ++++ b/chrome/browser/enterprise/connectors/analysis/analysis_service_settings.cc +@@ -200,8 +200,6 @@ AnalysisSettings AnalysisServiceSettings + settings.block_large_files = block_large_files_; + if (is_cloud_analysis()) { + CloudAnalysisSettings cloud_settings; +- cloud_settings.analysis_url = +- GetRegionalizedEndpoint(analysis_config_->region_urls, data_region); + // We assume all support_tags structs have the same max file size. + cloud_settings.max_file_size = + analysis_config_->supported_tags[0].max_file_size; +--- a/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc ++++ b/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc +@@ -36,8 +36,6 @@ + #include "chrome/browser/profiles/profile.h" + #include "chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h" + #include "chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h" +-#include "chrome/browser/safe_browsing/cloud_content_scanning/file_analysis_request.h" +-#include "chrome/browser/safe_browsing/download_protection/check_client_download_request.h" + #include "chrome/grit/generated_resources.h" + #include "components/enterprise/buildflags/buildflags.h" + #include "components/enterprise/common/files_scan_data.h" +@@ -1117,16 +1115,6 @@ void ContentAnalysisDelegate::AckAllRequ + void ContentAnalysisDelegate::FinishLargeDataRequestEarly( + std::unique_ptr request, + safe_browsing::BinaryUploadService::Result result) { +- // We add the request here in case we never actually uploaded anything, so +- // it wasn't added in OnGetRequestData +- safe_browsing::WebUIInfoSingleton::GetInstance()->AddToDeepScanRequests( +- request->per_profile_request(), /*access_token*/ "", /*upload_info*/ +- "Skipped - Large data blocked", /*upload_url*/ "", +- request->content_analysis_request()); +- safe_browsing::WebUIInfoSingleton::GetInstance()->AddToDeepScanResponses( +- /*token=*/"", safe_browsing::BinaryUploadService::ResultToString(result), +- enterprise_connectors::ContentAnalysisResponse()); +- + request->FinishRequest(result, + enterprise_connectors::ContentAnalysisResponse()); + } +--- a/chrome/browser/enterprise/connectors/analysis/content_analysis_downloads_delegate.cc ++++ b/chrome/browser/enterprise/connectors/analysis/content_analysis_downloads_delegate.cc +@@ -123,7 +123,7 @@ ContentAnalysisDownloadsDelegate::GetCus + } + + bool ContentAnalysisDownloadsDelegate::BypassRequiresJustification() const { +- return bypass_justification_required_; ++ return false; + } + + std::u16string ContentAnalysisDownloadsDelegate::GetBypassJustificationLabel() +--- a/chrome/browser/enterprise/connectors/analysis/files_request_handler.cc ++++ b/chrome/browser/enterprise/connectors/analysis/files_request_handler.cc +@@ -175,52 +175,12 @@ void FilesRequestHandler::FileRequestCal + } + + bool FilesRequestHandler::UploadDataImpl() { +- safe_browsing::IncrementCrashKey( +- safe_browsing::ScanningCrashKey::PENDING_FILE_UPLOADS, paths_.size()); +- +- if (!paths_.empty()) { +- safe_browsing::IncrementCrashKey( +- safe_browsing::ScanningCrashKey::TOTAL_FILE_UPLOADS, paths_.size()); +- +- std::vector tasks( +- paths_.size()); +- for (size_t i = 0; i < paths_.size(); ++i) +- tasks[i].request = PrepareFileRequest(i); +- +- file_access::RequestFilesAccessForSystem( +- paths_, +- base::BindOnce(&FilesRequestHandler::CreateFileOpeningJob, +- weak_ptr_factory_.GetWeakPtr(), std::move(tasks))); +- +- return true; +- } +- + // If zero files were passed to the FilesRequestHandler, we call the callback + // directly. + MaybeCompleteScanRequest(); + return false; + } + +-safe_browsing::FileAnalysisRequest* FilesRequestHandler::PrepareFileRequest( +- size_t index) { +- DCHECK_LT(index, paths_.size()); +- base::FilePath path = paths_[index]; +- auto request = std::make_unique( +- *analysis_settings_, path, path.BaseName(), /*mime_type*/ "", +- /* delay_opening_file */ true, +- base::BindOnce(&FilesRequestHandler::FileRequestCallback, +- weak_ptr_factory_.GetWeakPtr(), index), +- base::BindOnce(&FilesRequestHandler::FileRequestStartCallback, +- weak_ptr_factory_.GetWeakPtr(), index)); +- safe_browsing::FileAnalysisRequest* request_raw = request.get(); +- PrepareRequest(AccessPointToEnterpriseConnector(access_point_), request_raw); +- request_raw->GetRequestData(base::BindOnce( +- &FilesRequestHandler::OnGotFileInfo, weak_ptr_factory_.GetWeakPtr(), +- std::move(request), index)); +- +- return request_raw; +-} +- + void FilesRequestHandler::OnGotFileInfo( + std::unique_ptr request, + size_t index, +@@ -269,15 +229,6 @@ void FilesRequestHandler::OnGotFileInfo( + void FilesRequestHandler::FinishRequestEarly( + std::unique_ptr request, + safe_browsing::BinaryUploadService::Result result) { +- // We add the request here in case we never actually uploaded anything, so it +- // wasn't added in OnGetRequestData +- safe_browsing::WebUIInfoSingleton::GetInstance()->AddToDeepScanRequests( +- request->per_profile_request(), /*access_token*/ "", /*upload_info*/ "", +- /*upload_url=*/"", request->content_analysis_request()); +- safe_browsing::WebUIInfoSingleton::GetInstance()->AddToDeepScanResponses( +- /*token=*/"", safe_browsing::BinaryUploadService::ResultToString(result), +- enterprise_connectors::ContentAnalysisResponse()); +- + request->FinishRequest(result, + enterprise_connectors::ContentAnalysisResponse()); + } +--- a/chrome/browser/enterprise/connectors/analysis/files_request_handler.h ++++ b/chrome/browser/enterprise/connectors/analysis/files_request_handler.h +@@ -123,10 +123,6 @@ class FilesRequestHandler : public Reque + enterprise_connectors::ContentAnalysisResponse response); + + private: +- // Prepares an upload request for the file at `path`. If the file +- // cannot be uploaded it will have a failure verdict added to `result_`. +- safe_browsing::FileAnalysisRequest* PrepareFileRequest(size_t index); +- + // Called when the file info for `path` has been fetched. Also begins the + // upload process. + void OnGotFileInfo( +--- a/chrome/browser/enterprise/connectors/common.cc ++++ b/chrome/browser/enterprise/connectors/common.cc +@@ -342,7 +342,7 @@ void ShowDownloadReviewDialog(const std: + bool IsResumableUpload(const BinaryUploadService::Request& request) { + // Currently resumable upload doesn't support paste or LBUS. If one day we do, + // we should update the logic here as well. +- return !safe_browsing::IsConsumerScanRequest(request) && ++ return + request.cloud_or_local_settings().is_cloud_analysis() && + request.content_analysis_request().analysis_connector() != + enterprise_connectors::AnalysisConnector::BULK_DATA_ENTRY && +@@ -395,57 +395,6 @@ void ReportDataMaskingEvent( + content::BrowserContext* browser_context, + extensions::api::enterprise_reporting_private::DataMaskingEvent + data_masking_event) { +- CHECK(browser_context); +- +- auto* reporting_client = +- enterprise_connectors::RealtimeReportingClientFactory::GetForProfile( +- browser_context); +- std::optional settings = +- reporting_client->GetReportingSettings(); +- if (!settings.has_value() || +- !base::Contains(settings->enabled_event_names, +- enterprise_connectors::kKeySensitiveDataEvent)) { +- return; +- } +- +- base::Value::Dict event; +- event.Set(extensions::SafeBrowsingPrivateEventRouter::kKeyUrl, +- data_masking_event.url); +- event.Set(extensions::SafeBrowsingPrivateEventRouter::kKeyTabUrl, +- std::move(data_masking_event.url)); +- event.Set(extensions::SafeBrowsingPrivateEventRouter::kKeyEventResult, +- EventResultToString(data_masking_event.event_result)); +- +- base::Value::List triggered_rule_info; +- triggered_rule_info.reserve(data_masking_event.triggered_rule_info.size()); +- for (auto& rule : data_masking_event.triggered_rule_info) { +- base::Value::Dict triggered_rule; +- triggered_rule.Set( +- extensions::SafeBrowsingPrivateEventRouter::kKeyTriggeredRuleId, +- std::move(rule.rule_id)); +- triggered_rule.Set( +- extensions::SafeBrowsingPrivateEventRouter::kKeyTriggeredRuleName, +- std::move(rule.rule_name)); +- +- base::Value::List matched_detectors; +- for (auto& detector : rule.matched_detectors) { +- base::Value::Dict detector_value; +- detector_value.Set(kKeyDetectorId, std::move(detector.detector_id)); +- detector_value.Set(kKeyDisplayName, std::move(detector.display_name)); +- detector_value.Set(kKeyDetectorType, +- DetectorTypeToString(detector.detector_type)); +- matched_detectors.Append(std::move(detector_value)); +- } +- triggered_rule.Set(kKeyMatchedDetectors, std::move(matched_detectors)); +- +- triggered_rule_info.Append(std::move(triggered_rule)); +- } +- event.Set(extensions::SafeBrowsingPrivateEventRouter::kKeyTriggeredRuleInfo, +- std::move(triggered_rule_info)); +- +- reporting_client->ReportRealtimeEvent( +- enterprise_connectors::kKeySensitiveDataEvent, +- std::move(settings.value()), std::move(event)); + } + #endif // BUILDFLAG(ENABLE_EXTENSIONS) + +--- a/chrome/browser/enterprise/connectors/connectors_manager.cc ++++ b/chrome/browser/enterprise/connectors/connectors_manager.cc +@@ -317,16 +317,7 @@ std::vector Conne + } + + DataRegion ConnectorsManager::GetDataRegion() const { +-#if BUILDFLAG(IS_ANDROID) + return DataRegion::NO_PREFERENCE; +-#else +- bool apply_data_region = +- prefs()->HasPrefPath(prefs::kChromeDataRegionSetting) && +- base::FeatureList::IsEnabled(safe_browsing::kDlpRegionalizedEndpoints); +- return apply_data_region ? ChromeDataRegionSettingToEnum(prefs()->GetInteger( +- prefs::kChromeDataRegionSetting)) +- : DataRegion::NO_PREFERENCE; +-#endif + } + + void ConnectorsManager::StartObservingPrefs(PrefService* pref_service) { +--- a/chrome/browser/enterprise/connectors/connectors_service.cc ++++ b/chrome/browser/enterprise/connectors/connectors_service.cc +@@ -428,22 +428,7 @@ std::string ConnectorsService::GetManage + } + + std::string ConnectorsService::GetRealTimeUrlCheckIdentifier() const { +- auto dm_token = GetDmToken(kEnterpriseRealTimeUrlCheckScope); +- if (!dm_token) { + return std::string(); +- } +- +- Profile* profile = Profile::FromBrowserContext(context_); +- if (dm_token->scope == policy::POLICY_SCOPE_MACHINE) { +- return GetClientId(profile); +- } +- +- auto* identity_manager = IdentityManagerFactory::GetForProfile(profile); +- if (!identity_manager) { +- return std::string(); +- } +- +- return GetProfileEmail(identity_manager); + } + + ConnectorsManager* ConnectorsService::ConnectorsManagerForTesting() { +--- a/chrome/browser/enterprise/connectors/device_trust/signals/decorators/common/context_signals_decorator.cc ++++ b/chrome/browser/enterprise/connectors/device_trust/signals/decorators/common/context_signals_decorator.cc +@@ -26,25 +26,6 @@ enum class PasswordProtectionTrigger { + kPhisingReuse = 3 + }; + +-PasswordProtectionTrigger ConvertPasswordProtectionTrigger( +- const std::optional& +- policy_value) { +- if (!policy_value) { +- return PasswordProtectionTrigger::kUnset; +- } +- +- switch (policy_value.value()) { +- case safe_browsing::PASSWORD_PROTECTION_OFF: +- return PasswordProtectionTrigger::kOff; +- case safe_browsing::PASSWORD_REUSE: +- return PasswordProtectionTrigger::kPasswordReuse; +- case safe_browsing::PHISHING_REUSE: +- return PasswordProtectionTrigger::kPhisingReuse; +- case safe_browsing::PASSWORD_PROTECTION_TRIGGER_MAX: +- NOTREACHED_IN_MIGRATION(); +- return PasswordProtectionTrigger::kUnset; +- } +-} + + } // namespace + +@@ -74,16 +55,8 @@ void ContextSignalsDecorator::OnSignalsF + ToListValue(context_info.browser_affiliation_ids)); + signals.Set(device_signals::names::kProfileAffiliationIds, + ToListValue(context_info.profile_affiliation_ids)); +- signals.Set(device_signals::names::kRealtimeUrlCheckMode, +- static_cast(context_info.realtime_url_check_mode)); +- signals.Set( +- device_signals::names::kSafeBrowsingProtectionLevel, +- static_cast(context_info.safe_browsing_protection_level)); + signals.Set(device_signals::names::kSiteIsolationEnabled, + context_info.site_isolation_enabled); +- signals.Set(device_signals::names::kPasswordProtectionWarningTrigger, +- static_cast(ConvertPasswordProtectionTrigger( +- context_info.password_protection_warning_trigger))); + signals.Set(device_signals::names::kChromeRemoteDesktopAppBlocked, + context_info.chrome_remote_desktop_app_blocked); + signals.Set(device_signals::names::kBuiltInDnsClientEnabled, +--- a/chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.cc ++++ b/chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.cc +@@ -501,17 +501,7 @@ void RealtimeReportingClient::ReportEven + } + + std::string RealtimeReportingClient::GetProfileUserName() const { +- std::string username = +- identity_manager_ ? GetProfileEmail(identity_manager_) : std::string(); +- +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) +- if (username.empty()) { +- username = Profile::FromBrowserContext(context_)->GetPrefs()->GetString( +- enterprise_signin::prefs::kProfileUserEmail); +- } +-#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) +- +- return username; ++ return std::string(); + } + + std::string RealtimeReportingClient::GetProfileIdentifier() const { +--- a/chrome/browser/enterprise/data_controls/reporting_service.cc ++++ b/chrome/browser/enterprise/data_controls/reporting_service.cc +@@ -124,10 +124,6 @@ void ReportingService::ReportPaste( + const content::ClipboardEndpoint& destination, + const content::ClipboardMetadata& metadata, + const Verdict& verdict) { +- ReportCopyOrPaste( +- source, destination, metadata, verdict, +- extensions::SafeBrowsingPrivateEventRouter::kTriggerWebContentUpload, +- GetEventResult(verdict.level())); + } + + void ReportingService::ReportPasteWarningBypassed( +@@ -135,29 +131,17 @@ void ReportingService::ReportPasteWarnin + const content::ClipboardEndpoint& destination, + const content::ClipboardMetadata& metadata, + const Verdict& verdict) { +- ReportCopyOrPaste( +- source, destination, metadata, verdict, +- extensions::SafeBrowsingPrivateEventRouter::kTriggerWebContentUpload, +- safe_browsing::EventResult::BYPASSED); + } + + void ReportingService::ReportCopy(const content::ClipboardEndpoint& source, + const content::ClipboardMetadata& metadata, + const Verdict& verdict) { +- ReportCopyOrPaste( +- source, /*destination=*/std::nullopt, metadata, verdict, +- extensions::SafeBrowsingPrivateEventRouter::kTriggerClipboardCopy, +- GetEventResult(verdict.level())); + } + + void ReportingService::ReportCopyWarningBypassed( + const content::ClipboardEndpoint& source, + const content::ClipboardMetadata& metadata, + const Verdict& verdict) { +- ReportCopyOrPaste( +- source, /*destination=*/std::nullopt, metadata, verdict, +- extensions::SafeBrowsingPrivateEventRouter::kTriggerClipboardCopy, +- safe_browsing::EventResult::BYPASSED); + } + + void ReportingService::ReportCopyOrPaste( +@@ -167,45 +151,6 @@ void ReportingService::ReportCopyOrPaste + const Verdict& verdict, + const std::string& trigger, + safe_browsing::EventResult event_result) { +- auto* router = +- extensions::SafeBrowsingPrivateEventRouterFactory::GetForProfile( +- &profile_.get()); +- +- if (!router || verdict.triggered_rules().empty()) { +- return; +- } +- +- GURL url; +- std::string destination_string; +- std::string source_string; +- if (trigger == +- extensions::SafeBrowsingPrivateEventRouter::kTriggerWebContentUpload) { +- DCHECK(destination.has_value()); +- +- url = GetURL(*destination); +- destination_string = url.spec(); +- source_string = GetClipboardSourceString(source, *destination, +- kDataControlsRulesScopePref); +- } else { +- DCHECK_EQ( +- trigger, +- extensions::SafeBrowsingPrivateEventRouter::kTriggerClipboardCopy); +- DCHECK(!destination.has_value()); +- +- url = GetURL(source); +- source_string = GetURL(source).spec(); +- } +- +- router->OnDataControlsSensitiveDataEvent( +- /*url=*/url, +- /*tab_url=*/url, +- /*source=*/source_string, +- /*destination=*/destination_string, +- /*mime_type=*/GetMimeType(metadata.format_type), +- /*trigger=*/trigger, +- /*triggered_rules=*/verdict.triggered_rules(), +- /*event_result=*/event_result, +- /*content_size=*/metadata.size.value_or(-1)); + } + + // -------------------------------------- +@@ -235,7 +180,6 @@ ReportingServiceFactory::ReportingServic + .WithSystem(ProfileSelection::kNone) + .WithAshInternals(ProfileSelection::kNone) + .Build()) { +- DependsOn(extensions::SafeBrowsingPrivateEventRouterFactory::GetInstance()); + } + + ReportingServiceFactory::~ReportingServiceFactory() = default; +--- a/chrome/browser/enterprise/data_protection/data_protection_clipboard_utils.cc ++++ b/chrome/browser/enterprise/data_protection/data_protection_clipboard_utils.cc +@@ -153,41 +153,7 @@ void PasteIfAllowedByContentAnalysis( + return; + } + +- Profile* profile = Profile::FromBrowserContext(destination.browser_context()); +- if (!profile) { + std::move(callback).Run(std::move(clipboard_paste_data)); +- return; +- } +- +- bool is_files = +- metadata.format_type == ui::ClipboardFormatType::FilenamesType(); +- enterprise_connectors::AnalysisConnector connector = +- is_files ? enterprise_connectors::AnalysisConnector::FILE_ATTACHED +- : enterprise_connectors::AnalysisConnector::BULK_DATA_ENTRY; +- enterprise_connectors::ContentAnalysisDelegate::Data dialog_data; +- +- if (!enterprise_connectors::ContentAnalysisDelegate::IsEnabled( +- profile, *destination.data_transfer_endpoint()->GetURL(), +- &dialog_data, connector)) { +- std::move(callback).Run(std::move(clipboard_paste_data)); +- return; +- } +- +- dialog_data.reason = +- enterprise_connectors::ContentAnalysisRequest::CLIPBOARD_PASTE; +- dialog_data.clipboard_source = +- data_controls::ReportingService::GetClipboardSourceString( +- source, destination, +- enterprise_connectors::kOnBulkDataEntryScopePref); +- +- if (is_files) { +- dialog_data.paths = std::move(clipboard_paste_data.file_paths); +- HandleFileData(web_contents, std::move(dialog_data), std::move(callback)); +- } else { +- dialog_data.AddClipboardData(clipboard_paste_data); +- HandleStringData(web_contents, std::move(clipboard_paste_data), +- std::move(dialog_data), std::move(callback)); +- } + } + #endif // BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) + +--- a/chrome/browser/enterprise/data_protection/data_protection_navigation_observer.cc ++++ b/chrome/browser/enterprise/data_protection/data_protection_navigation_observer.cc +@@ -68,12 +68,6 @@ void RunPendingNavigationCallback( + auto* user_data = GetUserData(web_contents); + DCHECK(user_data); + +- if (ShouldReportSafeUrlFilteringEvents(user_data)) { +- MaybeTriggerUrlFilteringInterstitialEvent( +- web_contents, web_contents->GetLastCommittedURL(), +- /*threat_type=*/"", *user_data->rt_lookup_response()); +- } +- + std::move(callback).Run(user_data->settings()); + } + +@@ -176,9 +170,7 @@ void LogVerdictSource( + + bool IsScreenshotAllowedByDataControls(content::BrowserContext* context, + const GURL& url) { +- auto* rules = data_controls::ChromeRulesServiceFactory::GetInstance() +- ->GetForBrowserContext(context); +- return rules ? !rules->BlockScreenshots(url) : true; ++ return true; + } + + } // namespace +@@ -207,16 +199,6 @@ void DataProtectionNavigationObserver::C + std::move(callback).Run(UrlSettings::None()); + return; + } +- +- // ChromeEnterpriseRealTimeUrlLookupServiceFactory::GetForProfile() return +- // nullptr if enterprise policies are not set. In this case data protections +- // will be based on data controls alone, +- enterprise_data_protection::DataProtectionNavigationObserver:: +- CreateForNavigationHandle( +- *navigation_handle, +- safe_browsing::ChromeEnterpriseRealTimeUrlLookupServiceFactory:: +- GetForProfile(profile), +- navigation_handle->GetWebContents(), std::move(callback)); + } + + // static +@@ -252,35 +234,9 @@ void DataProtectionNavigationObserver::G + web_contents->GetLastCommittedURL())); + } + +- auto* lookup_service = +- g_lookup_service +- ? g_lookup_service +- : safe_browsing::ChromeEnterpriseRealTimeUrlLookupServiceFactory:: +- GetForProfile(profile); +- if (lookup_service && IsEnterpriseLookupEnabled(profile)) { +- auto lookup_callback = base::BindOnce( +- [](const std::string& identifier, +- DataProtectionNavigationObserver::Callback callback, +- base::WeakPtr web_contents, +- std::unique_ptr response) { +- if (web_contents) { +- DataProtectionPageUserData::UpdateRTLookupResponse( +- GetPageFromWebContents(web_contents.get()), identifier, +- std::move(response)); +- auto* user_data = GetUserData(web_contents.get()); +- DCHECK(user_data); +- std::move(callback).Run(user_data->settings()); +- } +- }, +- std::move(identifier), std::move(callback), web_contents->GetWeakPtr()); +- +- DoLookup(lookup_service, web_contents->GetLastCommittedURL(), +- GetIdentifier(profile), std::move(lookup_callback), web_contents); +- } else { + ud = GetUserData(web_contents); + DCHECK(ud); + std::move(callback).Run(ud->settings()); +- } + } + + // static +--- a/chrome/browser/enterprise/signals/context_info_fetcher.cc ++++ b/chrome/browser/enterprise/signals/context_info_fetcher.cc +@@ -227,7 +227,6 @@ void ContextInfoFetcher::Fetch(ContextIn + GetAnalysisConnectorProviders(enterprise_connectors::BULK_DATA_ENTRY); + info.on_print_providers = + GetAnalysisConnectorProviders(enterprise_connectors::PRINT); +- info.realtime_url_check_mode = GetRealtimeUrlCheckMode(); + info.on_security_event_providers = GetOnSecurityEventProviders(); + info.browser_version = version_info::GetVersionNumber(); + info.site_isolation_enabled = +@@ -284,11 +283,6 @@ std::vector ContextInfoFetc + return connectors_service_->GetAnalysisServiceProviderNames(connector); + } + +-enterprise_connectors::EnterpriseRealTimeUrlCheckMode +-ContextInfoFetcher::GetRealtimeUrlCheckMode() { +- return connectors_service_->GetAppliedRealTimeUrlCheck(); +-} +- + std::vector ContextInfoFetcher::GetOnSecurityEventProviders() { + return connectors_service_->GetReportingServiceProviderNames( + enterprise_connectors::ReportingConnector::SECURITY_EVENT); +--- a/chrome/browser/enterprise/signals/context_info_fetcher.h ++++ b/chrome/browser/enterprise/signals/context_info_fetcher.h +@@ -6,6 +6,7 @@ + #define CHROME_BROWSER_ENTERPRISE_SIGNALS_CONTEXT_INFO_FETCHER_H_ + + #include ++#include + #include + + #include "base/functional/callback_forward.h" +@@ -40,7 +41,6 @@ struct ContextInfo { + std::vector on_bulk_data_entry_providers; + std::vector on_print_providers; + std::vector on_security_event_providers; +- enterprise_connectors::EnterpriseRealTimeUrlCheckMode realtime_url_check_mode; + std::string browser_version; + safe_browsing::SafeBrowsingState safe_browsing_protection_level; + bool site_isolation_enabled; +@@ -91,8 +91,6 @@ class ContextInfoFetcher { + std::vector GetAnalysisConnectorProviders( + enterprise_connectors::AnalysisConnector connector); + +- enterprise_connectors::EnterpriseRealTimeUrlCheckMode +- GetRealtimeUrlCheckMode(); + + std::vector GetOnSecurityEventProviders(); + +--- a/chrome/browser/enterprise/signals/signals_utils.cc ++++ b/chrome/browser/enterprise/signals/signals_utils.cc +@@ -33,24 +33,6 @@ bool IsURLBlocked(const GURL& url, Polic + + } // namespace + +-safe_browsing::SafeBrowsingState GetSafeBrowsingProtectionLevel( +- PrefService* profile_prefs) { +- DCHECK(profile_prefs); +- bool safe_browsing_enabled = +- profile_prefs->GetBoolean(prefs::kSafeBrowsingEnabled); +- bool safe_browsing_enhanced_enabled = +- profile_prefs->GetBoolean(prefs::kSafeBrowsingEnhanced); +- +- if (safe_browsing_enabled) { +- if (safe_browsing_enhanced_enabled) +- return safe_browsing::SafeBrowsingState::ENHANCED_PROTECTION; +- else +- return safe_browsing::SafeBrowsingState::STANDARD_PROTECTION; +- } else { +- return safe_browsing::SafeBrowsingState::NO_SAFE_BROWSING; +- } +-} +- + std::optional GetThirdPartyBlockingEnabled(PrefService* local_state) { + DCHECK(local_state); + #if BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING) +@@ -65,15 +47,6 @@ bool GetBuiltInDnsClientEnabled(PrefServ + return local_state->GetBoolean(prefs::kBuiltInDnsClientEnabled); + } + +-std::optional +-GetPasswordProtectionWarningTrigger(PrefService* profile_prefs) { +- DCHECK(profile_prefs); +- if (!profile_prefs->HasPrefPath(prefs::kPasswordProtectionWarningTrigger)) +- return std::nullopt; +- return static_cast( +- profile_prefs->GetInteger(prefs::kPasswordProtectionWarningTrigger)); +-} +- + bool GetChromeRemoteDesktopAppBlocked(PolicyBlocklistService* service) { + DCHECK(service); + return IsURLBlocked(GURL("https://remotedesktop.google.com"), service) || +--- a/chrome/browser/enterprise/signals/signals_utils.h ++++ b/chrome/browser/enterprise/signals/signals_utils.h +@@ -19,12 +19,6 @@ std::optional GetThirdPartyBlockin + + bool GetBuiltInDnsClientEnabled(PrefService* local_state); + +-std::optional +-GetPasswordProtectionWarningTrigger(PrefService* profile_prefs); +- +-safe_browsing::SafeBrowsingState GetSafeBrowsingProtectionLevel( +- PrefService* profile_prefs); +- + bool GetChromeRemoteDesktopAppBlocked(PolicyBlocklistService* service); + + } // namespace utils +--- a/chrome/browser/extensions/BUILD.gn ++++ b/chrome/browser/extensions/BUILD.gn +@@ -259,10 +259,6 @@ source_set("extensions") { + "api/resources_private/resources_private_api.h", + "api/runtime/chrome_runtime_api_delegate.cc", + "api/runtime/chrome_runtime_api_delegate.h", +- "api/safe_browsing_private/safe_browsing_private_event_router.cc", +- "api/safe_browsing_private/safe_browsing_private_event_router.h", +- "api/safe_browsing_private/safe_browsing_private_event_router_factory.cc", +- "api/safe_browsing_private/safe_browsing_private_event_router_factory.h", + "api/search/search_api.cc", + "api/search/search_api.h", + "api/sessions/session_id.cc", +@@ -590,8 +586,6 @@ source_set("extensions") { + "mv2_experiment_stage.h", + "navigation_extension_enabler.cc", + "navigation_extension_enabler.h", +- "omaha_attributes_handler.cc", +- "omaha_attributes_handler.h", + "pack_extension_job.cc", + "pack_extension_job.h", + "pending_extension_info.cc", +--- a/chrome/browser/extensions/api/api_browser_context_keyed_service_factories.cc ++++ b/chrome/browser/extensions/api/api_browser_context_keyed_service_factories.cc +@@ -112,7 +112,6 @@ void EnsureApiBrowserContextKeyedService + #endif + extensions::ProcessesAPI::GetFactoryInstance(); + extensions::ReadingListEventRouter::GetFactoryInstance(); +- extensions::SafeBrowsingPrivateEventRouterFactory::GetInstance(); + extensions::SessionsAPI::GetFactoryInstance(); + extensions::SettingsPrivateEventRouterFactory::GetInstance(); + extensions::SettingsOverridesAPI::GetFactoryInstance(); +--- a/chrome/browser/extensions/api/cookies/cookies_api.cc ++++ b/chrome/browser/extensions/api/cookies/cookies_api.cc +@@ -333,19 +333,6 @@ void CookiesGetFunction::GetCookieListCa + } + + void CookiesGetFunction::NotifyExtensionTelemetry() { +- auto* telemetry_service = +- safe_browsing::ExtensionTelemetryServiceFactory::GetForProfile( +- Profile::FromBrowserContext(browser_context())); +- +- if (!telemetry_service || !telemetry_service->enabled()) { +- return; +- } +- +- auto cookies_get_signal = std::make_unique( +- extension_id(), parsed_args_->details.name, +- parsed_args_->details.store_id.value_or(std::string()), +- parsed_args_->details.url, js_callstack().value_or(StackTrace())); +- telemetry_service->AddSignal(std::move(cookies_get_signal)); + } + + CookiesGetAllFunction::CookiesGetAllFunction() { +@@ -439,24 +426,6 @@ void CookiesGetAllFunction::GetCookieLis + } + + void CookiesGetAllFunction::NotifyExtensionTelemetry() { +- auto* telemetry_service = +- safe_browsing::ExtensionTelemetryServiceFactory::GetForProfile( +- Profile::FromBrowserContext(browser_context())); +- +- if (!telemetry_service || !telemetry_service->enabled()) { +- return; +- } +- +- auto cookies_get_all_signal = +- std::make_unique( +- extension_id(), parsed_args_->details.domain.value_or(std::string()), +- parsed_args_->details.name.value_or(std::string()), +- parsed_args_->details.path.value_or(std::string()), +- parsed_args_->details.secure, +- parsed_args_->details.store_id.value_or(std::string()), +- parsed_args_->details.url.value_or(std::string()), +- parsed_args_->details.session, js_callstack().value_or(StackTrace())); +- telemetry_service->AddSignal(std::move(cookies_get_all_signal)); + } + + CookiesSetFunction::CookiesSetFunction() +--- a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc ++++ b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc +@@ -101,16 +101,8 @@ api::enterprise_reporting_private::Conte + info.third_party_blocking_enabled = signals.third_party_blocking_enabled; + info.os_firewall = ToInfoSettingValue(signals.os_firewall); + info.system_dns_servers = std::move(signals.system_dns_servers); +- switch (signals.realtime_url_check_mode) { +- case enterprise_connectors::REAL_TIME_CHECK_DISABLED: + info.realtime_url_check_mode = extensions::api:: + enterprise_reporting_private::RealtimeUrlCheckMode::kDisabled; +- break; +- case enterprise_connectors::REAL_TIME_CHECK_FOR_MAINFRAME_ENABLED: +- info.realtime_url_check_mode = extensions::api:: +- enterprise_reporting_private::RealtimeUrlCheckMode::kEnabledMainFrame; +- break; +- } + info.browser_version = std::move(signals.browser_version); + info.built_in_dns_client_enabled = signals.built_in_dns_client_enabled; + info.enterprise_profile_id = signals.enterprise_profile_id; +--- a/chrome/browser/extensions/api/tabs/tabs_api.cc ++++ b/chrome/browser/extensions/api/tabs/tabs_api.cc +@@ -423,30 +423,6 @@ void NotifyExtensionTelemetry(Profile* p + const std::string& current_url, + const std::string& new_url, + const std::optional& js_callstack) { +- // Ignore API calls that are not invoked by extensions. +- if (!extension) { +- return; +- } +- +- auto* extension_telemetry_service = +- safe_browsing::ExtensionTelemetryService::Get(profile); +- +- if (!extension_telemetry_service || !extension_telemetry_service->enabled() || +- !base::FeatureList::IsEnabled( +- safe_browsing::kExtensionTelemetryTabsApiSignal)) { +- return; +- } +- +- if (api_method == safe_browsing::TabsApiInfo::CAPTURE_VISIBLE_TAB && +- !base::FeatureList::IsEnabled( +- safe_browsing::kExtensionTelemetryTabsApiSignalCaptureVisibleTab)) { +- return; +- } +- +- auto tabs_api_signal = std::make_unique( +- extension->id(), api_method, current_url, new_url, +- js_callstack.value_or(StackTrace())); +- extension_telemetry_service->AddSignal(std::move(tabs_api_signal)); + } + + } // namespace +--- a/chrome/browser/extensions/blocklist.cc ++++ b/chrome/browser/extensions/blocklist.cc +@@ -185,20 +185,8 @@ Blocklist* Blocklist::Get(content::Brows + void Blocklist::GetBlocklistedIDs(const std::set& ids, + GetBlocklistedIDsCallback callback) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); +- +- if (ids.empty() || !GetDatabaseManager().get()) { + base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask( + FROM_HERE, base::BindOnce(std::move(callback), BlocklistStateMap())); +- return; +- } +- +- // Constructing the SafeBrowsingClientImpl begins the process of asking +- // safebrowsing for the blocklisted extensions. The set of blocklisted +- // extensions returned by SafeBrowsing will then be passed to +- // GetBlocklistStateIDs to get the particular BlocklistState for each id. +- SafeBrowsingClientImpl::Start( +- ids, base::BindOnce(&Blocklist::GetBlocklistStateForIDs, +- weak_ptr_factory_.GetWeakPtr(), std::move(callback))); + } + + void Blocklist::GetMalwareIDs(const std::set& ids, +--- a/chrome/browser/extensions/chrome_extensions_browser_client.cc ++++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc +@@ -816,44 +816,17 @@ void ChromeExtensionsBrowserClient::Noti + content::BrowserContext* context, + const ExtensionId& extension_id, + const std::string& code) const { +- auto* telemetry_service = +- safe_browsing::ExtensionTelemetryServiceFactory::GetForProfile( +- Profile::FromBrowserContext(context)); +- if (!telemetry_service || !telemetry_service->enabled() || +- !base::FeatureList::IsEnabled( +- safe_browsing::kExtensionTelemetryTabsExecuteScriptSignal)) { +- return; +- } +- +- auto signal = std::make_unique( +- extension_id, code); +- telemetry_service->AddSignal(std::move(signal)); + } + + bool ChromeExtensionsBrowserClient::IsExtensionTelemetryServiceEnabled( + content::BrowserContext* context) const { +- auto* telemetry_service = +- safe_browsing::ExtensionTelemetryServiceFactory::GetForProfile( +- Profile::FromBrowserContext(context)); +- return telemetry_service && telemetry_service->enabled(); ++ return false; + } + + void ChromeExtensionsBrowserClient::NotifyExtensionApiDeclarativeNetRequest( + content::BrowserContext* context, + const ExtensionId& extension_id, + const std::vector& rules) const { +- auto* telemetry_service = +- safe_browsing::ExtensionTelemetryServiceFactory::GetForProfile( +- Profile::FromBrowserContext(context)); +- if (!telemetry_service || !telemetry_service->enabled()) { +- return; +- } +- +- // The telemetry service will consume and release the signal object inside the +- // `AddSignal()` call. +- auto signal = std::make_unique( +- extension_id, rules); +- telemetry_service->AddSignal(std::move(signal)); + } + + void ChromeExtensionsBrowserClient:: +@@ -862,59 +835,12 @@ void ChromeExtensionsBrowserClient:: + const ExtensionId& extension_id, + const GURL& request_url, + const GURL& redirect_url) const { +- auto* telemetry_service = +- safe_browsing::ExtensionTelemetryServiceFactory::GetForProfile( +- Profile::FromBrowserContext(context)); +- if (!telemetry_service || !telemetry_service->enabled() || +- !base::FeatureList::IsEnabled( +- safe_browsing:: +- kExtensionTelemetryDeclarativeNetRequestActionSignal)) { +- return; +- } +- +- // The telemetry service will consume and release the signal object inside the +- // `AddSignal()` call. +- auto signal = safe_browsing::DeclarativeNetRequestActionSignal:: +- CreateDeclarativeNetRequestRedirectActionSignal(extension_id, request_url, +- redirect_url); +- telemetry_service->AddSignal(std::move(signal)); + } + + void ChromeExtensionsBrowserClient::NotifyExtensionRemoteHostContacted( + content::BrowserContext* context, + const ExtensionId& extension_id, + const GURL& url) const { +- // Collect only if new interception feature is disabled to avoid duplicates. +- if (base::FeatureList::IsEnabled( +- safe_browsing:: +- kExtensionTelemetryInterceptRemoteHostsContactedInRenderer)) { +- return; +- } +- +- safe_browsing::RemoteHostInfo::ProtocolType protocol = +- safe_browsing::RemoteHostInfo::UNSPECIFIED; +- if (base::FeatureList::IsEnabled( +- safe_browsing::kExtensionTelemetryReportContactedHosts) && +- url.SchemeIsHTTPOrHTTPS()) { +- protocol = safe_browsing::RemoteHostInfo::HTTP_HTTPS; +- } else if (base::FeatureList::IsEnabled( +- safe_browsing:: +- kExtensionTelemetryReportHostsContactedViaWebSocket) && +- url.SchemeIsWSOrWSS()) { +- protocol = safe_browsing::RemoteHostInfo::WEBSOCKET; +- } else { +- return; +- } +- auto* telemetry_service = +- safe_browsing::ExtensionTelemetryServiceFactory::GetForProfile( +- Profile::FromBrowserContext(context)); +- if (!telemetry_service || !telemetry_service->enabled()) { +- return; +- } +- auto remote_host_signal = +- std::make_unique(extension_id, +- url, protocol); +- telemetry_service->AddSignal(std::move(remote_host_signal)); + } + + // static +@@ -1083,7 +1009,6 @@ void ChromeExtensionsBrowserClient::GetW + + void ChromeExtensionsBrowserClient::CreatePasswordReuseDetectionManager( + content::WebContents* web_contents) const { +- ChromePasswordReuseDetectionManagerClient::CreateForWebContents(web_contents); + } + + media_device_salt::MediaDeviceSaltService* +--- a/chrome/browser/extensions/extension_service.cc ++++ b/chrome/browser/extensions/extension_service.cc +@@ -52,7 +52,6 @@ + #include "chrome/browser/extensions/forced_extensions/install_stage_tracker.h" + #include "chrome/browser/extensions/install_verifier.h" + #include "chrome/browser/extensions/installed_loader.h" +-#include "chrome/browser/extensions/omaha_attributes_handler.h" + #include "chrome/browser/extensions/pending_extension_manager.h" + #include "chrome/browser/extensions/permissions/permissions_updater.h" + #include "chrome/browser/extensions/profile_util.h" +@@ -229,7 +228,6 @@ void ExtensionService::BlocklistExtensio + blocklist_prefs::SetSafeBrowsingExtensionBlocklistState( + extension_id, BitMapBlocklistState::BLOCKLISTED_MALWARE, + extension_prefs_); +- OnBlocklistStateAdded(extension_id); + } + + void ExtensionService::GreylistExtensionForTest( +@@ -237,7 +235,6 @@ void ExtensionService::GreylistExtension + const BitMapBlocklistState& state) { + blocklist_prefs::SetSafeBrowsingExtensionBlocklistState(extension_id, state, + extension_prefs_); +- OnGreylistStateAdded(extension_id, state); + } + + bool ExtensionService::OnExternalExtensionUpdateUrlFound( +@@ -405,9 +402,6 @@ ExtensionService::ExtensionService( + safe_browsing_verdict_handler_(extension_prefs, + ExtensionRegistry::Get(profile), + this), +- omaha_attributes_handler_(extension_prefs, +- ExtensionRegistry::Get(profile), +- this), + extension_telemetry_service_verdict_handler_( + extension_prefs, + ExtensionRegistry::Get(profile), +@@ -937,17 +931,6 @@ bool ExtensionService::IsExtensionEnable + return extension_registrar_.IsExtensionEnabled(extension_id); + } + +-void ExtensionService::PerformActionBasedOnOmahaAttributes( +- const std::string& extension_id, +- const base::Value::Dict& attributes) { +- DCHECK_CURRENTLY_ON(BrowserThread::UI); +- omaha_attributes_handler_.PerformActionBasedOnOmahaAttributes(extension_id, +- attributes); +- allowlist_.PerformActionBasedOnOmahaAttributes(extension_id, attributes); +- // Show an error for the newly blocklisted extension. +- error_controller_->ShowErrorIfNeeded(); +-} +- + void ExtensionService::PerformActionBasedOnExtensionTelemetryServiceVerdicts( + const Blocklist::BlocklistStateMap& blocklist_state_map) { + DCHECK_CURRENTLY_ON(BrowserThread::UI); +@@ -957,89 +940,6 @@ void ExtensionService::PerformActionBase + error_controller_->ShowErrorIfNeeded(); + } + +-void ExtensionService::OnGreylistStateRemoved(const std::string& extension_id) { +- bool is_on_sb_list = (blocklist_prefs::GetSafeBrowsingExtensionBlocklistState( +- extension_id, extension_prefs_) != +- BitMapBlocklistState::NOT_BLOCKLISTED); +- bool is_on_omaha_list = +- blocklist_prefs::HasAnyOmahaGreylistState(extension_id, extension_prefs_); +- if (is_on_sb_list || is_on_omaha_list) { +- return; +- } +- // Clear all acknowledged states so the extension will still get disabled if +- // it is added to the greylist again. +- blocklist_prefs::ClearAcknowledgedGreylistStates(extension_id, +- extension_prefs_); +- RemoveDisableReasonAndMaybeEnable(extension_id, +- disable_reason::DISABLE_GREYLIST); +-} +- +-void ExtensionService::OnGreylistStateAdded(const std::string& extension_id, +- BitMapBlocklistState new_state) { +-#if DCHECK_IS_ON() +- bool has_new_state_on_sb_list = +- (blocklist_prefs::GetSafeBrowsingExtensionBlocklistState( +- extension_id, extension_prefs_) == new_state); +- bool has_new_state_on_omaha_list = blocklist_prefs::HasOmahaBlocklistState( +- extension_id, new_state, extension_prefs_); +- DCHECK(has_new_state_on_sb_list || has_new_state_on_omaha_list); +-#endif +- if (blocklist_prefs::HasAcknowledgedBlocklistState(extension_id, new_state, +- extension_prefs_)) { +- // If the extension is already acknowledged, don't disable it again +- // because it can be already re-enabled by the user. This could happen if +- // the extension is added to the SafeBrowsing blocklist, and then +- // subsequently marked by Omaha. In this case, we don't want to disable the +- // extension twice. +- return; +- } +- +- // Set the current greylist states to acknowledge immediately because the +- // extension is disabled silently. Clear the other acknowledged state because +- // when the state changes to another greylist state in the future, we'd like +- // to disable the extension again. +- blocklist_prefs::UpdateCurrentGreylistStatesAsAcknowledged(extension_id, +- extension_prefs_); +- DisableExtension(extension_id, disable_reason::DISABLE_GREYLIST); +-} +- +-void ExtensionService::OnBlocklistStateRemoved( +- const std::string& extension_id) { +- if (blocklist_prefs::IsExtensionBlocklisted(extension_id, extension_prefs_)) { +- return; +- } +- +- // Clear acknowledged state. +- blocklist_prefs::RemoveAcknowledgedBlocklistState( +- extension_id, BitMapBlocklistState::BLOCKLISTED_MALWARE, +- extension_prefs_); +- +- scoped_refptr extension = +- registry_->blocklisted_extensions().GetByID(extension_id); +- DCHECK(extension); +- registry_->RemoveBlocklisted(extension_id); +- AddExtension(extension.get()); +-} +- +-void ExtensionService::OnBlocklistStateAdded(const std::string& extension_id) { +- DCHECK( +- blocklist_prefs::IsExtensionBlocklisted(extension_id, extension_prefs_)); +- // The extension was already acknowledged by the user, it should already be in +- // the unloaded state. +- if (blocklist_prefs::HasAcknowledgedBlocklistState( +- extension_id, BitMapBlocklistState::BLOCKLISTED_MALWARE, +- extension_prefs_)) { +- DCHECK(base::Contains(registry_->blocklisted_extensions().GetIDs(), +- extension_id)); +- return; +- } +- +- scoped_refptr extension = +- registry_->GetInstalledExtension(extension_id); +- registry_->AddBlocklisted(extension); +- UnloadExtension(extension_id, UnloadedExtensionReason::BLOCKLIST); +-} +- + void ExtensionService::RemoveDisableReasonAndMaybeEnable( + const std::string& extension_id, + disable_reason::DisableReason reason_to_remove) { +--- a/chrome/browser/extensions/extension_service.h ++++ b/chrome/browser/extensions/extension_service.h +@@ -30,7 +30,6 @@ + #include "chrome/browser/extensions/forced_extensions/force_installed_metrics.h" + #include "chrome/browser/extensions/forced_extensions/force_installed_tracker.h" + #include "chrome/browser/extensions/install_gate.h" +-#include "chrome/browser/extensions/omaha_attributes_handler.h" + #include "chrome/browser/extensions/pending_extension_manager.h" + #include "chrome/browser/extensions/safe_browsing_verdict_handler.h" + #include "chrome/browser/profiles/profile_manager_observer.h" +@@ -283,40 +282,11 @@ class ExtensionService : public Extensio + // nothing. + void EnableExtension(const std::string& extension_id); + +- // Takes Safe Browsing and Omaha blocklist states into account and decides +- // whether to remove greylist disabled reason. Called when a greylisted +- // state is removed from the Safe Browsing blocklist or Omaha blocklist. Also +- // clears all acknowledged states if the greylist disabled reason is removed. +- void OnGreylistStateRemoved(const std::string& extension_id); +- +- // Takes acknowledged blocklist states into account and decides whether to +- // disable the greylisted extension. Called when a new greylisted state is +- // added to the Safe Browsing blocklist or Omaha blocklist. +- void OnGreylistStateAdded(const std::string& extension_id, +- BitMapBlocklistState new_state); +- +- // Takes Safe Browsing and Omaha malware blocklist states into account and +- // decides whether to remove the extension from the blocklist and reload it. +- // Called when a blocklisted extension is removed from the Safe Browsing +- // malware blocklist or Omaha malware blocklist. Also clears the acknowledged +- // state if the extension is reloaded. +- void OnBlocklistStateRemoved(const std::string& extension_id); +- +- // Takes acknowledged malware blocklist state into account and decides whether +- // to add the extension to the blocklist and unload it. Called when the +- // extension is added to the Safe Browsing malware blocklist or the Omaha +- // malware blocklist. +- void OnBlocklistStateAdded(const std::string& extension_id); +- + // Removes the disable reason and enable the extension if there are no disable + // reasons left and is not blocked for another reason. + void RemoveDisableReasonAndMaybeEnable(const std::string& extension_id, + disable_reason::DisableReason reason); + +- // Performs action based on Omaha attributes for the extension. +- void PerformActionBasedOnOmahaAttributes(const std::string& extension_id, +- const base::Value::Dict& attributes); +- + // Performs action based on verdicts received from the Extension Telemetry + // server. Currently, these verdicts are limited to off-store extensions. + void PerformActionBasedOnExtensionTelemetryServiceVerdicts( +@@ -676,8 +646,6 @@ class ExtensionService : public Extensio + + SafeBrowsingVerdictHandler safe_browsing_verdict_handler_; + +- OmahaAttributesHandler omaha_attributes_handler_; +- + ExtensionTelemetryServiceVerdictHandler + extension_telemetry_service_verdict_handler_; + +--- a/chrome/browser/extensions/extension_system_impl.cc ++++ b/chrome/browser/extensions/extension_system_impl.cc +@@ -448,8 +448,6 @@ void ExtensionSystemImpl::InstallUpdate( + void ExtensionSystemImpl::PerformActionBasedOnOmahaAttributes( + const std::string& extension_id, + const base::Value::Dict& attributes) { +- extension_service()->PerformActionBasedOnOmahaAttributes(extension_id, +- attributes); + } + + bool ExtensionSystemImpl::FinishDelayedInstallationIfReady( +--- a/chrome/browser/extensions/extension_telemetry_service_verdict_handler.cc ++++ b/chrome/browser/extensions/extension_telemetry_service_verdict_handler.cc +@@ -73,14 +73,12 @@ void ExtensionTelemetryServiceVerdictHan + blocklist_prefs::SetExtensionTelemetryServiceBlocklistState( + extension_id, BitMapBlocklistState::NOT_BLOCKLISTED, + extension_prefs_); +- extension_service_->OnBlocklistStateRemoved(extension_id); + ReportOffstoreExtensionReenabled(current_state); + break; + case BLOCKLISTED_MALWARE: + blocklist_prefs::SetExtensionTelemetryServiceBlocklistState( + extension_id, BitMapBlocklistState::BLOCKLISTED_MALWARE, + extension_prefs_); +- extension_service_->OnBlocklistStateAdded(extension_id); + ReportOffstoreExtensionDisabled( + ExtensionTelemetryDisableReason::kMalware); + break; +--- a/chrome/browser/extensions/safe_browsing_verdict_handler.cc ++++ b/chrome/browser/extensions/safe_browsing_verdict_handler.cc +@@ -119,7 +119,6 @@ void SafeBrowsingVerdictHandler::UpdateB + blocklist_.Remove(id); + blocklist_prefs::SetSafeBrowsingExtensionBlocklistState( + id, BitMapBlocklistState::NOT_BLOCKLISTED, extension_prefs_); +- extension_service_->OnBlocklistStateRemoved(id); + UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.UnblacklistInstalled", + extension->location()); + } +@@ -133,7 +132,6 @@ void SafeBrowsingVerdictHandler::UpdateB + blocklist_.Insert(extension); + blocklist_prefs::SetSafeBrowsingExtensionBlocklistState( + id, BitMapBlocklistState::BLOCKLISTED_MALWARE, extension_prefs_); +- extension_service_->OnBlocklistStateAdded(id); + UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.BlacklistInstalled", + extension->location()); + } +@@ -157,7 +155,6 @@ void SafeBrowsingVerdictHandler::UpdateG + blocklist_prefs::SetSafeBrowsingExtensionBlocklistState( + extension->id(), BitMapBlocklistState::NOT_BLOCKLISTED, + extension_prefs_); +- extension_service_->OnGreylistStateRemoved(extension->id()); + UMA_HISTOGRAM_ENUMERATION("Extensions.Greylist.Enabled", + extension->location()); + } +@@ -177,7 +174,6 @@ void SafeBrowsingVerdictHandler::UpdateG + blocklist_prefs::BlocklistStateToBitMapBlocklistState(greylist_state); + blocklist_prefs::SetSafeBrowsingExtensionBlocklistState( + extension->id(), bitmap_greylist_state, extension_prefs_); +- extension_service_->OnGreylistStateAdded(id, bitmap_greylist_state); + UMA_HISTOGRAM_ENUMERATION("Extensions.Greylist.Disabled", + extension->location()); + } +--- a/chrome/browser/file_select_helper.cc ++++ b/chrome/browser/file_select_helper.cc +@@ -323,7 +323,7 @@ void FileSelectHelper::PerformContentAna + if (AbortIfWebContentsDestroyed()) + return; + +-#if BUILDFLAG(ENTERPRISE_CLOUD_CONTENT_ANALYSIS) ++#if false + enterprise_connectors::ContentAnalysisDelegate::Data data; + if (enterprise_connectors::ContentAnalysisDelegate::IsEnabled( + profile_, web_contents_->GetLastCommittedURL(), &data, +@@ -353,7 +353,7 @@ void FileSelectHelper::PerformContentAna + #endif // BUILDFLAG(ENTERPRISE_CLOUD_CONTENT_ANALYSIS) + } + +-#if BUILDFLAG(ENTERPRISE_CLOUD_CONTENT_ANALYSIS) ++#if false + void FileSelectHelper::ContentAnalysisCompletionCallback( + std::vector list, + const enterprise_connectors::ContentAnalysisDelegate::Data& data, +--- a/chrome/browser/file_select_helper.h ++++ b/chrome/browser/file_select_helper.h +@@ -226,7 +226,7 @@ class FileSelectHelper : public base::Re + void PerformContentAnalysisIfNeeded( + std::vector list); + +-#if BUILDFLAG(ENTERPRISE_CLOUD_CONTENT_ANALYSIS) ++#if false + // Callback used to receive the results of a content analysis scan. + void ContentAnalysisCompletionCallback( + std::vector list, +--- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc ++++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc +@@ -37,7 +37,6 @@ + #include "chrome/browser/permissions/permission_decision_auto_blocker_factory.h" + #include "chrome/browser/profiles/profile.h" + #include "chrome/browser/profiles/profile_manager.h" +-#include "chrome/browser/safe_browsing/download_protection/download_protection_util.h" + #include "chrome/browser/ui/browser_finder.h" + #include "chrome/browser/ui/file_system_access/file_system_access_dangerous_file_dialog.h" + #include "chrome/browser/ui/file_system_access/file_system_access_dialogs.h" +@@ -451,89 +450,6 @@ bool ShouldBlockAccessToPath(const base: + return true; + } + +-void DoSafeBrowsingCheckOnUIThread( +- content::GlobalRenderFrameHostId frame_id, +- std::unique_ptr item, +- safe_browsing::CheckDownloadCallback callback) { +- DCHECK_CURRENTLY_ON(content::BrowserThread::UI); +- // Download Protection Service is not supported on Android. +-#if BUILDFLAG(FULL_SAFE_BROWSING) +- safe_browsing::SafeBrowsingService* sb_service = +- g_browser_process->safe_browsing_service(); +- if (!sb_service || !sb_service->download_protection_service() || +- !sb_service->download_protection_service()->enabled()) { +- std::move(callback).Run(safe_browsing::DownloadCheckResult::UNKNOWN); +- return; +- } +- +- if (!item->browser_context) { +- content::RenderProcessHost* rph = +- content::RenderProcessHost::FromID(frame_id.child_id); +- if (!rph) { +- std::move(callback).Run(safe_browsing::DownloadCheckResult::UNKNOWN); +- return; +- } +- item->browser_context = rph->GetBrowserContext(); +- } +- +- if (!item->web_contents) { +- content::RenderFrameHost* rfh = content::RenderFrameHost::FromID(frame_id); +- if (rfh) { +- DCHECK_NE(rfh->GetLifecycleState(), +- content::RenderFrameHost::LifecycleState::kPrerendering); +- item->web_contents = content::WebContents::FromRenderFrameHost(rfh); +- } +- } +- +- sb_service->download_protection_service()->CheckFileSystemAccessWrite( +- std::move(item), std::move(callback)); +-#else +- std::move(callback).Run(safe_browsing::DownloadCheckResult::UNKNOWN); +-#endif +-} +- +-ChromeFileSystemAccessPermissionContext::AfterWriteCheckResult +-InterpretSafeBrowsingResult(safe_browsing::DownloadCheckResult result) { +- using Result = safe_browsing::DownloadCheckResult; +- switch (result) { +- // Only allow downloads that are marked as SAFE or UNKNOWN by SafeBrowsing. +- // All other types are going to be blocked. UNKNOWN could be the result of a +- // failed safe browsing ping or if Safe Browsing is not enabled. +- case Result::UNKNOWN: +- case Result::SAFE: +- case Result::ALLOWLISTED_BY_POLICY: +- return ChromeFileSystemAccessPermissionContext::AfterWriteCheckResult:: +- kAllow; +- +- case Result::DANGEROUS: +- case Result::UNCOMMON: +- case Result::DANGEROUS_HOST: +- case Result::POTENTIALLY_UNWANTED: +- case Result::BLOCKED_PASSWORD_PROTECTED: +- case Result::BLOCKED_TOO_LARGE: +- case Result::DANGEROUS_ACCOUNT_COMPROMISE: +- case Result::BLOCKED_SCAN_FAILED: +- return ChromeFileSystemAccessPermissionContext::AfterWriteCheckResult:: +- kBlock; +- +- // This shouldn't be returned for File System Access write checks. +- case Result::ASYNC_SCANNING: +- case Result::ASYNC_LOCAL_PASSWORD_SCANNING: +- case Result::SENSITIVE_CONTENT_WARNING: +- case Result::SENSITIVE_CONTENT_BLOCK: +- case Result::DEEP_SCANNED_SAFE: +- case Result::PROMPT_FOR_SCANNING: +- case Result::PROMPT_FOR_LOCAL_PASSWORD_SCANNING: +- case Result::DEEP_SCANNED_FAILED: +- case Result::IMMEDIATE_DEEP_SCAN: +- NOTREACHED_IN_MIGRATION(); +- return ChromeFileSystemAccessPermissionContext::AfterWriteCheckResult:: +- kAllow; +- } +- NOTREACHED_IN_MIGRATION(); +- return ChromeFileSystemAccessPermissionContext::AfterWriteCheckResult::kBlock; +-} +- + std::string GenerateLastPickedDirectoryKey(const std::string& id) { + return id.empty() ? kDefaultLastPickedDirectoryKey + : base::StrCat({kCustomLastPickedDirectoryKey, "-", id}); +@@ -553,13 +469,7 @@ std::string_view GetGrantKeyFromGrantTyp + bool FileHasDangerousExtension(const url::Origin& origin, + const base::FilePath& path, + Profile* profile) { +- safe_browsing::DownloadFileType::DangerLevel danger_level = +- safe_browsing::FileTypePolicies::GetInstance()->GetFileDangerLevel( +- path, origin.GetURL(), profile->GetPrefs()); +- // See https://crbug.com/1320877#c4 for justification for why we show the +- // prompt if `danger_level` is ALLOW_ON_USER_GESTURE as well as DANGEROUS. +- return danger_level == safe_browsing::DownloadFileType::DANGEROUS || +- danger_level == safe_browsing::DownloadFileType::ALLOW_ON_USER_GESTURE; ++ return false; + } + + } // namespace +@@ -1672,7 +1582,7 @@ void ChromeFileSystemAccessPermissionCon + std::vector entries, + content::GlobalRenderFrameHostId frame_id, + EntriesAllowedByEnterprisePolicyCallback callback) { +-#if BUILDFLAG(ENTERPRISE_CLOUD_CONTENT_ANALYSIS) ++#if false + // Get WebContents pointer in order to perform enterprise content analysis. + content::WebContents* web_contents = nullptr; + if (!entries.empty()) { +@@ -1780,29 +1690,6 @@ void ChromeFileSystemAccessPermissionCon + std::move(callback)); + } + +-void ChromeFileSystemAccessPermissionContext::PerformAfterWriteChecks( +- std::unique_ptr item, +- content::GlobalRenderFrameHostId frame_id, +- base::OnceCallback callback) { +- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); +- content::GetUIThreadTaskRunner({})->PostTask( +- FROM_HERE, +- base::BindOnce( +- &DoSafeBrowsingCheckOnUIThread, frame_id, std::move(item), +- base::BindOnce( +- [](scoped_refptr task_runner, +- base::OnceCallback +- callback, +- safe_browsing::DownloadCheckResult result) { +- task_runner->PostTask( +- FROM_HERE, +- base::BindOnce(std::move(callback), +- InterpretSafeBrowsingResult(result))); +- }, +- base::SequencedTaskRunner::GetCurrentDefault(), +- std::move(callback)))); +-} +- + void ChromeFileSystemAccessPermissionContext::DidCheckPathAgainstBlocklist( + const url::Origin& origin, + const base::FilePath& path, +--- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h ++++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h +@@ -180,10 +180,6 @@ class ChromeFileSystemAccessPermissionCo + UserAction user_action, + content::GlobalRenderFrameHostId frame_id, + base::OnceCallback callback) override; +- void PerformAfterWriteChecks( +- std::unique_ptr item, +- content::GlobalRenderFrameHostId frame_id, +- base::OnceCallback callback) override; + bool CanObtainReadPermission(const url::Origin& origin) override; + bool CanObtainWritePermission(const url::Origin& origin) override; + void SetLastPickedDirectory(const url::Origin& origin, +--- a/chrome/browser/media/webrtc/display_media_access_handler.cc ++++ b/chrome/browser/media/webrtc/display_media_access_handler.cc +@@ -29,6 +29,7 @@ + #include "chrome/browser/ui/views/frame/browser_view.h" + #include "chrome/common/pref_names.h" + #include "components/prefs/pref_service.h" ++#include "components/safe_browsing/buildflags.h" + #include "components/url_formatter/elide_url.h" + #include "content/public/browser/browser_thread.h" + #include "content/public/browser/desktop_media_id.h" +@@ -136,6 +137,7 @@ void DisplayMediaAccessHandler::HandleRe + return; + } + ++ #if BUILDFLAG(FULL_SAFE_BROWSING) + // SafeBrowsing Delayed Warnings experiment can delay some SafeBrowsing + // warnings until user interaction. If the current page has a delayed warning, + // it'll have a user interaction observer attached. Show the warning +@@ -151,6 +153,7 @@ void DisplayMediaAccessHandler::HandleRe + observer->OnDesktopCaptureRequest(); + return; + } ++ #endif // BUILDFLAG(FULL_SAFE_BROWSING) + + #if BUILDFLAG(IS_MAC) + // Do not allow picker UI to be shown on a page that isn't in the foreground +--- a/chrome/browser/notifications/notification_display_service_impl.cc ++++ b/chrome/browser/notifications/notification_display_service_impl.cc +@@ -88,13 +88,6 @@ NotificationDisplayServiceImpl::Notifica + profile_)); + #endif + +-#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \ +- BUILDFLAG(IS_WIN) +- AddNotificationHandler( +- NotificationHandler::Type::TAILORED_SECURITY, +- std::make_unique()); +-#endif +- + #if BUILDFLAG(ENABLE_EXTENSIONS) + AddNotificationHandler( + NotificationHandler::Type::EXTENSION, +--- a/chrome/browser/password_manager/chrome_password_manager_client.cc ++++ b/chrome/browser/password_manager/chrome_password_manager_client.cc +@@ -38,7 +38,6 @@ + #include "chrome/browser/password_manager/profile_password_store_factory.h" + #include "chrome/browser/profiles/profile.h" + #include "chrome/browser/profiles/profile_manager.h" +-#include "chrome/browser/safe_browsing/chrome_password_protection_service.h" + #include "chrome/browser/safe_browsing/user_interaction_observer.h" + #include "chrome/browser/signin/identity_manager_factory.h" + #include "chrome/browser/sync/sync_service_factory.h" +@@ -1038,6 +1037,7 @@ autofill::LanguageCode ChromePasswordMan + return autofill::LanguageCode(); + } + ++#if BUILDFLAG(FULL_SAFE_BROWSING) + safe_browsing::PasswordProtectionService* + ChromePasswordManagerClient::GetPasswordProtectionService() const { + return safe_browsing::ChromePasswordProtectionService:: +@@ -1057,6 +1057,7 @@ void ChromePasswordManagerClient::CheckS + } + } + #endif // defined(ON_FOCUS_PING_ENABLED) ++#endif // BUILDFLAG(FULL_SAFE_BROWSING) + + #if !BUILDFLAG(IS_ANDROID) + void ChromePasswordManagerClient::MaybeReportEnterpriseLoginEvent( +@@ -1064,30 +1065,10 @@ void ChromePasswordManagerClient::MaybeR + bool is_federated, + const url::SchemeHostPort& federated_origin, + const std::u16string& login_user_name) const { +- extensions::SafeBrowsingPrivateEventRouter* router = +- extensions::SafeBrowsingPrivateEventRouterFactory::GetForProfile( +- profile_); +- if (!router) { +- return; +- } +- +- // The router is responsible for checking if the reporting of this event type +- // is enabled by the admin. +- router->OnLoginEvent(url, is_federated, federated_origin, login_user_name); + } + + void ChromePasswordManagerClient::MaybeReportEnterprisePasswordBreachEvent( + const std::vector>& identities) const { +- extensions::SafeBrowsingPrivateEventRouter* router = +- extensions::SafeBrowsingPrivateEventRouterFactory::GetForProfile( +- profile_); +- if (!router) { +- return; +- } +- +- // The router is responsible for checking if the reporting of this event type +- // is enabled by the admin. +- router->OnPasswordBreach(kPasswordBreachEntryTrigger, identities); + } + #endif + +@@ -1853,6 +1834,7 @@ bool ChromePasswordManagerClient::IsPass + is_enabled = false; + } + ++ #if BUILDFLAG(FULL_SAFE_BROWSING) + // SafeBrowsing Delayed Warnings experiment can delay some SafeBrowsing + // warnings until user interaction. If the current page has a delayed warning, + // it'll have a user interaction observer attached. Disable password +@@ -1863,6 +1845,7 @@ bool ChromePasswordManagerClient::IsPass + observer->OnPasswordSaveOrAutofillDenied(); + is_enabled = false; + } ++ #endif // BUILDFLAG(FULL_SAFE_BROWSING) + + if (log_manager_->IsLoggingActive()) { + password_manager::BrowserSavePasswordProgressLogger logger( +--- a/chrome/browser/password_manager/chrome_password_manager_client.h ++++ b/chrome/browser/password_manager/chrome_password_manager_client.h +@@ -237,15 +237,9 @@ class ChromePasswordManagerClient + autofill::LogManager* GetLogManager() override; + void AnnotateNavigationEntry(bool has_password_field) override; + autofill::LanguageCode GetPageLanguage() const override; +- safe_browsing::PasswordProtectionService* GetPasswordProtectionService() +- const override; + void TriggerUserPerceptionOfPasswordManagerSurvey( + const std::string& filling_assistance) override; + +-#if defined(ON_FOCUS_PING_ENABLED) +- void CheckSafeBrowsingReputation(const GURL& form_action, +- const GURL& frame_url) override; +-#endif + + // Reporting these events is only supported on desktop platforms. + #if !BUILDFLAG(IS_ANDROID) +--- a/chrome/browser/permissions/chrome_permissions_client.cc ++++ b/chrome/browser/permissions/chrome_permissions_client.cc +@@ -408,16 +408,6 @@ void ChromePermissionsClient::OnPromptRe + PermissionRevocationRequest::ExemptOriginFromFutureRevocations(profile, + origin); + } +- if (action == permissions::PermissionAction::GRANTED) { +- if (g_browser_process->safe_browsing_service()) { +- g_browser_process->safe_browsing_service() +- ->MaybeSendNotificationsAcceptedReport( +- web_contents->GetPrimaryMainFrame(), profile, +- web_contents->GetLastCommittedURL(), +- web_contents->GetController().GetLastCommittedEntry()->GetURL(), +- origin, prompt_display_duration); +- } +- } + } + + auto content_setting_type = RequestTypeToContentSettingsType(request_type); +--- a/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc ++++ b/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc +@@ -16,7 +16,6 @@ + #include "chrome/browser/browser_process.h" + #include "chrome/browser/permissions/quiet_notification_permission_ui_config.h" + #include "chrome/browser/permissions/quiet_notification_permission_ui_state.h" +-#include "chrome/browser/safe_browsing/safe_browsing_service.h" + #include "chrome/common/chrome_features.h" + #include "components/permissions/permission_request.h" + #include "components/permissions/request_type.h" +@@ -152,9 +151,6 @@ void ContextualNotificationPermissionUiS + } + + void ContextualNotificationPermissionUiSelector::Cancel() { +- // The computation either finishes synchronously above, or is waiting on the +- // Safe Browsing check. +- safe_browsing_request_.reset(); + } + + bool ContextualNotificationPermissionUiSelector::IsPermissionRequestSupported( +@@ -180,24 +176,14 @@ void ContextualNotificationPermissionUiS + std::optional decision = + GetDecisionBasedOnSiteReputation(reputation); + +- // If the PreloadData suggests this is an unacceptable site, ping Safe +- // Browsing to verify; but do not ping if it is not warranted. ++ // If the PreloadData suggests this is an unacceptable site, assume it is ++ // correct, since we can't access safe browsing. + if (!decision || (!decision->quiet_ui_reason && !decision->warning_reason)) { + Notify(Decision::UseNormalUiAndShowNoWarning()); +- return; ++ } else { ++ // decision has a value, unwrap with .value() ++ Notify(decision.value()); + } +- +- DCHECK(!safe_browsing_request_); +- DCHECK(g_browser_process->safe_browsing_service()); +- +- // It is fine to use base::Unretained() here, as |safe_browsing_request_| +- // guarantees not to fire the callback after its destruction. +- safe_browsing_request_.emplace( +- g_browser_process->safe_browsing_service()->database_manager(), +- base::DefaultClock::GetInstance(), origin, +- base::BindOnce(&ContextualNotificationPermissionUiSelector:: +- OnSafeBrowsingVerdictReceived, +- base::Unretained(this), *decision)); + } + + void ContextualNotificationPermissionUiSelector::OnSafeBrowsingVerdictReceived( +--- a/chrome/browser/permissions/permission_revocation_request.cc ++++ b/chrome/browser/permissions/permission_revocation_request.cc +@@ -135,27 +135,7 @@ void PermissionRevocationRequest::CheckA + DCHECK(profile_); + DCHECK(callback_); + +- if (!safe_browsing::IsSafeBrowsingEnabled(*profile_->GetPrefs()) || +- IsOriginExemptedFromFutureRevocations(profile_, origin_) || +- (!NotificationsPermissionRevocationConfig:: +- IsAbusiveOriginPermissionRevocationEnabled() && +- !NotificationsPermissionRevocationConfig:: +- IsDisruptiveOriginPermissionRevocationEnabled())) { + NotifyCallback(Outcome::PERMISSION_NOT_REVOKED); +- return; +- } +- +- CrowdDenyPreloadData* crowd_deny = CrowdDenyPreloadData::GetInstance(); +- permissions::PermissionUmaUtil::RecordCrowdDenyVersionAtAbuseCheckTime( +- crowd_deny->version_on_disk()); +- +- if (!crowd_deny->IsReadyToUse()) +- crowd_deny_request_start_time_ = base::TimeTicks::Now(); +- +- crowd_deny->GetReputationDataForSiteAsync( +- url::Origin::Create(origin_), +- base::BindOnce(&PermissionRevocationRequest::OnSiteReputationReady, +- weak_factory_.GetWeakPtr())); + } + + void PermissionRevocationRequest::OnSiteReputationReady( +@@ -165,33 +145,6 @@ void PermissionRevocationRequest::OnSite + base::TimeTicks::Now() - crowd_deny_request_start_time_.value(); + } + +- if (site_reputation && !site_reputation->warning_only()) { +- bool should_revoke_permission = false; +- switch (site_reputation->notification_ux_quality()) { +- case CrowdDenyPreloadData::SiteReputation::ABUSIVE_PROMPTS: +- case CrowdDenyPreloadData::SiteReputation::ABUSIVE_CONTENT: +- should_revoke_permission = NotificationsPermissionRevocationConfig:: +- IsAbusiveOriginPermissionRevocationEnabled(); +- break; +- case CrowdDenyPreloadData::SiteReputation::DISRUPTIVE_BEHAVIOR: +- should_revoke_permission = NotificationsPermissionRevocationConfig:: +- IsDisruptiveOriginPermissionRevocationEnabled(); +- break; +- default: +- should_revoke_permission = false; +- } +- DCHECK(g_browser_process->safe_browsing_service()); +- if (should_revoke_permission && +- g_browser_process->safe_browsing_service()) { +- safe_browsing_request_.emplace( +- g_browser_process->safe_browsing_service()->database_manager(), +- base::DefaultClock::GetInstance(), url::Origin::Create(origin_), +- base::BindOnce( +- &PermissionRevocationRequest::OnSafeBrowsingVerdictReceived, +- weak_factory_.GetWeakPtr(), site_reputation)); +- return; +- } +- } + NotifyCallback(Outcome::PERMISSION_NOT_REVOKED); + } + +--- a/chrome/browser/permissions/prediction_based_permission_ui_selector.cc ++++ b/chrome/browser/permissions/prediction_based_permission_ui_selector.cc +@@ -351,51 +351,5 @@ bool PredictionBasedPermissionUiSelector + + PredictionSource PredictionBasedPermissionUiSelector::GetPredictionTypeToUse( + permissions::RequestType request_type) { +- const bool is_msbb_enabled = profile_->GetPrefs()->GetBoolean( +- unified_consent::prefs::kUrlKeyedAnonymizedDataCollectionEnabled); +- +- const bool is_notification_cpss_enabled = +- profile_->GetPrefs()->GetBoolean(prefs::kEnableNotificationCPSS); +- +- const bool is_geolocation_cpss_enabled = +- profile_->GetPrefs()->GetBoolean(prefs::kEnableGeolocationCPSS); +- +- if (request_type == permissions::RequestType::kNotifications && +- !is_notification_cpss_enabled) { +- return PredictionSource::USE_NONE; +- } +- +- if (request_type == permissions::RequestType::kGeolocation && +- !is_geolocation_cpss_enabled) { +- return PredictionSource::USE_NONE; +- } +- +- bool is_tflite_available = false; +-#if BUILDFLAG(BUILD_WITH_TFLITE_LIB) +- is_tflite_available = true; +-#endif // BUILDFLAG(BUILD_WITH_TFLITE_LIB) +- +- bool is_on_device_enabled = false; +- +- if (request_type == permissions::RequestType::kNotifications) { +- is_on_device_enabled = base::FeatureList::IsEnabled( +- permissions::features::kPermissionOnDeviceNotificationPredictions); +- } else if (request_type == permissions::RequestType::kGeolocation) { +- is_on_device_enabled = base::FeatureList::IsEnabled( +- permissions::features::kPermissionOnDeviceGeolocationPredictions); +- } +-#if BUILDFLAG(IS_ANDROID) +- if (is_msbb_enabled && +- base::FeatureList::IsEnabled( +- permissions::features::kPermissionDedicatedCpssSettingAndroid)) { +-#else +- if (is_msbb_enabled && base::FeatureList::IsEnabled( +- permissions::features::kPermissionPredictionsV2)) { +-#endif +- return PredictionSource::USE_SERVER_SIDE; +- } else if (is_tflite_available && is_on_device_enabled) { +- return PredictionSource::USE_ONDEVICE; +- } else { + return PredictionSource::USE_NONE; +- } + } +--- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc ++++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc +@@ -118,6 +118,7 @@ + #include "components/privacy_sandbox/privacy_sandbox_prefs.h" + #include "components/privacy_sandbox/tracking_protection_prefs.h" + #include "components/proxy_config/proxy_policy_handler.h" ++#include "components/safe_browsing/buildflags.h" + #include "components/safe_browsing/content/common/file_type_policies_prefs.h" + #include "components/safe_browsing/core/common/safe_browsing_policy_handler.h" + #include "components/safe_browsing/core/common/safe_browsing_prefs.h" +@@ -2361,8 +2362,6 @@ std::unique_ptrAddHandler( + std::make_unique( + chrome_schema)); +- handlers->AddHandler( +- std::make_unique()); + handlers->AddHandler(std::make_unique()); + handlers->AddHandler( + std::make_unique(key::kURLBlocklist)); +@@ -2472,20 +2471,6 @@ std::unique_ptrAddHandler(std::make_unique( +- key::kExemptDomainFileTypePairsFromFileTypeDownloadWarnings, +- safe_browsing::file_type::prefs:: +- kExemptDomainFileTypePairsFromFileTypeDownloadWarnings, +- chrome_schema, SCHEMA_ALLOW_UNKNOWN, +- SimpleSchemaValidatingPolicyHandler::RECOMMENDED_PROHIBITED, +- SimpleSchemaValidatingPolicyHandler::MANDATORY_ALLOWED)); +- +- handlers->AddHandler(std::make_unique( +- key::kManagedConfigurationPerOrigin, +- prefs::kManagedConfigurationPerOrigin, chrome_schema, +- SCHEMA_ALLOW_UNKNOWN, +- SimpleSchemaValidatingPolicyHandler::RECOMMENDED_PROHIBITED, +- SimpleSchemaValidatingPolicyHandler::MANDATORY_ALLOWED)); + handlers->AddHandler( + std::make_unique()); + +--- a/chrome/browser/prefs/browser_prefs.cc ++++ b/chrome/browser/prefs/browser_prefs.cc +@@ -283,7 +283,6 @@ + #include "chrome/browser/metrics/tab_stats/tab_stats_tracker.h" + #include "chrome/browser/nearby_sharing/common/nearby_share_prefs.h" + #include "chrome/browser/new_tab_page/modules/file_suggestion/drive_service.h" +-#include "chrome/browser/new_tab_page/modules/safe_browsing/safe_browsing_handler.h" + #include "chrome/browser/new_tab_page/modules/v2/calendar/google_calendar_page_handler.h" + #include "chrome/browser/new_tab_page/modules/v2/most_relevant_tab_resumption/most_relevant_tab_resumption_page_handler.h" + #include "chrome/browser/new_tab_page/promos/promo_service.h" +@@ -2055,7 +2054,6 @@ void RegisterProfilePrefs(user_prefs::Pr + media_router::RegisterProfilePrefs(registry); + NewTabPageHandler::RegisterProfilePrefs(registry); + NewTabPageUI::RegisterProfilePrefs(registry); +- ntp::SafeBrowsingHandler::RegisterProfilePrefs(registry); + ntp_tiles::CustomLinksManagerImpl::RegisterProfilePrefs(registry); + PinnedTabCodec::RegisterProfilePrefs(registry); + policy::DeveloperToolsPolicyHandler::RegisterProfilePrefs(registry); +--- a/chrome/browser/printing/print_view_manager.cc ++++ b/chrome/browser/printing/print_view_manager.cc +@@ -380,7 +380,7 @@ void PrintViewManager::ShowScriptedPrint + DCHECK(print_preview_rfh_); + if (GetCurrentTargetFrame() != print_preview_rfh_) + return; +-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) ++#if false + set_analyzing_content(/*analyzing=*/true); + #endif + RejectPrintPreviewRequestIfRestricted( +@@ -394,7 +394,7 @@ void PrintViewManager::OnScriptedPrintPr + bool source_is_modifiable, + content::GlobalRenderFrameHostId rfh_id, + bool should_proceed) { +-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) ++#if false + set_analyzing_content(/*analyzing=*/false); + #endif + if (!should_proceed) { +@@ -427,7 +427,7 @@ void PrintViewManager::OnScriptedPrintPr + + void PrintViewManager::RequestPrintPreview( + mojom::RequestPrintPreviewParamsPtr params) { +-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) ++#if false + set_analyzing_content(/*analyzing=*/true); + #endif + RejectPrintPreviewRequestIfRestricted( +@@ -441,7 +441,7 @@ void PrintViewManager::OnRequestPrintPre + mojom::RequestPrintPreviewParamsPtr params, + content::GlobalRenderFrameHostId rfh_id, + bool should_proceed) { +-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) ++#if false + set_analyzing_content(/*analyzing=*/false); + #endif + if (!should_proceed) { +--- a/chrome/browser/printing/print_view_manager_base.cc ++++ b/chrome/browser/printing/print_view_manager_base.cc +@@ -441,7 +441,7 @@ void PrintViewManagerBase::StartLocalPri + PrinterHandler::PrintCallback callback) { + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + +-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) ++#if false + // Populating `content_analysis_before_printing_document_` if needed should be + // done first in this function's workflow, this way other code can check if + // content analysis is going to happen and delay starting `print_job_` to +@@ -839,7 +839,7 @@ void PrintViewManagerBase::ScriptedPrint + return; + } + #endif +-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) ++#if false + std::optional + scanning_data = enterprise_data_protection::GetPrintAnalysisData( + web_contents(), enterprise_data_protection::PrintScanningContext:: +@@ -1340,7 +1340,7 @@ void PrintViewManagerBase::CompleteScrip + std::move(callback_wrapper))); + } + +-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) ++#if false + void PrintViewManagerBase::CompletePrintDocumentAfterContentAnalysis( + scoped_refptr print_data, + const gfx::Size& page_size, +@@ -1363,17 +1363,6 @@ void PrintViewManagerBase::ContentAnalys + const gfx::Size& page_size, + const gfx::Rect& content_area, + const gfx::Point& offsets) { +- scanning_data.printer_name = +- base::UTF16ToUTF8(print_job_->document()->settings().device_name()); +- +- auto on_verdict = base::BindOnce( +- &PrintViewManagerBase::CompletePrintDocumentAfterContentAnalysis, +- weak_ptr_factory_.GetWeakPtr(), print_data, page_size, content_area, +- offsets); +- +- enterprise_data_protection::PrintIfAllowedByPolicy( +- print_data, web_contents()->GetOutermostWebContents(), +- std::move(scanning_data), std::move(on_verdict)); + } + + void PrintViewManagerBase::set_analyzing_content(bool analyzing) { +--- a/chrome/browser/printing/print_view_manager_base.h ++++ b/chrome/browser/printing/print_view_manager_base.h +@@ -229,7 +229,7 @@ class PrintViewManagerBase : public Prin + mojom::ScriptedPrintParamsPtr params, + ScriptedPrintCallback callback); + +-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) ++#if false + // Helper method bound to `content_analysis_before_printing_document_` when + // content analysis should happen right before the document is to be printed. + // This method is virtual for testing purposes. +--- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc ++++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc +@@ -845,9 +845,6 @@ void ChromeBrowserMainExtraPartsProfiles + enterprise_connectors::ExtensionInstallEventRouterFactory::GetInstance(); + enterprise_connectors::ExtensionTelemetryEventRouterFactory::GetInstance(); + #endif +-#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) +- enterprise_connectors::LocalBinaryUploadServiceFactory::GetInstance(); +-#endif + #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || \ + BUILDFLAG(IS_ANDROID) + enterprise_idle::IdleServiceFactory::GetInstance(); +@@ -1173,23 +1170,6 @@ void ChromeBrowserMainExtraPartsProfiles + #if !BUILDFLAG(IS_ANDROID) + ResetReportUploaderFactory::GetInstance(); + #endif +-#if BUILDFLAG(FULL_SAFE_BROWSING) +- safe_browsing::AdvancedProtectionStatusManagerFactory::GetInstance(); +- safe_browsing::ChromeEnterpriseRealTimeUrlLookupServiceFactory::GetInstance(); +-#endif +- safe_browsing::ChromePasswordProtectionServiceFactory::GetInstance(); +- safe_browsing::ChromePingManagerFactory::GetInstance(); +- safe_browsing::ClientSideDetectionServiceFactory::GetInstance(); +-#if BUILDFLAG(FULL_SAFE_BROWSING) +- safe_browsing::CloudBinaryUploadServiceFactory::GetInstance(); +- safe_browsing::ExtensionTelemetryServiceFactory::GetInstance(); +- safe_browsing::HashRealTimeServiceFactory::GetInstance(); +-#endif +- safe_browsing::RealTimeUrlLookupServiceFactory::GetInstance(); +- safe_browsing::SafeBrowsingMetricsCollectorFactory::GetInstance(); +- safe_browsing::SafeBrowsingNavigationObserverManagerFactory::GetInstance(); +- safe_browsing::TailoredSecurityServiceFactory::GetInstance(); +- safe_browsing::VerdictCacheManagerFactory::GetInstance(); + SafeSearchFactory::GetInstance(); + #if BUILDFLAG(IS_ANDROID) + if (base::FeatureList::IsEnabled(features::kSafetyHub)) { +--- a/chrome/browser/safe_browsing/cloud_content_scanning/file_opening_job.cc ++++ b/chrome/browser/safe_browsing/cloud_content_scanning/file_opening_job.cc +@@ -71,10 +71,6 @@ void FileOpeningJob::ProcessNextTask(bas + if (tasks_[i].taken.exchange(true, std::memory_order_relaxed)) + continue; + +- // Since we know we now have taken `tasks_[i]`, we can do the file opening +- // work safely. +- tasks_[i].request->OpenFile(); +- + // Now that the file opening work is done, `num_unopened_files_` is + // decremented atomically and we return to free the thread. + num_unopened_files_.fetch_sub(1, std::memory_order_relaxed); +--- a/chrome/browser/safe_browsing/cloud_content_scanning/file_opening_job.h ++++ b/chrome/browser/safe_browsing/cloud_content_scanning/file_opening_job.h +@@ -11,7 +11,6 @@ + #include "base/gtest_prod_util.h" + #include "base/memory/raw_ptr.h" + #include "base/task/post_job.h" +-#include "chrome/browser/safe_browsing/cloud_content_scanning/file_analysis_request.h" + + namespace safe_browsing { + +@@ -24,10 +23,6 @@ class FileOpeningJob { + FileOpeningTask(); + ~FileOpeningTask(); + +- // Non-owning pointer to the request corresponding to the file to open. +- raw_ptr +- request = nullptr; +- + // Indicates if this task has been taken and is owned by a thread. + std::atomic_bool taken{false}; + }; +--- a/chrome/browser/safe_browsing/metrics/safe_browsing_metrics_provider.cc ++++ b/chrome/browser/safe_browsing/metrics/safe_browsing_metrics_provider.cc +@@ -17,15 +17,6 @@ SafeBrowsingMetricsProvider::~SafeBrowsi + + void SafeBrowsingMetricsProvider::ProvideCurrentSessionData( + metrics::ChromeUserMetricsExtension* uma_proto) { +- Profile* profile = cached_profile_.GetMetricsProfile(); +- +- if (!profile) +- return; +- +- SafeBrowsingState state = GetSafeBrowsingState(*profile->GetPrefs()); +- +- base::UmaHistogramEnumeration( +- "SafeBrowsing.Pref.MainProfile.SafeBrowsingState", state); + } + + } // namespace safe_browsing +--- a/chrome/browser/safe_browsing/url_lookup_service_factory.cc ++++ b/chrome/browser/safe_browsing/url_lookup_service_factory.cc +@@ -71,29 +71,7 @@ RealTimeUrlLookupServiceFactory::~RealTi + std::unique_ptr + RealTimeUrlLookupServiceFactory::BuildServiceInstanceForBrowserContext( + content::BrowserContext* context) const { +- if (!g_browser_process->safe_browsing_service()) { + return nullptr; +- } +- Profile* profile = Profile::FromBrowserContext(context); +- return std::make_unique( +- GetURLLoaderFactory(context), +- VerdictCacheManagerFactory::GetForProfile(profile), +- base::BindRepeating( +- &safe_browsing::GetUserPopulationForProfileWithCookieTheftExperiments, +- profile), +- profile->GetPrefs(), +- std::make_unique( +- IdentityManagerFactory::GetForProfile(profile)), +- base::BindRepeating(&safe_browsing::SyncUtils:: +- AreSigninAndSyncSetUpForSafeBrowsingTokenFetches, +- SyncServiceFactory::GetForProfile(profile), +- IdentityManagerFactory::GetForProfile(profile)), +- profile->IsOffTheRecord(), +- base::BindRepeating( +- &RealTimeUrlLookupServiceFactory::GetVariationsService), +- SafeBrowsingNavigationObserverManagerFactory::GetForBrowserContext( +- profile), +- WebUIInfoSingleton::GetInstance()); + } + + scoped_refptr +--- a/chrome/browser/site_protection/site_protection_metrics_observer.cc ++++ b/chrome/browser/site_protection/site_protection_metrics_observer.cc +@@ -198,17 +198,6 @@ void SiteProtectionMetricsObserver::OnKn + SiteFamiliarityHistoryHeuristicName::kNoVisitsToAnySiteMoreThanADayAgo; + } + +- if (g_browser_process->safe_browsing_service()) { +- if (auto database_manager = +- g_browser_process->safe_browsing_service()->database_manager()) { +- GURL last_committed_url = metrics_data->last_committed_url; +- database_manager->CheckUrlForHighConfidenceAllowlist( +- last_committed_url, +- base::BindOnce(&SiteProtectionMetricsObserver::LogMetrics, +- weak_factory_.GetWeakPtr(), std::move(metrics_data))); +- return; +- } +- } + + LogMetrics(std::move(metrics_data), + /* url_on_safe_browsing_high_confidence_allowlist=*/false); +--- a/chrome/browser/ssl/chrome_security_blocking_page_factory.cc ++++ b/chrome/browser/ssl/chrome_security_blocking_page_factory.cc +@@ -147,15 +147,6 @@ CreateSettingsPageHelper() { + CreateChromeSettingsPageHelper(); + } + +-void LogSafeBrowsingSecuritySensitiveAction( +- safe_browsing::SafeBrowsingMetricsCollector* metrics_collector) { +- if (metrics_collector) { +- metrics_collector->AddSafeBrowsingEventToPref( +- safe_browsing::SafeBrowsingMetricsCollector::EventType:: +- SECURITY_SENSITIVE_SSL_INTERSTITIAL); +- } +-} +- + } // namespace + + std::unique_ptr +@@ -178,10 +169,6 @@ ChromeSecurityBlockingPageFactory::Creat + Profile::FromBrowserContext(web_contents->GetBrowserContext())); + state->DidDisplayErrorPage(cert_error); + +- LogSafeBrowsingSecuritySensitiveAction( +- safe_browsing::SafeBrowsingMetricsCollectorFactory::GetForProfile( +- Profile::FromBrowserContext(web_contents->GetBrowserContext()))); +- + auto controller_client = std::make_unique( + web_contents, ssl_info, cert_error, request_url, + std::move(metrics_helper), CreateSettingsPageHelper()); +@@ -244,10 +231,6 @@ ChromeSecurityBlockingPageFactory::Creat + const GURL& request_url, + const net::SSLInfo& ssl_info, + const std::string& mitm_software_name) { +- LogSafeBrowsingSecuritySensitiveAction( +- safe_browsing::SafeBrowsingMetricsCollectorFactory::GetForProfile( +- Profile::FromBrowserContext(web_contents->GetBrowserContext()))); +- + auto page = std::make_unique( + web_contents, cert_error, request_url, + /*can_show_enhanced_protection_message=*/true, ssl_info, +@@ -267,10 +250,6 @@ ChromeSecurityBlockingPageFactory::Creat + int cert_error, + const GURL& request_url, + const net::SSLInfo& ssl_info) { +- LogSafeBrowsingSecuritySensitiveAction( +- safe_browsing::SafeBrowsingMetricsCollectorFactory::GetForProfile( +- Profile::FromBrowserContext(web_contents->GetBrowserContext()))); +- + auto page = std::make_unique( + web_contents, cert_error, request_url, + /*can_show_enhanced_protection_message=*/true, ssl_info, +--- a/chrome/browser/ssl/sct_reporting_service_factory.cc ++++ b/chrome/browser/ssl/sct_reporting_service_factory.cc +@@ -41,15 +41,7 @@ SCTReportingServiceFactory::~SCTReportin + std::unique_ptr + SCTReportingServiceFactory::BuildServiceInstanceForBrowserContext( + content::BrowserContext* profile) const { +- safe_browsing::SafeBrowsingService* safe_browsing_service = +- g_browser_process->safe_browsing_service(); +- // In unit tests the safe browsing service can be null, if this happens, +- // return null instead of crashing. +- if (!safe_browsing_service) +- return nullptr; +- +- return std::make_unique(safe_browsing_service, +- static_cast(profile)); ++ return nullptr; + } + + // Force this to be created during BrowserContext creation, since we can't +--- a/chrome/browser/ssl/ssl_error_controller_client.cc ++++ b/chrome/browser/ssl/ssl_error_controller_client.cc +@@ -92,8 +92,6 @@ void SSLErrorControllerClient::GoBack() + } + + void SSLErrorControllerClient::Proceed() { +- MaybeTriggerSecurityInterstitialProceededEvent(web_contents_, request_url_, +- "SSL_ERROR", cert_error_); + #if BUILDFLAG(ENABLE_EXTENSIONS) + // Hosted Apps should not be allowed to run if there is a problem with their + // certificate. So, when users click proceed on an interstitial, move the tab +--- a/chrome/browser/subresource_filter/chrome_content_subresource_filter_web_contents_helper_factory.cc ++++ b/chrome/browser/subresource_filter/chrome_content_subresource_filter_web_contents_helper_factory.cc +@@ -6,7 +6,6 @@ + + #include "chrome/browser/browser_process.h" + #include "chrome/browser/profiles/profile.h" +-#include "chrome/browser/safe_browsing/safe_browsing_service.h" + #include "chrome/browser/subresource_filter/subresource_filter_profile_context_factory.h" + #include "components/safe_browsing/core/browser/db/database_manager.h" + #include "components/subresource_filter/content/browser/content_subresource_filter_web_contents_helper.h" +@@ -18,10 +17,7 @@ namespace { + // available. Otherwise returns nullptr. + const scoped_refptr + GetDatabaseManagerFromSafeBrowsingService() { +- safe_browsing::SafeBrowsingService* safe_browsing_service = +- g_browser_process->safe_browsing_service(); +- return safe_browsing_service ? safe_browsing_service->database_manager() +- : nullptr; ++ return nullptr; + } + + } // namespace +--- a/chrome/browser/ui/BUILD.gn ++++ b/chrome/browser/ui/BUILD.gn +@@ -598,7 +598,6 @@ static_library("ui") { + "//components/renderer_context_menu", + "//components/resources", + "//components/safe_browsing/content/browser", +- "//components/safe_browsing/content/browser:client_side_detection", + "//components/safe_browsing/content/browser/password_protection", + "//components/safe_browsing/content/browser/web_ui", + "//components/safe_browsing/core/browser/db:database_manager", +@@ -3214,8 +3213,6 @@ static_library("ui") { + "startup/web_app_startup_utils.h", + "tab_contents/chrome_web_contents_menu_helper.cc", + "tab_contents/chrome_web_contents_menu_helper.h", +- "tab_contents/chrome_web_contents_view_handle_drop.cc", +- "tab_contents/chrome_web_contents_view_handle_drop.h", + "views/autofill/payments/webauthn_dialog_view.cc", + "views/autofill/payments/webauthn_dialog_view.h", + "views/close_bubble_on_tab_activation_helper.cc", +@@ -4854,8 +4851,6 @@ static_library("ui") { + "views/safe_browsing/prompt_for_scanning_modal_dialog.h", + "views/safe_browsing/tailored_security_desktop_dialog_manager.cc", + "views/safe_browsing/tailored_security_desktop_dialog_manager.h", +- "views/safe_browsing/tailored_security_unconsented_modal.cc", +- "views/safe_browsing/tailored_security_unconsented_modal.h", + "views/send_tab_to_self/manage_account_devices_link_view.cc", + "views/send_tab_to_self/manage_account_devices_link_view.h", + "views/send_tab_to_self/send_tab_to_self_bubble.cc", +--- a/chrome/browser/ui/download/download_bubble_row_view_info.cc ++++ b/chrome/browser/ui/download/download_bubble_row_view_info.cc +@@ -10,7 +10,6 @@ + #include "chrome/browser/enterprise/connectors/common.h" + #include "chrome/browser/safe_browsing/advanced_protection_status_manager.h" + #include "chrome/browser/safe_browsing/advanced_protection_status_manager_factory.h" +-#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h" + #include "chrome/browser/ui/color/chrome_color_id.h" + #include "chrome/browser/ui/download/download_item_mode.h" + #include "chrome/grit/generated_resources.h" +@@ -367,6 +366,5 @@ void DownloadBubbleRowViewInfo::Reset() + } + + bool DownloadBubbleRowViewInfo::ShouldShowDeepScanNotice() const { +- return ShouldShowDeepScanPromptNotice(model_->profile(), +- model_->GetDangerType()); ++ return false; + } +--- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc ++++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc +@@ -113,20 +113,6 @@ void RecordWebsiteStateAtApiRequest(hist + void CheckUrlForAllowlistAndRecordMetric( + const GURL& url, + history::HistoryLastVisitResult result) { +- if (!g_browser_process->safe_browsing_service() || +- !g_browser_process->safe_browsing_service()->database_manager()) { +- RecordWebsiteStateAtApiRequest(result, std::nullopt); +- return; +- } +- g_browser_process->safe_browsing_service() +- ->database_manager() +- ->CheckUrlForHighConfidenceAllowlist( +- url, +- base::BindOnce( +- [](history::HistoryLastVisitResult result, bool on_allowlist) { +- RecordWebsiteStateAtApiRequest(result, on_allowlist); +- }, +- result)); + } + + } // namespace +--- a/chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_desktop.cc ++++ b/chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_desktop.cc +@@ -16,6 +16,7 @@ + #include "components/javascript_dialogs/tab_modal_dialog_manager.h" + #include "components/javascript_dialogs/tab_modal_dialog_view.h" + #include "components/navigation_metrics/navigation_metrics.h" ++#include "components/safe_browsing/buildflags.h" + #include "content/public/browser/devtools_agent_host.h" + #include "content/public/browser/navigation_handle.h" + #include "content/public/browser/render_frame_host.h" +@@ -35,6 +36,7 @@ JavaScriptTabModalDialogManagerDelegateD + + void JavaScriptTabModalDialogManagerDelegateDesktop::WillRunDialog() { + BrowserList::AddObserver(this); ++ #if BUILDFLAG(FULL_SAFE_BROWSING) + // SafeBrowsing Delayed Warnings experiment can delay some SafeBrowsing + // warnings until user interaction. If the current page has a delayed warning, + // it'll have a user interaction observer attached. Show the warning +@@ -45,6 +47,7 @@ void JavaScriptTabModalDialogManagerDele + if (observer) { + observer->OnJavaScriptDialog(); + } ++ #endif // BUILDFLAG(FULL_SAFE_BROWSING) + } + + void JavaScriptTabModalDialogManagerDelegateDesktop::DidCloseDialog() { +--- a/chrome/browser/ui/safety_hub/unused_site_permissions_service.cc ++++ b/chrome/browser/ui/safety_hub/unused_site_permissions_service.cc +@@ -52,7 +52,6 @@ + #include "components/prefs/pref_change_registrar.h" + #include "components/prefs/pref_service.h" + #include "components/safe_browsing/core/common/features.h" +-#include "components/safe_browsing/core/common/safe_browsing_prefs.h" + #include "content/public/browser/browser_context.h" + #include "content/public/browser/browser_thread.h" + #include "ui/base/l10n/l10n_util.h" +@@ -358,21 +357,6 @@ UnusedSitePermissionsService::UnusedSite + base::Unretained(this))); + } + +- if (base::FeatureList::IsEnabled( +- safe_browsing::kSafetyHubAbusiveNotificationRevocation)) { +- abusive_notification_manager_ = +- std::make_unique( +- g_browser_process->safe_browsing_service() +- ? g_browser_process->safe_browsing_service()->database_manager() +- : nullptr, +- hcsm()); +- +- pref_change_registrar_->Add( +- prefs::kSafeBrowsingEnabled, +- base::BindRepeating(&UnusedSitePermissionsService:: +- OnPermissionsAutorevocationControlChanged, +- base::Unretained(this))); +- } + + bool migration_completed = pref_change_registrar_->prefs()->GetBoolean( + safety_hub_prefs::kUnusedSitePermissionsRevocationMigrationCompleted); +@@ -1028,9 +1012,7 @@ bool UnusedSitePermissionsService::IsUnu + + bool UnusedSitePermissionsService:: + IsAbusiveNotificationAutoRevocationEnabled() { +- return base::FeatureList::IsEnabled( +- safe_browsing::kSafetyHubAbusiveNotificationRevocation) && +- safe_browsing::IsSafeBrowsingEnabled(*pref_change_registrar_->prefs()); ++ return false; + } + + const std::set +--- a/chrome/browser/ui/tab_helpers.cc ++++ b/chrome/browser/ui/tab_helpers.cc +@@ -393,7 +393,6 @@ void TabHelpers::AttachTabHelpers(WebCon + if (!autofill_client_provider.uses_platform_autofill()) { + ChromePasswordManagerClient::CreateForWebContents(web_contents); + } +- ChromePasswordReuseDetectionManagerClient::CreateForWebContents(web_contents); + CreateSubresourceFilterWebContentsHelper(web_contents); + #if BUILDFLAG(ENABLE_RLZ) + ChromeRLZTrackerWebContentsObserver::CreateForWebContentsIfNeeded( +--- a/chrome/browser/ui/views/download/bubble/download_bubble_contents_view.cc ++++ b/chrome/browser/ui/views/download/bubble/download_bubble_contents_view.cc +@@ -13,7 +13,6 @@ + #include "chrome/browser/download/download_core_service.h" + #include "chrome/browser/download/download_core_service_factory.h" + #include "chrome/browser/download/download_item_warning_data.h" +-#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h" + #include "chrome/browser/safe_browsing/safe_browsing_service.h" + #include "chrome/browser/ui/browser.h" + #include "chrome/browser/ui/browser_element_identifiers.h" +@@ -40,21 +39,6 @@ namespace { + + void MaybeSendDownloadReport(content::BrowserContext* browser_context, + download::DownloadItem* download) { +- if (download->GetURL().is_empty() || browser_context->IsOffTheRecord()) { +- return; +- } +- +- safe_browsing::SafeBrowsingService* service = +- g_browser_process->safe_browsing_service(); +- if (!service) { +- return; +- } +- +- service->SendDownloadReport(download, +- safe_browsing::ClientSafeBrowsingReportRequest:: +- DANGEROUS_DOWNLOAD_RECOVERY, +- /*did_proceed=*/true, +- /*show_download_in_folder=*/std::nullopt); + } + + } // namespace +@@ -189,74 +173,16 @@ void DownloadBubbleContentsView::Process + const ContentId& id, + DownloadItemWarningData::DeepScanTrigger trigger, + base::optional_ref password) { +- if (DownloadUIModel* model = GetDownloadModel(id); model) { +- LogDeepScanEvent(model->GetDownloadItem(), +- safe_browsing::DeepScanEvent::kPromptAccepted); +- DownloadItemWarningData::AddWarningActionEvent( +- model->GetDownloadItem(), +- DownloadItemWarningData::WarningSurface::BUBBLE_SUBPAGE, +- DownloadItemWarningData::WarningAction::ACCEPT_DEEP_SCAN); +- safe_browsing::DownloadProtectionService::UploadForConsumerDeepScanning( +- model->GetDownloadItem(), trigger, password); +- } + } + + void DownloadBubbleContentsView::ProcessLocalDecryptionPress( + const offline_items_collection::ContentId& id, + base::optional_ref password) { +- if (DownloadUIModel* model = GetDownloadModel(id); model) { +- LogLocalDecryptionEvent(safe_browsing::DeepScanEvent::kPromptAccepted); +- safe_browsing::DownloadProtectionService::CheckDownloadWithLocalDecryption( +- model->GetDownloadItem(), password); +- } + } + + void DownloadBubbleContentsView::ProcessLocalPasswordInProgressClick( + const offline_items_collection::ContentId& id, + DownloadCommands::Command command) { +- DownloadUIModel* model = GetDownloadModel(id); +- if (!model) { +- return; +- } +- +- download::DownloadItem* item = model->GetDownloadItem(); +- safe_browsing::SafeBrowsingService* sb_service = +- g_browser_process->safe_browsing_service(); +- if (!sb_service) { +- return; +- } +- safe_browsing::DownloadProtectionService* protection_service = +- sb_service->download_protection_service(); +- if (!protection_service) { +- return; +- } +- +- protection_service->CancelChecksForDownload(item); +- +- content::BrowserContext* browser_context = +- content::DownloadItemUtils::GetBrowserContext(item); +- DownloadCoreService* download_core_service = +- DownloadCoreServiceFactory::GetForBrowserContext(browser_context); +- +- DCHECK(download_core_service); +- ChromeDownloadManagerDelegate* delegate = +- download_core_service->GetDownloadManagerDelegate(); +- DCHECK(delegate); +- +- if (command == DownloadCommands::CANCEL) { +- LogLocalDecryptionEvent(safe_browsing::DeepScanEvent::kScanCanceled); +- delegate->CheckClientDownloadDone( +- item->GetId(), +- safe_browsing::DownloadCheckResult::PROMPT_FOR_LOCAL_PASSWORD_SCANNING); +- } else if (command == DownloadCommands::BYPASS_DEEP_SCANNING) { +- LogLocalDecryptionEvent(safe_browsing::DeepScanEvent::kPromptBypassed); +- MaybeSendDownloadReport(browser_context, item); +- delegate->CheckClientDownloadDone( +- item->GetId(), safe_browsing::DownloadCheckResult::UNKNOWN); +- } else { +- NOTREACHED_IN_MIGRATION() +- << "Unexpected command: " << static_cast(command); +- } + } + + bool DownloadBubbleContentsView::IsEncryptedArchive(const ContentId& id) { +--- a/chrome/browser/ui/views/download/download_item_view.cc ++++ b/chrome/browser/ui/views/download/download_item_view.cc +@@ -38,7 +38,6 @@ + #include "chrome/browser/icon_manager.h" + #include "chrome/browser/safe_browsing/advanced_protection_status_manager.h" + #include "chrome/browser/safe_browsing/advanced_protection_status_manager_factory.h" +-#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h" + #include "chrome/browser/safe_browsing/safe_browsing_service.h" + #include "chrome/browser/ui/browser.h" + #include "chrome/browser/ui/color/chrome_color_id.h" +@@ -814,9 +813,7 @@ void DownloadItemView::UpdateLabels() { + deep_scanning_label_->SetVisible(mode_ == + download::DownloadItemMode::kDeepScanning); + if (deep_scanning_label_->GetVisible()) { +- const int id = (model_->GetDownloadItem() && +- safe_browsing::DeepScanningRequest::ShouldUploadBinary( +- model_->GetDownloadItem())) ++ const int id = model_->GetDownloadItem() + ? IDS_PROMPT_DEEP_SCANNING_DOWNLOAD + : IDS_PROMPT_DEEP_SCANNING_APP_DOWNLOAD; + const std::u16string filename = ElidedFilename(*deep_scanning_label_); +@@ -842,11 +839,15 @@ void DownloadItemView::UpdateButtons() { + } + + const bool allow_open_during_deep_scan = ++#if BUILDFLAG(FULL_SAFE_BROWSING) + (mode_ == download::DownloadItemMode::kDeepScanning) && + !enterprise_connectors::ConnectorsServiceFactory::GetForBrowserContext( + model_->profile()) + ->DelayUntilVerdict( + enterprise_connectors::AnalysisConnector::FILE_DOWNLOADED); ++#else ++ false; ++#endif // BUILDFLAG(FULL_SAFE_BROWSING) + open_button_->SetEnabled((mode_ == download::DownloadItemMode::kNormal) || + prompt_to_scan || allow_open_during_deep_scan); + +@@ -1270,7 +1271,9 @@ void DownloadItemView::ShowContextMenuIm + } + + void DownloadItemView::OpenDownloadDuringAsyncScanning() { ++#if BUILDFLAG(FULL_SAFE_BROWSING) + model_->CompleteSafeBrowsingScan(); ++#endif + model_->SetOpenWhenComplete(true); + } + +--- a/chrome/browser/ui/views/media_router/presentation_receiver_window_view.cc ++++ b/chrome/browser/ui/views/media_router/presentation_receiver_window_view.cc +@@ -171,7 +171,6 @@ void PresentationReceiverWindowView::Ini + ChromeTranslateClient::CreateForWebContents(web_contents); + autofill::ChromeAutofillClient::CreateForWebContents(web_contents); + ChromePasswordManagerClient::CreateForWebContents(web_contents); +- ChromePasswordReuseDetectionManagerClient::CreateForWebContents(web_contents); + ManagePasswordsUIController::CreateForWebContents(web_contents); + SearchTabHelper::CreateForWebContents(web_contents); + TabDialogs::CreateForWebContents(web_contents); +--- a/chrome/browser/ui/views/profiles/profile_picker_dice_sign_in_provider.cc ++++ b/chrome/browser/ui/views/profiles/profile_picker_dice_sign_in_provider.cc +@@ -281,8 +281,6 @@ void ProfilePickerDiceSignInProvider::On + .Then(base::BindOnce(std::move(switch_finished_callback), true)); + host_->ShowScreen(contents(), BuildSigninURL(), + std::move(navigation_finished_closure)); +- ChromePasswordReuseDetectionManagerClient::CreateForProfilePickerWebContents( +- contents()); + // Attach a `DiceTabHelper` to the `WebContents` to trigger the completion + // of the step. + DiceTabHelper::CreateForWebContents(contents()); +--- a/chrome/browser/ui/views/profiles/profile_picker_force_signin_dialog_delegate.cc ++++ b/chrome/browser/ui/views/profiles/profile_picker_force_signin_dialog_delegate.cc +@@ -48,9 +48,6 @@ ProfilePickerForceSigninDialogDelegate:: + ChromePasswordManagerClient::CreateForWebContents( + web_view_->GetWebContents()); + +- ChromePasswordReuseDetectionManagerClient::CreateForWebContents( +- web_view_->GetWebContents()); +- + web_modal::WebContentsModalDialogManager::CreateForWebContents( + web_view_->GetWebContents()); + web_modal::WebContentsModalDialogManager::FromWebContents( +--- a/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc ++++ b/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc +@@ -110,7 +110,7 @@ void ChromeWebContentsViewDelegateViews: + void ChromeWebContentsViewDelegateViews::OnPerformingDrop( + const content::DropData& drop_data, + DropCompletionCallback callback) { +- HandleOnPerformingDrop(web_contents_, drop_data, std::move(callback)); ++ if (!callback.is_null()) std::move(callback).Run(std::move(drop_data)); + } + + std::unique_ptr CreateWebContentsViewDelegate( +--- a/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views_mac.mm ++++ b/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views_mac.mm +@@ -89,7 +89,7 @@ bool ChromeWebContentsViewDelegateViewsM + void ChromeWebContentsViewDelegateViewsMac::OnPerformingDrop( + const content::DropData& drop_data, + DropCompletionCallback callback) { +- HandleOnPerformingDrop(web_contents_, drop_data, std::move(callback)); ++ if (!callback.is_null()) std::move(callback).Run(std::move(drop_data)); + } + + std::unique_ptr +--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc ++++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc +@@ -406,9 +406,6 @@ WebUIFactoryFunction GetWebUIFactoryFunc + optimization_guide_internals::kChromeUIOptimizationGuideInternalsHost) { + return &NewWebUI; + } +- if (url.host_piece() == safe_browsing::kChromeUISafeBrowsingHost) +- return &NewComponentUI; + if (url.host_piece() == chrome::kChromeUISupervisedUserPassphrasePageHost) + return &NewWebUI; + if (url.host_piece() == +--- a/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc ++++ b/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc +@@ -191,10 +191,6 @@ void MaybeReportBypassAction(download::D + if (action != WarningAction::PROCEED && action != WarningAction::DISCARD) { + return; + } +- SendSafeBrowsingDownloadReport( +- safe_browsing::ClientSafeBrowsingReportRequest:: +- DANGEROUS_DOWNLOAD_RECOVERY, +- /*did_proceed=*/action == WarningAction::PROCEED, file); + } + + // Triggers a Trust and Safety sentiment survey (if enabled). Should be called +@@ -203,21 +199,6 @@ void MaybeReportBypassAction(download::D + void MaybeTriggerTrustSafetySurvey(download::DownloadItem* file, + WarningSurface surface, + WarningAction action) { +- CHECK(file); +- CHECK(surface == WarningSurface::DOWNLOADS_PAGE || +- surface == WarningSurface::DOWNLOAD_PROMPT); +- CHECK(action == WarningAction::PROCEED || action == WarningAction::DISCARD); +- if (Profile* profile = Profile::FromBrowserContext( +- content::DownloadItemUtils::GetBrowserContext(file)); +- profile && +- safe_browsing::IsSafeBrowsingSurveysEnabled(*profile->GetPrefs())) { +- TrustSafetySentimentService* trust_safety_sentiment_service = +- TrustSafetySentimentServiceFactory::GetForProfile(profile); +- if (trust_safety_sentiment_service) { +- trust_safety_sentiment_service->InteractedWithDownloadWarningUI(surface, +- action); +- } +- } + } + + void RecordDownloadsPageValidatedHistogram(download::DownloadItem* item) { +@@ -369,46 +350,10 @@ void DownloadsDOMHandler::RecordOpenBypa + + void DownloadsDOMHandler::RecordOpenBypassWarningInterstitial( + const std::string& id) { +- CHECK(base::FeatureList::IsEnabled( +- safe_browsing::kDangerousDownloadInterstitial)); +- CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_OPEN_BYPASS_WARNING_PROMPT); +- download::DownloadItem* file = GetDownloadByStringId(id); +- if (!CanLogWarningMetrics(file)) { +- return; +- } +- +- interstitial_open_time_ = base::TimeTicks::Now(); +- +- RecordDangerousDownloadInterstitialActionHistogram( +- DangerousDownloadInterstitialAction::kOpenInterstitial); +- +- RecordDownloadDangerPromptHistogram("Shown", *file); +- +- MaybeReportBypassAction(file, WarningSurface::DOWNLOADS_PAGE, +- WarningAction::KEEP); + } + + void DownloadsDOMHandler::RecordOpenSurveyOnDangerousInterstitial( + const std::string& id) { +- CHECK(base::FeatureList::IsEnabled( +- safe_browsing::kDangerousDownloadInterstitial)); +- CountDownloadsDOMEvents( +- DOWNLOADS_DOM_EVENT_OPEN_SURVEY_ON_DANGEROUS_INTERSTITIAL); +- download::DownloadItem* file = GetDownloadByStringId(id); +- if (!CanLogWarningMetrics(file)) { +- return; +- } +- +- DCHECK(interstitial_open_time_.has_value()) +- << "Dangerous download interstitial survey should only open after the " +- "download interstitial is opened."; +- interstitial_survey_open_time_ = base::TimeTicks::Now(); +- +- RecordDangerousDownloadInterstitialInteractionHistogram( +- DangerousDownloadInterstitialInteraction::kOpenSurvey, +- (*interstitial_survey_open_time_) - (*interstitial_open_time_)); +- RecordDangerousDownloadInterstitialActionHistogram( +- DangerousDownloadInterstitialAction::kOpenSurvey); + } + + void DownloadsDOMHandler::SaveDangerousFromDialogRequiringGesture( +@@ -443,54 +388,6 @@ void DownloadsDOMHandler::SaveDangerousF + void DownloadsDOMHandler::SaveDangerousFromInterstitialNeedGesture( + const std::string& id, + downloads::mojom::DangerousDownloadInterstitialSurveyOptions response) { +- CHECK(base::FeatureList::IsEnabled( +- safe_browsing::kDangerousDownloadInterstitial)); +- if (!GetWebUIWebContents()->HasRecentInteraction()) { +- LOG(ERROR) << "SaveDangerousFromInterstitialNeedGesture received without " +- "recent user interaction"; +- return; +- } +- +- CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_SAVE_DANGEROUS_FROM_PROMPT); +- download::DownloadItem* file = GetDownloadByStringId(id); +- if (!CanLogWarningMetrics(file)) { +- return; +- } +- +- DCHECK(interstitial_open_time_.has_value()) +- << "Saving from the dangerous download interstitial should only happen " +- "if the interstitial is opened."; +- DCHECK(interstitial_survey_open_time_.has_value()) +- << "Saving from the dangerous download interstitial should only happen " +- "after the interstitial survey is opened."; +- +- base::TimeTicks save_time = base::TimeTicks::Now(); +- RecordDangerousDownloadInterstitialInteractionHistogram( +- DangerousDownloadInterstitialInteraction::kCompleteSurvey, +- save_time - (*interstitial_survey_open_time_)); +- RecordDangerousDownloadInterstitialInteractionHistogram( +- DangerousDownloadInterstitialInteraction::kSaveDangerous, +- save_time - (*interstitial_open_time_)); +- +- RecordDangerousDownloadInterstitialActionHistogram( +- DangerousDownloadInterstitialAction::kSaveDangerous); +- +- base::UmaHistogramEnumeration( +- "Download.DangerousDownloadInterstitial.SurveyResponse", response); +- +- RecordDownloadDangerPromptHistogram("Proceed", *file); +- +- MaybeReportBypassAction(file, WarningSurface::DOWNLOAD_PROMPT, +- WarningAction::PROCEED); +- MaybeTriggerDownloadWarningHatsSurvey( +- file, DownloadWarningHatsType::kDownloadsPageBypass); +- MaybeTriggerTrustSafetySurvey(file, WarningSurface::DOWNLOAD_PROMPT, +- WarningAction::PROCEED); +- +- RecordDownloadsPageValidatedHistogram(file); +- +- // `file` is potentially deleted. +- file->ValidateDangerousDownload(); + } + + void DownloadsDOMHandler::RecordCancelBypassWarningDialog( +@@ -507,27 +404,6 @@ void DownloadsDOMHandler::RecordCancelBy + + void DownloadsDOMHandler::RecordCancelBypassWarningInterstitial( + const std::string& id) { +- CHECK(base::FeatureList::IsEnabled( +- safe_browsing::kDangerousDownloadInterstitial)); +- CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_CANCEL_BYPASS_WARNING_PROMPT); +- download::DownloadItem* file = GetDownloadByStringId(id); +- if (!CanLogWarningMetrics(file)) { +- return; +- } +- +- DCHECK(interstitial_open_time_.has_value()) +- << "Dangerous download interstitial should only be cancelled after the " +- "download interstitial is opened."; +- +- RecordDangerousDownloadInterstitialInteractionHistogram( +- DangerousDownloadInterstitialInteraction::kCancelInterstitial, +- base::TimeTicks::Now() - (*interstitial_open_time_)); +- +- RecordDangerousDownloadInterstitialActionHistogram( +- DangerousDownloadInterstitialAction::kCancelInterstitial); +- +- MaybeReportBypassAction(file, WarningSurface::DOWNLOAD_PROMPT, +- WarningAction::CANCEL); + } + + void DownloadsDOMHandler::DiscardDangerous(const std::string& id) { +@@ -753,18 +629,6 @@ void DownloadsDOMHandler::DeepScan(const + return; + } + +- if (DownloadItemWarningData::IsTopLevelEncryptedArchive(download)) { +- // For encrypted archives, we need a password from the user. We will request +- // this in the download bubble. +- PromptForScanningInBubble(GetWebUIWebContents(), download); +- return; +- } +- +- LogDeepScanEvent(download, +- safe_browsing::DeepScanEvent::kPromptAcceptedFromWebUI); +- DownloadItemWarningData::AddWarningActionEvent( +- download, DownloadItemWarningData::WarningSurface::DOWNLOADS_PAGE, +- DownloadItemWarningData::WarningAction::ACCEPT_DEEP_SCAN); + DownloadItemModel model(download); + DownloadCommands commands(model.GetWeakPtr()); + commands.ExecuteCommand(DownloadCommands::DEEP_SCAN); +@@ -800,12 +664,6 @@ void DownloadsDOMHandler::ReviewDangerou + return; + } + +- CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_REVIEW_DANGEROUS); +- download::DownloadItem* download = GetDownloadByStringId(id); +- if (download) { +- DownloadItemModel model(download); +- model.ReviewScanningVerdict(GetWebUIWebContents()); +- } + } + + #if BUILDFLAG(GOOGLE_CHROME_BRANDING) +--- a/chrome/browser/ui/webui/management/management_ui_handler.cc ++++ b/chrome/browser/ui/webui/management/management_ui_handler.cc +@@ -274,10 +274,7 @@ void ManagementUIHandler::AddReportingIn + enterprise_reporting::kCloudProfileReportingEnabled); + + const bool real_time_url_check_connector_enabled = +- enterprise_connectors::ConnectorsServiceFactory::GetForBrowserContext( +- Profile::FromWebUI(web_ui())) +- ->GetAppliedRealTimeUrlCheck() != +- enterprise_connectors::REAL_TIME_CHECK_DISABLED; ++ false; + + if (cloud_legacy_tech_report_enabled) { + Profile::FromWebUI(web_ui())->GetPrefs()->GetList( +@@ -453,12 +450,6 @@ base::Value::Dict ManagementUIHandler::G + &info); + } + +- if (connectors_service->GetAppliedRealTimeUrlCheck() != +- enterprise_connectors::REAL_TIME_CHECK_DISABLED) { +- AddThreatProtectionPermission(kManagementOnPageVisitedEvent, +- kManagementOnPageVisitedVisibleData, &info); +- } +- + if (connectors_service + ->GetReportingSettings( + enterprise_connectors::ReportingConnector::SECURITY_EVENT) +--- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc ++++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc +@@ -750,7 +750,7 @@ void PrintPreviewHandler::HandleDoPrint( + } + ReportUserActionHistogram(user_action); + +-#if BUILDFLAG(ENTERPRISE_CONTENT_ANALYSIS) ++#if false + std::string device_name = *settings.FindString(kSettingDeviceName); + + using enterprise_data_protection::PrintScanningContext; +--- a/chrome/browser/ui/webui/settings/hats_handler.cc ++++ b/chrome/browser/ui/webui/settings/hats_handler.cc +@@ -83,60 +83,6 @@ void HatsHandler::RegisterMessages() { + */ + void HatsHandler::HandleSecurityPageHatsRequest(const base::Value::List& args) { + AllowJavascript(); +- +- // There are 3 argument in the input list. +- // The first one is the SecurityPageInteraction that triggered the survey. +- // The second one is the safe browsing setting the user was on. +- // The third one is the total amount of time a user spent on the security page +- // in focus. +- CHECK_EQ(3U, args.size()); +- +- Profile* profile = Profile::FromWebUI(web_ui()); +- +- // Enterprise users consideration. +- // If the admin disabled the survey, the survey will not be requested. +- if (!safe_browsing::IsSafeBrowsingSurveysEnabled(*profile->GetPrefs())) { +- return; +- } +- +- // Request HaTS survey. +- HatsService* hats_service = HatsServiceFactory::GetForProfile( +- profile, /* create_if_necessary = */ true); +- +- // The HaTS service may not be available for the profile, for example if it +- // is a guest profile. +- if (!hats_service) { +- return; +- } +- +- // Do not send the survey if the user didn't stay on the page long enough. +- if (args[2].GetDouble() < +- features::kHappinessTrackingSurveysForSecurityPageTime.Get() +- .InMilliseconds()) { +- return; +- } +- +- auto interaction = static_cast(args[0].GetInt()); +- if (features::kHappinessTrackingSurveysForSecurityPageRequireInteraction +- .Get() && +- interaction == SecurityPageInteraction::NO_INTERACTION) { +- return; +- } +- +- // Generate the Product Specific bits data from |profile| and |args|. +- SurveyStringData product_specific_string_data = +- GetSecurityPageProductSpecificStringData(profile, args); +- +- hats_service->LaunchSurvey( +- kHatsSurveyTriggerSettingsSecurity, +- /*success_callback*/ base::DoNothing(), +- /*failure_callback*/ base::DoNothing(), +- /*product_specific_bits_data=*/{}, +- /*product_specific_string_data=*/product_specific_string_data); +- +- // Log histogram that indicates that a survey is requested from the security +- // page. +- base::UmaHistogramBoolean("Feedback.SecurityPage.SurveyRequested", true); + } + + /** +@@ -203,17 +149,7 @@ SurveyStringData HatsHandler::GetSecurit + } + } + +- bool safe_browsing_enabled = +- profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled); +- bool safe_browsing_enhanced_enabled = +- profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnhanced); +- if (safe_browsing_enhanced_enabled) { +- safe_browsing_setting_current = "enhanced_protection"; +- } else if (safe_browsing_enabled) { +- safe_browsing_setting_current = "standard_protection"; +- } else { + safe_browsing_setting_current = "no_protection"; +- } + + std::string client_channel = + std::string(version_info::GetChannelString(chrome::GetChannel())); +--- a/chrome/browser/webshare/share_service_impl.cc ++++ b/chrome/browser/webshare/share_service_impl.cc +@@ -17,7 +17,9 @@ + #include "chrome/browser/browser_process.h" + #include "chrome/browser/safe_browsing/safe_browsing_service.h" + #include "chrome/common/chrome_features.h" ++#if BUILDFLAG(SAFE_BROWSING_AVAILABLE) + #include "components/safe_browsing/content/common/file_type_policies.h" ++#endif + #include "components/safe_browsing/core/browser/db/database_manager.h" + #include "content/public/browser/web_contents.h" + #include "mojo/public/cpp/bindings/self_owned_receiver.h" +@@ -208,11 +210,13 @@ void ShareServiceImpl::Share(const std:: + + // Check if at least one file is marked by the download protection service + // to send a ping to check this file type. ++#if BUILDFLAG(SAFE_BROWSING_AVAILABLE) + if (!should_check_url && + safe_browsing::FileTypePolicies::GetInstance()->IsCheckedBinaryFile( + path)) { + should_check_url = true; + } ++#endif // BUILDFLAG(SAFE_BROWSING_AVAILABLE) + + // In the case where the original blob handle was to a native file (of + // unknown size), the serialized data does not contain an accurate file +@@ -222,6 +226,7 @@ void ShareServiceImpl::Share(const std:: + } + + DCHECK(!safe_browsing_request_); ++#if BUILDFLAG(SAFE_BROWSING_AVAILABLE) + if (should_check_url && g_browser_process->safe_browsing_service()) { + safe_browsing_request_.emplace( + g_browser_process->safe_browsing_service()->database_manager(), +@@ -231,6 +236,7 @@ void ShareServiceImpl::Share(const std:: + std::move(files), std::move(callback))); + return; + } ++#endif // BUILDFLAG(SAFE_BROWSING_AVAILABLE) + + OnSafeBrowsingResultReceived(title, text, share_url, std::move(files), + std::move(callback), +--- a/chrome/common/webui_url_constants.cc ++++ b/chrome/common/webui_url_constants.cc +@@ -126,7 +126,6 @@ base::span Chr + kChromeUISuggestInternalsHost, + #endif + kChromeUINTPTilesInternalsHost, +- safe_browsing::kChromeUISafeBrowsingHost, + kChromeUISyncInternalsHost, + #if !BUILDFLAG(IS_ANDROID) + kChromeUITabSearchHost, +--- a/chrome/renderer/url_loader_throttle_provider_impl.cc ++++ b/chrome/renderer/url_loader_throttle_provider_impl.cc +@@ -171,26 +171,6 @@ URLLoaderThrottleProviderImpl::CreateThr + DCHECK(!is_frame_resource || + type_ == blink::URLLoaderThrottleProviderType::kFrame); + +- if (!is_frame_resource) { +- if (pending_safe_browsing_) { +- safe_browsing_.Bind(std::move(pending_safe_browsing_)); +- } +- +-#if BUILDFLAG(ENABLE_EXTENSIONS) +- if (pending_extension_web_request_reporter_) { +- extension_web_request_reporter_.Bind( +- std::move(pending_extension_web_request_reporter_)); +- } +- +- auto throttle = std::make_unique( +- safe_browsing_.get(), local_frame_token, +- extension_web_request_reporter_.get()); +-#else +- auto throttle = std::make_unique( +- safe_browsing_.get(), local_frame_token); +-#endif // BUILDFLAG(ENABLE_EXTENSIONS) +- throttles.emplace_back(std::move(throttle)); +- } + + if (type_ == blink::URLLoaderThrottleProviderType::kFrame && + !is_frame_resource && local_frame_token.has_value()) { +--- a/chrome/renderer/websocket_handshake_throttle_provider_impl.cc ++++ b/chrome/renderer/websocket_handshake_throttle_provider_impl.cc +@@ -58,15 +58,5 @@ WebSocketHandshakeThrottleProviderImpl:: + scoped_refptr task_runner) { + DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); + +-#if BUILDFLAG(ENABLE_EXTENSIONS) +- if (pending_extension_web_request_reporter_) { +- extension_web_request_reporter_.Bind( +- std::move(pending_extension_web_request_reporter_)); +- } +- return std::make_unique< +- safe_browsing::WebSocketSBExtensionsHandshakeThrottle>( +- extension_web_request_reporter_.get()); +-#else + return nullptr; +-#endif + } +--- a/chrome/test/BUILD.gn ++++ b/chrome/test/BUILD.gn +@@ -2189,9 +2189,6 @@ if (!is_android) { + "//components/resources", + "//components/safe_browsing:buildflags", + "//components/safe_browsing/content/browser", +- "//components/safe_browsing/content/browser:client_side_detection", +- "//components/safe_browsing/content/browser:client_side_detection_images_cache", +- "//components/safe_browsing/content/browser:client_side_detection_service", + "//components/safe_browsing/content/browser:safe_browsing_service", + "//components/safe_browsing/content/browser/password_protection", + "//components/safe_browsing/content/browser/password_protection:test_support", +@@ -6878,9 +6875,6 @@ test("unit_tests") { + "//components/resources", + "//components/safe_browsing:buildflags", + "//components/safe_browsing/content/browser", +- "//components/safe_browsing/content/browser:client_side_detection", +- "//components/safe_browsing/content/browser:client_side_detection_images_cache", +- "//components/safe_browsing/content/browser:client_side_detection_service", + "//components/safe_browsing/content/browser/password_protection", + "//components/safe_browsing/content/browser/password_protection:mock_password_protection", + "//components/safe_browsing/content/browser/web_ui", +--- a/components/enterprise/connectors/core/reporting_service_settings.cc ++++ b/components/enterprise/connectors/core/reporting_service_settings.cc +@@ -44,16 +44,6 @@ ReportingServiceSettings::ReportingServi + else + DVLOG(1) << "Enabled event name list contains a non string value!"; + } +- } else { +- // When the list of enabled event names is not set, we assume all events are +- // enabled. This is to support the feature of selecting the "All always on" +- // option in the policy UI, which means to always enable all events, even +- // when new events may be added in the future. And this is also to support +- // existing customer policies that were created before we introduced the +- // concept of enabling/disabling events. +- for (const char* event : kAllReportingEvents) { +- enabled_event_names_.insert(event); +- } + } + + const base::Value::List* enabled_opt_in_events_value = +--- a/components/password_manager/content/browser/content_password_manager_driver.cc ++++ b/components/password_manager/content/browser/content_password_manager_driver.cc +@@ -622,7 +622,7 @@ void ContentPasswordManagerDriver::Check + if (!password_manager::bad_message::CheckFrameNotPrerendering( + render_frame_host_)) + return; +-#if defined(ON_FOCUS_PING_ENABLED) ++#if defined(ON_FOCUS_PING_ENABLED) && BUILDFLAG(FULL_SAFE_BROWSING) + client_->CheckSafeBrowsingReputation(form_action, frame_url); + #endif + } +--- 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 +@@ -324,12 +324,7 @@ bool LeakDetectionCheck::IsURLBlockedByP + const PrefService& prefs, + const GURL& form_url, + autofill::SavePasswordProgressLogger* logger) { +- bool is_blocked = safe_browsing::IsURLAllowlistedByPolicy(form_url, prefs); +- if (is_blocked && logger) { +- logger->LogMessage(autofill::SavePasswordProgressLogger:: +- STRING_LEAK_DETECTION_URL_BLOCKED); +- } +- return is_blocked; ++ return false; + } + + } // namespace password_manager +--- a/components/password_manager/core/browser/password_manager_client.h ++++ b/components/password_manager/core/browser/password_manager_client.h +@@ -418,9 +418,6 @@ class PasswordManagerClient { + // Returns the current best guess as to the page's display language. + virtual autofill::LanguageCode GetPageLanguage() const; + +- // Return the PasswordProtectionService associated with this instance. +- virtual safe_browsing::PasswordProtectionService* +- GetPasswordProtectionService() const = 0; + + // Maybe triggers a hats survey that measures the user's perception of + // Autofill for passwords. When triggering happens, the survey dialog will be +@@ -432,13 +429,6 @@ class PasswordManagerClient { + virtual void TriggerUserPerceptionOfPasswordManagerSurvey( + const std::string& filling_assistance); + +-#if defined(ON_FOCUS_PING_ENABLED) +- // Checks the safe browsing reputation of the webpage when the +- // user focuses on a username/password field. This is used for reporting +- // only, and won't trigger a warning. +- virtual void CheckSafeBrowsingReputation(const GURL& form_action, +- const GURL& frame_url) = 0; +-#endif + + // If the feature is enabled send an event to the enterprise reporting + // connector server indicating that the user signed in to a website. +--- a/components/safe_browsing/content/common/proto/BUILD.gn ++++ b/components/safe_browsing/content/common/proto/BUILD.gn +@@ -5,8 +5,12 @@ + import("//components/safe_browsing/buildflags.gni") + import("//third_party/protobuf/proto_library.gni") + +-if (safe_browsing_mode != 0) { ++# Although this was gated on safe_browsing_mode != 0, a considerable amount ++# of source code that relies on the types included in download_file_types.pb.h ++# is not gated on BUILDFLAG(SAFE_BROWSING_AVAILABLE). This is far less ++# invasive than the alternative. ++# if (safe_browsing_mode != 0) { + proto_library("download_file_types_proto") { + sources = [ "download_file_types.proto" ] + } +-} ++# } +--- a/components/safe_browsing/content/common/safe_browsing.mojom ++++ b/components/safe_browsing/content/common/safe_browsing.mojom +@@ -146,7 +146,6 @@ interface PhishingDetector { + mojo_base.mojom.ProtoWrapper? request); + }; + +-[EnableIf=full_safe_browsing] + // Interface for setting a phishing model. This is scoped to an entire + // RenderProcess. + interface PhishingModelSetter { +--- a/components/safe_browsing/core/browser/BUILD.gn ++++ b/components/safe_browsing/core/browser/BUILD.gn +@@ -23,8 +23,6 @@ source_set("browser") { + "url_checker_delegate.h", + "url_realtime_mechanism.cc", + "url_realtime_mechanism.h", +- "user_population.cc", +- "user_population.h", + ] + + configs += [ "//build/config/compiler:wexit_time_destructors" ] +--- a/components/safe_browsing/core/browser/db/BUILD.gn ++++ b/components/safe_browsing/core/browser/db/BUILD.gn +@@ -243,8 +243,6 @@ source_set("v4_store") { + sources = [ + "hash_prefix_map.cc", + "hash_prefix_map.h", +- "v4_store.cc", +- "v4_store.h", + ] + + configs += [ "//build/config/compiler:wexit_time_destructors" ] +--- a/components/safe_browsing/core/browser/db/hash_prefix_map.h ++++ b/components/safe_browsing/core/browser/db/hash_prefix_map.h +@@ -11,6 +11,7 @@ + #include + + #include "base/files/memory_mapped_file.h" ++#include "base/task/sequenced_task_runner.h" + #include "components/safe_browsing/core/browser/db/v4_protocol_manager_util.h" + #include "components/safe_browsing/core/browser/db/v4_store.pb.h" + #include "components/safe_browsing/core/common/proto/webui.pb.h" +--- a/components/safe_browsing/core/browser/db/v4_update_protocol_manager.cc ++++ b/components/safe_browsing/core/browser/db/v4_update_protocol_manager.cc +@@ -27,7 +27,6 @@ + #include "services/network/public/mojom/url_response_head.mojom.h" + + using base::Time; +-using enum safe_browsing::ExtendedReportingLevel; + + namespace { + +--- a/components/safe_browsing/core/browser/hashprefix_realtime/hash_realtime_service.h ++++ b/components/safe_browsing/core/browser/hashprefix_realtime/hash_realtime_service.h +@@ -12,6 +12,7 @@ + #include + #include + ++#include "base/containers/flat_map.h" + #include "base/containers/unique_ptr_adapters.h" + #include "base/gtest_prod_util.h" + #include "base/memory/raw_ptr.h" +--- a/components/safe_browsing/core/browser/hashprefix_realtime/ohttp_key_service.cc ++++ b/components/safe_browsing/core/browser/hashprefix_realtime/ohttp_key_service.cc +@@ -13,7 +13,6 @@ + #include "components/safe_browsing/core/browser/utils/backoff_operator.h" + #include "components/safe_browsing/core/common/features.h" + #include "components/safe_browsing/core/common/hashprefix_realtime/hash_realtime_utils.h" +-#include "components/safe_browsing/core/common/safe_browsing_prefs.h" + #include "components/safe_browsing/core/common/utils.h" + #include "google_apis/google_api_keys.h" + #include "net/base/net_errors.h" +@@ -115,13 +114,7 @@ constexpr net::NetworkTrafficAnnotationT + )"); + + bool IsEnabled(PrefService* pref_service, std::optional country) { +- // If this class has been created, it is already known that the session is not +- // off-the-record, so |is_off_the_record| is passed through as false. +- return safe_browsing::hash_realtime_utils::DetermineHashRealTimeSelection( +- /*is_off_the_record=*/false, pref_service, +- /*latest_country=*/country) == +- safe_browsing::hash_realtime_utils::HashRealTimeSelection:: +- kHashRealTimeService; ++ return false; + } + + GURL GetKeyFetchingUrl() { +@@ -407,25 +400,9 @@ void OhttpKeyService::MaybeStartServerTr + } + + void OhttpKeyService::PopulateKeyFromPref() { +- std::string key = +- pref_service_->GetString(prefs::kSafeBrowsingHashRealTimeOhttpKey); +- base::Time expiration_time = pref_service_->GetTime( +- prefs::kSafeBrowsingHashRealTimeOhttpExpirationTime); +- if (!key.empty() && expiration_time > base::Time::Now()) { +- std::string decoded_key; +- base::Base64Decode(key, &decoded_key); +- ohttp_key_ = {decoded_key, expiration_time}; +- } + } + + void OhttpKeyService::StoreKeyToPref() { +- if (ohttp_key_ && ohttp_key_->expiration > base::Time::Now()) { +- std::string base64_encoded_key = base::Base64Encode(ohttp_key_->key); +- pref_service_->SetString(prefs::kSafeBrowsingHashRealTimeOhttpKey, +- base64_encoded_key); +- pref_service_->SetTime(prefs::kSafeBrowsingHashRealTimeOhttpExpirationTime, +- ohttp_key_->expiration); +- } + } + + void OhttpKeyService::Shutdown() { +--- a/components/safe_browsing/core/browser/realtime/url_lookup_service.cc ++++ b/components/safe_browsing/core/browser/realtime/url_lookup_service.cc +@@ -267,17 +267,6 @@ void RealTimeUrlLookupService::MaybeLogP + bool request_had_cookie, + bool was_first_request, + bool sent_with_token) { +- std::string histogram_name = kCookieHistogramPrefix; +- base::StrAppend(&histogram_name, +- {was_first_request ? ".FirstRequest" : ".SubsequentRequest"}); +- base::UmaHistogramBoolean(histogram_name, request_had_cookie); +- // `pref_service_` can be null in tests. +- // This histogram variant is only logged for signed-out ESB users. +- if (!sent_with_token && pref_service_ && +- IsEnhancedProtectionEnabled(*pref_service_)) { +- base::StrAppend(&histogram_name, {".SignedOutEsbUser"}); +- base::UmaHistogramBoolean(histogram_name, request_had_cookie); +- } + } + + } // namespace safe_browsing +--- a/components/safe_browsing/core/browser/tailored_security_service/tailored_security_service.cc ++++ b/components/safe_browsing/core/browser/tailored_security_service/tailored_security_service.cc +@@ -409,7 +409,6 @@ void TailoredSecurityService::MaybeNotif + RecordEnabledNotificationResult( + TailoredSecurityNotificationResult::kHistoryNotSynced); + } +- SaveRetryState(TailoredSecurityRetryState::NO_RETRY_NEEDED); + return; + } + +@@ -419,7 +418,6 @@ void TailoredSecurityService::MaybeNotif + RecordEnabledNotificationResult( + TailoredSecurityNotificationResult::kSafeBrowsingControlledByPolicy); + } +- SaveRetryState(TailoredSecurityRetryState::NO_RETRY_NEEDED); + return; + } + +@@ -523,31 +521,10 @@ void TailoredSecurityService::Shutdown() + } + + void TailoredSecurityService::TailoredSecurityTimestampUpdateCallback() { +- if (base::FeatureList::IsEnabled( +- safe_browsing::kTailoredSecurityRetryForSyncUsers)) { +- // TODO(crbug.com/40925236): remove sync flow last user interaction pref. +- prefs_->SetInteger(prefs::kTailoredSecuritySyncFlowLastUserInteractionState, +- TailoredSecurityRetryState::UNKNOWN); +- prefs_->SetTime(prefs::kTailoredSecuritySyncFlowLastRunTime, +- base::Time::Now()); +- // If this method fails, then a retry is needed. If it succeeds, the +- // ChromeTailoredSecurityService will set this value to NO_RETRY_NEEDED for +- // us. +- prefs_->SetInteger(prefs::kTailoredSecuritySyncFlowRetryState, +- TailoredSecurityRetryState::RETRY_NEEDED); +- } +- + StartRequest(base::BindOnce(&TailoredSecurityService::MaybeNotifySyncUser, + weak_ptr_factory_.GetWeakPtr())); + } + +-void TailoredSecurityService::SaveRetryState(TailoredSecurityRetryState state) { +- if (base::FeatureList::IsEnabled( +- safe_browsing::kTailoredSecurityRetryForSyncUsers)) { +- prefs_->SetInteger(prefs::kTailoredSecuritySyncFlowRetryState, state); +- } +-} +- + void TailoredSecurityService::SetCanQuery(bool can_query) { + can_query_ = can_query; + if (can_query) { +--- a/components/safe_browsing/core/browser/tailored_security_service/tailored_security_service.h ++++ b/components/safe_browsing/core/browser/tailored_security_service/tailored_security_service.h +@@ -23,7 +23,6 @@ + #include "base/values.h" + #include "components/keyed_service/core/keyed_service.h" + #include "components/prefs/pref_change_registrar.h" +-#include "components/safe_browsing/core/common/safe_browsing_prefs.h" + #include "net/traffic_annotation/network_traffic_annotation.h" + #include "url/gurl.h" + +@@ -186,9 +185,6 @@ class TailoredSecurityService : public K + RetryDisabledStateRemainsUnset); + friend class TailoredSecurityTabHelperTest; + +- // Saves the supplied `TailoredSecurityRetryState` to preferences. +- void SaveRetryState(TailoredSecurityRetryState state); +- + // Stores pointer to `IdentityManager` instance. It must outlive the + // `TailoredSecurityService` and can be null during tests. + raw_ptr identity_manager_; +--- a/components/safe_browsing/core/browser/verdict_cache_manager.cc ++++ b/components/safe_browsing/core/browser/verdict_cache_manager.cc +@@ -443,16 +443,6 @@ VerdictCacheManager::VerdictCacheManager + // pref_service can be null in tests. + if (pref_service) { + pref_change_registrar_.Init(pref_service); +- pref_change_registrar_.Add( +- prefs::kSafeBrowsingEnhanced, +- base::BindRepeating(&VerdictCacheManager::CleanUpAllPageLoadTokens, +- weak_factory_.GetWeakPtr(), +- ClearReason::kSafeBrowsingStateChanged)); +- pref_change_registrar_.Add( +- prefs::kSafeBrowsingEnabled, +- base::BindRepeating(&VerdictCacheManager::CleanUpAllPageLoadTokens, +- weak_factory_.GetWeakPtr(), +- ClearReason::kSafeBrowsingStateChanged)); + } + // sync_observer_ can be null in some embedders that don't support sync. + if (sync_observer_) { +--- a/components/security_interstitials/content/ssl_blocking_page_base.cc ++++ b/components/security_interstitials/content/ssl_blocking_page_base.cc +@@ -4,7 +4,6 @@ + + #include "components/security_interstitials/content/ssl_blocking_page_base.h" + +-#include "components/safe_browsing/core/common/safe_browsing_prefs.h" + #include "components/security_interstitials/content/security_interstitial_controller_client.h" + #include "components/security_interstitials/core/controller_client.h" + #include "components/security_interstitials/core/metrics_helper.h" +@@ -42,33 +41,7 @@ SSLBlockingPageBase::~SSLBlockingPageBas + void SSLBlockingPageBase::OnInterstitialClosing() {} + + bool SSLBlockingPageBase::ShouldShowEnhancedProtectionMessage() { +- // Only show the enhanced protection message if all the following are true: +- // |can_show_enhanced_protection_message_| is set to true AND +- // the window is not incognito AND +- // Safe Browsing is not managed by policy AND +- // the user is not already in enhanced protection mode. +- if (!can_show_enhanced_protection_message_) { + return false; +- } +- +- const bool in_incognito = +- web_contents()->GetBrowserContext()->IsOffTheRecord(); +- const PrefService* pref_service = GetPrefs(web_contents()); +- bool is_enhanced_protection_enabled = +- safe_browsing::IsEnhancedProtectionEnabled(*pref_service); +- bool is_safe_browsing_managed = +- safe_browsing::IsSafeBrowsingPolicyManaged(*pref_service); +- +- if (in_incognito) { +- return false; +- } +- if (is_enhanced_protection_enabled) { +- return false; +- } +- if (is_safe_browsing_managed) { +- return false; +- } +- return true; + } + + void SSLBlockingPageBase::PopulateEnhancedProtectionMessage( +--- a/content/browser/file_system_access/file_system_access_safe_move_helper.cc ++++ b/content/browser/file_system_access/file_system_access_safe_move_helper.cc +@@ -168,15 +168,8 @@ void FileSystemAccessSafeMoveHelper::Sta + return; + } + +- if (!RequireAfterWriteChecks() || !manager_->permission_context()) { + DidAfterWriteCheck( + FileSystemAccessPermissionContext::AfterWriteCheckResult::kAllow); +- return; +- } +- +- ComputeHashForSourceFile( +- base::BindOnce(&FileSystemAccessSafeMoveHelper::DoAfterWriteCheck, +- weak_factory_.GetWeakPtr())); + } + + void FileSystemAccessSafeMoveHelper::ComputeHashForSourceFile( +@@ -215,45 +208,6 @@ bool FileSystemAccessSafeMoveHelper::Req + return dest_url().type() != storage::kFileSystemTypeTemporary; + } + +-void FileSystemAccessSafeMoveHelper::DoAfterWriteCheck( +- base::File::Error hash_result, +- const std::string& hash, +- int64_t size) { +- DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); +- +- if (hash_result != base::File::FILE_OK) { +- // Calculating the hash failed. +- std::move(callback_).Run(file_system_access_error::FromStatus( +- blink::mojom::FileSystemAccessStatus::kOperationAborted, +- "Failed to perform Safe Browsing check.")); +- return; +- } +- +- if (!manager_) { +- std::move(callback_).Run(file_system_access_error::FromStatus( +- blink::mojom::FileSystemAccessStatus::kOperationAborted)); +- return; +- } +- +- content::GlobalRenderFrameHostId outermost_main_frame_id; +- auto* rfh = content::RenderFrameHost::FromID(context_.frame_id); +- if (rfh) +- outermost_main_frame_id = rfh->GetOutermostMainFrame()->GetGlobalId(); +- +- auto item = std::make_unique(); +- item->target_file_path = dest_url().path(); +- item->full_path = source_url().path(); +- item->sha256_hash = hash; +- item->size = size; +- item->frame_url = context_.url; +- item->outermost_main_frame_id = outermost_main_frame_id; +- item->has_user_gesture = has_transient_user_activation_; +- manager_->permission_context()->PerformAfterWriteChecks( +- std::move(item), context_.frame_id, +- base::BindOnce(&FileSystemAccessSafeMoveHelper::DidAfterWriteCheck, +- weak_factory_.GetWeakPtr())); +-} +- + void FileSystemAccessSafeMoveHelper::DidAfterWriteCheck( + FileSystemAccessPermissionContext::AfterWriteCheckResult result) { + DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); +--- a/content/browser/file_system_access/file_system_access_safe_move_helper.h ++++ b/content/browser/file_system_access/file_system_access_safe_move_helper.h +@@ -60,9 +60,6 @@ class CONTENT_EXPORT FileSystemAccessSaf + private: + SEQUENCE_CHECKER(sequence_checker_); + +- void DoAfterWriteCheck(base::File::Error hash_result, +- const std::string& hash, +- int64_t size); + void DidAfterWriteCheck( + FileSystemAccessPermissionContext::AfterWriteCheckResult result); + void DidFileSkipQuarantine(base::File::Error result); +--- a/content/browser/file_system_access/mock_file_system_access_permission_context.cc ++++ b/content/browser/file_system_access/mock_file_system_access_permission_context.cc +@@ -23,11 +23,4 @@ void MockFileSystemAccessPermissionConte + user_action, frame_id, callback); + } + +-void MockFileSystemAccessPermissionContext::PerformAfterWriteChecks( +- std::unique_ptr item, +- GlobalRenderFrameHostId frame_id, +- base::OnceCallback callback) { +- PerformAfterWriteChecks_(item.get(), frame_id, callback); +-} +- + } // namespace content +--- a/content/browser/file_system_access/mock_file_system_access_permission_context.h ++++ b/content/browser/file_system_access/mock_file_system_access_permission_context.h +@@ -54,16 +54,6 @@ class MockFileSystemAccessPermissionCont + GlobalRenderFrameHostId frame_id, + base::OnceCallback& callback)); + +- void PerformAfterWriteChecks( +- std::unique_ptr item, +- GlobalRenderFrameHostId frame_id, +- base::OnceCallback callback) override; +- MOCK_METHOD(void, +- PerformAfterWriteChecks_, +- (FileSystemAccessWriteItem * item, +- GlobalRenderFrameHostId frame_id, +- base::OnceCallback& callback)); +- + MOCK_METHOD(bool, + CanObtainReadPermission, + (const url::Origin& origin), +--- a/content/public/browser/file_system_access_permission_context.h ++++ b/content/public/browser/file_system_access_permission_context.h +@@ -128,12 +128,6 @@ class FileSystemAccessPermissionContext + base::OnceCallback callback) = 0; + + enum class AfterWriteCheckResult { kAllow, kBlock }; +- // Runs a recently finished write operation through checks such as malware +- // or other security checks to determine if the write should be allowed. +- virtual void PerformAfterWriteChecks( +- std::unique_ptr item, +- GlobalRenderFrameHostId frame_id, +- base::OnceCallback callback) = 0; + + // Returns whether the give |origin| already allows read permission, or it is + // possible to request one. This is used to block file dialogs from being +--- a/content/public/test/fake_file_system_access_permission_context.cc ++++ b/content/public/test/fake_file_system_access_permission_context.cc +@@ -47,13 +47,6 @@ void FakeFileSystemAccessPermissionConte + std::move(callback).Run(SensitiveEntryResult::kAllowed); + } + +-void FakeFileSystemAccessPermissionContext::PerformAfterWriteChecks( +- std::unique_ptr item, +- GlobalRenderFrameHostId frame_id, +- base::OnceCallback callback) { +- std::move(callback).Run(AfterWriteCheckResult::kAllow); +-} +- + bool FakeFileSystemAccessPermissionContext::CanObtainReadPermission( + const url::Origin& origin) { + return true; +--- a/content/public/test/fake_file_system_access_permission_context.h ++++ b/content/public/test/fake_file_system_access_permission_context.h +@@ -46,11 +46,6 @@ class FakeFileSystemAccessPermissionCont + GlobalRenderFrameHostId frame_id, + base::OnceCallback callback) override; + +- void PerformAfterWriteChecks( +- std::unique_ptr item, +- GlobalRenderFrameHostId frame_id, +- base::OnceCallback callback) override; +- + bool CanObtainReadPermission(const url::Origin& origin) override; + bool CanObtainWritePermission(const url::Origin& origin) override; + +--- a/extensions/browser/updater/update_service.cc ++++ b/extensions/browser/updater/update_service.cc +@@ -134,13 +134,6 @@ void UpdateService::OnCrxStateChange(Upd + break; + } + +- if (should_perform_action_on_omaha_attributes) { +- base::Value::Dict attributes = GetExtensionOmahaAttributes(item); +- // Note that it's important to perform actions even if |attributes| is +- // empty, missing values may default to false and have associated logic. +- ExtensionSystem::Get(browser_context_) +- ->PerformActionBasedOnOmahaAttributes(item.id, attributes); +- } + } + + UpdateService::UpdateService( diff --git a/www-client/thorium/files/font-gc-r2.patch b/www-client/thorium/files/font-gc-r2.patch new file mode 100644 index 0000000..497775f --- /dev/null +++ b/www-client/thorium/files/font-gc-r2.patch @@ -0,0 +1,69 @@ +--- a/third_party/blink/renderer/platform/fonts/font_face_creation_params.h ++++ b/third_party/blink/renderer/platform/fonts/font_face_creation_params.h +@@ -64,7 +64,7 @@ + #endif + } + +- FontFaceCreationParams(const std::string& filename, ++ FontFaceCreationParams(const WTF::String& filename, + int fontconfig_interface_id, + int ttc_index = 0) + : creation_type_(kCreateFontByFciIdAndTtcIndex), +@@ -77,7 +77,7 @@ + DCHECK_EQ(creation_type_, kCreateFontByFamily); + return family_; + } +- const std::string& Filename() const { ++ const WTF::String& Filename() const { + DCHECK_EQ(creation_type_, kCreateFontByFciIdAndTtcIndex); + #if defined(ADDRESS_SANITIZER) + DCHECK(filename_.has_value()); +@@ -105,7 +105,7 @@ + std::tuple hash_data = { + ttc_index_, fontconfig_interface_id_, + HasFilename() ? StringHasher::HashMemory( +- Filename().data(), ++ Filename().Utf8().data(), + static_cast(Filename().length())) + : 0}; + return StringHasher::HashMemory(&hash_data, sizeof(hash_data)); +@@ -130,7 +130,7 @@ + FontFaceCreationType creation_type_; + AtomicString family_; + +- void SetFilename(std::string& filename) { ++ void SetFilename(WTF::String& filename) { + #if defined(ADDRESS_SANITIZER) + *filename_ = filename; + #else +@@ -167,7 +167,7 @@ + // See crbug.com/346174906. + std::optional filename_; + #else +- std::string filename_; ++ WTF::String filename_; + #endif + int fontconfig_interface_id_ = 0; + int ttc_index_ = 0; +--- a/third_party/blink/renderer/platform/fonts/linux/font_cache_linux.cc ++++ b/third_party/blink/renderer/platform/fonts/linux/font_cache_linux.cc +@@ -111,7 +111,7 @@ + + FontFaceCreationParams creation_params; + creation_params = FontFaceCreationParams( +- fallback_font.filepath.value(), fallback_font.fontconfig_interface_id, ++ WTF::String(fallback_font.filepath.value()), fallback_font.fontconfig_interface_id, + fallback_font.ttc_index); + + // Changes weight and/or italic of given FontDescription depends on +--- a/third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc ++++ b/third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc +@@ -234,7 +234,7 @@ + creation_params.FontconfigInterfaceId(), creation_params.TtcIndex()); + } + return SkTypeface_Factory::FromFilenameAndTtcIndex( +- creation_params.Filename().data(), creation_params.TtcIndex()); ++ creation_params.Filename().Utf8().data(), creation_params.TtcIndex()); + } + #endif + diff --git a/www-client/thorium/files/libusb.gn b/www-client/thorium/files/libusb.gn new file mode 100644 index 0000000..9f56f09 --- /dev/null +++ b/www-client/thorium/files/libusb.gn @@ -0,0 +1,24 @@ +# Copyright 2016 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("//build/config/linux/pkg_config.gni") +import("//build/shim_headers.gni") + +pkg_config("system_libusb") { + packages = [ "libusb-1.0" ] +} + +shim_headers("libusb_shim") { + root_path = "src/libusb" + headers = [ + "libusb.h", + ] +} + +source_set("libusb") { + deps = [ + ":libusb_shim", + ] + public_configs = [ ":system_libusb" ] +} diff --git a/www-client/thorium/files/perfetto-acc24608c84d2d2d8d684f40a110d0a6f4eddc51.patch b/www-client/thorium/files/perfetto-acc24608c84d2d2d8d684f40a110d0a6f4eddc51.patch new file mode 100644 index 0000000..bb799cb --- /dev/null +++ b/www-client/thorium/files/perfetto-acc24608c84d2d2d8d684f40a110d0a6f4eddc51.patch @@ -0,0 +1,89 @@ +From acc24608c84d2d2d8d684f40a110d0a6f4eddc51 Mon Sep 17 00:00:00 2001 +From: Daniele Di Proietto +Date: Mon, 6 Jan 2025 15:30:23 +0000 +Subject: [PATCH] Small fixes for libstdc++ + +Change-Id: I054305ff3de0007f98f9713347f72d63d69569e8 +--- + include/perfetto/tracing/track.h | 1 + + src/profiling/common/producer_support.cc | 1 + + src/trace_processor/importers/common/tracks.h | 4 ++-- + src/trace_processor/importers/common/tracks_internal.h | 8 ++++---- + .../perfetto_sql/engine/created_function.cc | 4 ++-- + src/trace_processor/util/regex.h | 2 +- + src/traceconv/pprof_reader.cc | 2 +- + 7 files changed, 12 insertions(+), 10 deletions(-) + +diff --git a/include/perfetto/tracing/track.h b/include/perfetto/tracing/track.h +index 43a8de13d4299387bc1c77582d33542371ffd74f..2a857298c7f4769a05d0db309aca59b72c22b115 100644 +--- a/include/perfetto/tracing/track.h ++++ b/include/perfetto/tracing/track.h +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + + namespace perfetto { + namespace internal { +diff --git a/src/profiling/common/producer_support.cc b/src/profiling/common/producer_support.cc +index 5303658d7b7bb0d4b08c00a1decc5c757b006ecb..e9e193db81f87b5c48eefc5aa5a3cfa307baafdb 100644 +--- a/src/profiling/common/producer_support.cc ++++ b/src/profiling/common/producer_support.cc +@@ -16,6 +16,7 @@ + + #include "src/profiling/common/producer_support.h" + ++#include + #include + + #include "perfetto/ext/base/android_utils.h" +diff --git a/src/trace_processor/perfetto_sql/engine/created_function.cc b/src/trace_processor/perfetto_sql/engine/created_function.cc +index 1c01c1787ea9ab1972159ce4efd65e225040cee6..e6cef14909d7dab58d1c4abbbe3e536c696910fb 100644 +--- a/src/trace_processor/perfetto_sql/engine/created_function.cc ++++ b/src/trace_processor/perfetto_sql/engine/created_function.cc +@@ -109,7 +109,7 @@ struct StoredSqlValue { + // the destructors run correctly for non-trivial members of the + // union. + using Data = +- std::variant; ++ std::variant; + + StoredSqlValue(SqlValue value) { + switch (value.type) { +@@ -134,7 +134,7 @@ struct StoredSqlValue { + } + + SqlValue AsSqlValue() { +- if (std::holds_alternative(data)) { ++ if (std::holds_alternative(data)) { + return SqlValue(); + } else if (std::holds_alternative(data)) { + return SqlValue::Long(std::get(data)); +diff --git a/src/trace_processor/util/regex.h b/src/trace_processor/util/regex.h +index 120e4c968279d75d8b8f341a96a1f6402a9c4e41..167af55d9bebe4c3c7febf1be91d0bdd01910282 100644 +--- a/src/trace_processor/util/regex.h ++++ b/src/trace_processor/util/regex.h +@@ -48,7 +48,7 @@ class Regex { + regfree(®ex_.value()); + } + } +- Regex(Regex&) = delete; ++ Regex(const Regex&) = delete; + Regex(Regex&& other) { + regex_ = std::move(other.regex_); + other.regex_ = std::nullopt; +diff --git a/src/traceconv/pprof_reader.cc b/src/traceconv/pprof_reader.cc +index f14cca73778b14505cce7d4f99848fae67a111c0..612b7c7a40e7127109550a7d0bcfed3685afa2b6 100644 +--- a/src/traceconv/pprof_reader.cc ++++ b/src/traceconv/pprof_reader.cc +@@ -16,8 +16,8 @@ + + #include "src/traceconv/pprof_reader.h" + ++#include + #include +-#include + + #include "perfetto/ext/base/file_utils.h" + diff --git a/www-client/thorium/files/perfetto-system-zlib.patch b/www-client/thorium/files/perfetto-system-zlib.patch new file mode 100644 index 0000000..e1bd9c8 --- /dev/null +++ b/www-client/thorium/files/perfetto-system-zlib.patch @@ -0,0 +1,11 @@ +--- a/third_party/perfetto/gn/BUILD.gn ++++ b/third_party/perfetto/gn/BUILD.gn +@@ -382,7 +382,7 @@ + if (enable_perfetto_zlib) { + group("zlib") { + if (perfetto_use_system_zlib) { +- public_configs = [ "//gn:system_zlib_config" ] ++ public_configs = [ ":system_zlib_config" ] + } else if (perfetto_root_path == "//") { + public_configs = [ "//buildtools:zlib_config" ] + public_deps = [ "//buildtools:zlib" ] diff --git a/www-client/thorium/files/reverse-roll-src-third_party-ffmpeg.patch b/www-client/thorium/files/reverse-roll-src-third_party-ffmpeg.patch new file mode 100644 index 0000000..c78848e --- /dev/null +++ b/www-client/thorium/files/reverse-roll-src-third_party-ffmpeg.patch @@ -0,0 +1,287 @@ +--- b/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc ++++ a/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc +@@ -74,7 +74,7 @@ + codec_context->sample_fmt = AV_SAMPLE_FMT_NONE; + } + ++ codec_context->channels = config.channel_count; +- codec_context->ch_layout.nb_channels = config.channel_count; + codec_context->sample_rate = config.samples_per_second; + + if (config.extra_data) { +@@ -124,8 +124,8 @@ + case cdm::kAudioFormatPlanarS16: + case cdm::kAudioFormatPlanarF32: { + const int decoded_size_per_channel = ++ decoded_audio_size / av_frame.channels; ++ for (int i = 0; i < av_frame.channels; ++i) { +- decoded_audio_size / av_frame.ch_layout.nb_channels; +- for (int i = 0; i < av_frame.ch_layout.nb_channels; ++i) { + memcpy(output_buffer, av_frame.extended_data[i], + decoded_size_per_channel); + output_buffer += decoded_size_per_channel; +@@ -185,14 +185,13 @@ + // Success! + decoding_loop_ = std::make_unique(codec_context_.get()); + samples_per_second_ = config.samples_per_second; ++ bytes_per_frame_ = codec_context_->channels * config.bits_per_channel / 8; +- bytes_per_frame_ = +- codec_context_->ch_layout.nb_channels * config.bits_per_channel / 8; + output_timestamp_helper_ = + std::make_unique(config.samples_per_second); + is_initialized_ = true; + + // Store initial values to guard against midstream configuration changes. ++ channels_ = codec_context_->channels; +- channels_ = codec_context_->ch_layout.nb_channels; + av_sample_format_ = codec_context_->sample_fmt; + + return true; +@@ -292,19 +291,17 @@ + for (auto& frame : audio_frames) { + int decoded_audio_size = 0; + if (frame->sample_rate != samples_per_second_ || ++ frame->channels != channels_ || frame->format != av_sample_format_) { +- frame->ch_layout.nb_channels != channels_ || +- frame->format != av_sample_format_) { + DLOG(ERROR) << "Unsupported midstream configuration change!" + << " Sample Rate: " << frame->sample_rate << " vs " ++ << samples_per_second_ << ", Channels: " << frame->channels ++ << " vs " << channels_ << ", Sample Format: " << frame->format ++ << " vs " << av_sample_format_; +- << samples_per_second_ +- << ", Channels: " << frame->ch_layout.nb_channels << " vs " +- << channels_ << ", Sample Format: " << frame->format << " vs " +- << av_sample_format_; + return cdm::kDecodeError; + } + + decoded_audio_size = av_samples_get_buffer_size( ++ nullptr, codec_context_->channels, frame->nb_samples, +- nullptr, codec_context_->ch_layout.nb_channels, frame->nb_samples, + codec_context_->sample_fmt, 1); + if (!decoded_audio_size) + continue; +@@ -323,9 +320,9 @@ + size_t* total_size, + std::vector>* audio_frames, + AVFrame* frame) { ++ *total_size += av_samples_get_buffer_size(nullptr, codec_context_->channels, ++ frame->nb_samples, ++ codec_context_->sample_fmt, 1); +- *total_size += av_samples_get_buffer_size( +- nullptr, codec_context_->ch_layout.nb_channels, frame->nb_samples, +- codec_context_->sample_fmt, 1); + audio_frames->emplace_back(av_frame_clone(frame)); + return true; + } +--- b/media/ffmpeg/ffmpeg_common.cc ++++ a/media/ffmpeg/ffmpeg_common.cc +@@ -345,11 +345,10 @@ + codec_context->sample_fmt, codec_context->codec_id); + + ChannelLayout channel_layout = ++ codec_context->channels > 8 +- codec_context->ch_layout.nb_channels > 8 + ? CHANNEL_LAYOUT_DISCRETE ++ : ChannelLayoutToChromeChannelLayout(codec_context->channel_layout, ++ codec_context->channels); +- : ChannelLayoutToChromeChannelLayout( +- codec_context->ch_layout.u.mask, +- codec_context->ch_layout.nb_channels); + + int sample_rate = codec_context->sample_rate; + switch (codec) { +@@ -402,7 +401,7 @@ + extra_data, encryption_scheme, seek_preroll, + codec_context->delay); + if (channel_layout == CHANNEL_LAYOUT_DISCRETE) ++ config->SetChannelsForDiscrete(codec_context->channels); +- config->SetChannelsForDiscrete(codec_context->ch_layout.nb_channels); + + #if BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO) + // These are bitstream formats unknown to ffmpeg, so they don't have +@@ -471,7 +470,7 @@ + + // TODO(scherkus): should we set |channel_layout|? I'm not sure if FFmpeg uses + // said information to decode. ++ codec_context->channels = config.channels(); +- codec_context->ch_layout.nb_channels = config.channels(); + codec_context->sample_rate = config.samples_per_second(); + + if (config.extra_data().empty()) { +--- b/media/filters/audio_file_reader.cc ++++ a/media/filters/audio_file_reader.cc +@@ -113,15 +113,14 @@ + + // Verify the channel layout is supported by Chrome. Acts as a sanity check + // against invalid files. See http://crbug.com/171962 ++ if (ChannelLayoutToChromeChannelLayout(codec_context_->channel_layout, ++ codec_context_->channels) == +- if (ChannelLayoutToChromeChannelLayout( +- codec_context_->ch_layout.u.mask, +- codec_context_->ch_layout.nb_channels) == + CHANNEL_LAYOUT_UNSUPPORTED) { + return false; + } + + // Store initial values to guard against midstream configuration changes. ++ channels_ = codec_context_->channels; +- channels_ = codec_context_->ch_layout.nb_channels; + audio_codec_ = CodecIDToAudioCodec(codec_context_->codec_id); + sample_rate_ = codec_context_->sample_rate; + av_sample_format_ = codec_context_->sample_fmt; +@@ -224,7 +223,7 @@ + if (frames_read < 0) + return false; + ++ const int channels = frame->channels; +- const int channels = frame->ch_layout.nb_channels; + if (frame->sample_rate != sample_rate_ || channels != channels_ || + frame->format != av_sample_format_) { + DLOG(ERROR) << "Unsupported midstream configuration change!" +--- b/media/filters/audio_file_reader_unittest.cc ++++ a/media/filters/audio_file_reader_unittest.cc +@@ -121,11 +121,11 @@ + EXPECT_FALSE(reader_->Open()); + } + ++ void RunTestFailingDecode(const char* fn) { +- void RunTestFailingDecode(const char* fn, int expect_read = 0) { + Initialize(fn); + EXPECT_TRUE(reader_->Open()); + std::vector> decoded_audio_packets; ++ EXPECT_EQ(reader_->Read(&decoded_audio_packets), 0); +- EXPECT_EQ(reader_->Read(&decoded_audio_packets), expect_read); + } + + void RunTestPartialDecode(const char* fn) { +@@ -219,7 +219,7 @@ + } + + TEST_F(AudioFileReaderTest, MidStreamConfigChangesFail) { ++ RunTestFailingDecode("midstream_config_change.mp3"); +- RunTestFailingDecode("midstream_config_change.mp3", 42624); + } + #endif + +--- b/media/filters/audio_video_metadata_extractor.cc ++++ a/media/filters/audio_video_metadata_extractor.cc +@@ -113,15 +113,6 @@ + if (!stream) + continue; + +- void* display_matrix = +- av_stream_get_side_data(stream, AV_PKT_DATA_DISPLAYMATRIX, nullptr); +- if (display_matrix) { +- rotation_ = VideoTransformation::FromFFmpegDisplayMatrix( +- static_cast(display_matrix)) +- .rotation; +- info.tags["rotate"] = base::NumberToString(rotation_); +- } +- + // Extract dictionary from streams also. Needed for containers that attach + // metadata to contained streams instead the container itself, like OGG. + ExtractDictionary(stream->metadata, &info.tags); +@@ -264,6 +255,8 @@ + if (raw_tags->find(tag->key) == raw_tags->end()) + (*raw_tags)[tag->key] = tag->value; + ++ if (ExtractInt(tag, "rotate", &rotation_)) ++ continue; + if (ExtractString(tag, "album", &album_)) + continue; + if (ExtractString(tag, "artist", &artist_)) +--- b/media/filters/ffmpeg_aac_bitstream_converter.cc ++++ a/media/filters/ffmpeg_aac_bitstream_converter.cc +@@ -195,15 +195,14 @@ + if (!header_generated_ || codec_ != stream_codec_parameters_->codec_id || + audio_profile_ != stream_codec_parameters_->profile || + sample_rate_index_ != sample_rate_index || ++ channel_configuration_ != stream_codec_parameters_->channels || +- channel_configuration_ != +- stream_codec_parameters_->ch_layout.nb_channels || + frame_length_ != header_plus_packet_size) { + header_generated_ = + GenerateAdtsHeader(stream_codec_parameters_->codec_id, + 0, // layer + stream_codec_parameters_->profile, sample_rate_index, + 0, // private stream ++ stream_codec_parameters_->channels, +- stream_codec_parameters_->ch_layout.nb_channels, + 0, // originality + 0, // home + 0, // copyrighted_stream +@@ -215,7 +214,7 @@ + codec_ = stream_codec_parameters_->codec_id; + audio_profile_ = stream_codec_parameters_->profile; + sample_rate_index_ = sample_rate_index; ++ channel_configuration_ = stream_codec_parameters_->channels; +- channel_configuration_ = stream_codec_parameters_->ch_layout.nb_channels; + frame_length_ = header_plus_packet_size; + } + +--- b/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc ++++ a/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc +@@ -34,7 +34,7 @@ + memset(&test_parameters_, 0, sizeof(AVCodecParameters)); + test_parameters_.codec_id = AV_CODEC_ID_AAC; + test_parameters_.profile = FF_PROFILE_AAC_MAIN; ++ test_parameters_.channels = 2; +- test_parameters_.ch_layout.nb_channels = 2; + test_parameters_.extradata = extradata_header_; + test_parameters_.extradata_size = sizeof(extradata_header_); + } +--- b/media/filters/ffmpeg_audio_decoder.cc ++++ a/media/filters/ffmpeg_audio_decoder.cc +@@ -28,7 +28,7 @@ + + // Return the number of channels from the data in |frame|. + static inline int DetermineChannels(AVFrame* frame) { ++ return frame->channels; +- return frame->ch_layout.nb_channels; + } + + // Called by FFmpeg's allocation routine to allocate a buffer. Uses +@@ -231,7 +231,7 @@ + // Translate unsupported into discrete layouts for discrete configurations; + // ffmpeg does not have a labeled discrete configuration internally. + ChannelLayout channel_layout = ChannelLayoutToChromeChannelLayout( ++ codec_context_->channel_layout, codec_context_->channels); +- codec_context_->ch_layout.u.mask, codec_context_->ch_layout.nb_channels); + if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED && + config_.channel_layout() == CHANNEL_LAYOUT_DISCRETE) { + channel_layout = CHANNEL_LAYOUT_DISCRETE; +@@ -348,11 +348,11 @@ + // Success! + av_sample_format_ = codec_context_->sample_fmt; + ++ if (codec_context_->channels != config.channels()) { +- if (codec_context_->ch_layout.nb_channels != config.channels()) { + MEDIA_LOG(ERROR, media_log_) + << "Audio configuration specified " << config.channels() + << " channels, but FFmpeg thinks the file contains " ++ << codec_context_->channels << " channels"; +- << codec_context_->ch_layout.nb_channels << " channels"; + ReleaseFFmpegResources(); + state_ = DecoderState::kUninitialized; + return false; +@@ -403,7 +403,7 @@ + if (frame->nb_samples <= 0) + return AVERROR(EINVAL); + ++ if (s->channels != channels) { +- if (s->ch_layout.nb_channels != channels) { + DLOG(ERROR) << "AVCodecContext and AVFrame disagree on channel count."; + return AVERROR(EINVAL); + } +@@ -436,8 +436,7 @@ + ChannelLayout channel_layout = + config_.channel_layout() == CHANNEL_LAYOUT_DISCRETE + ? CHANNEL_LAYOUT_DISCRETE ++ : ChannelLayoutToChromeChannelLayout(s->channel_layout, s->channels); +- : ChannelLayoutToChromeChannelLayout(s->ch_layout.u.mask, +- s->ch_layout.nb_channels); + + if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) { + DLOG(ERROR) << "Unsupported channel layout."; diff --git a/www-client/thorium/files/reverse-roll-src-third_party-ffmpeg_duration.patch b/www-client/thorium/files/reverse-roll-src-third_party-ffmpeg_duration.patch new file mode 100644 index 0000000..2e38380 --- /dev/null +++ b/www-client/thorium/files/reverse-roll-src-third_party-ffmpeg_duration.patch @@ -0,0 +1,15 @@ +--- a/media/filters/audio_file_reader.cc ++++ b/media/filters/audio_file_reader.cc +@@ -243,10 +243,10 @@ bool AudioFileReader::OnNewFrame( + // silence from being output. In the case where we are also discarding some + // portion of the packet (as indicated by a negative pts), we further want to + // adjust the duration downward by however much exists before zero. +- if (audio_codec_ == AudioCodec::kAAC && frame->duration) { ++ if (audio_codec_ == AudioCodec::kAAC && frame->pkt_duration) { + const base::TimeDelta pkt_duration = ConvertFromTimeBase( + glue_->format_context()->streams[stream_index_]->time_base, +- frame->duration + std::min(static_cast(0), frame->pts)); ++ frame->pkt_duration + std::min(static_cast(0), frame->pts)); + const base::TimeDelta frame_duration = + base::Seconds(frames_read / static_cast(sample_rate_)); + diff --git a/www-client/thorium/files/thorium-130-fix-building-without-libjxl.patch b/www-client/thorium/files/thorium-130-fix-building-without-libjxl.patch new file mode 100644 index 0000000..31b8803 --- /dev/null +++ b/www-client/thorium/files/thorium-130-fix-building-without-libjxl.patch @@ -0,0 +1,29 @@ +--- a/third_party/blink/public/public_features.gni ++++ b/third_party/blink/public/public_features.gni +@@ -4,6 +4,11 @@ + + import("//build/config/ui.gni") + ++declare_args() { ++ # Thorium internal flag ++ is_thorium_build = true ++} ++ + # Unhandled Tap enable means Contextual Search aka Touch to Search. + # TODO(donnd): remove all unhandled-tap handling after the Long-press experiment + # is fully launched. +--- a/chrome/browser/about_flags.cc ++++ b/chrome/browser/about_flags.cc +@@ -8928,12 +8928,6 @@ + "LauncherDynamicAnimations")}, + #endif // BUILDFLAG(IS_CHROMEOS_ASH) + +-#if BUILDFLAG(ENABLE_JXL_DECODER) +- {"enable-jxl", flag_descriptions::kEnableJXLName, +- flag_descriptions::kEnableJXLDescription, kOsAll, +- FEATURE_VALUE_TYPE(blink::features::kJXL)}, +-#endif // BUILDFLAG(ENABLE_JXL_DECODER) +- + #if BUILDFLAG(IS_ANDROID) + {"incognito-reauthentication-for-android", + flag_descriptions::kIncognitoReauthenticationForAndroidName, diff --git a/www-client/thorium/files/thorium-browser.xml b/www-client/thorium/files/thorium-browser.xml new file mode 100644 index 0000000..7d10706 --- /dev/null +++ b/www-client/thorium/files/thorium-browser.xml @@ -0,0 +1,13 @@ + + + + + + Thorium + thorium-browser + thorium-browser %s + thorium-browser + false + + + diff --git a/www-client/thorium/files/thorium-launcher.sh b/www-client/thorium/files/thorium-launcher.sh new file mode 100644 index 0000000..aba46cc --- /dev/null +++ b/www-client/thorium/files/thorium-launcher.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# Allow the user to override command-line flags, bug #357629. +# This is based on Debian's chromium-browser package, and is intended +# to be consistent with Debian. +for f in /etc/thorium/*; do + [[ -f ${f} ]] && source "${f}" +done + +# Prefer user defined CHROMIUM_USER_FLAGS (from env) over system +# default CHROMIUM_FLAGS (from /etc/thorium/default). +CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-"$CHROMIUM_FLAGS"} + +# Let the wrapped binary know that it has been run through the wrapper +export CHROME_WRAPPER=$(readlink -f "$0") + +PROGDIR=${CHROME_WRAPPER%/*} + +case ":$PATH:" in + *:$PROGDIR:*) + # $PATH already contains $PROGDIR + ;; + *) + # Append $PROGDIR to $PATH + export PATH="$PATH:$PROGDIR" + ;; +esac + +if [[ ${EUID} == 0 && -O ${XDG_CONFIG_HOME:-${HOME}} ]]; then + # Running as root with HOME owned by root. + # Pass --user-data-dir to work around upstream failsafe. + CHROMIUM_FLAGS="--user-data-dir=${XDG_CONFIG_HOME:-${HOME}/.config}/thorium + ${CHROMIUM_FLAGS}" +fi + +# Select session type and platform +if @@OZONE_AUTO_SESSION@@; then + platform= + if [[ ${XDG_SESSION_TYPE} == x11 ]]; then + platform=x11 + elif [[ ${XDG_SESSION_TYPE} == wayland ]]; then + platform=wayland + else + if [[ -n ${WAYLAND_DISPLAY} ]]; then + platform=wayland + else + platform=x11 + fi + fi + if ${DISABLE_OZONE_PLATFORM:-false}; then + platform=x11 + fi + CHROMIUM_FLAGS="--ozone-platform=${platform} ${CHROMIUM_FLAGS}" +fi + +# Set the .desktop file name +export CHROME_DESKTOP="thorium-browser-thorium.desktop" + +exec -a "thorium-browser" "$PROGDIR/thorium" --extra-plugin-dir=/usr/lib/nsbrowser/plugins ${CHROMIUM_FLAGS} "$@" diff --git a/www-client/thorium/files/thorium-shell-launcher.sh b/www-client/thorium/files/thorium-shell-launcher.sh new file mode 100644 index 0000000..f8fc065 --- /dev/null +++ b/www-client/thorium/files/thorium-shell-launcher.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Allow the user to override command-line flags, bug #357629. +# This is based on Debian's chromium-browser package, and is intended +# to be consistent with Debian. +for f in /etc/thorium-shell/*; do + [[ -f ${f} ]] && source "${f}" +done + +# Prefer user defined CHROMIUM_USER_FLAGS (from env) over system +# default CHROMIUM_FLAGS (from /etc/thorium-shell/default). +CHROMIUM_FLAGS=${CHROMIUM_USER_FLAGS:-"$CHROMIUM_FLAGS"} + +# Let the wrapped binary know that it has been run through the wrapper +export CHROME_WRAPPER=$(readlink -f "$0") + +PROGDIR=${CHROME_WRAPPER%/*} + +case ":$PATH:" in + *:$PROGDIR:*) + # $PATH already contains $PROGDIR + ;; + *) + # Append $PROGDIR to $PATH + export PATH="$PATH:$PROGDIR" + ;; +esac + +if [[ ${EUID} == 0 && -O ${XDG_CONFIG_HOME:-${HOME}} ]]; then + # Running as root with HOME owned by root. + # Pass --user-data-dir to work around upstream failsafe. + CHROMIUM_FLAGS="--user-data-dir=${XDG_CONFIG_HOME:-${HOME}/.config}/thorium-shell + ${CHROMIUM_FLAGS}" +fi + +CHROMIUM_FLAGS="--enable-experimental-web-platform-features --debug --enable-clear-hevc-for-testing + ${CHROMIUM_FLAGS}" + +# Set the .desktop file name +export CHROME_DESKTOP="thorium-shell.desktop" + +exec -a "thorium-shell" "$PROGDIR/thorium_shell" ${CHROMIUM_FLAGS} "$@" diff --git a/www-client/thorium/files/thorium-shell.default b/www-client/thorium/files/thorium-shell.default new file mode 100644 index 0000000..7a415ef --- /dev/null +++ b/www-client/thorium/files/thorium-shell.default @@ -0,0 +1,7 @@ +# Default settings for thorium_shell. This file is sourced by /bin/bash +# from the thorium_shell launcher. + +# Options to pass to thorium_shell. +# See https://github.com/Alex313031/thorium/blob/main/docs/PATCHES.md for additional +# command-line switches. +#CHROMIUM_FLAGS="" diff --git a/www-client/thorium/files/thorium-shell.desktop b/www-client/thorium/files/thorium-shell.desktop new file mode 100644 index 0000000..39c65f5 --- /dev/null +++ b/www-client/thorium/files/thorium-shell.desktop @@ -0,0 +1,15 @@ +[Desktop Entry] +Version=1.0 +Name=Thorium Shell +GenericName=Blink Core +Comment=Run Thorium Tests in content_shell +Exec=/usr/bin/thorium-shell %U +Terminal=false +X-MultipleArgs=True +Keywords=shell +Type=Application +Icon=thorium-shell +Categories=Network;WebBrowser; +MimeType=text/html;text/xml;application/xhtml_xml;application/x-mimearchive;x-scheme-handler/http;x-scheme-handler/https; +StartupWMClass=thorium_shell +StartupNotify=true diff --git a/www-client/thorium/files/thorium.default b/www-client/thorium/files/thorium.default new file mode 100644 index 0000000..1335b26 --- /dev/null +++ b/www-client/thorium/files/thorium.default @@ -0,0 +1,7 @@ +# Default settings for thorium. This file is sourced by /bin/bash +# from the chromium launcher. + +# Options to pass to thorium. +# See https://github.com/Alex313031/thorium/blob/main/docs/PATCHES.md for additional +# command-line switches. +#CHROMIUM_FLAGS="" diff --git a/www-client/thorium/files/unbundle-ffmpeg-av_stream_get_first_dts.patch b/www-client/thorium/files/unbundle-ffmpeg-av_stream_get_first_dts.patch new file mode 100644 index 0000000..dae1add --- /dev/null +++ b/www-client/thorium/files/unbundle-ffmpeg-av_stream_get_first_dts.patch @@ -0,0 +1,12 @@ +diff --git a/build/linux/unbundle/ffmpeg.gn b/build/linux/unbundle/ffmpeg.gn +index 16e20744706..6a079b32221 100644 +--- a/build/linux/unbundle/ffmpeg.gn ++++ b/build/linux/unbundle/ffmpeg.gn +@@ -12,6 +12,7 @@ pkg_config("system_ffmpeg") { + "libavformat", + "libavutil", + ] ++ defines = [ "av_stream_get_first_dts(stream)=stream->first_dts" ] + } + + buildflag_header("ffmpeg_features") { diff --git a/www-client/thorium/files/update-dicts.sh b/www-client/thorium/files/update-dicts.sh new file mode 100644 index 0000000..7a4f4ab --- /dev/null +++ b/www-client/thorium/files/update-dicts.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# Taken from +# https://github.com/qvint/ungoogled-chromium-fedora/commit/a68fdd679566da5134d916776f14e00c8e6a8042 + +self="$(readlink -f "${0}")" +self_dir="$(dirname "${self}")" +dict_utility="${self_dir}/convert_dict" + +# Defaults. +hunspell_dicts_dir="/usr/share/myspell" +user_data_dir="${HOME}/.config/thorium" + +# Parse command-line arguments. +while [[ $# -gt 0 ]]; do + arg_name="${1}" + + case "${arg_name}" in + "--hunspell-dicts-dir") + hunspell_dicts_dir="${2}" + shift; shift + ;; + "--user-data-dir") + user_data_dir="${2}" + shift; shift + ;; + *) + echo -n "Usage: ungoogled-chromium-update-dicts " + echo "[--hunspell-dicts-dir DIR] [--user-data-dir DIR]" + exit 1 + esac +done + +# List all chromium language entries. +chromium_language_entries="$("${dict_utility}" list)" + +# Iterate through chromium language entries and make *.bdic files. +chromium_dicts_dir="${user_data_dir}/Dictionaries" +mkdir -p "${chromium_dicts_dir}" +while read -r chromium_language_entry; do + while read \ + chromium_language \ + chromium_language_region \ + chromium_bdic_basename; do + + hunspell_language_region="${chromium_language_region//-/_}" + aff_path="${hunspell_dicts_dir}/${hunspell_language_region}.aff" + dic_path="${hunspell_dicts_dir}/${hunspell_language_region}.dic" + bdic_path="${chromium_dicts_dir}/${chromium_bdic_basename}" + + if \ + [[ -f "${aff_path}" ]] && \ + [[ -f "${dic_path}" ]] && \ + [[ ! -f "${bdic_path}" ]]; then + "${dict_utility}" convert "${aff_path}" "${dic_path}" "${bdic_path}" + fi + done <<< "${chromium_language_entry}" +done <<< "${chromium_language_entries}" diff --git a/www-client/thorium/metadata.xml b/www-client/thorium/metadata.xml new file mode 100644 index 0000000..6a51049 --- /dev/null +++ b/www-client/thorium/metadata.xml @@ -0,0 +1,53 @@ + + + + + blackteahamburger + blackteahamburger@outlook.com + + + Alex313031/thorium + Matt.Jolly/chromium-patches + https://github.com/Alex313031/thorium + https://thorium.rocks/docs + + + Enable Bluetooth. Disabling bluetooth does break WebAuthn. Could also break something else. Improved patch is welcome. + Build with CFI (Control Flow Integrity) enabled. It requires "-stdlib=libc++", see #40 for more details. + Patch and build the convert_dict utility. The script will be installed into /usr/lib64/chromium-browser/update-dicts.sh. More info here: https://github.com/ungoogled-software/ungoogled-chromium/issues/188#issuecomment-444752907 + Enable DCHECK feature with severity configurable at runtime. Mostly intended for debugging and development, NOT RECOMMENDED for general use. + Build chromedriver + Build with GTK4 headers + Enable support for Google Hangouts features such as screen sharing + Build Ozone only with headless backend, NOT RECOMMENDED for general uses + Enable HEVC decoding support. Should work with system-ffmpeg, but might require additional patching for the built-in one. + Use bundled C++ Standard Library (libc++) + Use libXNVCtrl library from x11-drivers/nvidia-drivers instead of the bundled one + Enable Official build instead of Developer build + Optimize parts of Chromium's UI written with web technologies (HTML/CSS/JS) for runtime performance purposes. This does more work at compile time for speed benefits at runtime. + Allow building on a PaX-enabled kernel + Enable PGO. Requires bundled binary profile data in sources tree. Often requires masked/testing llvm. + Enable proprietary codecs like H.264, MP3 + Enable support for remote desktop and screen cast using media-video/pipewire + Use the system app-arch/brotli instead of the bundled one + Use the system dev-libs/crc32c instead of the bundled one + Use the system dev-libs/double-conversion instead of the bundled one + Use the system media-video/ffmpeg instead of the bundled one + Use the system media-libs/harfbuzz instead of the bundled one + Use the system dev-libs/icu instead of the bundled one + Use the system dev-libs/jsoncpp instead of the bundled one + Use the system dev-libs/libevent instead of the bundled one + Use the system dev-libs/libusb instead of the bundled one + Use the system media-libs/openh264 instead of the bundled one. If disabled, it will restrict USE=bindist. + Use the system-wide media-libs/openjpeg instead of the bundled one. OpenJPEG use are exclusively for Chromium's PDF viewer. + Use system libpng instead of the bundled one + Use the system-wide dev-libs/re2 instead of the bundled one + Use the system-wide app-arch/snappy instead of the bundled one + Use the system media-libs/woff2 instead of the bundled one + Use the system app-arch/zstd instead of the bundled one + Apply ungoogled-chromium modifications to chromium sources + Unsupported closed-source DRM capability (required by Netflix VOD) + Build with libjxl for Thorium + Build Thorium Content Shell + + diff --git a/www-client/thorium/thorium-130.0.6723.174.ebuild b/www-client/thorium/thorium-130.0.6723.174.ebuild new file mode 100644 index 0000000..104abe0 --- /dev/null +++ b/www-client/thorium/thorium-130.0.6723.174.ebuild @@ -0,0 +1,1958 @@ +# Copyright 2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +GN_MIN_VER=0.2165 +# chromium-tools/get-chromium-toolchain-strings.py +TEST_FONT=f26f29c9d3bfae588207bbc9762de8d142e58935c62a86f67332819b15203b35 + +CHROMIUM_LANGS="af am ar bg bn ca cs da de el en-GB es es-419 et fa fi fil fr gu he + hi hr hu id it ja kn ko lt lv ml mr ms nb nl pl pt-BR pt-PT ro ru sk sl sr + sv sw ta te th tr uk ur vi zh-CN zh-TW" + +LLVM_COMPAT=( 19 ) +PYTHON_COMPAT=( python3_{11..13} ) +PYTHON_REQ_USE="xml(+)" + +inherit check-reqs chromium-2 desktop flag-o-matic llvm-r1 multiprocessing ninja-utils pax-utils +inherit python-any-r1 readme.gentoo-r1 systemd toolchain-funcs xdg-utils + +# Use following environment variables to customise the build +# EXTRA_GN — pass extra options to gn +# NINJAOPTS="-k0 -j8" useful to populate ccache even if ebuild is still failing +# UGC_SKIP_PATCHES — space-separated list of patches to skip +# UGC_KEEP_BINARIES — space-separated list of binaries to keep +# UGC_SKIP_SUBSTITUTION — space-separated list of files to skip domain substitution + +UGC_SKIP_PATCHES=" + core/ungoogled-chromium/disable-privacy-sandbox.patch \ + core/ungoogled-chromium/fix-building-without-safebrowsing.patch \ + extra/debian/disable/google-api-warning.patch \ + extra/inox-patchset/0013-disable-missing-key-warning.patch \ + extra/inox-patchset/0016-chromium-sandbox-pie.patch \ + extra/ungoogled-chromium/fix-distilled-icons.patch \ + extra/ungoogled-chromium/enable-menu-on-reload-button.patch \ + extra/ungoogled-chromium/enable-default-prefetch-privacy-changes.patch \ + extra/ungoogled-chromium/add-flag-to-disable-local-history-expiration.patch \ + extra/ungoogled-chromium/add-flag-to-scroll-tabs.patch \ + extra/ungoogled-chromium/enable-page-saving-on-more-pages.patch \ + extra/ungoogled-chromium/add-flag-for-custom-ntp.patch \ + extra/ungoogled-chromium/add-flag-to-show-avatar-button.patch \ + extra/ungoogled-chromium/keep-expired-flags.patch \ + extra/ungoogled-chromium/disable-download-quarantine.patch \ + bromite/disable-fetching-field-trials.patch \ + extra/ungoogled-chromium/add-flag-for-tab-hover-cards.patch \ + extra/ungoogled-chromium/add-flag-for-close-confirmation.patch \ + extra/ungoogled-chromium/add-flag-to-close-window-with-last-tab.patch \ + upstream-fixes/hardware_destructive_interference_size.patch \ + extra/inox-patchset/0008-restore-classic-ntp.patch \ + extra/iridium-browser/net-cert-increase-default-key-length-for-newly-gener.patch \ + extra/ungoogled-chromium/add-flag-for-tabsearch-button.patch +" + +DESCRIPTION="Chromium fork focused on high performance and security" +HOMEPAGE="https://thorium.rocks" +PPC64_HASH="a85b64f07b489b8c6fdb13ecf79c16c56c560fc6" +PATCH_V="${PV%%\.*}-2" +THORIUM_COMMIT_ID="6a89d88a334d8df585ce07f9a56254ef85fc8956" +THORIUM_WD="${WORKDIR}/thorium-${THORIUM_COMMIT_ID}" +UGC_PVR="130.0.6723.116-1" +UGC_PF="ungoogled-chromium-${UGC_PVR}" +UGC_WD="${WORKDIR}/${UGC_PF}" +T_LIBJXL_COMMIT_ID="059d2253e91e3c8af7cc860f1c633f18ac19eb67" +T_LIBJXL_PF="thorium-libjxl-${T_LIBJXL_COMMIT_ID}" +T_LIBJXL_WD="${WORKDIR}/${T_LIBJXL_PF}" +SRC_URI="https://github.com/blackteahamburger/gentoo-chromium-source-tarball/releases/download/${PV}/chromium-${PV}.tar.xz + test? ( + https://github.com/blackteahamburger/gentoo-chromium-source-tarball/releases/download/${PV}/chromium-${PV}-testdata.tar.xz -> chromium-${PV}-testdata-gentoo.tar.xz + https://chromium-fonts.storage.googleapis.com/${TEST_FONT} -> chromium-testfonts-${TEST_FONT:0:10}.tar.gz + ) + https://github.com/Alex313031/thorium/archive/${THORIUM_COMMIT_ID}.tar.gz -> thorium-${THORIUM_COMMIT_ID}.tar.gz + https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/${PATCH_V}/chromium-patches-${PATCH_V}.tar.bz2 + ppc64? ( + https://gitlab.raptorengineering.com/raptor-engineering-public/chromium/openpower-patches/-/archive/${PPC64_HASH}/openpower-patches-${PPC64_HASH}.tar.bz2 -> chromium-openpower-${PPC64_HASH:0:10}.tar.bz2 + ) + ungoogled? ( https://github.com/ungoogled-software/ungoogled-chromium/archive/${UGC_PVR}.tar.gz -> ${UGC_PF}.tar.gz ) + thorium-libjxl? ( https://github.com/Alex313031/thorium-libjxl/archive/${T_LIBJXL_COMMIT_ID}.tar.gz -> ${T_LIBJXL_PF}.tar.gz ) + thorium-shell? ( https://chromium-fonts.storage.googleapis.com/${TEST_FONT} -> chromium-testfonts-${TEST_FONT:0:10}.tar.gz ) +" + +declare -A CHROMIUM_COMMITS=( + ["587c2cf8b11d3c32fa26887063eda3171a3d353e"]="third_party/ruy/src" + ["dc9db222b929f5da415216134b77d7f3bf141813"]="." #131+ + ["7e28832cd3320d2b603e6ef9468581e1c65c14f1"]="." #131+ + ["b51da416e04ecc9edafff531f9678c6404e654b7"]="." #131+ + ["4c49d7f04f43ab4757637cac21cfef7c0cd060fc"]="." #131+ + ["47fb59539e5744467eb6f7aae52f5a169910d56c"]="." #131+ + ["39583ff118920284de516d262979960e7159bcfc"]="." #131+ + ["c502d310d8cb91f1c1098a7287e75114023e57f0"]="." #131+ + ["40c273b2c0f5f26e16e67428ceaafd8b339bb61f"]="." #131+ + ["8739a5b33176e82e06a746163c0c76de4908ced9"]="." #131+ +) + +if [ ! -z "${CHROMIUM_COMMITS[*]}" ]; then + for i in "${!CHROMIUM_COMMITS[@]}"; do + if [[ ${CHROMIUM_COMMITS[$i]} =~ webrtc ]]; then + #TODO: is it safe to use this mirror? + SRC_URI+="https://github.com/webrtc-mirror/webrtc/commit/${i/-}.patch?full_index=true -> webrtc-${i/-}.patch + " + elif [[ ${CHROMIUM_COMMITS[$i]} =~ angle ]]; then + SRC_URI+="https://github.com/google/angle/commit/${i/-}.patch?full_index=true -> angle-${i/-}.patch + " + elif [[ ${CHROMIUM_COMMITS[$i]} =~ quiche ]]; then + SRC_URI+="https://github.com/google/quiche/commit/${i/-}.patch?full_index=true -> quiche-${i/-}.patch + " + elif [[ ${CHROMIUM_COMMITS[$i]} =~ vulkan-utility-libraries ]]; then + SRC_URI+="https://github.com/KhronosGroup/Vulkan-Utility-Libraries/commit/${i/-}.patch?full_index=true -> vulkan-utility-libraries-${i/-}.patch + " + elif [[ ${CHROMIUM_COMMITS[$i]} =~ ruy ]]; then + SRC_URI+="https://github.com/google/ruy/commit/${i/-}.patch?full_index=true -> ruy-${i/-}.patch + " + else + SRC_URI+="https://github.com/chromium/chromium/commit/${i/-}.patch?full_index=true -> chromium-${i/-}.patch + " + fi + done +fi + +S="${WORKDIR}/chromium-${PV}" + +LICENSE="BSD" +SLOT="0" +KEYWORDS="~amd64" +IUSE_SYSTEM_LIBS="av1 brotli crc32c double-conversion ffmpeg +harfbuzz +icu jsoncpp +libevent +libusb libvpx +openh264 openjpeg +png re2 snappy woff2 +zstd" +IUSE="+X bluetooth cfi convert-dict cups cpu_flags_arm_neon custom-cflags debug enable-driver gtk4 hangouts headless hevc kerberos lto libcxx nvidia +official +optimize-webui pax-kernel +pgo +proprietary-codecs pulseaudio qt6 screencast selinux test ungoogled vaapi wayland widevine cpu_flags_ppc_vsx3" + +for i in ${IUSE_SYSTEM_LIBS}; do + [[ $i =~ ^(\+)?(.*)$ ]] + IUSE+=" ${BASH_REMATCH[1]}system-${BASH_REMATCH[2]}" +done + +# Thorium specific +IUSE+=" cpu_flags_x86_avx512f cpu_flags_x86_avx2 cpu_flags_x86_sse4_1 cpu_flags_x86_sse3 cpu_flags_x86_sse2 +thorium-libjxl thorium-shell" + +RESTRICT=" + !system-ffmpeg? ( proprietary-codecs? ( bindist ) ) + !system-openh264? ( bindist ) + !test? ( test ) +" +REQUIRED_USE=" + x86? ( !widevine ) + debug? ( !official ) + ppc64? ( !cfi ) + test? ( cfi ) + screencast? ( wayland ) + !headless? ( || ( X wayland ) ) + !proprietary-codecs? ( !hevc ) + vaapi? ( !system-av1 !system-libvpx ) +" + +COMMON_X_DEPEND=" + x11-libs/libXcomposite:= + x11-libs/libXcursor:= + x11-libs/libXdamage:= + x11-libs/libXfixes:= + >=x11-libs/libXi-1.6.0:= + x11-libs/libXrandr:= + x11-libs/libXrender:= + x11-libs/libXtst:= + x11-libs/libxshmfence:= +" + +COMMON_SNAPSHOT_DEPEND=" + system-brotli? ( >=app-arch/brotli-9999 ) + system-crc32c? ( dev-libs/crc32c ) + system-double-conversion? ( dev-libs/double-conversion ) + system-woff2? ( media-libs/woff2 ) + system-snappy? ( app-arch/snappy ) + system-jsoncpp? ( dev-libs/jsoncpp ) + system-libevent? ( dev-libs/libevent ) + thorium-libjxl? ( media-libs/libjxl ) + system-openjpeg? ( media-libs/openjpeg:2= ) + system-re2? ( >=dev-libs/re2-0.2019.08.01:= ) + system-libvpx? ( >=media-libs/libvpx-1.13.0:=[postproc] ) + system-libusb? ( virtual/libusb:1 ) + system-icu? ( >=dev-libs/icu-73.0:= ) + >=dev-libs/libxml2-2.12.4:=[icu] + dev-libs/nspr:= + >=dev-libs/nss-3.26:= + dev-libs/libxslt:= + media-libs/fontconfig:= + >=media-libs/freetype-2.11.0-r1:= + system-harfbuzz? ( >=media-libs/harfbuzz-3:0=[icu(-)] ) + media-libs/libjpeg-turbo:= + system-png? ( media-libs/libpng:=[-apng(-)] ) + system-zstd? ( >=app-arch/zstd-1.5.5:= ) + >=media-libs/libwebp-0.4.0:= + media-libs/mesa:=[gbm(+)] + >=media-libs/openh264-1.6.0:= + system-av1? ( + >=media-libs/dav1d-1.0.0:= + >=media-libs/libaom-3.7.0:= + ) + sys-libs/zlib:= + x11-libs/libdrm:= + sys-libs/zlib:= + x11-libs/libdrm:= + !headless? ( + dev-libs/glib:2 + >=media-libs/alsa-lib-1.0.19:= + pulseaudio? ( + || ( + media-libs/libpulse + >=media-sound/apulse-0.1.9 + ) + ) + sys-apps/pciutils:= + kerberos? ( virtual/krb5 ) + vaapi? ( >=media-libs/libva-2.7:=[X?,wayland?] ) + X? ( + x11-base/xorg-proto:= + x11-libs/libX11:= + x11-libs/libxcb:= + x11-libs/libXext:= + ) + x11-libs/libxkbcommon:= + wayland? ( + dev-libs/libffi:= + dev-libs/wayland:= + screencast? ( + media-video/pipewire:= + || ( + sys-apps/xdg-desktop-portal-gnome + sys-apps/xdg-desktop-portal-gtk + kde-plasma/xdg-desktop-portal-kde + gui-libs/xdg-desktop-portal-lxqt + gui-libs/xdg-desktop-portal-wlr + ) + ) + ) + ) +" + +COMMON_DEPEND=" + ${COMMON_SNAPSHOT_DEPEND} + app-arch/bzip2:= + dev-libs/expat:= + system-ffmpeg? ( + >=media-video/ffmpeg-4.3:= + || ( + media-video/ffmpeg[-samba] + >=net-fs/samba-4.5.10-r1[-debug(-)] + ) + >=media-libs/opus-1.3.1:= + ) + net-misc/curl[ssl] + sys-apps/dbus:= + media-libs/flac:= + sys-libs/zlib:=[minizip] + !headless? ( + X? ( ${COMMON_X_DEPEND} ) + >=app-accessibility/at-spi2-core-2.46.0:2 + media-libs/mesa:=[X?,wayland?] + cups? ( >=net-print/cups-1.3.11:= ) + virtual/udev + x11-libs/cairo:= + x11-libs/gdk-pixbuf:2 + x11-libs/pango:= + qt6? ( dev-qt/qtbase:6[gui,widgets] ) + ) +" + +RDEPEND="${COMMON_DEPEND} + !headless? ( + || ( + x11-libs/gtk+:3[X?,wayland?] + gui-libs/gtk:4[X?,wayland?] + ) + qt6? ( dev-qt/qtbase:6[X?,wayland?] ) + ) + virtual/ttf-fonts + selinux? ( sec-policy/selinux-chromium ) +" + +DEPEND="${COMMON_DEPEND} + !headless? ( + gtk4? ( gui-libs/gtk:4[X?,wayland?] ) + !gtk4? ( x11-libs/gtk+:3[X?,wayland?] ) + ) +" + +BDEPEND=" + ${COMMON_SNAPSHOT_DEPEND} + ${PYTHON_DEPS} + $(python_gen_any_dep ' + dev-python/setuptools[${PYTHON_USEDEP}] + ') + >=app-arch/gzip-1.7 + !headless? ( + qt6? ( dev-qt/qtbase:6 ) + ) + $(llvm_gen_dep ' + llvm-core/llvm:${LLVM_SLOT} + !pgo? ( + llvm-core/clang:${LLVM_SLOT} + || ( llvm-core/lld:${LLVM_SLOT} sys-devel/mold ) + ) + pgo? ( + >llvm-core/clang-19.0.0_pre20240518:${LLVM_SLOT} + || ( >llvm-core/lld-19.0.0_pre20240518:${LLVM_SLOT} sys-devel/mold ) + ) + cfi? ( llvm-runtimes/compiler-rt-sanitizers:${LLVM_SLOT}[cfi] ) + ') + >=dev-build/gn-${GN_MIN_VER} + app-alternatives/ninja + dev-lang/perl + >=dev-util/gperf-3.2 + dev-vcs/git + >=net-libs/nodejs-7.6.0[inspector] + >=sys-devel/bison-2.4.3 + sys-devel/flex + virtual/pkgconfig +" + +if ! has chromium_pkg_die ${EBUILD_DEATH_HOOKS}; then + EBUILD_DEATH_HOOKS+=" chromium_pkg_die"; +fi + +DISABLE_AUTOFORMATTING="yes" +DOC_CONTENTS=" +Some web pages may require additional fonts to display properly. +Try installing some of the following packages if some characters +are not displayed properly: +- media-fonts/arphicfonts +- media-fonts/droid +- media-fonts/ipamonafont +- media-fonts/noto +- media-fonts/ja-ipafonts +- media-fonts/takao-fonts +- media-fonts/wqy-microhei +- media-fonts/wqy-zenhei + +To fix broken icons on the Downloads page, you should install an icon +theme that covers the appropriate MIME types, and configure this as your +GTK+ icon theme. + +For native file dialogs in KDE, install kde-apps/kdialog. + +To make password storage work with your desktop environment you may +have install one of the supported credentials management applications: +- app-crypt/libsecret (GNOME) +- kde-frameworks/kwallet (KDE) +If you have one of above packages installed, but don't want to use +them in Chromium, then add --password-store=basic to CHROMIUM_FLAGS +in /etc/thorium/default. +" + +python_check_deps() { + python_has_version "dev-python/setuptools[${PYTHON_USEDEP}]" +} + +pre_build_checks() { + # Check build requirements: bugs #471810, #541816, #914220 + # We're going to start doing maths here on the size of an unpacked source tarball, + # this should make updates easier as chromium continues to balloon in size. + local BASE_DISK=24 + local EXTRA_DISK=1 + local CHECKREQS_MEMORY="4G" + tc-is-cross-compiler && EXTRA_DISK=2 + # Bug #952923 + #if tc-is-lto || use pgo; then + if use lto || use pgo; then + CHECKREQS_MEMORY="9G" + tc-is-cross-compiler && EXTRA_DISK=4 + use pgo && EXTRA_DISK=8 + fi + if is-flagq '-g?(gdb)?([1-9])'; then + if use custom-cflags; then + EXTRA_DISK=13 + fi + CHECKREQS_MEMORY="16G" + fi + CHECKREQS_DISK_BUILD="$((BASE_DISK + EXTRA_DISK))G" + check-reqs_${EBUILD_PHASE_FUNC} +} + +pkg_pretend() { + if use libcxx; then + ewarn + ewarn "Building with libcxx, please be aware that system-*" + ewarn "and some other c++ dependencies need to be compiled" + ewarn "with the same c++ library as thorium itself" + ewarn "dev-libs/jsoncpp is most problematic, see #58 #49 #119 for details" + ewarn "Simplest solution would be to disable corresponding system-* flags" + ewarn + fi + if use cfi; then + ewarn + ewarn "Building with cfi is only possible if building with -stdlib=libc++" + ewarn "Make sure all dependencies are also built this way, see #40" + ewarn + fi + pre_build_checks + + if use headless; then + local headless_unused_flags=("cups" "kerberos" "pulseaudio" "qt6" "vaapi" "wayland") + for myiuse in ${headless_unused_flags[@]}; do + use ${myiuse} && ewarn "Ignoring USE=${myiuse}, USE=headless is set." + done + fi +} + +pkg_setup() { + pre_build_checks + + # The linux:unbundle toolchain in GN grabs CC, CXX, CPP (etc) from the environment + # We'll set these to clang here then use llvm-utils functions to very explicitly set these + # to a sane value. + # This is effectively the 'force-clang' path if GCC support is re-added. + # TODO: check if the user has already selected a specific impl via make.conf and respect that. + use_lto="false" + # Bug #952923 + #if tc-is-lto; then + if use lto; then + if ! use x86; then + use_lto="true" + fi + # We can rely on GN to do this for us; anecdotally without this builds + # take significantly longer with LTO enabled and it doesn't hurt anything. + filter-lto + fi + + if [ "$use_lto" = "false" ] && use official; then + einfo "USE=official selected and LTO not detected." + einfo "It is _highly_ recommended that LTO be enabled for performance reasons" + einfo "and to be consistent with the upstream \"official\" build optimisations." + fi + + if [ "$use_lto" = "false" ] && use cfi; then + die "CFI requires LTO" + fi + + export use_lto + + llvm-r1_pkg_setup + + # Forcing clang; respect llvm_slot_x to enable selection of impl from LLVM_COMPAT + AR=llvm-ar + CPP="${CHOST}-clang++-${LLVM_SLOT} -E" + NM=llvm-nm + CC="${CHOST}-clang-${LLVM_SLOT}" + CXX="${CHOST}-clang++-${LLVM_SLOT}" + if tc-is-cross-compiler; then + CPP="${CBUILD}-clang++-${LLVM_SLOT} -E" + fi + + # Users should never hit this, it's purely a development convenience + if ver_test $(gn --version || die) -lt ${GN_MIN_VER}; then + die "dev-build/gn >= ${GN_MIN_VER} is required to build this Chromium" + fi + + chromium_suid_sandbox_check_kernel_config +} + +src_unpack() { + unpack chromium-${PV}.tar.xz + unpack chromium-patches-${PATCH_V}.tar.bz2 + + if use test; then + # A new testdata tarball is available for each release; but testfonts tend to remain stable + # for the duration of a release. + # This unpacks directly into/over ${S} so we can just use `unpack`. + unpack chromium-${PV}-testdata-gentoo.tar.xz + fi + + if use test; then + # This just contains a bunch of font files that need to be unpacked (or moved) to the correct location. + local testfonts_dir="${S}/third_party/test_fonts" + local testfonts_tar="${DISTDIR}/chromium-testfonts-${TEST_FONT:0:10}.tar.gz" + tar xf "${testfonts_tar}" -C "${testfonts_dir}" || die "Failed to unpack testfonts" + fi + + if use thorium-shell; then + local testfonts_dir="${S}/third_party/test_fonts/test_fonts" + local testfonts_tar="${DISTDIR}/chromium-testfonts-${TEST_FONT:0:10}.tar.gz" + tar xf "${testfonts_tar}" -C "${testfonts_dir}" || die "Failed to unpack testfonts" + fi + + unpack thorium-${THORIUM_COMMIT_ID}.tar.gz + + use ungoogled && unpack ${UGC_PF}.tar.gz + + if use ppc64; then + unpack chromium-openpower-${PPC64_HASH:0:10}.tar.bz2 + fi + + if use thorium-libjxl; then + unpack ${T_LIBJXL_PF}.tar.gz + fi +} + +src_prepare() { + # Calling this here supports resumption via FEATURES=keepwork + python_setup + + einfo "Applying Thorium patches" + if use thorium-libjxl; then + sed -i "s|cp -r -v thorium-libjxl|cp -r -v ${T_LIBJXL_WD}|" "${THORIUM_WD}/setup.sh" || die + else + sed -i '/thorium-libjxl/d' "${THORIUM_WD}/setup.sh" || die + fi + if ! use thorium-shell; then + sed -i '/thorium_shell/d' "${THORIUM_WD}/setup.sh" || die + fi + sed -i "s|cd ~/thorium|cd ${THORIUM_WD}|" "${THORIUM_WD}/setup.sh" || die + sed -i '/update_pgo_profiles.py/d' "${THORIUM_WD}/setup.sh" || die + local setup_arg + if use cpu_flags_x86_avx512f; then + setup_arg="--avx512" + elif use cpu_flags_x86_avx2; then + setup_arg="--avx2" + elif use cpu_flags_x86_sse4_1; then + setup_arg="--sse4" + elif use cpu_flags_x86_sse3; then + setup_arg="--sse3" + elif use cpu_flags_x86_sse2; then + setup_arg="--sse2" + else + setup_arg="" + fi + CR_DIR="${S}" "${THORIUM_WD}/setup.sh" ${setup_arg} || die + if [[ -z ${setup_arg} ]]; then + sed -i "s|other/ffmpeg_hevc_ac3.patch|${THORIUM_WD}/other/ffmpeg_hevc_ac3.patch|" "${THORIUM_WD}/patch_ac3.sh" || die + CR_DIR="${S}" "${THORIUM_WD}/patch_ac3.sh" || die + fi + + rm "${WORKDIR}/chromium-patches-${PATCH_V}/chromium-131-compiler.patch" || die + #if ! use custom-cflags; then #See #25 #92 + # sed -i '/default_stack_frames/Q' "${FILESDIR}/chromium-131-compiler.patch" || die + #fi + + # disable global media controls, crashes with libstdc++ + sed -i -e \ + "/\"GlobalMediaControlsCastStartStop\"/,+4{s/ENABLED/DISABLED/;}" \ + "chrome/browser/media/router/media_router_feature.cc" + + local PATCHES=( + "${FILESDIR}/chromium-cross-compile.patch" + "${FILESDIR}/chromium-109-system-openh264.patch" + "${FILESDIR}/chromium-109-system-zlib.patch" + "${FILESDIR}/chromium-111-InkDropHost-crash.patch" + "${FILESDIR}/chromium-126-oauth2-client-switches.patch" + "${FILESDIR}/chromium-125-cloud_authenticator.patch" + "${FILESDIR}/chromium-123-qrcode.patch" + "${FILESDIR}/perfetto-system-zlib.patch" + "${FILESDIR}/chromium-127-cargo_crate.patch" + "${FILESDIR}/chromium-127-crabby.patch" + "${FILESDIR}/chromium-128-gtk-fix-prefers-color-scheme-query.patch" + "${FILESDIR}/chromium-130-fontations.patch" + "${FILESDIR}/chromium-132-no-link-builtins.patch" + "${FILESDIR}/chromium-132-mold.patch" + "${FILESDIR}/chromium-134-qt5-optional.patch" + "${FILESDIR}/chromium-131-compiler.patch" + "${FILESDIR}/chromium-130-fix-includes.patch" # https://github.com/Alex313031/thorium/issues/978 + "${FILESDIR}/chromium-130-fix-building-without-tflite-lib.patch" # https://github.com/Alex313031/thorium/issues/978 + "${FILESDIR}/chromium-135-gperf.patch" + "${FILESDIR}/chromium-137-fix-for-kde.patch" + ) + + shopt -s globstar nullglob + # 130: moved the PPC64 patches into the chromium-patches repo + local patch + for patch in "${WORKDIR}/chromium-patches-${PATCH_V}"/**/*.patch; do + if [[ ${patch} == *"ppc64le"* ]]; then + use ppc64 && PATCHES+=( "${patch}" ) + else + PATCHES+=( "${patch}" ) + fi + done + + # We can't use the bundled compiler builtins with the system toolchain + # `grep` is a development convenience to ensure we fail early when google changes something. + local builtins_match="if (is_clang && !is_nacl && !is_cronet_build) {" + grep -q "${builtins_match}" build/config/compiler/BUILD.gn || die "Failed to disable bundled compiler builtins" + sed -i -e "/${builtins_match}/,+2d" build/config/compiler/BUILD.gn + + if use ppc64; then + # Above this level there are ungoogled-chromium patches that we can't apply + local patchset_dir="${WORKDIR}/openpower-patches-${PPC64_HASH}/patches/ppc64le" + # Apply the OpenPOWER patches + local power9_patch="patches/ppc64le/core/baseline-isa-3-0.patch" + for patch in ${patchset_dir}/**/*.{patch,diff}; do + if [[ ${patch} == *"${power9_patch}" ]]; then + use cpu_flags_ppc_vsx3 && PATCHES+=( "${patch}" ) + else + PATCHES+=( "${patch}" ) + fi + done + + PATCHES+=( "${WORKDIR}/openpower-patches-${PPC64_HASH}/patches/upstream/blink-fix-size-assertions.patch" ) + fi + + shopt -u globstar nullglob + + ewarn + ewarn "Following features are disabled:" + ewarn " - Fontations Rust font stack" + ewarn " - Crabby Avif parser/decoder implementation in Rust" + ewarn + + if ! use libcxx ; then + PATCHES+=( + "${FILESDIR}/chromium-130-libstdc++.patch" + "${FILESDIR}/font-gc-r2.patch" + ) + fi + + if [ ! -z "${CHROMIUM_COMMITS[*]}" ]; then + for i in "${!CHROMIUM_COMMITS[@]}"; do + if [[ ${CHROMIUM_COMMITS[$i]} =~ webrtc ]]; then + patch_prefix="webrtc" + elif [[ ${CHROMIUM_COMMITS[$i]} =~ angle ]]; then + patch_prefix="angle" + elif [[ ${CHROMIUM_COMMITS[$i]} =~ quiche ]]; then + patch_prefix="quiche" + elif [[ ${CHROMIUM_COMMITS[$i]} =~ vulkan-utility-libraries ]]; then + patch_prefix="vulkan-utility-libraries" + elif [[ ${CHROMIUM_COMMITS[$i]} =~ ruy ]]; then + patch_prefix="ruy" + else + patch_prefix="chromium" + fi + pushd "${CHROMIUM_COMMITS[$i]}" > /dev/null || die + if [[ $i = -* ]]; then + einfo "Reverting ${patch_prefix}-${i/-}.patch" + git apply -R --exclude="*unittest.cc" --exclude="DEPS" \ + -p1 < "${DISTDIR}/${patch_prefix}-${i/-}.patch" || die + else + einfo "Applying ${patch_prefix}-${i/-}.patch" + git apply --exclude="*unittest.cc" --exclude="DEPS" \ + -p1 < "${DISTDIR}/${patch_prefix}-${i/-}.patch" || die + fi + popd > /dev/null || die + done + fi + + einfo "Reverting chromium-84fcdd0620a72aa73ea521c682fb246067f2c14d.patch" + eapply "${FILESDIR}/chromium-revert-84fcdd0620a72aa73ea521c682fb246067f2c14d.patch" + + einfo "Applying perfetto-acc24608c84d2d2d8d684f40a110d0a6f4eddc51.patch" + pushd third_party/perfetto + eapply "${FILESDIR}/perfetto-acc24608c84d2d2d8d684f40a110d0a6f4eddc51.patch" + popd + + if ! use bluetooth ; then + PATCHES+=( + "${FILESDIR}/disable-bluez-r1.patch" + ) + fi + + if use convert-dict ; then + PATCHES+=( + "${FILESDIR}/chromium-ucf-dict-utility-r1.patch" + ) + fi + + if use system-ffmpeg; then + PATCHES+=( + "${FILESDIR}/chromium-99-opus.patch" + ) + if has_version " gn leftovers + third_party/speech-dispatcher + third_party/usb_ids + third_party/xdg-utils + ) + + if use test; then + # tar tvf /var/cache/distfiles/${P}-testdata.tar.xz | grep '^d' | grep 'third_party' | awk '{print $NF}' + keeplibs+=( + third_party/google_benchmark/src/include/benchmark + third_party/google_benchmark/src/src + third_party/perfetto/protos/third_party/pprof + third_party/test_fonts + third_party/test_fonts/fontconfig + ) + fi + + if ! use system-harfbuzz; then + keeplibs+=( third_party/harfbuzz-ng ) + fi + + if ! use system-ffmpeg; then + keeplibs+=( third_party/ffmpeg third_party/opus ) + fi + + if ! use system-icu; then + keeplibs+=( third_party/icu ) + fi + + if ! use system-png; then + keeplibs+=( third_party/libpng ) + fi + + if ! use system-zstd; then + keeplibs+=( third_party/zstd ) + fi + + if ! use system-av1; then + keeplibs+=( + third_party/dav1d + third_party/libaom + third_party/libaom/source/libaom/third_party/fastfeat + third_party/libaom/source/libaom/third_party/SVT-AV1 + third_party/libaom/source/libaom/third_party/vector + third_party/libaom/source/libaom/third_party/x86inc + ) + fi + + if use libcxx; then + keeplibs+=( third_party/libc++ ) + fi + + if ! use system-openh264; then + keeplibs+=( third_party/openh264 ) + fi + + if ! use system-re2; then + keeplibs+=( third_party/re2 ) + fi + + if use thorium-shell; then + keeplibs+=( + third_party/google_benchmark/src/include/benchmark + third_party/google_benchmark/src/src + third_party/perfetto/protos/third_party/pprof + third_party/quic_trace + third_party/test_fonts + ) + fi + + # Arch-specific + if use arm64 || use ppc64 ; then + keeplibs+=( third_party/swiftshader/third_party/llvm-10.0 ) + fi + # we need to generate ppc64 stuff because upstream does not ship it yet + # it has to be done before unbundling. + if use ppc64; then + pushd third_party/libvpx >/dev/null || die + mkdir -p source/config/linux/ppc64 || die + # requires git and clang, bug #832803 + # Revert https://chromium.googlesource.com/chromium/src/+/b463d0f40b08b4e896e7f458d89ae58ce2a27165%5E%21/third_party/libvpx/generate_gni.sh + # and https://chromium.googlesource.com/chromium/src/+/71ebcbce867dd31da5f8b405a28fcb0de0657d91%5E%21/third_party/libvpx/generate_gni.sh + # since we're not in a git repo + sed -i -e "s|^update_readme||g; s|clang-format|${EPREFIX}/bin/true|g; /^git -C/d; /git cl/d; /cd \$BASE_DIR\/\$LIBVPX_SRC_DIR/ign format --in-place \$BASE_DIR\/BUILD.gn\ngn format --in-place \$BASE_DIR\/libvpx_srcs.gni" \ + generate_gni.sh || die + ./generate_gni.sh || die + popd >/dev/null || die + + pushd third_party/ffmpeg >/dev/null || die + cp libavcodec/ppc/h264dsp.c libavcodec/ppc/h264dsp_ppc.c || die + cp libavcodec/ppc/h264qpel.c libavcodec/ppc/h264qpel_ppc.c || die + popd >/dev/null || die + fi + + # Sanity check keeplibs, on major version bumps it is often necessary to update this list + # and this enables us to hit them all at once. + # There are some entries that need to be whitelisted (TODO: Why? The file is understandable, the rest seem odd) + whitelist_libs=( + net/third_party/quic + third_party/devtools-frontend/src/front_end/third_party/additional_readme_paths.json + third_party/libjingle + third_party/mesa + third_party/skia/third_party/vulkan + third_party/vulkan + ) + local not_found_libs=() + for lib in "${keeplibs[@]}"; do + if [[ ! -d "${lib}" ]] && ! has "${lib}" "${whitelist_libs[@]}"; then + not_found_libs+=( "${lib}" ) + fi + done + + if [[ ${#not_found_libs[@]} -gt 0 ]]; then + eerror "The following \`keeplibs\` directories were not found in the source tree:" + for lib in "${not_found_libs[@]}"; do + eerror " ${lib}" + done + die "Please update the ebuild." + fi + + # Remove most bundled libraries. Some are still needed. + einfo "Unbundling third-party libraries ..." + build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove || die + + # bundled eu-strip is for amd64 only and we don't want to pre-stripped binaries + mkdir -p buildtools/third_party/eu-strip/bin || die + ln -s "${EPREFIX}"/bin/true buildtools/third_party/eu-strip/bin/eu-strip || die +} + +src_configure() { + # Calling this here supports resumption via FEATURES=keepwork + python_setup + + local myconf_gn="" + + # We already forced the "correct" clang via pkg_setup + + if tc-is-cross-compiler; then + CC="${CC} -target ${CHOST} --sysroot ${ESYSROOT}" + CXX="${CXX} -target ${CHOST} --sysroot ${ESYSROOT}" + BUILD_AR=${AR} + BUILD_CC=${CC} + BUILD_CXX=${CXX} + BUILD_NM=${NM} + fi + + strip-unsupported-flags + + myconf_gn+=" is_clang=true clang_use_chrome_plugins=false" + + if tc-ld-is-mold; then + myconf_gn+=" use_mold=true" + myconf_gn+=" use_lld=false" + else + myconf_gn+=" use_mold=false" + myconf_gn+=" use_lld=true" + fi + + # Make sure the build system will use the right tools, bug #340795. + tc-export AR CC CXX NM + + myconf_gn+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\"" + + if tc-is-cross-compiler; then + tc-export BUILD_{AR,CC,CXX,NM} + myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:host\"" + myconf_gn+=" v8_snapshot_toolchain=\"//build/toolchain/linux/unbundle:host\"" + myconf_gn+=" pkg_config=\"$(tc-getPKG_CONFIG)\"" + myconf_gn+=" host_pkg_config=\"$(tc-getBUILD_PKG_CONFIG)\"" + + # setup cups-config, build system only uses --libs option + if use cups; then + mkdir "${T}/cups-config" || die + cp "${ESYSROOT}/usr/bin/${CHOST}-cups-config" "${T}/cups-config/cups-config" || die + export PATH="${PATH}:${T}/cups-config" + fi + + # Don't inherit PKG_CONFIG_PATH from environment + local -x PKG_CONFIG_PATH= + else + myconf_gn+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\"" + fi + + # Disable rust for now; it's only used for testing and we don't need the additional bdep + myconf_gn+=" enable_rust=false" + + # GN needs explicit config for Debug/Release as opposed to inferring it from build directory. + myconf_gn+=" is_debug=$(usex debug true false)" + + # enable DCHECK with USE=debug only, increases chrome binary size by 30%, bug #811138. + # DCHECK is fatal by default, make it configurable at runtime, #bug 807881. + myconf_gn+=" dcheck_always_on=$(usex debug true false)" + myconf_gn+=" dcheck_is_configurable=$(usex debug true false)" + + # Component build isn't generally intended for use by end users. It's mostly useful + # for development and debugging. + myconf_gn+=" is_component_build=false" + + # Disable nacl, we can't build without pnacl (http://crbug.com/269560). + myconf_gn+=" enable_nacl=false" + + local gn_system_libraries=( + flac + fontconfig + freetype + libdrm + libjpeg + libwebp + libxml + libxslt + zlib + ) + if use system-brotli; then + gn_system_libraries+=( brotli ) + fi + if use system-crc32c; then + gn_system_libraries+=( crc32c ) + fi + if use system-double-conversion; then + gn_system_libraries+=( double-conversion ) + fi + if use system-woff2; then + gn_system_libraries+=( woff2 ) + fi + if use nvidia; then + gn_system_libraries+=( libXNVCtrl ) + fi + if use system-ffmpeg; then + gn_system_libraries+=( ffmpeg opus ) + fi + if use system-jsoncpp; then + gn_system_libraries+=( jsoncpp ) + fi + if use system-icu; then + gn_system_libraries+=( icu ) + fi + if use system-png; then + gn_system_libraries+=( libpng ) + myconf_gn+=" use_system_libpng=true" + fi + if use system-zstd; then + gn_system_libraries+=( zstd ) + fi + if use system-av1; then + gn_system_libraries+=( dav1d libaom ) + fi + if use system-libusb; then + gn_system_libraries+=( libusb ) + fi + if use system-libvpx; then + gn_system_libraries+=( libvpx ) + fi + if use thorium-libjxl; then + gn_system_libraries+=( libjxl ) + fi + if use system-libevent; then + gn_system_libraries+=( libevent ) + fi + use system-openh264 && gn_system_libraries+=( + openh264 + ) + use system-re2 && gn_system_libraries+=( + re2 + ) + use system-snappy && gn_system_libraries+=( + snappy + ) + + build/linux/unbundle/replace_gn_files.py --system-libraries "${gn_system_libraries[@]}" || die + + # See dependency logic in third_party/BUILD.gn + myconf_gn+=" use_system_harfbuzz=$(usex system-harfbuzz true false)" + + # Optional dependencies. + myconf_gn+=" enable_hangout_services_extension=$(usex hangouts true false)" + myconf_gn+=" enable_widevine=$(usex widevine true false)" + + if use headless; then + myconf_gn+=" use_cups=false" + myconf_gn+=" use_kerberos=false" + myconf_gn+=" use_pulseaudio=false" + myconf_gn+=" use_vaapi=false" + myconf_gn+=" rtc_use_pipewire=false" + else + myconf_gn+=" use_cups=$(usex cups true false)" + myconf_gn+=" use_kerberos=$(usex kerberos true false)" + myconf_gn+=" use_pulseaudio=$(usex pulseaudio true false)" + myconf_gn+=" use_vaapi=$(usex vaapi true false)" + myconf_gn+=" rtc_use_pipewire=$(usex screencast true false)" + myconf_gn+=" gtk_version=$(usex gtk4 4 3)" + fi + + # Allows distributions to link pulseaudio directly (DT_NEEDED) instead of + # using dlopen. This helps with automated detection of ABI mismatches and + # prevents silent errors. + if use pulseaudio; then + myconf_gn+=" link_pulseaudio=true" + fi + + # Non-developer builds of Chromium (for example, non-Chrome browsers, or + # Chromium builds provided by Linux distros) should disable the testing config + myconf_gn+=" disable_fieldtrial_testing_config=true" + + # The sysroot is the oldest debian image that chromium supports, we don't need it + myconf_gn+=" use_sysroot=false" + + # This determines whether or not GN uses the bundled libcxx + if use libcxx; then + myconf_gn+=" use_custom_libcxx=true" + else + myconf_gn+=" use_custom_libcxx=false" + append-cppflags -U_GLIBCXX_ASSERTIONS # See #318 + fi + + myconf_gn+=" use_bluez=$(usex bluetooth true false)" + + myconf_gn+=" is_cfi=$(usex cfi true false)" + + if use cfi; then + myconf_gn+=" use_cfi_icall=true" + myconf_gn+=" use_cfi_cast=true" + fi + + if use pgo; then + myconf_gn+=" chrome_pgo_phase=2" + myconf_gn+=" v8_enable_builtins_optimization=true" + else + myconf_gn+=" chrome_pgo_phase=0" + fi + + myconf_gn+=" optimize_webui=$(usex optimize-webui true false)" + myconf_gn+=" use_system_freetype=$(usex system-harfbuzz true false)" + myconf_gn+=" use_system_libopenjpeg2=$(usex system-openjpeg true false)" + myconf_gn+=" enable_pdf=true" + myconf_gn+=" use_system_lcms2=true" + myconf_gn+=" enable_print_preview=true" + myconf_gn+=" enable_platform_hevc=$(usex hevc true false)" + myconf_gn+=" enable_hevc_parser_and_hw_decoder=$(usex hevc true false)" + + # Ungoogled flags + myconf_gn+=" build_with_tflite_lib=false" + myconf_gn+=" enable_mse_mpeg2ts_stream_parser=$(usex proprietary-codecs true false)" + myconf_gn+=" enable_reading_list=false" + myconf_gn+=" enable_remoting=false" + myconf_gn+=" enable_reporting=false" + if use ungoogled; then + myconf_gn+=" enable_mdns=false" + myconf_gn+=" enable_service_discovery=false" + fi + myconf_gn+=" exclude_unwind_tables=true" + myconf_gn+=" google_api_key=\"\"" + myconf_gn+=" google_default_client_id=\"\"" + myconf_gn+=" google_default_client_secret=\"\"" + # https://github.com/Alex313031/thorium/issues/978 + if use ungoogled; then + myconf_gn+=" safe_browsing_mode=0" + fi + myconf_gn+=" use_official_google_api_keys=false" + myconf_gn+=" use_unofficial_version_number=false" + + # myconf_gn+=" enable_swiftshader=false" + + # Additional flags + myconf_gn+=" perfetto_use_system_zlib=true" + myconf_gn+=" use_system_zlib=true" + myconf_gn+=" use_system_libjpeg=true" + myconf_gn+=" rtc_build_examples=false" + myconf_gn+=" enable_chromium_prelude=false" + myconf_gn+=" enable_updater=false" + myconf_gn+=" enable_update_notifications=false" + + # Disable pseudolocales, only used for testing + myconf_gn+=" enable_pseudolocales=false" + + # Disable code formating of generated files + myconf_gn+=" blink_enable_generated_code_formatting=false" + + ffmpeg_branding="$(usex proprietary-codecs Chrome Chromium)" + myconf_gn+=" proprietary_codecs=$(usex proprietary-codecs true false)" + myconf_gn+=" ffmpeg_branding=\"${ffmpeg_branding}\"" + + local myarch="$(tc-arch)" + + # Avoid CFLAGS problems + if ! use custom-cflags; then + filter-flags "-O*" "-Wl,-O*" # See #25 + strip-flags + + # Prevent linker from running out of address space, bug #471810 . + if use x86; then + filter-flags "-g*" + fi + + # Prevent libvpx/xnnpack build failures. Bug 530248, 544702, 546984, 853646. + if [[ ${myarch} == amd64 || ${myarch} == x86 ]]; then + filter-flags -mno-mmx -mno-sse2 -mno-ssse3 -mno-sse4.1 -mno-avx -mno-avx2 -mno-fma -mno-fma4 -mno-xop -mno-sse4a + fi + fi + + if [[ $myarch = amd64 ]] ; then + myconf_gn+=" target_cpu=\"x64\"" + ffmpeg_target_arch=x64 + elif [[ $myarch = x86 ]] ; then + myconf_gn+=" target_cpu=\"x86\"" + ffmpeg_target_arch=ia32 + + # This is normally defined by compiler_cpu_abi in + # build/config/compiler/BUILD.gn, but we patch that part out. + append-flags -msse2 -mfpmath=sse -mmmx + elif [[ $myarch = arm64 ]] ; then + myconf_gn+=" target_cpu=\"arm64\"" + ffmpeg_target_arch=arm64 + elif [[ $myarch = ppc64 ]] ; then + myconf_gn+=" target_cpu=\"ppc64\"" + ffmpeg_target_arch=ppc64 + else + die "Failed to determine target arch, got '$myarch'." + fi + + myconf_gn+=" treat_warnings_as_errors=false" + # Disable fatal linker warnings, bug 506268. + myconf_gn+=" fatal_linker_warnings=false" + + # Disable external code space for V8 for ppc64. It is disabled for ppc64 + # by default, but cross-compiling on amd64 enables it again. + if tc-is-cross-compiler; then + if ! use amd64 && ! use arm64; then + myconf_gn+=" v8_enable_external_code_space=false" + fi + fi + + # Only enabled for clang, but gcc has endian macros too + myconf_gn+=" v8_use_libm_trig_functions=true" + + # Bug 491582. + export TMPDIR="${WORKDIR}/temp" + mkdir -p -m 755 "${TMPDIR}" || die + + # https://bugs.gentoo.org/654216 + addpredict /dev/dri/ #nowarn + + # We don't use the same clang version as upstream, and with -Werror + # we need to make sure that we don't get superfluous warnings. + append-flags -Wno-unknown-warning-option + if tc-is-cross-compiler; then + export BUILD_CXXFLAGS+=" -Wno-unknown-warning-option" + export BUILD_CFLAGS+=" -Wno-unknown-warning-option" + fi + + # Explicitly disable ICU data file support for system-icu/headless builds. + if use system-icu || use headless; then + myconf_gn+=" icu_use_data_file=false" + fi + + # Don't need nocompile checks and GN crashes with our config + myconf_gn+=" enable_nocompile_tests=false" + + # Enable ozone wayland and/or headless support + myconf_gn+=" use_ozone=true ozone_auto_platforms=false" + myconf_gn+=" ozone_platform_headless=true" + if use headless; then + myconf_gn+=" ozone_platform=\"headless\"" + myconf_gn+=" use_xkbcommon=false use_gtk=false use_qt=false" + myconf_gn+=" use_glib=false use_gio=false" + myconf_gn+=" use_pangocairo=false use_alsa=false" + myconf_gn+=" use_libpci=false use_udev=false" + myconf_gn+=" enable_print_preview=false" + myconf_gn+=" enable_remoting=false" + else + myconf_gn+=" use_system_minigbm=true" + myconf_gn+=" use_xkbcommon=true" + myconf_gn+=" use_qt5=false" + if use qt6; then + myconf_gn+=" use_qt6=true" + local cbuild_libdir=$(get_libdir) + if tc-is-cross-compiler; then + # Hack to workaround get_libdir not being able to handle CBUILD, bug #794181 + local cbuild_libdir=$($(tc-getBUILD_PKG_CONFIG) --keep-system-libs --libs-only-L libxslt) + cbuild_libdir=${cbuild_libdir:2} + cbuild_libdir=${cbuild_libdir/% } + fi + myconf_gn+=" moc_qt6_path=\"${EPREFIX}/usr/${cbuild_libdir}/qt6/libexec\"" + else + myconf_gn+=" use_qt6=false" + fi + myconf_gn+=" ozone_platform_x11=$(usex X true false)" + myconf_gn+=" ozone_platform_wayland=$(usex wayland true false)" + myconf_gn+=" ozone_platform=$(usex wayland \"wayland\" \"x11\")" + use wayland && myconf_gn+=" use_system_libffi=true" + fi + + # Results in undefined references in chrome linking, may require CFI to work + if use arm64; then + myconf_gn+=" arm_control_flow_integrity=\"none\"" + fi + + myconf_gn+=" use_thin_lto=${use_lto}" + myconf_gn+=" thin_lto_enable_optimizations=${use_lto}" + + # Enable official builds + myconf_gn+=" is_official_build=$(usex official true false)" + if use official; then + # Allow building against system libraries in official builds + sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \ + tools/generate_shim_headers/generate_shim_headers.py || die + # Don't add symbols to build + myconf_gn+=" symbol_level=0" + else + myconf_gn+=" devtools_skip_typecheck=false" # See #142 + fi + + # skipping typecheck is only supported on amd64, bug #876157 + if ! use amd64; then + myconf_gn+=" devtools_skip_typecheck=false" + fi + + einfo "Configuring Thorium ..." + set -- gn gen --args="${myconf_gn} ${EXTRA_GN}" out/thorium + echo "$@" + "$@" || die +} + +src_compile() { + # Final link uses lots of file descriptors. + # Much larger, required by mold, https://github.com/rui314/mold/issues/336 + ulimit -n 1048576 + + # Calling this here supports resumption via FEATURES=keepwork + python_setup + + # Don't inherit PYTHONPATH from environment, bug #789021, #812689 + local -x PYTHONPATH= + + use convert-dict && eninja -C out/thorium convert_dict + + # Build mksnapshot and pax-mark it. + if use pax-kernel; then + local x + for x in mksnapshot v8_context_snapshot_generator; do + if tc-is-cross-compiler; then + eninja -C out/thorium "host/${x}" + pax-mark m "out/thorium/host/${x}" + else + eninja -C out/thorium "${x}" + pax-mark m "out/thorium/${x}" + fi + done + fi + + # Even though ninja autodetects number of CPUs, we respect + # user's options, for debugging with -j 1 or any other reason. + eninja -C out/thorium thorium $(use test && echo "base_unittests") + + use enable-driver && eninja -C out/thorium chromedriver + use thorium-shell && eninja -C out/thorium thorium_shell + #use suid && eninja -C out/thorium chrome_sandbox + + pax-mark m out/thorium/thorium + + use enable-driver && mv out/thorium/chromedriver{.unstripped,} + + rm -f out/thorium/locales/*.pak.info || die + + # Build manpage; bug #684550 + sed -e 's|@@PACKAGE@@|thorium-browser|g; + s|@@MENUNAME@@|Thorium|g;' \ + chrome/app/resources/manpage.1.in > \ + out/thorium/thorium-browser.1 || die + + # Build desktop file; bug #706786 + #sed -e 's|@@MENUNAME@@|Thorium|g; + # s|@@USR_BIN_SYMLINK_NAME@@|thorium-browser|g; + # s|@@PACKAGE@@|thorium-browser|g; + # s|\(^Exec=\)/usr/bin/|\1|g;' \ + # chrome/installer/linux/common/desktop.template > \ + # out/thorium/thorium-browser-thorium.desktop || die + + # Build vk_swiftshader_icd.json; bug #827861 + sed -e 's|${ICD_LIBRARY_PATH}|./libvk_swiftshader.so|g' \ + third_party/swiftshader/src/Vulkan/vk_swiftshader_icd.json.tmpl > \ + out/thorium/vk_swiftshader_icd.json || die +} + +src_test() { + # Initial list of tests to skip pulled from Alpine. Thanks Lauren! + # https://issues.chromium.org/issues/40939315 + local skip_tests=( + 'MessagePumpLibeventTest.NestedNotification*' + ClampTest.Death + OptionalTest.DereferencingNoValueCrashes + PlatformThreadTest.SetCurrentThreadTypeTest + RawPtrTest.TrivialRelocability + SafeNumerics.IntMaxOperations + StackTraceTest.TraceStackFramePointersFromBuffer + StringPieceTest.InvalidLengthDeath + StringPieceTest.OutOfBoundsDeath + ThreadPoolEnvironmentConfig.CanUseBackgroundPriorityForWorker + ValuesUtilTest.FilePath + # Gentoo-specific + AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/0 + AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/1 + AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/2 + AlternateTestParams/PartitionAllocDeathTest.RepeatedAllocReturnNullDirect/3 + AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/0 + AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/1 + AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/2 + AlternateTestParams/PartitionAllocDeathTest.RepeatedReallocReturnNullDirect/3 + CharacterEncodingTest.GetCanonicalEncodingNameByAliasName + CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGFPE + CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGILL + CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGSEGV + CheckExitCodeAfterSignalHandlerDeathTest.CheckSIGSEGVNonCanonicalAddress + FilePathTest.FromUTF8Unsafe_And_AsUTF8Unsafe + ICUStringConversionsTest.ConvertToUtf8AndNormalize + NumberFormattingTest.FormatPercent + PathServiceTest.CheckedGetFailure + PlatformThreadTest.CanChangeThreadType + StackCanary.ChangingStackCanaryCrashesOnReturn + StackTraceDeathTest.StackDumpSignalHandlerIsMallocFree + SysStrings.SysNativeMBAndWide + SysStrings.SysNativeMBToWide + SysStrings.SysWideToNativeMB + TestLauncherTools.TruncateSnippetFocusedMatchesFatalMessagesTest + ToolsSanityTest.BadVirtualCallNull + ToolsSanityTest.BadVirtualCallWrongType + ) + + local test_filter="-$(IFS=:; printf '%s' "${skip_tests[*]}")" + # test-launcher-bot-mode enables parallelism and plain output + ./out/thorium/base_unittests --test-launcher-bot-mode \ + --test-launcher-jobs="$(makeopts_jobs)" \ + --gtest_filter="${test_filter}" || die "Tests failed!" +} + +src_install() { + local CHROMIUM_HOME="/usr/$(get_libdir)/thorium" + exeinto "${CHROMIUM_HOME}" + doexe out/thorium/thorium + + if use convert-dict; then + newexe "${FILESDIR}/update-dicts.sh" update-dicts.sh + doexe out/thorium/convert_dict + fi + + #if use suid; then + # newexe out/thorium/chrome_sandbox chrome-sandbox + # fperms 4755 "${CHROMIUM_HOME}/chrome-sandbox" + #fi + + use enable-driver && doexe out/thorium/chromedriver + use thorium-shell && doexe out/thorium/thorium_shell + #doexe out/thorium/chrome_crashpad_handler + + ozone_auto_session () { + use X && use wayland && ! use headless && echo true || echo false + } + local sedargs=( -e + "s:/usr/lib/:/usr/$(get_libdir)/:g; + s:@@OZONE_AUTO_SESSION@@:$(ozone_auto_session):g" + ) + sed "${sedargs[@]}" "${FILESDIR}/thorium-launcher.sh" > thorium-launcher.sh || die + doexe thorium-launcher.sh + + # It is important that we name the target "chromium-browser", + # xdg-utils expect it; bug #355517. + dosym "${CHROMIUM_HOME}/thorium-launcher.sh" /usr/bin/thorium-browser + # keep the old symlink around for consistency + dosym "${CHROMIUM_HOME}/thorium-launcher.sh" /usr/bin/thorium + + use enable-driver && dosym "${CHROMIUM_HOME}/chromedriver" /usr/bin/chromedriver + if use thorium-shell; then + doexe "${FILESDIR}/thorium-shell-launcher.sh" + dosym "${CHROMIUM_HOME}/thorium-shell-launcher.sh" /usr/bin/thorium-shell + fi + + # Allow users to override command-line options, bug #357629. + insinto /etc/thorium + newins "${FILESDIR}/thorium.default" "default" + + if use thorium-shell; then + insinto /etc/thorium-shell + newins "${FILESDIR}/thorium-shell.default" "default" + fi + + pushd out/thorium/locales > /dev/null || die + chromium_remove_language_paks + popd + + insinto "${CHROMIUM_HOME}" + doins out/thorium/*.bin + doins out/thorium/*.pak + ( + shopt -s nullglob + local files=(out/thorium/*.so out/thorium/*.so.[0-9]) + [[ ${#files[@]} -gt 0 ]] && doins "${files[@]}" + ) + + # Install bundled xdg-utils, avoids installing X11 libraries with USE="-X wayland" + doins out/thorium/xdg-{settings,mime} + + if ! use system-icu && ! use headless; then + doins out/thorium/icudtl.dat + fi + + doins -r out/thorium/locales + #doins -r out/thorium/MEIPreload + + # Install vk_swiftshader_icd.json; bug #827861 + doins out/thorium/vk_swiftshader_icd.json + + if [[ -d out/thorium/swiftshader ]]; then + insinto "${CHROMIUM_HOME}/swiftshader" + doins out/thorium/swiftshader/*.so + fi + + use widevine && dosym WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so "${CHROMIUM_HOME}/libwidevinecdm.so" + + # Install icons + local branding size + for size in 16 24 32 48 64 128 256 ; do + newicon -s ${size} "${THORIUM_WD}/logos/NEW/product_logo_${size}.png" \ + thorium-browser.png + done + if use thorium-shell; then + for size in 16 24 32 48 64 128 256 ; do + newicon -s ${size} "${THORIUM_WD}/logos/NEW/thorium_shell/thorium-devtools-${size}.png" \ + thorium-shell.png + done + fi + + # Install desktop entry + sed -i -e 's|./thorium-browser|/usr/bin/thorium-browser|' \ + -e 's/Icon=product_logo_256.png/Icon=thorium-browser/' \ + "${THORIUM_WD}/infra/portable/thorium-portable.desktop" || die + newmenu "${THORIUM_WD}/infra/portable/thorium-portable.desktop" thorium-browser-thorium.desktop + if use thorium-shell; then + domenu "${FILESDIR}/thorium-shell.desktop" + fi + + # Install GNOME default application entry (bug #303100). + insinto /usr/share/gnome-control-center/default-apps + newins "${FILESDIR}"/thorium-browser.xml thorium-browser.xml + + # Install manpage; bug #684550 + doman out/thorium/thorium-browser.1 + dosym thorium-browser.1 /usr/share/man/man1/thorium.1 + + readme.gentoo_create_doc +} + +pkg_postrm() { + xdg_icon_cache_update + xdg_desktop_database_update +} + +pkg_postinst() { + xdg_icon_cache_update + xdg_desktop_database_update + readme.gentoo_print_elog + + if ! use headless; then + if use vaapi; then + elog "VA-API is disabled by default at runtime. You have to enable it" + elog "by adding --enable-features=VaapiVideoDecoder to CHROMIUM_FLAGS" + elog "in /etc/thorium/default." + fi + if use screencast; then + elog "Screencast is disabled by default at runtime. Either enable it" + elog "by navigating to chrome://flags/#enable-webrtc-pipewire-capturer" + elog "inside Chromium or add --enable-features=WebRTCPipeWireCapturer" + elog "to CHROMIUM_FLAGS in /etc/thorium/default." + elog + elog "Additional setup may be required for screencasting to work." + elog "See issue: https://github.com/PF4Public/gentoo-overlay/issues/314" + fi + if use gtk4; then + elog "Chromium prefers GTK3 over GTK4 at runtime. To override this" + elog "behaviour you need to pass --gtk-version=4, e.g. by adding it" + elog "to CHROMIUM_FLAGS in /etc/thorium/default." + fi + if use widevine; then + elog "widevine requires binary plugins, which are distributed separately" + elog "Make sure you have www-plugins/chrome-binary-plugins installed" + fi + fi + + if systemd_is_booted && ! [[ -f "/etc/machine-id" ]]; then + ewarn "The lack of an '/etc/machine-id' file on this system booted with systemd" + ewarn "indicates that the Gentoo handbook was not followed to completion." + ewarn "" + ewarn "Chromium is known to behave unpredictably with this system configuration;" + ewarn "please complete the configuration of this system before logging any bugs." + fi +}