fix-building-without-safebrowsing.patch 104 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368
  1. # Additional changes to Inox's fix-building-without-safebrowsing.patch
  2. --- a/chrome/browser/BUILD.gn
  3. +++ b/chrome/browser/BUILD.gn
  4. @@ -631,8 +631,6 @@ static_library("browser") {
  5. "internal_auth.h",
  6. "interstitials/chrome_settings_page_helper.cc",
  7. "interstitials/chrome_settings_page_helper.h",
  8. - "interstitials/enterprise_util.cc",
  9. - "interstitials/enterprise_util.h",
  10. "invalidation/profile_invalidation_provider_factory.cc",
  11. "invalidation/profile_invalidation_provider_factory.h",
  12. "k_anonymity_service/k_anonymity_service_client.cc",
  13. @@ -3757,10 +3755,6 @@ static_library("browser") {
  14. "enterprise/connectors/analysis/analysis_service_settings.h",
  15. "enterprise/connectors/analysis/analysis_settings.cc",
  16. "enterprise/connectors/analysis/analysis_settings.h",
  17. - "enterprise/connectors/analysis/content_analysis_delegate.cc",
  18. - "enterprise/connectors/analysis/content_analysis_delegate.h",
  19. - "enterprise/connectors/analysis/content_analysis_delegate_base.cc",
  20. - "enterprise/connectors/analysis/content_analysis_delegate_base.h",
  21. "enterprise/connectors/analysis/content_analysis_dialog.cc",
  22. "enterprise/connectors/analysis/content_analysis_dialog.h",
  23. "enterprise/connectors/analysis/content_analysis_downloads_delegate.cc",
  24. @@ -4040,10 +4034,6 @@ static_library("browser") {
  25. "new_tab_page/modules/recipes/recipes_service_factory.h",
  26. "new_tab_page/modules/recipes/time_format_util.cc",
  27. "new_tab_page/modules/recipes/time_format_util.h",
  28. - "new_tab_page/modules/safe_browsing/safe_browsing_handler.cc",
  29. - "new_tab_page/modules/safe_browsing/safe_browsing_handler.h",
  30. - "new_tab_page/modules/safe_browsing/safe_browsing_prefs.cc",
  31. - "new_tab_page/modules/safe_browsing/safe_browsing_prefs.h",
  32. "new_tab_page/new_tab_page_util.cc",
  33. "new_tab_page/new_tab_page_util.h",
  34. "new_tab_page/one_google_bar/one_google_bar_data.cc",
  35. @@ -4488,7 +4478,6 @@ static_library("browser") {
  36. "//chrome/browser/new_tab_page/modules/feed:mojo_bindings",
  37. "//chrome/browser/new_tab_page/modules/photos:mojo_bindings",
  38. "//chrome/browser/new_tab_page/modules/recipes:mojo_bindings",
  39. - "//chrome/browser/new_tab_page/modules/safe_browsing:mojo_bindings",
  40. "//chrome/browser/policy:path_parser",
  41. "//chrome/browser/profile_resetter:profile_reset_report_proto",
  42. "//chrome/browser/resource_coordinator:intervention_policy_database_proto",
  43. @@ -7884,9 +7873,14 @@ static_library("browser") {
  44. "//components/safe_browsing/content/browser:safe_browsing_blocking_page",
  45. "//components/safe_browsing/content/browser/download:download_stats",
  46. "//components/safe_browsing/content/common:file_type_policies",
  47. - "//components/safe_browsing/content/common/proto:download_file_types_proto",
  48. + # "//components/safe_browsing/content/common/proto:download_file_types_proto",
  49. ]
  50. }
  51. + # Use download_file_types_proto regardless of safe_browsing_mode, for
  52. + # now...
  53. + deps += [
  54. + "//components/safe_browsing/content/common/proto:download_file_types_proto",
  55. + ]
  56. if (build_with_tflite_lib) {
  57. sources += [
  58. --- a/chrome/browser/accuracy_tips/accuracy_service_factory.cc
  59. +++ b/chrome/browser/accuracy_tips/accuracy_service_factory.cc
  60. @@ -45,10 +45,7 @@ KeyedService* AccuracyServiceFactory::Bu
  61. content::BrowserContext* browser_context) const {
  62. DCHECK(base::FeatureList::IsEnabled(safe_browsing::kAccuracyTipsFeature));
  63. Profile* profile = Profile::FromBrowserContext(browser_context);
  64. - auto sb_database =
  65. - g_browser_process->safe_browsing_service()
  66. - ? g_browser_process->safe_browsing_service()->database_manager()
  67. - : nullptr;
  68. + auto sb_database = nullptr;
  69. auto* history_service = HistoryServiceFactory::GetForProfile(
  70. profile, ServiceAccessType::IMPLICIT_ACCESS);
  71. auto delegate = std::make_unique<AccuracyServiceDelegate>(profile);
  72. --- a/chrome/browser/chrome_content_browser_client.cc
  73. +++ b/chrome/browser/chrome_content_browser_client.cc
  74. @@ -4649,11 +4649,13 @@ ChromeContentBrowserClient::CreateThrott
  75. &throttles);
  76. #endif
  77. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  78. if (base::FeatureList::IsEnabled(safe_browsing::kDelayedWarnings)) {
  79. throttles.push_back(
  80. std::make_unique<safe_browsing::DelayedWarningNavigationThrottle>(
  81. handle));
  82. }
  83. +#endif
  84. #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
  85. MaybeAddThrottle(browser_switcher::BrowserSwitcherNavigationThrottle::
  86. @@ -6088,26 +6090,7 @@ ChromeContentBrowserClient::GetSafeBrows
  87. const std::vector<std::string>& allowlist_domains) {
  88. DCHECK_CURRENTLY_ON(BrowserThread::IO);
  89. - // Should not bypass safe browsing check if the check is for enterprise
  90. - // lookup.
  91. - if (!safe_browsing_enabled_for_profile && !should_check_on_sb_disabled)
  92. - return nullptr;
  93. -
  94. - // |safe_browsing_service_| may be unavailable in tests.
  95. - if (safe_browsing_service_ && !safe_browsing_url_checker_delegate_) {
  96. - safe_browsing_url_checker_delegate_ =
  97. - base::MakeRefCounted<safe_browsing::UrlCheckerDelegateImpl>(
  98. - safe_browsing_service_->database_manager(),
  99. - safe_browsing_service_->ui_manager());
  100. - }
  101. -
  102. - // Update allowlist domains.
  103. - if (safe_browsing_url_checker_delegate_) {
  104. - safe_browsing_url_checker_delegate_->SetPolicyAllowlistDomains(
  105. - allowlist_domains);
  106. - }
  107. -
  108. - return safe_browsing_url_checker_delegate_;
  109. + return nullptr;
  110. }
  111. safe_browsing::RealTimeUrlLookupServiceBase*
  112. @@ -6128,11 +6111,6 @@ ChromeContentBrowserClient::GetUrlLookup
  113. GetForProfile(profile);
  114. }
  115. #endif
  116. -
  117. - if (is_consumer_lookup_enabled) {
  118. - return safe_browsing::RealTimeUrlLookupServiceFactory::GetForProfile(
  119. - profile);
  120. - }
  121. return nullptr;
  122. }
  123. --- a/chrome/browser/chrome_content_browser_client_receiver_bindings.cc
  124. +++ b/chrome/browser/chrome_content_browser_client_receiver_bindings.cc
  125. @@ -143,34 +143,6 @@ void MaybeCreateSafeBrowsingForRenderer(
  126. const std::vector<std::string>& allowlist_domains)>
  127. get_checker_delegate,
  128. mojo::PendingReceiver<safe_browsing::mojom::SafeBrowsing> receiver) {
  129. - DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  130. -
  131. - content::RenderProcessHost* render_process_host =
  132. - content::RenderProcessHost::FromID(process_id);
  133. - if (!render_process_host)
  134. - return;
  135. -
  136. - PrefService* pref_service =
  137. - Profile::FromBrowserContext(render_process_host->GetBrowserContext())
  138. - ->GetPrefs();
  139. -
  140. - std::vector<std::string> allowlist_domains =
  141. - safe_browsing::GetURLAllowlistByPolicy(pref_service);
  142. -
  143. - bool safe_browsing_enabled =
  144. - safe_browsing::IsSafeBrowsingEnabled(*pref_service);
  145. - content::GetIOThreadTaskRunner({})->PostTask(
  146. - FROM_HERE,
  147. - base::BindOnce(
  148. - &safe_browsing::MojoSafeBrowsingImpl::MaybeCreate, process_id,
  149. - resource_context,
  150. - base::BindRepeating(get_checker_delegate, safe_browsing_enabled,
  151. - // Navigation initiated from renderer should never
  152. - // check when safe browsing is disabled, because
  153. - // enterprise check only supports mainframe URL.
  154. - /*should_check_on_sb_disabled=*/false,
  155. - allowlist_domains),
  156. - std::move(receiver)));
  157. }
  158. // BadgeManager is not used for Android.
  159. --- a/chrome/browser/component_updater/chrome_client_side_phishing_component_installer.cc
  160. +++ b/chrome/browser/component_updater/chrome_client_side_phishing_component_installer.cc
  161. @@ -29,20 +29,6 @@ namespace {
  162. void LoadFromDisk(const base::FilePath& pb_path,
  163. const base::FilePath& visual_tflite_model_path) {
  164. - if (pb_path.empty())
  165. - return;
  166. -
  167. - std::string binary_pb;
  168. - if (!base::ReadFileToString(pb_path, &binary_pb))
  169. - binary_pb.clear();
  170. -
  171. - base::File visual_tflite_model(visual_tflite_model_path,
  172. - base::File::FLAG_OPEN | base::File::FLAG_READ);
  173. -
  174. - // The ClientSidePhishingModel singleton will react appropriately if the
  175. - // |binary_pb| is empty or |visual_tflite_model| is invalid.
  176. - safe_browsing::ClientSidePhishingModel::GetInstance()
  177. - ->PopulateFromDynamicUpdate(binary_pb, std::move(visual_tflite_model));
  178. }
  179. void PopulateModelFromFiles(const base::FilePath& install_dir) {
  180. @@ -56,9 +42,6 @@ void PopulateModelFromFiles(const base::
  181. update_client::InstallerAttributes GetInstallerAttributes() {
  182. update_client::InstallerAttributes attributes;
  183. - // Pass the tag parameter to the installer as the "tag" attribute; it will
  184. - // be used to choose which binary is downloaded.
  185. - attributes["tag"] = safe_browsing::GetClientSideDetectionTag();
  186. return attributes;
  187. }
  188. --- a/chrome/browser/devtools/devtools_window.cc
  189. +++ b/chrome/browser/devtools/devtools_window.cc
  190. @@ -72,6 +72,7 @@
  191. #include "content/public/browser/web_contents.h"
  192. #include "content/public/common/content_client.h"
  193. #include "content/public/common/url_constants.h"
  194. +#include "net/cert/x509_certificate.h"
  195. #include "third_party/blink/public/common/input/web_gesture_event.h"
  196. #include "third_party/blink/public/common/input/web_input_event.h"
  197. #include "third_party/blink/public/common/renderer_preferences/renderer_preferences.h"
  198. --- a/chrome/browser/download/bubble/download_bubble_controller.cc
  199. +++ b/chrome/browser/download/bubble/download_bubble_controller.cc
  200. @@ -402,8 +402,6 @@ void DownloadBubbleUIController::Process
  201. ProcessDownloadWarningButtonPress(model, command);
  202. break;
  203. case DownloadCommands::REVIEW:
  204. - model->ReviewScanningVerdict(
  205. - browser_->tab_strip_model()->GetActiveWebContents());
  206. break;
  207. case DownloadCommands::RETRY:
  208. RetryDownload(model, command);
  209. --- a/chrome/browser/download/chrome_download_manager_delegate.cc
  210. +++ b/chrome/browser/download/chrome_download_manager_delegate.cc
  211. @@ -132,7 +132,6 @@ using content::DownloadManager;
  212. using download::DownloadItem;
  213. using download::DownloadPathReservationTracker;
  214. using download::PathValidationResult;
  215. -using safe_browsing::DownloadFileType;
  216. using safe_browsing::DownloadProtectionService;
  217. using ConnectionType = net::NetworkChangeNotifier::ConnectionType;
  218. @@ -1486,7 +1485,6 @@ void ChromeDownloadManagerDelegate::OnDo
  219. DownloadItemModel model(item);
  220. model.DetermineAndSetShouldPreferOpeningInBrowser(
  221. target_info->target_path, target_info->is_filetype_handled_safely);
  222. - model.SetDangerLevel(target_info->danger_level);
  223. }
  224. if (ShouldBlockFile(item, target_info->danger_type)) {
  225. MaybeReportDangerousDownloadBlocked(
  226. @@ -1565,56 +1563,6 @@ bool ChromeDownloadManagerDelegate::IsOp
  227. bool ChromeDownloadManagerDelegate::ShouldBlockFile(
  228. download::DownloadItem* item,
  229. download::DownloadDangerType danger_type) const {
  230. - DownloadPrefs::DownloadRestriction download_restriction =
  231. - download_prefs_->download_restriction();
  232. -
  233. - if (IsDangerTypeBlocked(danger_type))
  234. - return true;
  235. -
  236. - // TODO(crbug/1061111): Move this into IsDangerTypeBlocked once the UX is
  237. - // ready.
  238. - if (danger_type ==
  239. - download::DOWNLOAD_DANGER_TYPE_BLOCKED_UNSUPPORTED_FILETYPE)
  240. - return true;
  241. -
  242. - bool file_type_dangerous =
  243. - (item &&
  244. - DownloadItemModel(item).GetDangerLevel() !=
  245. - DownloadFileType::NOT_DANGEROUS &&
  246. - danger_type == download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS);
  247. -
  248. - switch (download_restriction) {
  249. - case (DownloadPrefs::DownloadRestriction::NONE):
  250. - return false;
  251. -
  252. - case (DownloadPrefs::DownloadRestriction::POTENTIALLY_DANGEROUS_FILES):
  253. - return danger_type != download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS ||
  254. - file_type_dangerous;
  255. -
  256. - case (DownloadPrefs::DownloadRestriction::DANGEROUS_FILES): {
  257. - return (danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT ||
  258. - danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE ||
  259. - danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL ||
  260. - danger_type ==
  261. - download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE ||
  262. - file_type_dangerous);
  263. - }
  264. -
  265. - case (DownloadPrefs::DownloadRestriction::MALICIOUS_FILES): {
  266. - return (danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_CONTENT ||
  267. - danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_HOST ||
  268. - danger_type == download::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL ||
  269. - danger_type ==
  270. - download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE);
  271. - }
  272. -
  273. - case (DownloadPrefs::DownloadRestriction::ALL_FILES):
  274. - return true;
  275. -
  276. - default:
  277. - LOG(ERROR) << "Invalid download restruction value: "
  278. - << static_cast<int>(download_restriction);
  279. - }
  280. return false;
  281. }
  282. @@ -1629,7 +1577,6 @@ void ChromeDownloadManagerDelegate::Mayb
  283. service->MaybeSendDangerousDownloadOpenedReport(download,
  284. show_download_in_folder);
  285. }
  286. -#endif
  287. if (!download->GetAutoOpened()) {
  288. download::DownloadContent download_content =
  289. download::DownloadContentFromMimeType(download->GetMimeType(), false);
  290. @@ -1637,6 +1584,7 @@ void ChromeDownloadManagerDelegate::Mayb
  291. download->GetDangerType(), download_content, base::Time::Now(),
  292. download->GetEndTime(), show_download_in_folder);
  293. }
  294. +#endif
  295. }
  296. void ChromeDownloadManagerDelegate::CheckDownloadAllowed(
  297. @@ -1694,8 +1642,7 @@ void ChromeDownloadManagerDelegate::Chec
  298. DCHECK(download_item);
  299. DCHECK(download_item->IsSavePackageDownload());
  300. -#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || \
  301. - BUILDFLAG(IS_MAC)
  302. +#if 0
  303. absl::optional<enterprise_connectors::AnalysisSettings> settings =
  304. safe_browsing::DeepScanningRequest::ShouldUploadBinary(download_item);
  305. --- a/chrome/browser/download/download_item_model.cc
  306. +++ b/chrome/browser/download/download_item_model.cc
  307. @@ -924,100 +924,10 @@ void DownloadItemModel::ExecuteCommand(D
  308. DownloadItemModel::BubbleUIInfo
  309. DownloadItemModel::GetBubbleUIInfoForTailoredWarning() const {
  310. - download::DownloadDangerType danger_type = GetDangerType();
  311. - TailoredVerdict tailored_verdict = safe_browsing::DownloadProtectionService::
  312. - GetDownloadProtectionTailoredVerdict(download_);
  313. -
  314. - // Suspicious archives
  315. - if (danger_type == download::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT &&
  316. - tailored_verdict.tailored_verdict_type() ==
  317. - TailoredVerdict::SUSPICIOUS_ARCHIVE) {
  318. - return DownloadUIModel::BubbleUIInfo(
  319. - l10n_util::GetStringUTF16(
  320. - IDS_DOWNLOAD_BUBBLE_SUBPAGE_SUMMARY_SUSPICIOUS_ARCHIVE))
  321. - .AddIconAndColor(views::kInfoIcon, ui::kColorAlertMediumSeverity)
  322. - .AddPrimaryButton(DownloadCommands::Command::DISCARD)
  323. - .AddSubpageButton(l10n_util::GetStringUTF16(IDS_DOWNLOAD_BUBBLE_DELETE),
  324. - DownloadCommands::Command::DISCARD,
  325. - /*is_prominent=*/true)
  326. - .AddSubpageButton(
  327. - l10n_util::GetStringUTF16(IDS_DOWNLOAD_BUBBLE_CONTINUE),
  328. - DownloadCommands::Command::KEEP,
  329. - /*is_prominent=*/false);
  330. - }
  331. -
  332. - // Cookie theft
  333. - if (danger_type ==
  334. - download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE &&
  335. - tailored_verdict.tailored_verdict_type() ==
  336. - TailoredVerdict::COOKIE_THEFT) {
  337. - if (base::Contains(tailored_verdict.adjustments(),
  338. - TailoredVerdict::ACCOUNT_INFO_STRING)) {
  339. - auto* identity_manager = IdentityManagerFactory::GetForProfile(profile());
  340. - std::string email =
  341. - identity_manager
  342. - ? identity_manager
  343. - ->GetPrimaryAccountInfo(signin::ConsentLevel::kSignin)
  344. - .email
  345. - : "";
  346. - base::UmaHistogramBoolean(
  347. - "SBClientDownload.TailoredWarning.HasVaidEmailForAccountInfo",
  348. - !email.empty());
  349. - if (!email.empty()) {
  350. - return DownloadUIModel::BubbleUIInfo(
  351. - l10n_util::GetStringFUTF16(
  352. - IDS_DOWNLOAD_BUBBLE_SUBPAGE_SUMMARY_COOKIE_THEFT_AND_ACCOUNT,
  353. - base::ASCIIToUTF16(email)))
  354. - .AddIconAndColor(vector_icons::kNotSecureWarningIcon,
  355. - ui::kColorAlertHighSeverity)
  356. - .AddPrimaryButton(DownloadCommands::Command::DISCARD)
  357. - .AddSubpageButton(
  358. - l10n_util::GetStringUTF16(IDS_DOWNLOAD_BUBBLE_DELETE),
  359. - DownloadCommands::Command::DISCARD,
  360. - /*is_prominent=*/true);
  361. - }
  362. - }
  363. - return DownloadUIModel::BubbleUIInfo(
  364. - l10n_util::GetStringUTF16(
  365. - IDS_DOWNLOAD_BUBBLE_SUBPAGE_SUMMARY_COOKIE_THEFT))
  366. - .AddIconAndColor(vector_icons::kNotSecureWarningIcon,
  367. - ui::kColorAlertHighSeverity)
  368. - .AddPrimaryButton(DownloadCommands::Command::DISCARD)
  369. - .AddSubpageButton(l10n_util::GetStringUTF16(IDS_DOWNLOAD_BUBBLE_DELETE),
  370. - DownloadCommands::Command::DISCARD,
  371. - /*is_prominent=*/true);
  372. - }
  373. -
  374. - NOTREACHED();
  375. return DownloadUIModel::BubbleUIInfo();
  376. }
  377. bool DownloadItemModel::ShouldShowTailoredWarning() const {
  378. - if (!IsBubbleV2Enabled() ||
  379. - !base::FeatureList::IsEnabled(safe_browsing::kDownloadTailoredWarnings)) {
  380. - return false;
  381. - }
  382. -
  383. - static const struct ValidCombination {
  384. - download::DownloadDangerType danger_type;
  385. - TailoredVerdict::TailoredVerdictType tailored_verdict_type;
  386. - } kValidTailoredWarningCombinations[]{
  387. - {download::DOWNLOAD_DANGER_TYPE_UNCOMMON_CONTENT,
  388. - TailoredVerdict::SUSPICIOUS_ARCHIVE},
  389. - {download::DOWNLOAD_DANGER_TYPE_DANGEROUS_ACCOUNT_COMPROMISE,
  390. - TailoredVerdict::COOKIE_THEFT}};
  391. -
  392. - download::DownloadDangerType danger_type = GetDangerType();
  393. - TailoredVerdict tailored_verdict = safe_browsing::DownloadProtectionService::
  394. - GetDownloadProtectionTailoredVerdict(download_);
  395. - for (const auto& combination : kValidTailoredWarningCombinations) {
  396. - if (danger_type == combination.danger_type &&
  397. - tailored_verdict.tailored_verdict_type() ==
  398. - combination.tailored_verdict_type) {
  399. - return true;
  400. - }
  401. - }
  402. -
  403. return false;
  404. }
  405. --- a/chrome/browser/download/download_stats.cc
  406. +++ b/chrome/browser/download/download_stats.cc
  407. @@ -10,6 +10,7 @@
  408. #include "build/build_config.h"
  409. #include "components/download/public/common/download_content.h"
  410. #include "components/profile_metrics/browser_profile_type.h"
  411. +#include "components/safe_browsing/buildflags.h"
  412. #include "components/safe_browsing/content/browser/download/download_stats.h"
  413. void RecordDownloadCount(ChromeDownloadCountTypes type) {
  414. @@ -29,8 +30,10 @@ void RecordDangerousDownloadWarningShown
  415. bool has_user_gesture) {
  416. base::UmaHistogramEnumeration("Download.ShowedDownloadWarning", danger_type,
  417. download::DOWNLOAD_DANGER_TYPE_MAX);
  418. +#if BUILDFLAG(SAFE_BROWSING_AVAILABLE)
  419. safe_browsing::RecordDangerousDownloadWarningShown(
  420. danger_type, file_path, is_https, has_user_gesture);
  421. +#endif
  422. }
  423. void RecordOpenedDangerousConfirmDialog(
  424. --- a/chrome/browser/download/download_target_determiner.cc
  425. +++ b/chrome/browser/download/download_target_determiner.cc
  426. @@ -956,12 +956,14 @@ void DownloadTargetDeterminer::CheckVisi
  427. bool visited_referrer_before) {
  428. DCHECK_CURRENTLY_ON(BrowserThread::UI);
  429. DCHECK_EQ(STATE_DETERMINE_INTERMEDIATE_PATH, next_state_);
  430. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  431. safe_browsing::RecordDownloadFileTypeAttributes(
  432. safe_browsing::FileTypePolicies::GetInstance()->GetFileDangerLevel(
  433. virtual_path_.BaseName(), download_->GetURL(),
  434. GetProfile()->GetPrefs()),
  435. download_->HasUserGesture(), visited_referrer_before,
  436. GetLastDownloadBypassTimestamp());
  437. +#endif // BUILDFLAG(FULL_SAFE_BROWSING)
  438. danger_level_ = GetDangerLevel(
  439. visited_referrer_before ? VISITED_REFERRER : NO_VISITS_TO_REFERRER);
  440. if (danger_level_ != DownloadFileType::NOT_DANGEROUS &&
  441. @@ -1199,6 +1201,7 @@ DownloadFileType::DangerLevel DownloadTa
  442. absl::optional<base::Time>
  443. DownloadTargetDeterminer::GetLastDownloadBypassTimestamp() const {
  444. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  445. safe_browsing::SafeBrowsingMetricsCollector* metrics_collector =
  446. safe_browsing::SafeBrowsingMetricsCollectorFactory::GetForProfile(
  447. GetProfile());
  448. @@ -1207,6 +1210,9 @@ DownloadTargetDeterminer::GetLastDownloa
  449. safe_browsing::SafeBrowsingMetricsCollector::
  450. EventType::DANGEROUS_DOWNLOAD_BYPASS)
  451. : absl::nullopt;
  452. +#else
  453. + return absl::nullopt;
  454. +#endif // BUILDFLAG(FULL_SAFE_BROWSING)
  455. }
  456. void DownloadTargetDeterminer::OnDownloadDestroyed(
  457. --- a/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc
  458. +++ b/chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.cc
  459. @@ -37,7 +37,6 @@
  460. #include "chrome/browser/safe_browsing/cloud_content_scanning/binary_upload_service.h"
  461. #include "chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h"
  462. #include "chrome/browser/safe_browsing/cloud_content_scanning/file_analysis_request.h"
  463. -#include "chrome/browser/safe_browsing/download_protection/check_client_download_request.h"
  464. #include "chrome/grit/generated_resources.h"
  465. #include "components/enterprise/common/proto/connectors.pb.h"
  466. #include "components/policy/core/common/chrome_schema.h"
  467. --- a/chrome/browser/enterprise/connectors/analysis/content_analysis_downloads_delegate.cc
  468. +++ b/chrome/browser/enterprise/connectors/analysis/content_analysis_downloads_delegate.cc
  469. @@ -82,10 +82,7 @@ absl::optional<GURL> ContentAnalysisDown
  470. }
  471. bool ContentAnalysisDownloadsDelegate::BypassRequiresJustification() const {
  472. - if (!base::FeatureList::IsEnabled(kBypassJustificationEnabled))
  473. return false;
  474. -
  475. - return bypass_justification_required_;
  476. }
  477. std::u16string ContentAnalysisDownloadsDelegate::GetBypassJustificationLabel()
  478. --- a/chrome/browser/enterprise/connectors/analysis/files_request_handler.cc
  479. +++ b/chrome/browser/enterprise/connectors/analysis/files_request_handler.cc
  480. @@ -233,15 +233,6 @@ void FilesRequestHandler::OnGotFileInfo(
  481. void FilesRequestHandler::FinishRequestEarly(
  482. std::unique_ptr<safe_browsing::BinaryUploadService::Request> request,
  483. safe_browsing::BinaryUploadService::Result result) {
  484. - // We add the request here in case we never actually uploaded anything, so it
  485. - // wasn't added in OnGetRequestData
  486. - safe_browsing::WebUIInfoSingleton::GetInstance()->AddToDeepScanRequests(
  487. - request->tab_url(), request->per_profile_request(),
  488. - request->content_analysis_request());
  489. - safe_browsing::WebUIInfoSingleton::GetInstance()->AddToDeepScanResponses(
  490. - /*token=*/"", safe_browsing::BinaryUploadService::ResultToString(result),
  491. - enterprise_connectors::ContentAnalysisResponse());
  492. -
  493. request->FinishRequest(result,
  494. enterprise_connectors::ContentAnalysisResponse());
  495. }
  496. --- a/chrome/browser/enterprise/connectors/connectors_service.cc
  497. +++ b/chrome/browser/enterprise/connectors/connectors_service.cc
  498. @@ -446,19 +446,6 @@ absl::optional<std::string> ConnectorsSe
  499. return absl::nullopt;
  500. }
  501. -safe_browsing::EnterpriseRealTimeUrlCheckMode
  502. -ConnectorsService::GetAppliedRealTimeUrlCheck() const {
  503. - if (!ConnectorsEnabled() ||
  504. - !GetDmToken(prefs::kSafeBrowsingEnterpriseRealTimeUrlCheckScope)
  505. - .has_value()) {
  506. - return safe_browsing::REAL_TIME_CHECK_DISABLED;
  507. - }
  508. -
  509. - return static_cast<safe_browsing::EnterpriseRealTimeUrlCheckMode>(
  510. - Profile::FromBrowserContext(context_)->GetPrefs()->GetInteger(
  511. - prefs::kSafeBrowsingEnterpriseRealTimeUrlCheckMode));
  512. -}
  513. -
  514. ConnectorsManager* ConnectorsService::ConnectorsManagerForTesting() {
  515. return connectors_manager_.get();
  516. }
  517. --- a/chrome/browser/enterprise/connectors/connectors_service.h
  518. +++ b/chrome/browser/enterprise/connectors/connectors_service.h
  519. @@ -98,12 +98,6 @@ class ConnectorsService : public KeyedSe
  520. // is no token to use.
  521. absl::optional<std::string> GetDMTokenForRealTimeUrlCheck() const;
  522. - // Returns the value to used by the enterprise real-time URL check Connector
  523. - // if it is set and if the scope it's set at has a valid browser-profile
  524. - // affiliation.
  525. - safe_browsing::EnterpriseRealTimeUrlCheckMode GetAppliedRealTimeUrlCheck()
  526. - const;
  527. -
  528. // Returns the CBCM domain or profile domain that enables connector policies.
  529. // If both set Connector policies, the CBCM domain is returned as it has
  530. // precedence.
  531. --- a/chrome/browser/enterprise/connectors/device_trust/signals/decorators/common/context_signals_decorator.cc
  532. +++ b/chrome/browser/enterprise/connectors/device_trust/signals/decorators/common/context_signals_decorator.cc
  533. @@ -26,25 +26,6 @@ enum class PasswordProtectionTrigger {
  534. kPhisingReuse = 3
  535. };
  536. -PasswordProtectionTrigger ConvertPasswordProtectionTrigger(
  537. - const absl::optional<safe_browsing::PasswordProtectionTrigger>&
  538. - policy_value) {
  539. - if (!policy_value) {
  540. - return PasswordProtectionTrigger::kUnset;
  541. - }
  542. -
  543. - switch (policy_value.value()) {
  544. - case safe_browsing::PASSWORD_PROTECTION_OFF:
  545. - return PasswordProtectionTrigger::kOff;
  546. - case safe_browsing::PASSWORD_REUSE:
  547. - return PasswordProtectionTrigger::kPasswordReuse;
  548. - case safe_browsing::PHISHING_REUSE:
  549. - return PasswordProtectionTrigger::kPhisingReuse;
  550. - case safe_browsing::PASSWORD_PROTECTION_TRIGGER_MAX:
  551. - NOTREACHED();
  552. - return PasswordProtectionTrigger::kUnset;
  553. - }
  554. -}
  555. } // namespace
  556. @@ -74,16 +55,8 @@ void ContextSignalsDecorator::OnSignalsF
  557. ToListValue(context_info.browser_affiliation_ids));
  558. signals.Set(device_signals::names::kProfileAffiliationIds,
  559. ToListValue(context_info.profile_affiliation_ids));
  560. - signals.Set(device_signals::names::kRealtimeUrlCheckMode,
  561. - static_cast<int32_t>(context_info.realtime_url_check_mode));
  562. - signals.Set(
  563. - device_signals::names::kSafeBrowsingProtectionLevel,
  564. - static_cast<int32_t>(context_info.safe_browsing_protection_level));
  565. signals.Set(device_signals::names::kSiteIsolationEnabled,
  566. context_info.site_isolation_enabled);
  567. - signals.Set(device_signals::names::kPasswordProtectionWarningTrigger,
  568. - static_cast<int32_t>(ConvertPasswordProtectionTrigger(
  569. - context_info.password_protection_warning_trigger)));
  570. signals.Set(device_signals::names::kChromeRemoteDesktopAppBlocked,
  571. context_info.chrome_remote_desktop_app_blocked);
  572. signals.Set(device_signals::names::kBuiltInDnsClientEnabled,
  573. --- a/chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.cc
  574. +++ b/chrome/browser/enterprise/connectors/reporting/realtime_reporting_client.cc
  575. @@ -400,7 +400,7 @@ void RealtimeReportingClient::ReportReal
  576. }
  577. std::string RealtimeReportingClient::GetProfileUserName() const {
  578. - return safe_browsing::GetProfileEmail(identity_manager_);
  579. + return std::string();
  580. }
  581. #if BUILDFLAG(IS_CHROMEOS_ASH)
  582. --- a/chrome/browser/enterprise/connectors/reporting/reporting_service_settings.cc
  583. +++ b/chrome/browser/enterprise/connectors/reporting/reporting_service_settings.cc
  584. @@ -74,16 +74,6 @@ ReportingServiceSettings::ReportingServi
  585. else
  586. DVLOG(1) << "Enabled event name list contains a non string value!";
  587. }
  588. - } else {
  589. - // When the list of enabled event names is not set, we assume all events are
  590. - // enabled. This is to support the feature of selecting the "All always on"
  591. - // option in the policy UI, which means to always enable all events, even
  592. - // when new events may be added in the future. And this is also to support
  593. - // existing customer policies that were created before we introduced the
  594. - // concept of enabling/disabling events.
  595. - for (const char* event : kAllReportingEvents) {
  596. - enabled_event_names_.insert(event);
  597. - }
  598. }
  599. const base::Value* enabled_opt_in_events_value =
  600. --- a/chrome/browser/enterprise/signals/context_info_fetcher.cc
  601. +++ b/chrome/browser/enterprise/signals/context_info_fetcher.cc
  602. @@ -206,7 +206,6 @@ void ContextInfoFetcher::Fetch(ContextIn
  603. GetAnalysisConnectorProviders(enterprise_connectors::BULK_DATA_ENTRY);
  604. info.on_print_providers =
  605. GetAnalysisConnectorProviders(enterprise_connectors::PRINT);
  606. - info.realtime_url_check_mode = GetRealtimeUrlCheckMode();
  607. info.on_security_event_providers = GetOnSecurityEventProviders();
  608. info.browser_version = version_info::GetVersionNumber();
  609. info.site_isolation_enabled =
  610. @@ -264,11 +263,6 @@ std::vector<std::string> ContextInfoFetc
  611. return connectors_service_->GetAnalysisServiceProviderNames(connector);
  612. }
  613. -safe_browsing::EnterpriseRealTimeUrlCheckMode
  614. -ContextInfoFetcher::GetRealtimeUrlCheckMode() {
  615. - return connectors_service_->GetAppliedRealTimeUrlCheck();
  616. -}
  617. -
  618. std::vector<std::string> ContextInfoFetcher::GetOnSecurityEventProviders() {
  619. return connectors_service_->GetReportingServiceProviderNames(
  620. enterprise_connectors::ReportingConnector::SECURITY_EVENT);
  621. --- a/chrome/browser/enterprise/signals/context_info_fetcher.h
  622. +++ b/chrome/browser/enterprise/signals/context_info_fetcher.h
  623. @@ -6,6 +6,7 @@
  624. #define CHROME_BROWSER_ENTERPRISE_SIGNALS_CONTEXT_INFO_FETCHER_H_
  625. #include <string>
  626. +#include <memory>
  627. #include <vector>
  628. #include "base/callback_forward.h"
  629. @@ -39,7 +40,6 @@ struct ContextInfo {
  630. std::vector<std::string> on_bulk_data_entry_providers;
  631. std::vector<std::string> on_print_providers;
  632. std::vector<std::string> on_security_event_providers;
  633. - safe_browsing::EnterpriseRealTimeUrlCheckMode realtime_url_check_mode;
  634. std::string browser_version;
  635. safe_browsing::SafeBrowsingState safe_browsing_protection_level;
  636. bool site_isolation_enabled;
  637. @@ -90,7 +90,6 @@ class ContextInfoFetcher {
  638. std::vector<std::string> GetAnalysisConnectorProviders(
  639. enterprise_connectors::AnalysisConnector connector);
  640. - safe_browsing::EnterpriseRealTimeUrlCheckMode GetRealtimeUrlCheckMode();
  641. std::vector<std::string> GetOnSecurityEventProviders();
  642. --- a/chrome/browser/enterprise/signals/signals_utils.cc
  643. +++ b/chrome/browser/enterprise/signals/signals_utils.cc
  644. @@ -33,24 +33,6 @@ bool IsURLBlocked(const GURL& url, Polic
  645. } // namespace
  646. -safe_browsing::SafeBrowsingState GetSafeBrowsingProtectionLevel(
  647. - PrefService* profile_prefs) {
  648. - DCHECK(profile_prefs);
  649. - bool safe_browsing_enabled =
  650. - profile_prefs->GetBoolean(prefs::kSafeBrowsingEnabled);
  651. - bool safe_browsing_enhanced_enabled =
  652. - profile_prefs->GetBoolean(prefs::kSafeBrowsingEnhanced);
  653. -
  654. - if (safe_browsing_enabled) {
  655. - if (safe_browsing_enhanced_enabled)
  656. - return safe_browsing::SafeBrowsingState::ENHANCED_PROTECTION;
  657. - else
  658. - return safe_browsing::SafeBrowsingState::STANDARD_PROTECTION;
  659. - } else {
  660. - return safe_browsing::SafeBrowsingState::NO_SAFE_BROWSING;
  661. - }
  662. -}
  663. -
  664. absl::optional<bool> GetThirdPartyBlockingEnabled(PrefService* local_state) {
  665. DCHECK(local_state);
  666. #if BUILDFLAG(IS_WIN) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
  667. @@ -65,15 +47,6 @@ bool GetBuiltInDnsClientEnabled(PrefServ
  668. return local_state->GetBoolean(prefs::kBuiltInDnsClientEnabled);
  669. }
  670. -absl::optional<safe_browsing::PasswordProtectionTrigger>
  671. -GetPasswordProtectionWarningTrigger(PrefService* profile_prefs) {
  672. - DCHECK(profile_prefs);
  673. - if (!profile_prefs->HasPrefPath(prefs::kPasswordProtectionWarningTrigger))
  674. - return absl::nullopt;
  675. - return static_cast<safe_browsing::PasswordProtectionTrigger>(
  676. - profile_prefs->GetInteger(prefs::kPasswordProtectionWarningTrigger));
  677. -}
  678. -
  679. absl::optional<bool> GetChromeCleanupEnabled(PrefService* local_state) {
  680. DCHECK(local_state);
  681. #if BUILDFLAG(IS_WIN)
  682. --- a/chrome/browser/enterprise/signals/signals_utils.h
  683. +++ b/chrome/browser/enterprise/signals/signals_utils.h
  684. @@ -21,12 +21,6 @@ bool GetBuiltInDnsClientEnabled(PrefServ
  685. absl::optional<bool> GetChromeCleanupEnabled(PrefService* local_state);
  686. -absl::optional<safe_browsing::PasswordProtectionTrigger>
  687. -GetPasswordProtectionWarningTrigger(PrefService* profile_prefs);
  688. -
  689. -safe_browsing::SafeBrowsingState GetSafeBrowsingProtectionLevel(
  690. - PrefService* profile_prefs);
  691. -
  692. bool GetChromeRemoteDesktopAppBlocked(PolicyBlocklistService* service);
  693. } // namespace utils
  694. --- a/chrome/browser/extensions/BUILD.gn
  695. +++ b/chrome/browser/extensions/BUILD.gn
  696. @@ -303,10 +303,6 @@ static_library("extensions") {
  697. "api/runtime/chrome_runtime_api_delegate.h",
  698. "api/safe_browsing_private/safe_browsing_private_api.cc",
  699. "api/safe_browsing_private/safe_browsing_private_api.h",
  700. - "api/safe_browsing_private/safe_browsing_private_event_router.cc",
  701. - "api/safe_browsing_private/safe_browsing_private_event_router.h",
  702. - "api/safe_browsing_private/safe_browsing_private_event_router_factory.cc",
  703. - "api/safe_browsing_private/safe_browsing_private_event_router_factory.h",
  704. "api/safe_browsing_private/safe_browsing_util.cc",
  705. "api/safe_browsing_private/safe_browsing_util.h",
  706. "api/scripting/scripting_api.cc",
  707. @@ -639,8 +635,6 @@ static_library("extensions") {
  708. "menu_manager_factory.h",
  709. "navigation_observer.cc",
  710. "navigation_observer.h",
  711. - "omaha_attributes_handler.cc",
  712. - "omaha_attributes_handler.h",
  713. "pack_extension_job.cc",
  714. "pack_extension_job.h",
  715. "pending_extension_info.cc",
  716. --- a/chrome/browser/extensions/api/cookies/cookies_api.cc
  717. +++ b/chrome/browser/extensions/api/cookies/cookies_api.cc
  718. @@ -285,21 +285,6 @@ void CookiesGetFunction::GetCookieListCa
  719. }
  720. void CookiesGetFunction::NotifyExtensionTelemetry() {
  721. - auto* telemetry_service =
  722. - safe_browsing::ExtensionTelemetryServiceFactory::GetForProfile(
  723. - Profile::FromBrowserContext(browser_context()));
  724. -
  725. - if (!telemetry_service || !telemetry_service->enabled() ||
  726. - !base::FeatureList::IsEnabled(
  727. - safe_browsing::kExtensionTelemetryCookiesGetSignal)) {
  728. - return;
  729. - }
  730. -
  731. - auto cookies_get_signal = std::make_unique<safe_browsing::CookiesGetSignal>(
  732. - extension_id(), parsed_args_->details.name,
  733. - parsed_args_->details.store_id.value_or(std::string()),
  734. - parsed_args_->details.url);
  735. - telemetry_service->AddSignal(std::move(cookies_get_signal));
  736. }
  737. CookiesGetAllFunction::CookiesGetAllFunction() {
  738. @@ -383,26 +368,6 @@ void CookiesGetAllFunction::GetCookieLis
  739. }
  740. void CookiesGetAllFunction::NotifyExtensionTelemetry() {
  741. - auto* telemetry_service =
  742. - safe_browsing::ExtensionTelemetryServiceFactory::GetForProfile(
  743. - Profile::FromBrowserContext(browser_context()));
  744. -
  745. - if (!telemetry_service || !telemetry_service->enabled() ||
  746. - !base::FeatureList::IsEnabled(
  747. - safe_browsing::kExtensionTelemetryCookiesGetAllSignal)) {
  748. - return;
  749. - }
  750. -
  751. - auto cookies_get_all_signal =
  752. - std::make_unique<safe_browsing::CookiesGetAllSignal>(
  753. - extension_id(), parsed_args_->details.domain.value_or(std::string()),
  754. - parsed_args_->details.name.value_or(std::string()),
  755. - parsed_args_->details.path.value_or(std::string()),
  756. - parsed_args_->details.secure.value_or(false),
  757. - parsed_args_->details.store_id.value_or(std::string()),
  758. - parsed_args_->details.url.value_or(std::string()),
  759. - parsed_args_->details.session.value_or(false));
  760. - telemetry_service->AddSignal(std::move(cookies_get_all_signal));
  761. }
  762. CookiesSetFunction::CookiesSetFunction()
  763. --- a/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc
  764. +++ b/chrome/browser/extensions/api/enterprise_reporting_private/enterprise_reporting_private_api.cc
  765. @@ -92,17 +92,8 @@ api::enterprise_reporting_private::Conte
  766. info.third_party_blocking_enabled = signals.third_party_blocking_enabled;
  767. info.os_firewall = ToInfoSettingValue(signals.os_firewall);
  768. info.system_dns_servers = std::move(signals.system_dns_servers);
  769. - switch (signals.realtime_url_check_mode) {
  770. - case safe_browsing::REAL_TIME_CHECK_DISABLED:
  771. info.realtime_url_check_mode = extensions::api::
  772. enterprise_reporting_private::REALTIME_URL_CHECK_MODE_DISABLED;
  773. - break;
  774. - case safe_browsing::REAL_TIME_CHECK_FOR_MAINFRAME_ENABLED:
  775. - info.realtime_url_check_mode =
  776. - extensions::api::enterprise_reporting_private::
  777. - REALTIME_URL_CHECK_MODE_ENABLED_MAIN_FRAME;
  778. - break;
  779. - }
  780. info.browser_version = std::move(signals.browser_version);
  781. info.built_in_dns_client_enabled = signals.built_in_dns_client_enabled;
  782. --- a/chrome/browser/extensions/browser_context_keyed_service_factories.cc
  783. +++ b/chrome/browser/extensions/browser_context_keyed_service_factories.cc
  784. @@ -117,7 +117,6 @@ void EnsureBrowserContextKeyedServiceFac
  785. #endif
  786. extensions::PreferenceAPI::GetFactoryInstance();
  787. extensions::ProcessesAPI::GetFactoryInstance();
  788. - extensions::SafeBrowsingPrivateEventRouterFactory::GetInstance();
  789. extensions::SessionsAPI::GetFactoryInstance();
  790. extensions::SettingsPrivateEventRouterFactory::GetInstance();
  791. extensions::SettingsOverridesAPI::GetFactoryInstance();
  792. --- a/chrome/browser/extensions/chrome_extensions_browser_client.cc
  793. +++ b/chrome/browser/extensions/chrome_extensions_browser_client.cc
  794. @@ -658,52 +658,22 @@ void ChromeExtensionsBrowserClient::Noti
  795. content::BrowserContext* context,
  796. const ExtensionId& extension_id,
  797. const std::string& code) const {
  798. - auto* telemetry_service =
  799. - safe_browsing::ExtensionTelemetryServiceFactory::GetForProfile(
  800. - Profile::FromBrowserContext(context));
  801. - if (!telemetry_service || !telemetry_service->enabled() ||
  802. - !base::FeatureList::IsEnabled(
  803. - safe_browsing::kExtensionTelemetryTabsExecuteScriptSignal)) {
  804. - return;
  805. - }
  806. -
  807. - auto signal = std::make_unique<safe_browsing::TabsExecuteScriptSignal>(
  808. - extension_id, code);
  809. - telemetry_service->AddSignal(std::move(signal));
  810. }
  811. bool ChromeExtensionsBrowserClient::IsExtensionTelemetryServiceEnabled(
  812. content::BrowserContext* context) const {
  813. - auto* telemetry_service =
  814. - safe_browsing::ExtensionTelemetryServiceFactory::GetForProfile(
  815. - Profile::FromBrowserContext(context));
  816. - return telemetry_service && telemetry_service->enabled();
  817. + return false;
  818. }
  819. bool ChromeExtensionsBrowserClient::
  820. IsExtensionTelemetryRemoteHostContactedSignalEnabled() const {
  821. - return base::FeatureList::IsEnabled(
  822. - safe_browsing::kExtensionTelemetryReportContactedHosts);
  823. + return false;
  824. }
  825. void ChromeExtensionsBrowserClient::NotifyExtensionRemoteHostContacted(
  826. content::BrowserContext* context,
  827. const ExtensionId& extension_id,
  828. const GURL& url) const {
  829. - if (!url.SchemeIsHTTPOrHTTPS()) {
  830. - return;
  831. - }
  832. - auto* telemetry_service =
  833. - safe_browsing::ExtensionTelemetryServiceFactory::GetForProfile(
  834. - Profile::FromBrowserContext(context));
  835. - if (!telemetry_service || !telemetry_service->enabled() ||
  836. - !IsExtensionTelemetryRemoteHostContactedSignalEnabled()) {
  837. - return;
  838. - }
  839. - auto remote_host_signal =
  840. - std::make_unique<safe_browsing::RemoteHostContactedSignal>(extension_id,
  841. - url);
  842. - telemetry_service->AddSignal(std::move(remote_host_signal));
  843. }
  844. // static
  845. --- a/chrome/browser/extensions/extension_service.cc
  846. +++ b/chrome/browser/extensions/extension_service.cc
  847. @@ -53,7 +53,6 @@
  848. #include "chrome/browser/extensions/forced_extensions/install_stage_tracker.h"
  849. #include "chrome/browser/extensions/install_verifier.h"
  850. #include "chrome/browser/extensions/installed_loader.h"
  851. -#include "chrome/browser/extensions/omaha_attributes_handler.h"
  852. #include "chrome/browser/extensions/pending_extension_manager.h"
  853. #include "chrome/browser/extensions/permissions_updater.h"
  854. #include "chrome/browser/extensions/shared_module_service.h"
  855. @@ -190,7 +189,6 @@ void ExtensionService::BlocklistExtensio
  856. blocklist_prefs::SetSafeBrowsingExtensionBlocklistState(
  857. extension_id, BitMapBlocklistState::BLOCKLISTED_MALWARE,
  858. extension_prefs_);
  859. - OnBlocklistStateAdded(extension_id);
  860. }
  861. bool ExtensionService::OnExternalExtensionUpdateUrlFound(
  862. @@ -356,9 +354,6 @@ ExtensionService::ExtensionService(Profi
  863. safe_browsing_verdict_handler_(extension_prefs,
  864. ExtensionRegistry::Get(profile),
  865. this),
  866. - omaha_attributes_handler_(extension_prefs,
  867. - ExtensionRegistry::Get(profile),
  868. - this),
  869. registry_(ExtensionRegistry::Get(profile)),
  870. pending_extension_manager_(profile),
  871. install_directory_(install_directory),
  872. @@ -862,100 +857,6 @@ bool ExtensionService::IsExtensionEnable
  873. return extension_registrar_.IsExtensionEnabled(extension_id);
  874. }
  875. -void ExtensionService::PerformActionBasedOnOmahaAttributes(
  876. - const std::string& extension_id,
  877. - const base::Value& attributes) {
  878. - DCHECK_CURRENTLY_ON(BrowserThread::UI);
  879. - omaha_attributes_handler_.PerformActionBasedOnOmahaAttributes(extension_id,
  880. - attributes);
  881. - allowlist_.PerformActionBasedOnOmahaAttributes(extension_id, attributes);
  882. - // Show an error for the newly blocklisted extension.
  883. - error_controller_->ShowErrorIfNeeded();
  884. -}
  885. -
  886. -void ExtensionService::OnGreylistStateRemoved(const std::string& extension_id) {
  887. - bool is_on_sb_list = (blocklist_prefs::GetSafeBrowsingExtensionBlocklistState(
  888. - extension_id, extension_prefs_) !=
  889. - BitMapBlocklistState::NOT_BLOCKLISTED);
  890. - bool is_on_omaha_list =
  891. - blocklist_prefs::HasAnyOmahaGreylistState(extension_id, extension_prefs_);
  892. - if (is_on_sb_list || is_on_omaha_list) {
  893. - return;
  894. - }
  895. - // Clear all acknowledged states so the extension will still get disabled if
  896. - // it is added to the greylist again.
  897. - blocklist_prefs::ClearAcknowledgedGreylistStates(extension_id,
  898. - extension_prefs_);
  899. - RemoveDisableReasonAndMaybeEnable(extension_id,
  900. - disable_reason::DISABLE_GREYLIST);
  901. -}
  902. -
  903. -void ExtensionService::OnGreylistStateAdded(const std::string& extension_id,
  904. - BitMapBlocklistState new_state) {
  905. -#if DCHECK_IS_ON()
  906. - bool has_new_state_on_sb_list =
  907. - (blocklist_prefs::GetSafeBrowsingExtensionBlocklistState(
  908. - extension_id, extension_prefs_) == new_state);
  909. - bool has_new_state_on_omaha_list = blocklist_prefs::HasOmahaBlocklistState(
  910. - extension_id, new_state, extension_prefs_);
  911. - DCHECK(has_new_state_on_sb_list || has_new_state_on_omaha_list);
  912. -#endif
  913. - if (blocklist_prefs::HasAcknowledgedBlocklistState(extension_id, new_state,
  914. - extension_prefs_)) {
  915. - // If the extension is already acknowledged, don't disable it again
  916. - // because it can be already re-enabled by the user. This could happen if
  917. - // the extension is added to the SafeBrowsing blocklist, and then
  918. - // subsequently marked by Omaha. In this case, we don't want to disable the
  919. - // extension twice.
  920. - return;
  921. - }
  922. -
  923. - // Set the current greylist states to acknowledge immediately because the
  924. - // extension is disabled silently. Clear the other acknowledged state because
  925. - // when the state changes to another greylist state in the future, we'd like
  926. - // to disable the extension again.
  927. - blocklist_prefs::UpdateCurrentGreylistStatesAsAcknowledged(extension_id,
  928. - extension_prefs_);
  929. - DisableExtension(extension_id, disable_reason::DISABLE_GREYLIST);
  930. -}
  931. -
  932. -void ExtensionService::OnBlocklistStateRemoved(
  933. - const std::string& extension_id) {
  934. - if (blocklist_prefs::IsExtensionBlocklisted(extension_id, extension_prefs_)) {
  935. - return;
  936. - }
  937. -
  938. - // Clear acknowledged state.
  939. - blocklist_prefs::RemoveAcknowledgedBlocklistState(
  940. - extension_id, BitMapBlocklistState::BLOCKLISTED_MALWARE,
  941. - extension_prefs_);
  942. -
  943. - scoped_refptr<const Extension> extension =
  944. - registry_->blocklisted_extensions().GetByID(extension_id);
  945. - DCHECK(extension);
  946. - registry_->RemoveBlocklisted(extension_id);
  947. - AddExtension(extension.get());
  948. -}
  949. -
  950. -void ExtensionService::OnBlocklistStateAdded(const std::string& extension_id) {
  951. - DCHECK(
  952. - blocklist_prefs::IsExtensionBlocklisted(extension_id, extension_prefs_));
  953. - // The extension was already acknowledged by the user, it should already be in
  954. - // the unloaded state.
  955. - if (blocklist_prefs::HasAcknowledgedBlocklistState(
  956. - extension_id, BitMapBlocklistState::BLOCKLISTED_MALWARE,
  957. - extension_prefs_)) {
  958. - DCHECK(base::Contains(registry_->blocklisted_extensions().GetIDs(),
  959. - extension_id));
  960. - return;
  961. - }
  962. -
  963. - scoped_refptr<const Extension> extension =
  964. - registry_->GetInstalledExtension(extension_id);
  965. - registry_->AddBlocklisted(extension);
  966. - UnloadExtension(extension_id, UnloadedExtensionReason::BLOCKLIST);
  967. -}
  968. -
  969. void ExtensionService::RemoveDisableReasonAndMaybeEnable(
  970. const std::string& extension_id,
  971. disable_reason::DisableReason reason_to_remove) {
  972. --- a/chrome/browser/extensions/extension_service.h
  973. +++ b/chrome/browser/extensions/extension_service.h
  974. @@ -26,7 +26,6 @@
  975. #include "chrome/browser/extensions/forced_extensions/force_installed_metrics.h"
  976. #include "chrome/browser/extensions/forced_extensions/force_installed_tracker.h"
  977. #include "chrome/browser/extensions/install_gate.h"
  978. -#include "chrome/browser/extensions/omaha_attributes_handler.h"
  979. #include "chrome/browser/extensions/pending_extension_manager.h"
  980. #include "chrome/browser/extensions/safe_browsing_verdict_handler.h"
  981. #include "chrome/browser/profiles/profile_manager.h"
  982. @@ -276,40 +275,11 @@ class ExtensionService : public Extensio
  983. // nothing.
  984. void EnableExtension(const std::string& extension_id);
  985. - // Takes Safe Browsing and Omaha blocklist states into account and decides
  986. - // whether to remove greylist disabled reason. Called when a greylisted
  987. - // state is removed from the Safe Browsing blocklist or Omaha blocklist. Also
  988. - // clears all acknowledged states if the greylist disabled reason is removed.
  989. - void OnGreylistStateRemoved(const std::string& extension_id);
  990. -
  991. - // Takes acknowledged blocklist states into account and decides whether to
  992. - // disable the greylisted extension. Called when a new greylisted state is
  993. - // added to the Safe Browsing blocklist or Omaha blocklist.
  994. - void OnGreylistStateAdded(const std::string& extension_id,
  995. - BitMapBlocklistState new_state);
  996. -
  997. - // Takes Safe Browsing and Omaha malware blocklist states into account and
  998. - // decides whether to remove the extension from the blocklist and reload it.
  999. - // Called when a blocklisted extension is removed from the Safe Browsing
  1000. - // malware blocklist or Omaha malware blocklist. Also clears the acknowledged
  1001. - // state if the extension is reloaded.
  1002. - void OnBlocklistStateRemoved(const std::string& extension_id);
  1003. -
  1004. - // Takes acknowledged malware blocklist state into account and decides whether
  1005. - // to add the extension to the blocklist and unload it. Called when the
  1006. - // extension is added to the Safe Browsing malware blocklist or the Omaha
  1007. - // malware blocklist.
  1008. - void OnBlocklistStateAdded(const std::string& extension_id);
  1009. -
  1010. // Removes the disable reason and enable the extension if there are no disable
  1011. // reasons left and is not blocked for another reason.
  1012. void RemoveDisableReasonAndMaybeEnable(const std::string& extension_id,
  1013. disable_reason::DisableReason reason);
  1014. - // Performs action based on Omaha attributes for the extension.
  1015. - void PerformActionBasedOnOmahaAttributes(const std::string& extension_id,
  1016. - const base::Value& attributes);
  1017. -
  1018. // Disables the extension. If the extension is already disabled, just adds
  1019. // the |disable_reasons| (a bitmask of disable_reason::DisableReason - there
  1020. // can be multiple DisableReasons e.g. when an extension comes in disabled
  1021. @@ -651,8 +621,6 @@ class ExtensionService : public Extensio
  1022. SafeBrowsingVerdictHandler safe_browsing_verdict_handler_;
  1023. - OmahaAttributesHandler omaha_attributes_handler_;
  1024. -
  1025. // Sets of enabled/disabled/terminated/blocklisted extensions. Not owned.
  1026. raw_ptr<ExtensionRegistry> registry_ = nullptr;
  1027. --- a/chrome/browser/extensions/extension_system_impl.cc
  1028. +++ b/chrome/browser/extensions/extension_system_impl.cc
  1029. @@ -464,8 +464,6 @@ void ExtensionSystemImpl::InstallUpdate(
  1030. void ExtensionSystemImpl::PerformActionBasedOnOmahaAttributes(
  1031. const std::string& extension_id,
  1032. const base::Value& attributes) {
  1033. - extension_service()->PerformActionBasedOnOmahaAttributes(extension_id,
  1034. - attributes);
  1035. }
  1036. bool ExtensionSystemImpl::FinishDelayedInstallationIfReady(
  1037. --- a/chrome/browser/extensions/safe_browsing_verdict_handler.cc
  1038. +++ b/chrome/browser/extensions/safe_browsing_verdict_handler.cc
  1039. @@ -119,7 +119,6 @@ void SafeBrowsingVerdictHandler::UpdateB
  1040. blocklist_.Remove(id);
  1041. blocklist_prefs::SetSafeBrowsingExtensionBlocklistState(
  1042. id, BitMapBlocklistState::NOT_BLOCKLISTED, extension_prefs_);
  1043. - extension_service_->OnBlocklistStateRemoved(id);
  1044. UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.UnblacklistInstalled",
  1045. extension->location());
  1046. }
  1047. @@ -133,7 +132,6 @@ void SafeBrowsingVerdictHandler::UpdateB
  1048. blocklist_.Insert(extension);
  1049. blocklist_prefs::SetSafeBrowsingExtensionBlocklistState(
  1050. id, BitMapBlocklistState::BLOCKLISTED_MALWARE, extension_prefs_);
  1051. - extension_service_->OnBlocklistStateAdded(id);
  1052. UMA_HISTOGRAM_ENUMERATION("ExtensionBlacklist.BlacklistInstalled",
  1053. extension->location());
  1054. }
  1055. @@ -157,7 +155,6 @@ void SafeBrowsingVerdictHandler::UpdateG
  1056. blocklist_prefs::SetSafeBrowsingExtensionBlocklistState(
  1057. extension->id(), BitMapBlocklistState::NOT_BLOCKLISTED,
  1058. extension_prefs_);
  1059. - extension_service_->OnGreylistStateRemoved(extension->id());
  1060. UMA_HISTOGRAM_ENUMERATION("Extensions.Greylist.Enabled",
  1061. extension->location());
  1062. }
  1063. @@ -177,7 +174,6 @@ void SafeBrowsingVerdictHandler::UpdateG
  1064. blocklist_prefs::BlocklistStateToBitMapBlocklistState(greylist_state);
  1065. blocklist_prefs::SetSafeBrowsingExtensionBlocklistState(
  1066. extension->id(), bitmap_greylist_state, extension_prefs_);
  1067. - extension_service_->OnGreylistStateAdded(id, bitmap_greylist_state);
  1068. UMA_HISTOGRAM_ENUMERATION("Extensions.Greylist.Disabled",
  1069. extension->location());
  1070. }
  1071. --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
  1072. +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
  1073. @@ -37,8 +37,6 @@
  1074. #include "chrome/browser/file_system_access/file_system_access_permission_request_manager.h"
  1075. #include "chrome/browser/installable/installable_utils.h"
  1076. #include "chrome/browser/profiles/profile.h"
  1077. -#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
  1078. -#include "chrome/browser/safe_browsing/safe_browsing_service.h"
  1079. #include "chrome/browser/ui/file_system_access_dialogs.h"
  1080. #include "chrome/common/chrome_paths.h"
  1081. #include "chrome/common/pdf_util.h"
  1082. @@ -344,85 +342,6 @@ BindResultCallbackToCurrentSequence(
  1083. base::SequencedTaskRunnerHandle::Get(), std::move(callback));
  1084. }
  1085. -void DoSafeBrowsingCheckOnUIThread(
  1086. - content::GlobalRenderFrameHostId frame_id,
  1087. - std::unique_ptr<content::FileSystemAccessWriteItem> item,
  1088. - safe_browsing::CheckDownloadCallback callback) {
  1089. - DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  1090. - // Download Protection Service is not supported on Android.
  1091. -#if BUILDFLAG(FULL_SAFE_BROWSING)
  1092. - safe_browsing::SafeBrowsingService* sb_service =
  1093. - g_browser_process->safe_browsing_service();
  1094. - if (!sb_service || !sb_service->download_protection_service() ||
  1095. - !sb_service->download_protection_service()->enabled()) {
  1096. - std::move(callback).Run(safe_browsing::DownloadCheckResult::UNKNOWN);
  1097. - return;
  1098. - }
  1099. -
  1100. - if (!item->browser_context) {
  1101. - content::RenderProcessHost* rph =
  1102. - content::RenderProcessHost::FromID(frame_id.child_id);
  1103. - if (!rph) {
  1104. - std::move(callback).Run(safe_browsing::DownloadCheckResult::UNKNOWN);
  1105. - return;
  1106. - }
  1107. - item->browser_context = rph->GetBrowserContext();
  1108. - }
  1109. -
  1110. - if (!item->web_contents) {
  1111. - content::RenderFrameHost* rfh = content::RenderFrameHost::FromID(frame_id);
  1112. - if (rfh) {
  1113. - DCHECK_NE(rfh->GetLifecycleState(),
  1114. - content::RenderFrameHost::LifecycleState::kPrerendering);
  1115. - item->web_contents = content::WebContents::FromRenderFrameHost(rfh);
  1116. - }
  1117. - }
  1118. -
  1119. - sb_service->download_protection_service()->CheckFileSystemAccessWrite(
  1120. - std::move(item), std::move(callback));
  1121. -#else
  1122. - std::move(callback).Run(safe_browsing::DownloadCheckResult::UNKNOWN);
  1123. -#endif
  1124. -}
  1125. -
  1126. -ChromeFileSystemAccessPermissionContext::AfterWriteCheckResult
  1127. -InterpretSafeBrowsingResult(safe_browsing::DownloadCheckResult result) {
  1128. - using Result = safe_browsing::DownloadCheckResult;
  1129. - switch (result) {
  1130. - // Only allow downloads that are marked as SAFE or UNKNOWN by SafeBrowsing.
  1131. - // All other types are going to be blocked. UNKNOWN could be the result of a
  1132. - // failed safe browsing ping or if Safe Browsing is not enabled.
  1133. - case Result::UNKNOWN:
  1134. - case Result::SAFE:
  1135. - case Result::ALLOWLISTED_BY_POLICY:
  1136. - return ChromeFileSystemAccessPermissionContext::AfterWriteCheckResult::
  1137. - kAllow;
  1138. -
  1139. - case Result::DANGEROUS:
  1140. - case Result::UNCOMMON:
  1141. - case Result::DANGEROUS_HOST:
  1142. - case Result::POTENTIALLY_UNWANTED:
  1143. - case Result::BLOCKED_PASSWORD_PROTECTED:
  1144. - case Result::BLOCKED_TOO_LARGE:
  1145. - case Result::BLOCKED_UNSUPPORTED_FILE_TYPE:
  1146. - case Result::DANGEROUS_ACCOUNT_COMPROMISE:
  1147. - return ChromeFileSystemAccessPermissionContext::AfterWriteCheckResult::
  1148. - kBlock;
  1149. -
  1150. - // This shouldn't be returned for File System Access write checks.
  1151. - case Result::ASYNC_SCANNING:
  1152. - case Result::SENSITIVE_CONTENT_WARNING:
  1153. - case Result::SENSITIVE_CONTENT_BLOCK:
  1154. - case Result::DEEP_SCANNED_SAFE:
  1155. - case Result::PROMPT_FOR_SCANNING:
  1156. - NOTREACHED();
  1157. - return ChromeFileSystemAccessPermissionContext::AfterWriteCheckResult::
  1158. - kAllow;
  1159. - }
  1160. - NOTREACHED();
  1161. - return ChromeFileSystemAccessPermissionContext::AfterWriteCheckResult::kBlock;
  1162. -}
  1163. -
  1164. std::string GenerateLastPickedDirectoryKey(const std::string& id) {
  1165. return id.empty() ? kDefaultLastPickedDirectoryKey
  1166. : base::StrCat({kCustomLastPickedDirectoryKey, "-", id});
  1167. @@ -1204,28 +1123,6 @@ void ChromeFileSystemAccessPermissionCon
  1168. frame_id, std::move(callback)));
  1169. }
  1170. -void ChromeFileSystemAccessPermissionContext::PerformAfterWriteChecks(
  1171. - std::unique_ptr<content::FileSystemAccessWriteItem> item,
  1172. - content::GlobalRenderFrameHostId frame_id,
  1173. - base::OnceCallback<void(AfterWriteCheckResult)> callback) {
  1174. - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  1175. - content::GetUIThreadTaskRunner({})->PostTask(
  1176. - FROM_HERE,
  1177. - base::BindOnce(
  1178. - &DoSafeBrowsingCheckOnUIThread, frame_id, std::move(item),
  1179. - base::BindOnce(
  1180. - [](scoped_refptr<base::TaskRunner> task_runner,
  1181. - base::OnceCallback<void(AfterWriteCheckResult result)>
  1182. - callback,
  1183. - safe_browsing::DownloadCheckResult result) {
  1184. - task_runner->PostTask(
  1185. - FROM_HERE,
  1186. - base::BindOnce(std::move(callback),
  1187. - InterpretSafeBrowsingResult(result)));
  1188. - },
  1189. - base::SequencedTaskRunnerHandle::Get(), std::move(callback))));
  1190. -}
  1191. -
  1192. void ChromeFileSystemAccessPermissionContext::
  1193. DidConfirmSensitiveDirectoryAccess(
  1194. const url::Origin& origin,
  1195. @@ -1237,27 +1134,6 @@ void ChromeFileSystemAccessPermissionCon
  1196. bool should_block) {
  1197. DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  1198. if (!should_block) {
  1199. - // If attempting to save a file with a dangerous extension, prompt the user
  1200. - // to make them confirm they actually want to save the file.
  1201. - if (user_action == UserAction::kSave) {
  1202. - safe_browsing::DownloadFileType::DangerLevel danger_level =
  1203. - safe_browsing::FileTypePolicies::GetInstance()->GetFileDangerLevel(
  1204. - path, origin.GetURL(),
  1205. - Profile::FromBrowserContext(profile_)->GetPrefs());
  1206. - // See https://crbug.com/1320877#c4 for justification for why we show the
  1207. - // prompt if `danger_level` is ALLOW_ON_USER_GESTURE as well as DANGEROUS.
  1208. - if (danger_level == safe_browsing::DownloadFileType::DANGEROUS ||
  1209. - danger_level ==
  1210. - safe_browsing::DownloadFileType::ALLOW_ON_USER_GESTURE) {
  1211. - auto result_callback =
  1212. - BindResultCallbackToCurrentSequence(std::move(callback));
  1213. - content::GetUIThreadTaskRunner({})->PostTask(
  1214. - FROM_HERE,
  1215. - base::BindOnce(&ShowFileSystemAccessDangerousFileDialogOnUIThread,
  1216. - frame_id, origin, path, std::move(result_callback)));
  1217. - return;
  1218. - }
  1219. - }
  1220. std::move(callback).Run(SensitiveEntryResult::kAllowed);
  1221. return;
  1222. }
  1223. --- a/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h
  1224. +++ b/chrome/browser/file_system_access/chrome_file_system_access_permission_context.h
  1225. @@ -88,10 +88,6 @@ class ChromeFileSystemAccessPermissionCo
  1226. UserAction user_action,
  1227. content::GlobalRenderFrameHostId frame_id,
  1228. base::OnceCallback<void(SensitiveEntryResult)> callback) override;
  1229. - void PerformAfterWriteChecks(
  1230. - std::unique_ptr<content::FileSystemAccessWriteItem> item,
  1231. - content::GlobalRenderFrameHostId frame_id,
  1232. - base::OnceCallback<void(AfterWriteCheckResult)> callback) override;
  1233. bool CanObtainReadPermission(const url::Origin& origin) override;
  1234. bool CanObtainWritePermission(const url::Origin& origin) override;
  1235. --- a/chrome/browser/media/webrtc/display_media_access_handler.cc
  1236. +++ b/chrome/browser/media/webrtc/display_media_access_handler.cc
  1237. @@ -24,6 +24,7 @@
  1238. #include "chrome/browser/safe_browsing/user_interaction_observer.h"
  1239. #include "chrome/common/pref_names.h"
  1240. #include "components/prefs/pref_service.h"
  1241. +#include "components/safe_browsing/buildflags.h"
  1242. #include "components/url_formatter/elide_url.h"
  1243. #include "content/public/browser/browser_thread.h"
  1244. #include "content/public/browser/desktop_capture.h"
  1245. @@ -112,6 +113,7 @@ void DisplayMediaAccessHandler::HandleRe
  1246. return;
  1247. }
  1248. + #if BUILDFLAG(FULL_SAFE_BROWSING)
  1249. // SafeBrowsing Delayed Warnings experiment can delay some SafeBrowsing
  1250. // warnings until user interaction. If the current page has a delayed warning,
  1251. // it'll have a user interaction observer attached. Show the warning
  1252. @@ -127,6 +129,7 @@ void DisplayMediaAccessHandler::HandleRe
  1253. observer->OnDesktopCaptureRequest();
  1254. return;
  1255. }
  1256. + #endif // BUILDFLAG(FULL_SAFE_BROWSING)
  1257. #if BUILDFLAG(IS_MAC)
  1258. // Do not allow picker UI to be shown on a page that isn't in the foreground
  1259. --- a/chrome/browser/notifications/notification_display_service_impl.cc
  1260. +++ b/chrome/browser/notifications/notification_display_service_impl.cc
  1261. @@ -88,13 +88,6 @@ NotificationDisplayServiceImpl::Notifica
  1262. profile_));
  1263. #endif
  1264. -#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_MAC) || \
  1265. - BUILDFLAG(IS_WIN)
  1266. - AddNotificationHandler(
  1267. - NotificationHandler::Type::TAILORED_SECURITY,
  1268. - std::make_unique<safe_browsing::TailoredSecurityNotificationHandler>());
  1269. -#endif
  1270. -
  1271. #if BUILDFLAG(ENABLE_EXTENSIONS)
  1272. AddNotificationHandler(
  1273. NotificationHandler::Type::EXTENSION,
  1274. --- a/chrome/browser/password_manager/chrome_password_manager_client.cc
  1275. +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
  1276. @@ -36,7 +36,6 @@
  1277. #include "chrome/browser/password_manager/password_scripts_fetcher_factory.h"
  1278. #include "chrome/browser/password_manager/password_store_factory.h"
  1279. #include "chrome/browser/profiles/profile.h"
  1280. -#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
  1281. #include "chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service.h"
  1282. #include "chrome/browser/safe_browsing/extension_telemetry/extension_telemetry_service_factory.h"
  1283. #include "chrome/browser/safe_browsing/extension_telemetry/password_reuse_signal.h"
  1284. @@ -961,6 +960,7 @@ autofill::LanguageCode ChromePasswordMan
  1285. return autofill::LanguageCode();
  1286. }
  1287. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  1288. safe_browsing::PasswordProtectionService*
  1289. ChromePasswordManagerClient::GetPasswordProtectionService() const {
  1290. return safe_browsing::ChromePasswordProtectionService::
  1291. @@ -1034,13 +1034,9 @@ void ChromePasswordManagerClient::CheckP
  1292. telemetry_service->AddSignal(std::move(password_reuse_signal));
  1293. #endif // !BUILDFLAG(IS_ANDROID)
  1294. }
  1295. +#endif // BUILDFLAG(FULL_SAFE_BROWSING)
  1296. void ChromePasswordManagerClient::LogPasswordReuseDetectedEvent() {
  1297. - safe_browsing::PasswordProtectionService* pps =
  1298. - GetPasswordProtectionService();
  1299. - if (pps) {
  1300. - pps->MaybeLogPasswordReuseDetectedEvent(web_contents());
  1301. - }
  1302. }
  1303. #if !BUILDFLAG(IS_ANDROID)
  1304. @@ -1049,36 +1045,10 @@ void ChromePasswordManagerClient::MaybeR
  1305. bool is_federated,
  1306. const url::Origin& federated_origin,
  1307. const std::u16string& login_user_name) const {
  1308. - if (!base::FeatureList::IsEnabled(policy::features::kLoginEventReporting))
  1309. - return;
  1310. -
  1311. - extensions::SafeBrowsingPrivateEventRouter* router =
  1312. - extensions::SafeBrowsingPrivateEventRouterFactory::GetForProfile(
  1313. - profile_);
  1314. - if (!router)
  1315. - return;
  1316. -
  1317. - // The router is responsible for checking if the reporting of this event type
  1318. - // is enabled by the admin.
  1319. - router->OnLoginEvent(url, is_federated, federated_origin, login_user_name);
  1320. }
  1321. void ChromePasswordManagerClient::MaybeReportEnterprisePasswordBreachEvent(
  1322. const std::vector<std::pair<GURL, std::u16string>>& identities) const {
  1323. - if (!base::FeatureList::IsEnabled(
  1324. - policy::features::kPasswordBreachEventReporting)) {
  1325. - return;
  1326. - }
  1327. -
  1328. - extensions::SafeBrowsingPrivateEventRouter* router =
  1329. - extensions::SafeBrowsingPrivateEventRouterFactory::GetForProfile(
  1330. - profile_);
  1331. - if (!router)
  1332. - return;
  1333. -
  1334. - // The router is responsible for checking if the reporting of this event type
  1335. - // is enabled by the admin.
  1336. - router->OnPasswordBreach(kPasswordBreachEntryTrigger, identities);
  1337. }
  1338. #endif
  1339. @@ -1596,7 +1566,9 @@ void ChromePasswordManagerClient::OnPast
  1340. }
  1341. was_on_paste_called_ = true;
  1342. +#if defined(SYNC_PASSWORD_REUSE_WARNING_ENABLED)
  1343. password_reuse_detection_manager_.OnPaste(std::move(text));
  1344. +#endif // defined(SYNC_PASSWORD_REUSE_WARNING_ENABLED)
  1345. }
  1346. void ChromePasswordManagerClient::RenderFrameCreated(
  1347. @@ -1632,7 +1604,9 @@ void ChromePasswordManagerClient::OnInpu
  1348. if (key_event.windows_key_code == (ui::VKEY_V & 0x1f)) {
  1349. OnPaste();
  1350. } else {
  1351. +#if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
  1352. password_reuse_detection_manager_.OnKeyPressedCommitted(key_event.text);
  1353. +#endif // defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
  1354. }
  1355. #endif // BUILDFLAG(IS_ANDROID)
  1356. }
  1357. @@ -1671,6 +1645,7 @@ bool ChromePasswordManagerClient::IsPass
  1358. is_enabled = false;
  1359. }
  1360. + #if BUILDFLAG(FULL_SAFE_BROWSING)
  1361. // SafeBrowsing Delayed Warnings experiment can delay some SafeBrowsing
  1362. // warnings until user interaction. If the current page has a delayed warning,
  1363. // it'll have a user interaction observer attached. Disable password
  1364. @@ -1681,6 +1656,7 @@ bool ChromePasswordManagerClient::IsPass
  1365. observer->OnPasswordSaveOrAutofillDenied();
  1366. is_enabled = false;
  1367. }
  1368. + #endif // BUILDFLAG(FULL_SAFE_BROWSING)
  1369. if (log_manager_->IsLoggingActive()) {
  1370. password_manager::BrowserSavePasswordProgressLogger logger(
  1371. --- a/chrome/browser/password_manager/chrome_password_manager_client.h
  1372. +++ b/chrome/browser/password_manager/chrome_password_manager_client.h
  1373. @@ -233,13 +233,14 @@ class ChromePasswordManagerClient
  1374. void AnnotateNavigationEntry(bool has_password_field) override;
  1375. autofill::LanguageCode GetPageLanguage() const override;
  1376. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  1377. safe_browsing::PasswordProtectionService* GetPasswordProtectionService()
  1378. const override;
  1379. #if defined(ON_FOCUS_PING_ENABLED)
  1380. void CheckSafeBrowsingReputation(const GURL& form_action,
  1381. const GURL& frame_url) override;
  1382. -#endif
  1383. +#endif // defined(ON_FOCUS_PING_ENABLED)
  1384. void CheckProtectedPasswordEntry(
  1385. password_manager::metrics_util::PasswordType reused_password_type,
  1386. @@ -249,6 +250,7 @@ class ChromePasswordManagerClient
  1387. bool password_field_exists,
  1388. uint64_t reused_password_hash,
  1389. const std::string& domain) override;
  1390. +#endif // BUILDFLAG(FULL_SAFE_BROWSING)
  1391. void LogPasswordReuseDetectedEvent() override;
  1392. --- a/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc
  1393. +++ b/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc
  1394. @@ -16,7 +16,6 @@
  1395. #include "chrome/browser/browser_process.h"
  1396. #include "chrome/browser/permissions/quiet_notification_permission_ui_config.h"
  1397. #include "chrome/browser/permissions/quiet_notification_permission_ui_state.h"
  1398. -#include "chrome/browser/safe_browsing/safe_browsing_service.h"
  1399. #include "chrome/common/chrome_features.h"
  1400. #include "components/permissions/permission_request.h"
  1401. #include "components/permissions/request_type.h"
  1402. @@ -159,9 +158,6 @@ void ContextualNotificationPermissionUiS
  1403. }
  1404. void ContextualNotificationPermissionUiSelector::Cancel() {
  1405. - // The computation either finishes synchronously above, or is waiting on the
  1406. - // Safe Browsing check.
  1407. - safe_browsing_request_.reset();
  1408. }
  1409. bool ContextualNotificationPermissionUiSelector::IsPermissionRequestSupported(
  1410. @@ -187,24 +183,14 @@ void ContextualNotificationPermissionUiS
  1411. absl::optional<Decision> decision =
  1412. GetDecisionBasedOnSiteReputation(reputation);
  1413. - // If the PreloadData suggests this is an unacceptable site, ping Safe
  1414. - // Browsing to verify; but do not ping if it is not warranted.
  1415. + // If the PreloadData suggests this is an unacceptable site, assume it is
  1416. + // correct, since we can't access safe browsing.
  1417. if (!decision || (!decision->quiet_ui_reason && !decision->warning_reason)) {
  1418. Notify(Decision::UseNormalUiAndShowNoWarning());
  1419. - return;
  1420. + } else {
  1421. + // decision has a value, unwrap with .value()
  1422. + Notify(decision.value());
  1423. }
  1424. -
  1425. - DCHECK(!safe_browsing_request_);
  1426. - DCHECK(g_browser_process->safe_browsing_service());
  1427. -
  1428. - // It is fine to use base::Unretained() here, as |safe_browsing_request_|
  1429. - // guarantees not to fire the callback after its destruction.
  1430. - safe_browsing_request_.emplace(
  1431. - g_browser_process->safe_browsing_service()->database_manager(),
  1432. - base::DefaultClock::GetInstance(), origin,
  1433. - base::BindOnce(&ContextualNotificationPermissionUiSelector::
  1434. - OnSafeBrowsingVerdictReceived,
  1435. - base::Unretained(this), *decision));
  1436. }
  1437. void ContextualNotificationPermissionUiSelector::OnSafeBrowsingVerdictReceived(
  1438. --- a/chrome/browser/permissions/permission_revocation_request.cc
  1439. +++ b/chrome/browser/permissions/permission_revocation_request.cc
  1440. @@ -135,27 +135,7 @@ void PermissionRevocationRequest::CheckA
  1441. DCHECK(profile_);
  1442. DCHECK(callback_);
  1443. - if (!safe_browsing::IsSafeBrowsingEnabled(*profile_->GetPrefs()) ||
  1444. - IsOriginExemptedFromFutureRevocations(profile_, origin_) ||
  1445. - (!NotificationsPermissionRevocationConfig::
  1446. - IsAbusiveOriginPermissionRevocationEnabled() &&
  1447. - !NotificationsPermissionRevocationConfig::
  1448. - IsDisruptiveOriginPermissionRevocationEnabled())) {
  1449. NotifyCallback(Outcome::PERMISSION_NOT_REVOKED);
  1450. - return;
  1451. - }
  1452. -
  1453. - CrowdDenyPreloadData* crowd_deny = CrowdDenyPreloadData::GetInstance();
  1454. - permissions::PermissionUmaUtil::RecordCrowdDenyVersionAtAbuseCheckTime(
  1455. - crowd_deny->version_on_disk());
  1456. -
  1457. - if (!crowd_deny->IsReadyToUse())
  1458. - crowd_deny_request_start_time_ = base::TimeTicks::Now();
  1459. -
  1460. - crowd_deny->GetReputationDataForSiteAsync(
  1461. - url::Origin::Create(origin_),
  1462. - base::BindOnce(&PermissionRevocationRequest::OnSiteReputationReady,
  1463. - weak_factory_.GetWeakPtr()));
  1464. }
  1465. void PermissionRevocationRequest::OnSiteReputationReady(
  1466. @@ -165,33 +145,6 @@ void PermissionRevocationRequest::OnSite
  1467. base::TimeTicks::Now() - crowd_deny_request_start_time_.value();
  1468. }
  1469. - if (site_reputation && !site_reputation->warning_only()) {
  1470. - bool should_revoke_permission = false;
  1471. - switch (site_reputation->notification_ux_quality()) {
  1472. - case CrowdDenyPreloadData::SiteReputation::ABUSIVE_PROMPTS:
  1473. - case CrowdDenyPreloadData::SiteReputation::ABUSIVE_CONTENT:
  1474. - should_revoke_permission = NotificationsPermissionRevocationConfig::
  1475. - IsAbusiveOriginPermissionRevocationEnabled();
  1476. - break;
  1477. - case CrowdDenyPreloadData::SiteReputation::DISRUPTIVE_BEHAVIOR:
  1478. - should_revoke_permission = NotificationsPermissionRevocationConfig::
  1479. - IsDisruptiveOriginPermissionRevocationEnabled();
  1480. - break;
  1481. - default:
  1482. - should_revoke_permission = false;
  1483. - }
  1484. - DCHECK(g_browser_process->safe_browsing_service());
  1485. - if (should_revoke_permission &&
  1486. - g_browser_process->safe_browsing_service()) {
  1487. - safe_browsing_request_.emplace(
  1488. - g_browser_process->safe_browsing_service()->database_manager(),
  1489. - base::DefaultClock::GetInstance(), url::Origin::Create(origin_),
  1490. - base::BindOnce(
  1491. - &PermissionRevocationRequest::OnSafeBrowsingVerdictReceived,
  1492. - weak_factory_.GetWeakPtr(), site_reputation));
  1493. - return;
  1494. - }
  1495. - }
  1496. NotifyCallback(Outcome::PERMISSION_NOT_REVOKED);
  1497. }
  1498. --- a/chrome/browser/permissions/prediction_based_permission_ui_selector.cc
  1499. +++ b/chrome/browser/permissions/prediction_based_permission_ui_selector.cc
  1500. @@ -341,52 +341,5 @@ bool PredictionBasedPermissionUiSelector
  1501. PredictionSource PredictionBasedPermissionUiSelector::GetPredictionTypeToUse(
  1502. permissions::RequestType request_type) {
  1503. - if (!safe_browsing::IsSafeBrowsingEnabled(*(profile_->GetPrefs()))) {
  1504. return PredictionSource::USE_NONE;
  1505. - }
  1506. -
  1507. - bool is_server_side_prediction_enabled = false;
  1508. - bool is_ondevice_prediction_enabled = false;
  1509. -
  1510. - bool is_tflite_available = false;
  1511. -#if BUILDFLAG(BUILD_WITH_TFLITE_LIB)
  1512. - is_tflite_available = true;
  1513. -#endif // BUILDFLAG(BUILD_WITH_TFLITE_LIB)
  1514. -
  1515. - // Notification supports both flavours of the quiet prompt
  1516. - if (request_type == permissions::RequestType::kNotifications &&
  1517. - (base::FeatureList::IsEnabled(features::kQuietNotificationPrompts) ||
  1518. - base::FeatureList::IsEnabled(
  1519. - permissions::features::kPermissionQuietChip))) {
  1520. - is_server_side_prediction_enabled =
  1521. - base::FeatureList::IsEnabled(features::kPermissionPredictions);
  1522. -
  1523. - is_ondevice_prediction_enabled =
  1524. - is_tflite_available &&
  1525. - base::FeatureList::IsEnabled(
  1526. - permissions::features::kPermissionOnDeviceNotificationPredictions);
  1527. - }
  1528. -
  1529. - // Geolocation supports only the quiet chip ui
  1530. - if (request_type == permissions::RequestType::kGeolocation &&
  1531. - base::FeatureList::IsEnabled(
  1532. - permissions::features::kPermissionQuietChip)) {
  1533. - is_server_side_prediction_enabled = base::FeatureList::IsEnabled(
  1534. - features::kPermissionGeolocationPredictions);
  1535. -
  1536. - is_ondevice_prediction_enabled =
  1537. - is_tflite_available &&
  1538. - base::FeatureList::IsEnabled(
  1539. - permissions::features::kPermissionOnDeviceGeolocationPredictions);
  1540. - }
  1541. -
  1542. - if (is_server_side_prediction_enabled && is_ondevice_prediction_enabled) {
  1543. - return PredictionSource::USE_ANY;
  1544. - } else if (is_server_side_prediction_enabled) {
  1545. - return PredictionSource::USE_SERVER_SIDE;
  1546. - } else if (is_ondevice_prediction_enabled) {
  1547. - return PredictionSource::USE_ONDEVICE;
  1548. - } else {
  1549. - return PredictionSource::USE_NONE;
  1550. - }
  1551. }
  1552. --- a/chrome/browser/policy/configuration_policy_handler_list_factory.cc
  1553. +++ b/chrome/browser/policy/configuration_policy_handler_list_factory.cc
  1554. @@ -95,6 +95,7 @@
  1555. #include "components/policy/policy_constants.h"
  1556. #include "components/privacy_sandbox/privacy_sandbox_prefs.h"
  1557. #include "components/proxy_config/proxy_policy_handler.h"
  1558. +#include "components/safe_browsing/buildflags.h"
  1559. #include "components/safe_browsing/content/common/file_type_policies_prefs.h"
  1560. #include "components/safe_browsing/core/common/safe_browsing_policy_handler.h"
  1561. #include "components/safe_browsing/core/common/safe_browsing_prefs.h"
  1562. @@ -1847,8 +1848,6 @@ std::unique_ptr<ConfigurationPolicyHandl
  1563. handlers->AddHandler(
  1564. std::make_unique<bookmarks::ManagedBookmarksPolicyHandler>(
  1565. chrome_schema));
  1566. - handlers->AddHandler(
  1567. - std::make_unique<safe_browsing::SafeBrowsingPolicyHandler>());
  1568. handlers->AddHandler(std::make_unique<syncer::SyncPolicyHandler>());
  1569. handlers->AddHandler(
  1570. std::make_unique<URLBlocklistPolicyHandler>(key::kURLBlocklist));
  1571. @@ -1906,13 +1905,6 @@ std::unique_ptr<ConfigurationPolicyHandl
  1572. prefs::kSafeBrowsingEnterpriseRealTimeUrlCheckMode,
  1573. prefs::kSafeBrowsingEnterpriseRealTimeUrlCheckScope, chrome_schema));
  1574. - handlers->AddHandler(std::make_unique<SimpleSchemaValidatingPolicyHandler>(
  1575. - key::kExemptDomainFileTypePairsFromFileTypeDownloadWarnings,
  1576. - safe_browsing::file_type::prefs::
  1577. - kExemptDomainFileTypePairsFromFileTypeDownloadWarnings,
  1578. - chrome_schema, SCHEMA_ALLOW_UNKNOWN,
  1579. - SimpleSchemaValidatingPolicyHandler::RECOMMENDED_PROHIBITED,
  1580. - SimpleSchemaValidatingPolicyHandler::MANDATORY_ALLOWED));
  1581. handlers->AddHandler(
  1582. std::make_unique<ManagedAccountRestrictionsPolicyHandler>(chrome_schema));
  1583. --- a/chrome/browser/prefs/browser_prefs.cc
  1584. +++ b/chrome/browser/prefs/browser_prefs.cc
  1585. @@ -259,7 +259,6 @@
  1586. #include "chrome/browser/new_tab_page/modules/drive/drive_service.h"
  1587. #include "chrome/browser/new_tab_page/modules/photos/photos_service.h"
  1588. #include "chrome/browser/new_tab_page/modules/recipes/recipes_service.h"
  1589. -#include "chrome/browser/new_tab_page/modules/safe_browsing/safe_browsing_handler.h"
  1590. #include "chrome/browser/new_tab_page/promos/promo_service.h"
  1591. #include "chrome/browser/policy/developer_tools_policy_handler.h"
  1592. #include "chrome/browser/search/background/ntp_custom_background_service.h"
  1593. @@ -1408,7 +1407,6 @@ void RegisterProfilePrefs(user_prefs::Pr
  1594. NewTabPageHandler::RegisterProfilePrefs(registry);
  1595. NewTabPageUI::RegisterProfilePrefs(registry);
  1596. NewTabUI::RegisterProfilePrefs(registry);
  1597. - ntp::SafeBrowsingHandler::RegisterProfilePrefs(registry);
  1598. ntp_tiles::CustomLinksManagerImpl::RegisterProfilePrefs(registry);
  1599. PhotosService::RegisterProfilePrefs(registry);
  1600. PinnedTabCodec::RegisterProfilePrefs(registry);
  1601. --- a/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
  1602. +++ b/chrome/browser/profiles/chrome_browser_main_extra_parts_profiles.cc
  1603. @@ -589,7 +589,6 @@ void ChromeBrowserMainExtraPartsProfiles
  1604. }
  1605. #endif
  1606. TabRestoreServiceFactory::GetInstance();
  1607. - safe_browsing::TailoredSecurityServiceFactory::GetInstance();
  1608. TemplateURLFetcherFactory::GetInstance();
  1609. TemplateURLServiceFactory::GetInstance();
  1610. #if !BUILDFLAG(IS_ANDROID)
  1611. --- a/chrome/browser/reputation/reputation_service.cc
  1612. +++ b/chrome/browser/reputation/reputation_service.cc
  1613. @@ -116,9 +116,7 @@ void ReputationService::GetReputationSta
  1614. ReputationCheckCallback callback) {
  1615. DCHECK(url.SchemeIsHTTPOrHTTPS());
  1616. - bool has_delayed_warning =
  1617. - !!safe_browsing::SafeBrowsingUserInteractionObserver::FromWebContents(
  1618. - web_contents);
  1619. + bool has_delayed_warning = false;
  1620. LookalikeUrlService* service = LookalikeUrlService::Get(profile_);
  1621. if (service->EngagedSitesNeedUpdating()) {
  1622. --- a/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_page.ts
  1623. +++ b/chrome/browser/resources/settings/privacy_page/privacy_guide/privacy_guide_page.ts
  1624. @@ -17,7 +17,6 @@ import './privacy_guide_completion_fragm
  1625. import './privacy_guide_cookies_fragment.js';
  1626. import './privacy_guide_history_sync_fragment.js';
  1627. import './privacy_guide_msbb_fragment.js';
  1628. -import './privacy_guide_safe_browsing_fragment.js';
  1629. import './privacy_guide_welcome_fragment.js';
  1630. import './step_indicator.js';
  1631. --- a/chrome/browser/safe_browsing/metrics/safe_browsing_metrics_provider.cc
  1632. +++ b/chrome/browser/safe_browsing/metrics/safe_browsing_metrics_provider.cc
  1633. @@ -17,15 +17,6 @@ SafeBrowsingMetricsProvider::~SafeBrowsi
  1634. void SafeBrowsingMetricsProvider::ProvideCurrentSessionData(
  1635. metrics::ChromeUserMetricsExtension* uma_proto) {
  1636. - Profile* profile = cached_profile_.GetMetricsProfile();
  1637. -
  1638. - if (!profile)
  1639. - return;
  1640. -
  1641. - SafeBrowsingState state = GetSafeBrowsingState(*profile->GetPrefs());
  1642. -
  1643. - base::UmaHistogramEnumeration(
  1644. - "SafeBrowsing.Pref.MainProfile.SafeBrowsingState", state);
  1645. }
  1646. } // namespace safe_browsing
  1647. --- a/chrome/browser/safe_browsing/url_lookup_service_factory.cc
  1648. +++ b/chrome/browser/safe_browsing/url_lookup_service_factory.cc
  1649. @@ -56,28 +56,7 @@ RealTimeUrlLookupServiceFactory::RealTim
  1650. KeyedService* RealTimeUrlLookupServiceFactory::BuildServiceInstanceFor(
  1651. content::BrowserContext* context) const {
  1652. - if (!g_browser_process->safe_browsing_service()) {
  1653. - return nullptr;
  1654. - }
  1655. - Profile* profile = Profile::FromBrowserContext(context);
  1656. - auto url_loader_factory =
  1657. - std::make_unique<network::CrossThreadPendingSharedURLLoaderFactory>(
  1658. - g_browser_process->safe_browsing_service()->GetURLLoaderFactory(
  1659. - profile));
  1660. - return new RealTimeUrlLookupService(
  1661. - network::SharedURLLoaderFactory::Create(std::move(url_loader_factory)),
  1662. - VerdictCacheManagerFactory::GetForProfile(profile),
  1663. - base::BindRepeating(&safe_browsing::GetUserPopulationForProfile, profile),
  1664. - profile->GetPrefs(),
  1665. - std::make_unique<SafeBrowsingPrimaryAccountTokenFetcher>(
  1666. - IdentityManagerFactory::GetForProfile(profile)),
  1667. - base::BindRepeating(&safe_browsing::SyncUtils::
  1668. - AreSigninAndSyncSetUpForSafeBrowsingTokenFetches,
  1669. - SyncServiceFactory::GetForProfile(profile),
  1670. - IdentityManagerFactory::GetForProfile(profile)),
  1671. - profile->IsOffTheRecord(), g_browser_process->variations_service(),
  1672. - SafeBrowsingNavigationObserverManagerFactory::GetForBrowserContext(
  1673. - profile));
  1674. + return nullptr;
  1675. }
  1676. } // namespace safe_browsing
  1677. --- a/chrome/browser/ssl/chrome_security_blocking_page_factory.cc
  1678. +++ b/chrome/browser/ssl/chrome_security_blocking_page_factory.cc
  1679. @@ -143,15 +143,6 @@ CreateSettingsPageHelper() {
  1680. CreateChromeSettingsPageHelper();
  1681. }
  1682. -void LogSafeBrowsingSecuritySensitiveAction(
  1683. - safe_browsing::SafeBrowsingMetricsCollector* metrics_collector) {
  1684. - if (metrics_collector) {
  1685. - metrics_collector->AddSafeBrowsingEventToPref(
  1686. - safe_browsing::SafeBrowsingMetricsCollector::EventType::
  1687. - SECURITY_SENSITIVE_SSL_INTERSTITIAL);
  1688. - }
  1689. -}
  1690. -
  1691. } // namespace
  1692. std::unique_ptr<SSLBlockingPage>
  1693. @@ -175,10 +166,6 @@ ChromeSecurityBlockingPageFactory::Creat
  1694. Profile::FromBrowserContext(web_contents->GetBrowserContext()));
  1695. state->DidDisplayErrorPage(cert_error);
  1696. - LogSafeBrowsingSecuritySensitiveAction(
  1697. - safe_browsing::SafeBrowsingMetricsCollectorFactory::GetForProfile(
  1698. - Profile::FromBrowserContext(web_contents->GetBrowserContext())));
  1699. -
  1700. auto controller_client = std::make_unique<SSLErrorControllerClient>(
  1701. web_contents, ssl_info, cert_error, request_url,
  1702. std::move(metrics_helper), CreateSettingsPageHelper());
  1703. @@ -248,10 +235,6 @@ ChromeSecurityBlockingPageFactory::Creat
  1704. std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
  1705. const net::SSLInfo& ssl_info,
  1706. const std::string& mitm_software_name) {
  1707. - LogSafeBrowsingSecuritySensitiveAction(
  1708. - safe_browsing::SafeBrowsingMetricsCollectorFactory::GetForProfile(
  1709. - Profile::FromBrowserContext(web_contents->GetBrowserContext())));
  1710. -
  1711. auto page = std::make_unique<MITMSoftwareBlockingPage>(
  1712. web_contents, cert_error, request_url, std::move(ssl_cert_reporter),
  1713. /*can_show_enhanced_protection_message=*/true, ssl_info,
  1714. @@ -273,10 +256,6 @@ ChromeSecurityBlockingPageFactory::Creat
  1715. const GURL& request_url,
  1716. std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
  1717. const net::SSLInfo& ssl_info) {
  1718. - LogSafeBrowsingSecuritySensitiveAction(
  1719. - safe_browsing::SafeBrowsingMetricsCollectorFactory::GetForProfile(
  1720. - Profile::FromBrowserContext(web_contents->GetBrowserContext())));
  1721. -
  1722. auto page = std::make_unique<BlockedInterceptionBlockingPage>(
  1723. web_contents, cert_error, request_url, std::move(ssl_cert_reporter),
  1724. /*can_show_enhanced_protection_message=*/true, ssl_info,
  1725. --- a/chrome/browser/ssl/sct_reporting_service_factory.cc
  1726. +++ b/chrome/browser/ssl/sct_reporting_service_factory.cc
  1727. @@ -31,15 +31,7 @@ SCTReportingServiceFactory::~SCTReportin
  1728. KeyedService* SCTReportingServiceFactory::BuildServiceInstanceFor(
  1729. content::BrowserContext* profile) const {
  1730. - safe_browsing::SafeBrowsingService* safe_browsing_service =
  1731. - g_browser_process->safe_browsing_service();
  1732. - // In unit tests the safe browsing service can be null, if this happens,
  1733. - // return null instead of crashing.
  1734. - if (!safe_browsing_service)
  1735. - return nullptr;
  1736. -
  1737. - return new SCTReportingService(safe_browsing_service,
  1738. - static_cast<Profile*>(profile));
  1739. + return nullptr;
  1740. }
  1741. // Force this to be created during BrowserContext creation, since we can't
  1742. --- a/chrome/browser/ssl/ssl_error_controller_client.cc
  1743. +++ b/chrome/browser/ssl/ssl_error_controller_client.cc
  1744. @@ -91,8 +91,6 @@ void SSLErrorControllerClient::GoBack()
  1745. }
  1746. void SSLErrorControllerClient::Proceed() {
  1747. - MaybeTriggerSecurityInterstitialProceededEvent(web_contents_, request_url_,
  1748. - "SSL_ERROR", cert_error_);
  1749. #if BUILDFLAG(ENABLE_EXTENSIONS)
  1750. // Hosted Apps should not be allowed to run if there is a problem with their
  1751. // certificate. So, when users click proceed on an interstitial, move the tab
  1752. --- a/chrome/browser/subresource_filter/chrome_content_subresource_filter_web_contents_helper_factory.cc
  1753. +++ b/chrome/browser/subresource_filter/chrome_content_subresource_filter_web_contents_helper_factory.cc
  1754. @@ -6,7 +6,6 @@
  1755. #include "chrome/browser/browser_process.h"
  1756. #include "chrome/browser/profiles/profile.h"
  1757. -#include "chrome/browser/safe_browsing/safe_browsing_service.h"
  1758. #include "chrome/browser/subresource_filter/subresource_filter_profile_context_factory.h"
  1759. #include "components/safe_browsing/core/browser/db/database_manager.h"
  1760. #include "components/subresource_filter/content/browser/content_subresource_filter_web_contents_helper.h"
  1761. @@ -18,10 +17,7 @@ namespace {
  1762. // available. Otherwise returns nullptr.
  1763. const scoped_refptr<safe_browsing::SafeBrowsingDatabaseManager>
  1764. GetDatabaseManagerFromSafeBrowsingService() {
  1765. - safe_browsing::SafeBrowsingService* safe_browsing_service =
  1766. - g_browser_process->safe_browsing_service();
  1767. - return safe_browsing_service ? safe_browsing_service->database_manager()
  1768. - : nullptr;
  1769. + return nullptr;
  1770. }
  1771. } // namespace
  1772. --- a/chrome/browser/ui/BUILD.gn
  1773. +++ b/chrome/browser/ui/BUILD.gn
  1774. @@ -553,7 +553,6 @@ static_library("ui") {
  1775. "//components/renderer_context_menu",
  1776. "//components/resources",
  1777. "//components/safe_browsing/content/browser",
  1778. - "//components/safe_browsing/content/browser:client_side_detection",
  1779. "//components/safe_browsing/content/browser/password_protection",
  1780. "//components/safe_browsing/content/browser/web_ui",
  1781. "//components/safe_browsing/core/browser/db:database_manager",
  1782. @@ -4918,8 +4917,6 @@ static_library("ui") {
  1783. "views/safe_browsing/prompt_for_scanning_modal_dialog.h",
  1784. "views/safe_browsing/tailored_security_desktop_dialog_manager.cc",
  1785. "views/safe_browsing/tailored_security_desktop_dialog_manager.h",
  1786. - "views/safe_browsing/tailored_security_unconsented_modal.cc",
  1787. - "views/safe_browsing/tailored_security_unconsented_modal.h",
  1788. "views/send_tab_to_self/manage_account_devices_link_view.cc",
  1789. "views/send_tab_to_self/manage_account_devices_link_view.h",
  1790. "views/send_tab_to_self/send_tab_to_self_bubble_device_button.cc",
  1791. --- a/chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_desktop.cc
  1792. +++ b/chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_desktop.cc
  1793. @@ -16,6 +16,7 @@
  1794. #include "components/javascript_dialogs/tab_modal_dialog_manager.h"
  1795. #include "components/javascript_dialogs/tab_modal_dialog_view.h"
  1796. #include "components/navigation_metrics/navigation_metrics.h"
  1797. +#include "components/safe_browsing/buildflags.h"
  1798. #include "content/public/browser/devtools_agent_host.h"
  1799. #include "content/public/browser/navigation_handle.h"
  1800. #include "content/public/browser/render_frame_host.h"
  1801. @@ -35,6 +36,7 @@ JavaScriptTabModalDialogManagerDelegateD
  1802. void JavaScriptTabModalDialogManagerDelegateDesktop::WillRunDialog() {
  1803. BrowserList::AddObserver(this);
  1804. + #if BUILDFLAG(FULL_SAFE_BROWSING)
  1805. // SafeBrowsing Delayed Warnings experiment can delay some SafeBrowsing
  1806. // warnings until user interaction. If the current page has a delayed warning,
  1807. // it'll have a user interaction observer attached. Show the warning
  1808. @@ -45,6 +47,7 @@ void JavaScriptTabModalDialogManagerDele
  1809. if (observer) {
  1810. observer->OnJavaScriptDialog();
  1811. }
  1812. + #endif // BUILDFLAG(FULL_SAFE_BROWSING)
  1813. }
  1814. void JavaScriptTabModalDialogManagerDelegateDesktop::DidCloseDialog() {
  1815. --- a/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop.cc
  1816. +++ b/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop.cc
  1817. @@ -10,7 +10,10 @@
  1818. #include "base/memory/weak_ptr.h"
  1819. #include "base/strings/utf_string_conversions.h"
  1820. #include "base/task/thread_pool.h"
  1821. +#include "components/safe_browsing/buildflags.h"
  1822. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  1823. #include "chrome/browser/enterprise/connectors/analysis/content_analysis_delegate.h"
  1824. +#endif
  1825. #include "chrome/browser/profiles/profile.h"
  1826. #include "chrome/browser/safe_browsing/cloud_content_scanning/deep_scanning_utils.h"
  1827. #include "content/public/browser/web_contents.h"
  1828. @@ -22,6 +25,7 @@
  1829. namespace {
  1830. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  1831. // Helper to keep a mapping of files to the index of their corresponding parent
  1832. // entry in content::DropData::filenames. For instance, this means that for a
  1833. // DropData with filenames = [ "a.txt", "dir/"], `PathsAndIndexes` might be
  1834. @@ -113,6 +117,7 @@ ContentAnalysisDropData GetPathsToScan(
  1835. return content_analysis_drop_data;
  1836. }
  1837. +#endif // BUILDFLAG(FULL_SAFE_BROWSING)
  1838. // Helper class to handle WebContents being destroyed while files are opened in
  1839. // the threadpool. This class deletes itself either when it's no longer needed
  1840. @@ -128,6 +133,7 @@ class HandleDropScanData : public conten
  1841. drop_data_(std::move(drop_data)),
  1842. callback_(std::move(callback)) {}
  1843. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  1844. void ScanData(ContentAnalysisDropData content_analysis_drop_data) {
  1845. DCHECK(web_contents());
  1846. @@ -140,6 +146,7 @@ class HandleDropScanData : public conten
  1847. delete this;
  1848. }
  1849. +#endif // BUILDFLAG(FULL_SAFE_BROWSING)
  1850. void WebContentsDestroyed() override { delete this; }
  1851. @@ -160,13 +167,16 @@ void HandleOnPerformDrop(
  1852. content::WebContents* web_contents,
  1853. content::DropData drop_data,
  1854. content::WebContentsViewDelegate::DropCompletionCallback callback) {
  1855. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  1856. enterprise_connectors::ContentAnalysisDelegate::Data data;
  1857. +#endif
  1858. Profile* profile =
  1859. Profile::FromBrowserContext(web_contents->GetBrowserContext());
  1860. auto connector =
  1861. drop_data.filenames.empty()
  1862. ? enterprise_connectors::AnalysisConnector::BULK_DATA_ENTRY
  1863. : enterprise_connectors::AnalysisConnector::FILE_ATTACHED;
  1864. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  1865. if (!enterprise_connectors::ContentAnalysisDelegate::IsEnabled(
  1866. profile, web_contents->GetLastCommittedURL(), &data, connector)) {
  1867. std::move(callback).Run(std::move(drop_data));
  1868. @@ -203,6 +213,7 @@ void HandleOnPerformDrop(
  1869. base::BindOnce(&HandleDropScanData::ScanData,
  1870. handle_drop_scan_data->GetWeakPtr()));
  1871. }
  1872. +#endif // BUILDFLAG(FULL_SAFE_BROWSING)
  1873. if (!callback.is_null()) {
  1874. std::move(callback).Run(std::move(drop_data));
  1875. --- a/chrome/browser/ui/views/download/download_item_view.cc
  1876. +++ b/chrome/browser/ui/views/download/download_item_view.cc
  1877. @@ -840,9 +840,7 @@ void DownloadItemView::UpdateLabels() {
  1878. deep_scanning_label_->SetVisible(mode_ ==
  1879. download::DownloadItemMode::kDeepScanning);
  1880. if (deep_scanning_label_->GetVisible()) {
  1881. - const int id = (model_->GetDownloadItem() &&
  1882. - safe_browsing::DeepScanningRequest::ShouldUploadBinary(
  1883. - model_->GetDownloadItem()))
  1884. + const int id = model_->GetDownloadItem()
  1885. ? IDS_PROMPT_DEEP_SCANNING_DOWNLOAD
  1886. : IDS_PROMPT_DEEP_SCANNING_APP_DOWNLOAD;
  1887. const std::u16string filename = ElidedFilename(*deep_scanning_label_);
  1888. @@ -868,11 +866,15 @@ void DownloadItemView::UpdateButtons() {
  1889. }
  1890. const bool allow_open_during_deep_scan =
  1891. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  1892. (mode_ == download::DownloadItemMode::kDeepScanning) &&
  1893. !enterprise_connectors::ConnectorsServiceFactory::GetForBrowserContext(
  1894. model_->profile())
  1895. ->DelayUntilVerdict(
  1896. enterprise_connectors::AnalysisConnector::FILE_DOWNLOADED);
  1897. +#else
  1898. + false;
  1899. +#endif // BUILDFLAG(FULL_SAFE_BROWSING)
  1900. open_button_->SetEnabled((mode_ == download::DownloadItemMode::kNormal) ||
  1901. prompt_to_scan || allow_open_during_deep_scan);
  1902. @@ -1369,7 +1371,9 @@ void DownloadItemView::ShowContextMenuIm
  1903. }
  1904. void DownloadItemView::OpenDownloadDuringAsyncScanning() {
  1905. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  1906. model_->CompleteSafeBrowsingScan();
  1907. +#endif
  1908. model_->SetOpenWhenComplete(true);
  1909. }
  1910. --- a/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc
  1911. +++ b/chrome/browser/ui/webui/downloads/downloads_dom_handler.cc
  1912. @@ -376,12 +376,6 @@ void DownloadsDOMHandler::ReviewDangerou
  1913. return;
  1914. }
  1915. - CountDownloadsDOMEvents(DOWNLOADS_DOM_EVENT_REVIEW_DANGEROUS);
  1916. - download::DownloadItem* download = GetDownloadByStringId(id);
  1917. - if (download) {
  1918. - DownloadItemModel model(download);
  1919. - model.ReviewScanningVerdict(GetWebUIWebContents());
  1920. - }
  1921. }
  1922. // DownloadsDOMHandler, private: --------------------------------------------
  1923. --- a/chrome/browser/ui/webui/management/management_ui_handler.cc
  1924. +++ b/chrome/browser/ui/webui/management/management_ui_handler.cc
  1925. @@ -927,12 +927,6 @@ base::Value::Dict ManagementUIHandler::G
  1926. &info);
  1927. }
  1928. - if (connectors_service->GetAppliedRealTimeUrlCheck() !=
  1929. - safe_browsing::REAL_TIME_CHECK_DISABLED) {
  1930. - AddThreatProtectionPermission(kManagementOnPageVisitedEvent,
  1931. - kManagementOnPageVisitedVisibleData, &info);
  1932. - }
  1933. -
  1934. const std::string enterprise_manager =
  1935. connectors_service->GetManagementDomain();
  1936. --- a/chrome/browser/webshare/share_service_impl.cc
  1937. +++ b/chrome/browser/webshare/share_service_impl.cc
  1938. @@ -17,7 +17,9 @@
  1939. #include "chrome/browser/browser_process.h"
  1940. #include "chrome/browser/safe_browsing/safe_browsing_service.h"
  1941. #include "chrome/common/chrome_features.h"
  1942. +#if BUILDFLAG(SAFE_BROWSING_AVAILABLE)
  1943. #include "components/safe_browsing/content/common/file_type_policies.h"
  1944. +#endif
  1945. #include "components/safe_browsing/core/browser/db/database_manager.h"
  1946. #include "content/public/browser/web_contents.h"
  1947. #include "mojo/public/cpp/bindings/self_owned_receiver.h"
  1948. @@ -200,11 +202,13 @@ void ShareServiceImpl::Share(const std::
  1949. // Check if at least one file is marked by the download protection service
  1950. // to send a ping to check this file type.
  1951. +#if BUILDFLAG(SAFE_BROWSING_AVAILABLE)
  1952. if (!should_check_url &&
  1953. safe_browsing::FileTypePolicies::GetInstance()->IsCheckedBinaryFile(
  1954. path)) {
  1955. should_check_url = true;
  1956. }
  1957. +#endif // BUILDFLAG(SAFE_BROWSING_AVAILABLE)
  1958. // In the case where the original blob handle was to a native file (of
  1959. // unknown size), the serialized data does not contain an accurate file
  1960. @@ -214,6 +218,7 @@ void ShareServiceImpl::Share(const std::
  1961. }
  1962. DCHECK(!safe_browsing_request_);
  1963. +#if BUILDFLAG(SAFE_BROWSING_AVAILABLE)
  1964. if (should_check_url && g_browser_process->safe_browsing_service()) {
  1965. safe_browsing_request_.emplace(
  1966. g_browser_process->safe_browsing_service()->database_manager(),
  1967. @@ -223,6 +228,7 @@ void ShareServiceImpl::Share(const std::
  1968. std::move(files), std::move(callback)));
  1969. return;
  1970. }
  1971. +#endif // BUILDFLAG(SAFE_BROWSING_AVAILABLE)
  1972. OnSafeBrowsingResultReceived(title, text, share_url, std::move(files),
  1973. std::move(callback),
  1974. --- a/chrome/test/BUILD.gn
  1975. +++ b/chrome/test/BUILD.gn
  1976. @@ -1406,7 +1406,6 @@ if (!is_android) {
  1977. "//components/resources",
  1978. "//components/safe_browsing:buildflags",
  1979. "//components/safe_browsing/content/browser",
  1980. - "//components/safe_browsing/content/browser:client_side_detection",
  1981. "//components/safe_browsing/content/browser:safe_browsing_service",
  1982. "//components/safe_browsing/content/browser/password_protection",
  1983. "//components/safe_browsing/content/browser/password_protection:test_support",
  1984. @@ -5951,7 +5950,6 @@ test("unit_tests") {
  1985. "//components/resources",
  1986. "//components/safe_browsing:buildflags",
  1987. "//components/safe_browsing/content/browser",
  1988. - "//components/safe_browsing/content/browser:client_side_detection",
  1989. "//components/safe_browsing/content/browser/password_protection",
  1990. "//components/safe_browsing/content/browser/password_protection:mock_password_protection",
  1991. "//components/safe_browsing/content/browser/web_ui",
  1992. --- a/components/password_manager/content/browser/content_password_manager_driver.cc
  1993. +++ b/components/password_manager/content/browser/content_password_manager_driver.cc
  1994. @@ -430,7 +430,7 @@ void ContentPasswordManagerDriver::Check
  1995. if (!password_manager::bad_message::CheckFrameNotPrerendering(
  1996. render_frame_host_))
  1997. return;
  1998. -#if defined(ON_FOCUS_PING_ENABLED)
  1999. +#if defined(ON_FOCUS_PING_ENABLED) && BUILDFLAG(FULL_SAFE_BROWSING)
  2000. client_->CheckSafeBrowsingReputation(form_action, frame_url);
  2001. #endif
  2002. }
  2003. --- a/components/password_manager/core/browser/password_manager_client.h
  2004. +++ b/components/password_manager/core/browser/password_manager_client.h
  2005. @@ -394,11 +394,14 @@ class PasswordManagerClient {
  2006. // Returns the current best guess as to the page's display language.
  2007. virtual autofill::LanguageCode GetPageLanguage() const;
  2008. +#if (defined(ON_FOCUS_PING_ENABLED) || defined(PASSWORD_REUSE_DETECTION_ENABLED)) && \
  2009. + BUILDFLAG(FULL_SAFE_BROWSING)
  2010. // Return the PasswordProtectionService associated with this instance.
  2011. virtual safe_browsing::PasswordProtectionService*
  2012. GetPasswordProtectionService() const = 0;
  2013. +#endif
  2014. -#if defined(ON_FOCUS_PING_ENABLED)
  2015. +#if defined(ON_FOCUS_PING_ENABLED) && BUILDFLAG(FULL_SAFE_BROWSING)
  2016. // Checks the safe browsing reputation of the webpage when the
  2017. // user focuses on a username/password field. This is used for reporting
  2018. // only, and won't trigger a warning.
  2019. @@ -406,6 +409,7 @@ class PasswordManagerClient {
  2020. const GURL& frame_url) = 0;
  2021. #endif
  2022. +#if defined(PASSWORD_REUSE_DETECTION_ENABLED)
  2023. // Checks the safe browsing reputation of the webpage where password reuse
  2024. // happens. This is called by the PasswordReuseDetectionManager when a
  2025. // protected password is typed on the wrong domain. This may trigger a
  2026. @@ -422,6 +426,7 @@ class PasswordManagerClient {
  2027. bool password_field_exists,
  2028. uint64_t reused_password_hash,
  2029. const std::string& domain) = 0;
  2030. +#endif
  2031. // Records a Chrome Sync event that GAIA password reuse was detected.
  2032. virtual void LogPasswordReuseDetectedEvent() = 0;
  2033. --- a/components/password_manager/core/browser/password_reuse_detection_manager.cc
  2034. +++ b/components/password_manager/core/browser/password_reuse_detection_manager.cc
  2035. @@ -163,9 +163,11 @@ void PasswordReuseDetectionManager::OnRe
  2036. ? reused_protected_password_hash->username
  2037. : "";
  2038. + #if defined(PASSWORD_REUSE_DETECTION_ENABLED)
  2039. client_->CheckProtectedPasswordEntry(
  2040. reused_password_type, username, matching_reused_credentials,
  2041. password_field_detected, reused_password_hash, domain);
  2042. + #endif
  2043. }
  2044. void PasswordReuseDetectionManager::SetClockForTesting(base::Clock* clock) {
  2045. --- a/components/safe_browsing/content/common/proto/BUILD.gn
  2046. +++ b/components/safe_browsing/content/common/proto/BUILD.gn
  2047. @@ -5,8 +5,12 @@
  2048. import("//components/safe_browsing/buildflags.gni")
  2049. import("//third_party/protobuf/proto_library.gni")
  2050. -if (safe_browsing_mode != 0) {
  2051. +# Although this was gated on safe_browsing_mode != 0, a considerable amount
  2052. +# of source code that relies on the types included in download_file_types.pb.h
  2053. +# is not gated on BUILDFLAG(SAFE_BROWSING_AVAILABLE). This is far less
  2054. +# invasive than the alternative.
  2055. +# if (safe_browsing_mode != 0) {
  2056. proto_library("download_file_types_proto") {
  2057. sources = [ "download_file_types.proto" ]
  2058. }
  2059. -}
  2060. +# }
  2061. --- a/components/safe_browsing/content/common/safe_browsing.mojom
  2062. +++ b/components/safe_browsing/content/common/safe_browsing.mojom
  2063. @@ -138,7 +138,6 @@ interface PhishingDetector {
  2064. => (PhishingDetectorResult result, string request_proto);
  2065. };
  2066. -[EnableIf=full_safe_browsing]
  2067. // Interface for setting a phishing model. This is scoped to an entire
  2068. // RenderProcess.
  2069. interface PhishingModelSetter {
  2070. --- a/components/safe_browsing/core/browser/BUILD.gn
  2071. +++ b/components/safe_browsing/core/browser/BUILD.gn
  2072. @@ -11,8 +11,6 @@ source_set("browser") {
  2073. "safe_browsing_url_checker_impl.cc",
  2074. "safe_browsing_url_checker_impl.h",
  2075. "url_checker_delegate.h",
  2076. - "user_population.cc",
  2077. - "user_population.h",
  2078. ]
  2079. public_deps = [ "//google_apis:google_apis" ]
  2080. --- a/components/safe_browsing/core/browser/verdict_cache_manager.cc
  2081. +++ b/components/safe_browsing/core/browser/verdict_cache_manager.cc
  2082. @@ -402,16 +402,6 @@ VerdictCacheManager::VerdictCacheManager
  2083. // pref_service can be null in tests.
  2084. if (pref_service) {
  2085. pref_change_registrar_.Init(pref_service);
  2086. - pref_change_registrar_.Add(
  2087. - prefs::kSafeBrowsingEnhanced,
  2088. - base::BindRepeating(&VerdictCacheManager::CleanUpAllPageLoadTokens,
  2089. - weak_factory_.GetWeakPtr(),
  2090. - ClearReason::kSafeBrowsingStateChanged));
  2091. - pref_change_registrar_.Add(
  2092. - prefs::kSafeBrowsingEnabled,
  2093. - base::BindRepeating(&VerdictCacheManager::CleanUpAllPageLoadTokens,
  2094. - weak_factory_.GetWeakPtr(),
  2095. - ClearReason::kSafeBrowsingStateChanged));
  2096. }
  2097. // sync_observer_ can be null in some embedders that don't support sync.
  2098. if (sync_observer_) {
  2099. --- a/content/browser/file_system_access/file_system_access_safe_move_helper.cc
  2100. +++ b/content/browser/file_system_access/file_system_access_safe_move_helper.cc
  2101. @@ -166,15 +166,8 @@ void FileSystemAccessSafeMoveHelper::Sta
  2102. return;
  2103. }
  2104. - if (!RequireSecurityChecks() || !manager_->permission_context()) {
  2105. DidAfterWriteCheck(
  2106. FileSystemAccessPermissionContext::AfterWriteCheckResult::kAllow);
  2107. - return;
  2108. - }
  2109. -
  2110. - ComputeHashForSourceFile(
  2111. - base::BindOnce(&FileSystemAccessSafeMoveHelper::DoAfterWriteCheck,
  2112. - weak_factory_.GetWeakPtr()));
  2113. }
  2114. void FileSystemAccessSafeMoveHelper::ComputeHashForSourceFile(
  2115. @@ -195,45 +188,6 @@ void FileSystemAccessSafeMoveHelper::Com
  2116. std::move(wrapped_callback), source_url()));
  2117. }
  2118. -void FileSystemAccessSafeMoveHelper::DoAfterWriteCheck(
  2119. - base::File::Error hash_result,
  2120. - const std::string& hash,
  2121. - int64_t size) {
  2122. - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  2123. -
  2124. - if (hash_result != base::File::FILE_OK) {
  2125. - // Calculating the hash failed.
  2126. - std::move(callback_).Run(file_system_access_error::FromStatus(
  2127. - blink::mojom::FileSystemAccessStatus::kOperationAborted,
  2128. - "Failed to perform Safe Browsing check."));
  2129. - return;
  2130. - }
  2131. -
  2132. - if (!manager_) {
  2133. - std::move(callback_).Run(file_system_access_error::FromStatus(
  2134. - blink::mojom::FileSystemAccessStatus::kOperationAborted));
  2135. - return;
  2136. - }
  2137. -
  2138. - content::GlobalRenderFrameHostId outermost_main_frame_id;
  2139. - auto* rfh = content::RenderFrameHost::FromID(context_.frame_id);
  2140. - if (rfh)
  2141. - outermost_main_frame_id = rfh->GetOutermostMainFrame()->GetGlobalId();
  2142. -
  2143. - auto item = std::make_unique<FileSystemAccessWriteItem>();
  2144. - item->target_file_path = dest_url().path();
  2145. - item->full_path = source_url().path();
  2146. - item->sha256_hash = hash;
  2147. - item->size = size;
  2148. - item->frame_url = context_.url;
  2149. - item->outermost_main_frame_id = outermost_main_frame_id;
  2150. - item->has_user_gesture = has_transient_user_activation_;
  2151. - manager_->permission_context()->PerformAfterWriteChecks(
  2152. - std::move(item), context_.frame_id,
  2153. - base::BindOnce(&FileSystemAccessSafeMoveHelper::DidAfterWriteCheck,
  2154. - weak_factory_.GetWeakPtr()));
  2155. -}
  2156. -
  2157. void FileSystemAccessSafeMoveHelper::DidAfterWriteCheck(
  2158. FileSystemAccessPermissionContext::AfterWriteCheckResult result) {
  2159. DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  2160. --- a/content/browser/file_system_access/file_system_access_safe_move_helper.h
  2161. +++ b/content/browser/file_system_access/file_system_access_safe_move_helper.h
  2162. @@ -55,9 +55,6 @@ class CONTENT_EXPORT FileSystemAccessSaf
  2163. private:
  2164. SEQUENCE_CHECKER(sequence_checker_);
  2165. - void DoAfterWriteCheck(base::File::Error hash_result,
  2166. - const std::string& hash,
  2167. - int64_t size);
  2168. void DidAfterWriteCheck(
  2169. FileSystemAccessPermissionContext::AfterWriteCheckResult result);
  2170. void DidFileSkipQuarantine(base::File::Error result);
  2171. --- a/content/public/browser/file_system_access_permission_context.h
  2172. +++ b/content/public/browser/file_system_access_permission_context.h
  2173. @@ -112,12 +112,6 @@ class FileSystemAccessPermissionContext
  2174. base::OnceCallback<void(SensitiveEntryResult)> callback) = 0;
  2175. enum class AfterWriteCheckResult { kAllow, kBlock };
  2176. - // Runs a recently finished write operation through checks such as malware
  2177. - // or other security checks to determine if the write should be allowed.
  2178. - virtual void PerformAfterWriteChecks(
  2179. - std::unique_ptr<FileSystemAccessWriteItem> item,
  2180. - GlobalRenderFrameHostId frame_id,
  2181. - base::OnceCallback<void(AfterWriteCheckResult)> callback) = 0;
  2182. // Returns whether the give |origin| already allows read permission, or it is
  2183. // possible to request one. This is used to block file dialogs from being
  2184. --- a/extensions/browser/updater/update_service.cc
  2185. +++ b/extensions/browser/updater/update_service.cc
  2186. @@ -125,13 +125,6 @@ void UpdateService::OnEvent(Events event
  2187. break;
  2188. }
  2189. - if (should_perform_action_on_omaha_attributes) {
  2190. - base::Value attributes = GetExtensionOmahaAttributes(extension_id);
  2191. - // Note that it's important to perform actions even if |attributes| is
  2192. - // empty, missing values may default to false and have associated logic.
  2193. - ExtensionSystem::Get(browser_context_)
  2194. - ->PerformActionBasedOnOmahaAttributes(extension_id, attributes);
  2195. - }
  2196. }
  2197. UpdateService::UpdateService(
  2198. --- a/printing/buildflags/buildflags.gni
  2199. +++ b/printing/buildflags/buildflags.gni
  2200. @@ -36,7 +36,7 @@ declare_args() {
  2201. # Enable snapshotting a page when printing for its content to be analyzed for
  2202. # sensitive content by enterprise users.
  2203. - enable_print_content_analysis = is_chromeos || is_win || is_linux || is_mac
  2204. + enable_print_content_analysis = false
  2205. }
  2206. declare_args() {
  2207. --- a/weblayer/BUILD.gn
  2208. +++ b/weblayer/BUILD.gn
  2209. @@ -477,7 +477,6 @@ source_set("weblayer_lib_base") {
  2210. "//components/profile_metrics",
  2211. "//components/reduce_accept_language/browser",
  2212. "//components/safe_browsing/content/browser",
  2213. - "//components/safe_browsing/content/browser:client_side_detection",
  2214. "//components/safe_browsing/content/browser/web_ui",
  2215. "//components/safe_browsing/content/common:interfaces",
  2216. "//components/safe_browsing/content/renderer:throttles",