fix-building-without-safebrowsing.patch 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. # Additional changes to Inox's fix-building-without-safebrowsing.patch
  2. --- a/chrome/browser/chrome_content_browser_client.cc
  3. +++ b/chrome/browser/chrome_content_browser_client.cc
  4. @@ -4916,18 +4916,7 @@ ChromeContentBrowserClient::GetSafeBrows
  5. bool safe_browsing_enabled_for_profile) {
  6. DCHECK_CURRENTLY_ON(BrowserThread::IO);
  7. - if (!safe_browsing_enabled_for_profile)
  8. - return nullptr;
  9. -
  10. - // |safe_browsing_service_| may be unavailable in tests.
  11. - if (safe_browsing_service_ && !safe_browsing_url_checker_delegate_) {
  12. - safe_browsing_url_checker_delegate_ =
  13. - base::MakeRefCounted<safe_browsing::UrlCheckerDelegateImpl>(
  14. - safe_browsing_service_->database_manager(),
  15. - safe_browsing_service_->ui_manager());
  16. - }
  17. -
  18. - return safe_browsing_url_checker_delegate_;
  19. + return nullptr;
  20. }
  21. base::Optional<std::string>
  22. --- a/chrome/browser/download/download_item_model.cc
  23. +++ b/chrome/browser/download/download_item_model.cc
  24. @@ -25,16 +25,12 @@
  25. #include "chrome/browser/download/download_stats.h"
  26. #include "chrome/browser/download/offline_item_utils.h"
  27. #include "chrome/browser/profiles/profile.h"
  28. -#include "chrome/browser/safe_browsing/download_protection/deep_scanning_request.h"
  29. -#include "chrome/browser/safe_browsing/download_protection/download_feedback_service.h"
  30. #include "chrome/grit/chromium_strings.h"
  31. #include "chrome/grit/generated_resources.h"
  32. #include "components/download/public/common/download_danger_type.h"
  33. #include "components/download/public/common/download_interrupt_reasons.h"
  34. #include "components/download/public/common/download_item.h"
  35. #include "components/safe_browsing/buildflags.h"
  36. -#include "components/safe_browsing/core/file_type_policies.h"
  37. -#include "components/safe_browsing/core/proto/download_file_types.pb.h"
  38. #include "content/public/browser/download_item_utils.h"
  39. #include "ui/base/l10n/l10n_util.h"
  40. #include "ui/base/l10n/time_format.h"
  41. @@ -47,7 +43,6 @@
  42. using base::TimeDelta;
  43. using download::DownloadItem;
  44. using MixedContentStatus = download::DownloadItem::MixedContentStatus;
  45. -using safe_browsing::DownloadFileType;
  46. namespace {
  47. @@ -296,14 +291,7 @@ bool DownloadItemModel::IsMixedContent()
  48. }
  49. bool DownloadItemModel::ShouldAllowDownloadFeedback() const {
  50. -#if BUILDFLAG(FULL_SAFE_BROWSING)
  51. - if (!IsDangerous())
  52. - return false;
  53. - return safe_browsing::DownloadFeedbackService::IsEnabledForDownload(
  54. - *download_);
  55. -#else
  56. return false;
  57. -#endif
  58. }
  59. bool DownloadItemModel::ShouldRemoveFromShelfWhenComplete() const {
  60. --- a/chrome/browser/native_file_system/chrome_native_file_system_permission_context.cc
  61. +++ b/chrome/browser/native_file_system/chrome_native_file_system_permission_context.cc
  62. @@ -19,7 +19,6 @@
  63. #include "chrome/browser/native_file_system/native_file_system_permission_context_factory.h"
  64. #include "chrome/browser/native_file_system/native_file_system_permission_request_manager.h"
  65. #include "chrome/browser/profiles/profile.h"
  66. -#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
  67. #include "chrome/browser/ui/native_file_system_dialogs.h"
  68. #include "chrome/common/chrome_paths.h"
  69. #include "components/content_settings/core/browser/host_content_settings_map.h"
  70. @@ -214,81 +213,6 @@ BindResultCallbackToCurrentSequence(
  71. base::SequencedTaskRunnerHandle::Get(), std::move(callback));
  72. }
  73. -void DoSafeBrowsingCheckOnUIThread(
  74. - int process_id,
  75. - int frame_id,
  76. - std::unique_ptr<content::NativeFileSystemWriteItem> item,
  77. - safe_browsing::CheckDownloadCallback callback) {
  78. - DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
  79. - // Download Protection Service is not supported on Android.
  80. -#if BUILDFLAG(FULL_SAFE_BROWSING)
  81. - safe_browsing::SafeBrowsingService* sb_service =
  82. - g_browser_process->safe_browsing_service();
  83. - if (!sb_service || !sb_service->download_protection_service() ||
  84. - !sb_service->download_protection_service()->enabled()) {
  85. - std::move(callback).Run(safe_browsing::DownloadCheckResult::UNKNOWN);
  86. - return;
  87. - }
  88. -
  89. - if (!item->browser_context) {
  90. - content::RenderProcessHost* rph =
  91. - content::RenderProcessHost::FromID(process_id);
  92. - if (!rph) {
  93. - std::move(callback).Run(safe_browsing::DownloadCheckResult::UNKNOWN);
  94. - return;
  95. - }
  96. - item->browser_context = rph->GetBrowserContext();
  97. - }
  98. -
  99. - if (!item->web_contents) {
  100. - content::RenderFrameHost* rfh =
  101. - content::RenderFrameHost::FromID(process_id, frame_id);
  102. - if (rfh)
  103. - item->web_contents = content::WebContents::FromRenderFrameHost(rfh);
  104. - }
  105. -
  106. - sb_service->download_protection_service()->CheckNativeFileSystemWrite(
  107. - std::move(item), std::move(callback));
  108. -#endif
  109. -}
  110. -
  111. -ChromeNativeFileSystemPermissionContext::AfterWriteCheckResult
  112. -InterpretSafeBrowsingResult(safe_browsing::DownloadCheckResult result) {
  113. - using Result = safe_browsing::DownloadCheckResult;
  114. - switch (result) {
  115. - // Only allow downloads that are marked as SAFE or UNKNOWN by SafeBrowsing.
  116. - // All other types are going to be blocked. UNKNOWN could be the result of a
  117. - // failed safe browsing ping.
  118. - case Result::UNKNOWN:
  119. - case Result::SAFE:
  120. - case Result::WHITELISTED_BY_POLICY:
  121. - return ChromeNativeFileSystemPermissionContext::AfterWriteCheckResult::
  122. - kAllow;
  123. -
  124. - case Result::DANGEROUS:
  125. - case Result::UNCOMMON:
  126. - case Result::DANGEROUS_HOST:
  127. - case Result::POTENTIALLY_UNWANTED:
  128. - case Result::BLOCKED_PASSWORD_PROTECTED:
  129. - case Result::BLOCKED_TOO_LARGE:
  130. - case Result::BLOCKED_UNSUPPORTED_FILE_TYPE:
  131. - return ChromeNativeFileSystemPermissionContext::AfterWriteCheckResult::
  132. - kBlock;
  133. -
  134. - // This shouldn't be returned for Native File System write checks.
  135. - case Result::ASYNC_SCANNING:
  136. - case Result::SENSITIVE_CONTENT_WARNING:
  137. - case Result::SENSITIVE_CONTENT_BLOCK:
  138. - case Result::DEEP_SCANNED_SAFE:
  139. - case Result::PROMPT_FOR_SCANNING:
  140. - NOTREACHED();
  141. - return ChromeNativeFileSystemPermissionContext::AfterWriteCheckResult::
  142. - kAllow;
  143. - }
  144. - NOTREACHED();
  145. - return ChromeNativeFileSystemPermissionContext::AfterWriteCheckResult::kBlock;
  146. -}
  147. -
  148. } // namespace
  149. ChromeNativeFileSystemPermissionContext::Grants::Grants() = default;
  150. @@ -383,29 +307,6 @@ void ChromeNativeFileSystemPermissionCon
  151. frame_id, std::move(callback)));
  152. }
  153. -void ChromeNativeFileSystemPermissionContext::PerformAfterWriteChecks(
  154. - std::unique_ptr<content::NativeFileSystemWriteItem> item,
  155. - int process_id,
  156. - int frame_id,
  157. - base::OnceCallback<void(AfterWriteCheckResult)> callback) {
  158. - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
  159. - base::PostTask(
  160. - FROM_HERE, {content::BrowserThread::UI},
  161. - base::BindOnce(
  162. - &DoSafeBrowsingCheckOnUIThread, process_id, frame_id, std::move(item),
  163. - base::BindOnce(
  164. - [](scoped_refptr<base::TaskRunner> task_runner,
  165. - base::OnceCallback<void(AfterWriteCheckResult result)>
  166. - callback,
  167. - safe_browsing::DownloadCheckResult result) {
  168. - task_runner->PostTask(
  169. - FROM_HERE,
  170. - base::BindOnce(std::move(callback),
  171. - InterpretSafeBrowsingResult(result)));
  172. - },
  173. - base::SequencedTaskRunnerHandle::Get(), std::move(callback))));
  174. -}
  175. -
  176. void ChromeNativeFileSystemPermissionContext::
  177. DidConfirmSensitiveDirectoryAccess(
  178. const url::Origin& origin,
  179. --- a/chrome/browser/native_file_system/chrome_native_file_system_permission_context.h
  180. +++ b/chrome/browser/native_file_system/chrome_native_file_system_permission_context.h
  181. @@ -59,11 +59,6 @@ class ChromeNativeFileSystemPermissionCo
  182. int process_id,
  183. int frame_id,
  184. base::OnceCallback<void(PermissionStatus)> callback) override;
  185. - void PerformAfterWriteChecks(
  186. - std::unique_ptr<content::NativeFileSystemWriteItem> item,
  187. - int process_id,
  188. - int frame_id,
  189. - base::OnceCallback<void(AfterWriteCheckResult)> callback) override;
  190. bool CanObtainWritePermission(const url::Origin& origin) override;
  191. ContentSetting GetReadGuardContentSetting(const url::Origin& origin);
  192. --- a/chrome/browser/password_manager/chrome_password_manager_client.cc
  193. +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
  194. @@ -26,7 +26,6 @@
  195. #include "chrome/browser/password_manager/password_store_factory.h"
  196. #include "chrome/browser/prerender/prerender_contents.h"
  197. #include "chrome/browser/profiles/profile.h"
  198. -#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
  199. #include "chrome/browser/signin/identity_manager_factory.h"
  200. #include "chrome/browser/site_isolation/site_isolation_policy.h"
  201. #include "chrome/browser/sync/profile_sync_service_factory.h"
  202. @@ -94,11 +93,11 @@
  203. #if BUILDFLAG(FULL_SAFE_BROWSING)
  204. #include "chrome/browser/safe_browsing/advanced_protection_status_manager.h"
  205. #include "chrome/browser/safe_browsing/advanced_protection_status_manager_factory.h"
  206. +#endif
  207. #include "services/service_manager/public/cpp/connector.h"
  208. #include "third_party/blink/public/mojom/clipboard/clipboard.mojom.h"
  209. #include "ui/base/clipboard/clipboard.h"
  210. #include "ui/events/keycodes/keyboard_codes.h"
  211. -#endif
  212. #if defined(OS_ANDROID)
  213. #include "chrome/browser/android/tab_android.h"
  214. @@ -606,6 +605,7 @@ bool ChromePasswordManagerClient::IsIsol
  215. return SiteIsolationPolicy::IsIsolationForPasswordSitesEnabled();
  216. }
  217. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  218. #if defined(ON_FOCUS_PING_ENABLED) || \
  219. defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
  220. safe_browsing::PasswordProtectionService*
  221. @@ -628,6 +628,7 @@ void ChromePasswordManagerClient::CheckS
  222. }
  223. }
  224. #endif // defined(ON_FOCUS_PING_ENABLED)
  225. +#endif // BUILDFLAG(FULL_SAFE_BROWSING)
  226. #if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
  227. void ChromePasswordManagerClient::CheckProtectedPasswordEntry(
  228. @@ -636,24 +637,11 @@ void ChromePasswordManagerClient::CheckP
  229. const std::vector<password_manager::MatchingReusedCredential>&
  230. matching_reused_credentials,
  231. bool password_field_exists) {
  232. - safe_browsing::PasswordProtectionService* pps =
  233. - GetPasswordProtectionService();
  234. - if (!pps)
  235. - return;
  236. -
  237. - pps->MaybeStartProtectedPasswordEntryRequest(
  238. - web_contents(), web_contents()->GetLastCommittedURL(), username,
  239. - password_type, matching_reused_credentials, password_field_exists);
  240. }
  241. #endif // defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
  242. #if defined(SYNC_PASSWORD_REUSE_WARNING_ENABLED)
  243. void ChromePasswordManagerClient::LogPasswordReuseDetectedEvent() {
  244. - safe_browsing::PasswordProtectionService* pps =
  245. - GetPasswordProtectionService();
  246. - if (pps) {
  247. - pps->MaybeLogPasswordReuseDetectedEvent(web_contents());
  248. - }
  249. }
  250. #endif // defined(SYNC_PASSWORD_REUSE_WARNING_ENABLED)
  251. @@ -781,7 +769,9 @@ void ChromePasswordManagerClient::OnInpu
  252. if (key_event.windows_key_code == (ui::VKEY_V & 0x1f)) {
  253. OnPaste();
  254. } else {
  255. +#if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
  256. password_reuse_detection_manager_.OnKeyPressedCommitted(key_event.text);
  257. +#endif // defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
  258. }
  259. #endif // defined(OS_ANDROID)
  260. }
  261. @@ -907,9 +897,11 @@ void ChromePasswordManagerClient::OnPast
  262. base::string16 text;
  263. clipboard->ReadText(ui::ClipboardBuffer::kCopyPaste, &text);
  264. was_on_paste_called_ = true;
  265. +#if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
  266. password_reuse_detection_manager_.OnPaste(std::move(text));
  267. +#endif // defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
  268. }
  269. -#endif
  270. +#endif // !defined(OS_ANDROID)
  271. gfx::RectF ChromePasswordManagerClient::GetBoundsInScreenSpace(
  272. const gfx::RectF& bounds) {
  273. --- a/chrome/browser/password_manager/chrome_password_manager_client.h
  274. +++ b/chrome/browser/password_manager/chrome_password_manager_client.h
  275. @@ -200,7 +200,7 @@ class ChromePasswordManagerClient
  276. void OnImeFinishComposingTextEvent() override;
  277. #endif // defined(OS_ANDROID)
  278. -#if defined(ON_FOCUS_PING_ENABLED)
  279. +#if defined(ON_FOCUS_PING_ENABLED) && BUILDFLAG(FULL_SAFE_BROWSING)
  280. void CheckSafeBrowsingReputation(const GURL& form_action,
  281. const GURL& frame_url) override;
  282. safe_browsing::PasswordProtectionService* GetPasswordProtectionService()
  283. --- a/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc
  284. +++ b/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc
  285. @@ -18,12 +18,10 @@
  286. #include "chrome/browser/permissions/quiet_notification_permission_ui_config.h"
  287. #include "chrome/browser/permissions/quiet_notification_permission_ui_state.h"
  288. #include "chrome/browser/profiles/profile.h"
  289. -#include "chrome/browser/safe_browsing/safe_browsing_service.h"
  290. #include "chrome/common/chrome_features.h"
  291. #include "chrome/common/pref_names.h"
  292. #include "components/permissions/permission_request.h"
  293. #include "components/prefs/pref_service.h"
  294. -#include "components/safe_browsing/core/db/database_manager.h"
  295. namespace {
  296. @@ -114,50 +112,14 @@ void ContextualNotificationPermissionUiS
  297. Notify(UiToUse::kNormalUi, base::nullopt);
  298. return;
  299. }
  300. -
  301. - // Even if the quiet UI is enabled on all sites, the crowd deny trigger
  302. - // condition must be evaluated, so that the less prominent UI and the correct
  303. - // strings are shown on origins with crowd deny activated.
  304. - EvaluateCrowdDenyTrigger(url::Origin::Create(request->GetOrigin()));
  305. }
  306. void ContextualNotificationPermissionUiSelector::Cancel() {
  307. - // The computation either finishes synchronously above, or is waiting on the
  308. - // Safe Browsing check.
  309. - safe_browsing_request_.reset();
  310. }
  311. ContextualNotificationPermissionUiSelector::
  312. ~ContextualNotificationPermissionUiSelector() = default;
  313. -void ContextualNotificationPermissionUiSelector::EvaluateCrowdDenyTrigger(
  314. - url::Origin origin) {
  315. - if (!QuietNotificationPermissionUiConfig::IsCrowdDenyTriggeringEnabled()) {
  316. - OnCrowdDenyTriggerEvaluated(UiToUse::kNormalUi);
  317. - return;
  318. - }
  319. -
  320. - base::Optional<UiToUse> ui_to_use = GetUiToUseBasedOnSiteReputation(
  321. - CrowdDenyPreloadData::GetInstance()->GetReputationDataForSite(origin));
  322. - if (!ui_to_use || *ui_to_use == UiToUse::kNormalUi) {
  323. - OnCrowdDenyTriggerEvaluated(UiToUse::kNormalUi);
  324. - return;
  325. - }
  326. -
  327. - // PreloadData suggests a spammy site, ping safe browsing to verify.
  328. - DCHECK(!safe_browsing_request_);
  329. - DCHECK(g_browser_process->safe_browsing_service());
  330. -
  331. - // It is fine to use base::Unretained() here, as |safe_browsing_request_|
  332. - // guarantees not to fire the callback after its destruction.
  333. - safe_browsing_request_.emplace(
  334. - g_browser_process->safe_browsing_service()->database_manager(),
  335. - base::DefaultClock::GetInstance(), origin,
  336. - base::BindOnce(&ContextualNotificationPermissionUiSelector::
  337. - OnSafeBrowsingVerdictReceived,
  338. - base::Unretained(this)));
  339. -}
  340. -
  341. void ContextualNotificationPermissionUiSelector::OnSafeBrowsingVerdictReceived(
  342. CrowdDenySafeBrowsingRequest::Verdict verdict) {
  343. DCHECK(safe_browsing_request_);
  344. --- a/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop.cc
  345. +++ b/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop.cc
  346. @@ -78,33 +78,8 @@ void HandleOnPerformDrop(
  347. content::WebContents* web_contents,
  348. const content::DropData& drop_data,
  349. content::WebContentsViewDelegate::DropCompletionCallback callback) {
  350. - safe_browsing::DeepScanningDialogDelegate::Data data;
  351. - Profile* profile =
  352. - Profile::FromBrowserContext(web_contents->GetBrowserContext());
  353. - if (!safe_browsing::DeepScanningDialogDelegate::IsEnabled(
  354. - profile, web_contents->GetLastCommittedURL(), &data)) {
  355. - std::move(callback).Run(
  356. - content::WebContentsViewDelegate::DropCompletionResult::kContinue);
  357. - return;
  358. - }
  359. -
  360. - // Collect the data that needs to be scanned.
  361. - if (!drop_data.url_title.empty())
  362. - data.text.push_back(drop_data.url_title);
  363. - if (!drop_data.text.is_null())
  364. - data.text.push_back(drop_data.text.string());
  365. - if (!drop_data.html.is_null())
  366. - data.text.push_back(drop_data.html.string());
  367. - if (!drop_data.file_contents.empty())
  368. - data.text.push_back(base::UTF8ToUTF16(drop_data.file_contents));
  369. -
  370. - if (drop_data.filenames.empty()) {
  371. - ScanData(web_contents, std::move(callback), std::move(data));
  372. - } else {
  373. - base::ThreadPool::PostTaskAndReplyWithResult(
  374. - FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()},
  375. - base::BindOnce(&GetPathsToScan, web_contents, std::move(drop_data),
  376. - std::move(data)),
  377. - base::BindOnce(&ScanData, web_contents, std::move(callback)));
  378. - }
  379. + // In the original code, this ran safe_browsing::DeepScanningDialogDelegate
  380. + // Instead, run the code under "if (!safe_browsing::DeepScanningDialogDelegate::IsEnabled(...)) ..."
  381. + std::move(callback).Run(
  382. + content::WebContentsViewDelegate::DropCompletionResult::kContinue);
  383. }
  384. --- a/chrome/browser/ui/views/download/download_item_view.cc
  385. +++ b/chrome/browser/ui/views/download/download_item_view.cc
  386. @@ -1306,6 +1306,7 @@ void DownloadItemView::ShowDeepScanningD
  387. },
  388. base::Unretained(this))));
  389. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  390. int delay_delivery = g_browser_process->local_state()->GetInteger(
  391. prefs::kDelayDeliveryUntilVerdict);
  392. if (delay_delivery != safe_browsing::DELAY_DOWNLOADS &&
  393. @@ -1317,6 +1318,9 @@ void DownloadItemView::ShowDeepScanningD
  394. } else {
  395. open_button_->SetEnabled(false);
  396. }
  397. +#else
  398. + open_button_->SetEnabled(false);
  399. +#endif // BUILDFLAG(FULL_SAFE_BROWSING)
  400. file_name_label_->SetVisible(false);
  401. status_label_->SetVisible(false);
  402. @@ -1627,7 +1631,9 @@ base::string16 DownloadItemView::ElidedF
  403. }
  404. void DownloadItemView::OpenDownloadDuringAsyncScanning() {
  405. +#if BUILDFLAG(FULL_SAFE_BROWSING)
  406. model_->CompleteSafeBrowsingScan();
  407. +#endif
  408. model_->SetOpenWhenComplete(true);
  409. }
  410. --- a/chrome/browser/ui/views/safe_browsing/password_reuse_modal_warning_dialog.cc
  411. +++ b/chrome/browser/ui/views/safe_browsing/password_reuse_modal_warning_dialog.cc
  412. @@ -184,10 +184,7 @@ PasswordReuseModalWarningDialog::Passwor
  413. placeholder_offsets);
  414. } else {
  415. views::Label* message_body_label = CreateMessageBodyLabel(
  416. - service_
  417. - ? service_->GetWarningDetailText(password_type,
  418. - &placeholder_offsets)
  419. - : l10n_util::GetStringUTF16(IDS_PAGE_INFO_CHANGE_PASSWORD_DETAILS));
  420. + l10n_util::GetStringUTF16(IDS_PAGE_INFO_CHANGE_PASSWORD_DETAILS));
  421. CreateGaiaPasswordReuseModalWarningDialog(message_body_label);
  422. }
  423. modal_construction_start_time_ = base::TimeTicks::Now();
  424. --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
  425. +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
  426. @@ -83,8 +83,6 @@
  427. #include "components/nacl/common/buildflags.h"
  428. #include "components/prefs/pref_service.h"
  429. #include "components/safe_browsing/buildflags.h"
  430. -#include "components/safe_browsing/content/web_ui/safe_browsing_ui.h"
  431. -#include "components/safe_browsing/core/web_ui/constants.h"
  432. #include "components/security_interstitials/content/connection_help_ui.h"
  433. #include "components/security_interstitials/content/known_interception_disclosure_ui.h"
  434. #include "components/security_interstitials/content/urls.h"
  435. @@ -444,8 +442,6 @@ WebUIFactoryFunction GetWebUIFactoryFunc
  436. return &NewWebUI<PredictorsUI>;
  437. if (url.host_piece() == chrome::kChromeUIQuotaInternalsHost)
  438. return &NewWebUI<QuotaInternalsUI>;
  439. - if (url.host_piece() == safe_browsing::kChromeUISafeBrowsingHost)
  440. - return &NewWebUI<safe_browsing::SafeBrowsingUI>;
  441. if (url.host_piece() == chrome::kChromeUISignInInternalsHost)
  442. return &NewWebUI<SignInInternalsUI>;
  443. if (url.host_piece() == chrome::kChromeUISuggestionsHost)
  444. --- a/components/password_manager/content/browser/content_password_manager_driver.cc
  445. +++ b/components/password_manager/content/browser/content_password_manager_driver.cc
  446. @@ -310,7 +310,7 @@ void ContentPasswordManagerDriver::ShowT
  447. void ContentPasswordManagerDriver::CheckSafeBrowsingReputation(
  448. const GURL& form_action,
  449. const GURL& frame_url) {
  450. -#if defined(ON_FOCUS_PING_ENABLED)
  451. +#if defined(ON_FOCUS_PING_ENABLED) && BUILDFLAG(FULL_SAFE_BROWSING)
  452. client_->CheckSafeBrowsingReputation(form_action, frame_url);
  453. #endif
  454. }
  455. --- a/components/password_manager/core/browser/password_manager_client.h
  456. +++ b/components/password_manager/core/browser/password_manager_client.h
  457. @@ -310,7 +310,7 @@ class PasswordManagerClient {
  458. // Returns the current best guess as to the page's display language.
  459. virtual std::string GetPageLanguage() const;
  460. -#if defined(ON_FOCUS_PING_ENABLED)
  461. +#if defined(ON_FOCUS_PING_ENABLED) && BUILDFLAG(FULL_SAFE_BROWSING)
  462. // Return the PasswordProtectionService associated with this instance.
  463. virtual safe_browsing::PasswordProtectionService*
  464. GetPasswordProtectionService() const = 0;
  465. --- a/components/safe_browsing/content/common/safe_browsing.mojom
  466. +++ b/components/safe_browsing/content/common/safe_browsing.mojom
  467. @@ -117,7 +117,6 @@ enum PhishingDetectorResult {
  468. INVALID_SCORE = 4,
  469. };
  470. -[EnableIf=full_safe_browsing]
  471. interface PhishingDetector {
  472. // Tells the renderer to begin phishing detection for the given toplevel URL
  473. // which it has started loading. Returns the serialized request proto and a
  474. --- a/content/browser/native_file_system/native_file_system_file_writer_impl.cc
  475. +++ b/content/browser/native_file_system/native_file_system_file_writer_impl.cc
  476. @@ -94,8 +94,7 @@ NativeFileSystemFileWriterImpl::NativeFi
  477. url,
  478. handle_state,
  479. /*is_directory=*/false),
  480. - swap_url_(swap_url),
  481. - has_transient_user_activation_(has_transient_user_activation) {
  482. + swap_url_(swap_url) {
  483. DCHECK_EQ(swap_url.type(), url.type());
  484. }
  485. @@ -303,51 +302,7 @@ void NativeFileSystemFileWriterImpl::Clo
  486. // swap file even if the writer was destroyed at that point.
  487. state_ = State::kClosePending;
  488. - if (!RequireAfterWriteCheck() || !manager()->permission_context()) {
  489. - DidPassAfterWriteCheck(std::move(callback));
  490. - return;
  491. - }
  492. -
  493. - ComputeHashForSwapFile(base::BindOnce(
  494. - &NativeFileSystemFileWriterImpl::DoAfterWriteCheck,
  495. - weak_factory_.GetWeakPtr(), swap_url().path(), std::move(callback)));
  496. -}
  497. -
  498. -// static
  499. -void NativeFileSystemFileWriterImpl::DoAfterWriteCheck(
  500. - base::WeakPtr<NativeFileSystemFileWriterImpl> file_writer,
  501. - const base::FilePath& swap_path,
  502. - NativeFileSystemFileWriterImpl::CloseCallback callback,
  503. - base::File::Error hash_result,
  504. - const std::string& hash,
  505. - int64_t size) {
  506. - if (!file_writer || hash_result != base::File::FILE_OK) {
  507. - // If writer was deleted, or calculating the hash failed try deleting the
  508. - // swap file and invoke the callback.
  509. - base::ThreadPool::PostTask(
  510. - FROM_HERE, {base::MayBlock()},
  511. - base::BindOnce(base::IgnoreResult(&base::DeleteFile), swap_path,
  512. - /*recursive=*/false));
  513. - std::move(callback).Run(native_file_system_error::FromStatus(
  514. - NativeFileSystemStatus::kOperationAborted,
  515. - "Failed to perform Safe Browsing check."));
  516. - return;
  517. - }
  518. -
  519. - DCHECK_CALLED_ON_VALID_SEQUENCE(file_writer->sequence_checker_);
  520. -
  521. - auto item = std::make_unique<NativeFileSystemWriteItem>();
  522. - item->target_file_path = file_writer->url().path();
  523. - item->full_path = file_writer->swap_url().path();
  524. - item->sha256_hash = hash;
  525. - item->size = size;
  526. - item->frame_url = file_writer->context().url;
  527. - item->has_user_gesture = file_writer->has_transient_user_activation_;
  528. - file_writer->manager()->permission_context()->PerformAfterWriteChecks(
  529. - std::move(item), file_writer->context().process_id,
  530. - file_writer->context().frame_id,
  531. - base::BindOnce(&NativeFileSystemFileWriterImpl::DidAfterWriteCheck,
  532. - file_writer, swap_path, std::move(callback)));
  533. + DidPassAfterWriteCheck(std::move(callback));
  534. }
  535. // static
  536. --- a/content/browser/native_file_system/native_file_system_file_writer_impl.h
  537. +++ b/content/browser/native_file_system/native_file_system_file_writer_impl.h
  538. @@ -80,15 +80,8 @@ class CONTENT_EXPORT NativeFileSystemFil
  539. bool complete);
  540. void TruncateImpl(uint64_t length, TruncateCallback callback);
  541. void CloseImpl(CloseCallback callback);
  542. - // The following two methods are static, because they need to be invoked to
  543. + // The following method is static because they need to be invoked to
  544. // perform cleanup even if the writer was deleted before they were invoked.
  545. - static void DoAfterWriteCheck(
  546. - base::WeakPtr<NativeFileSystemFileWriterImpl> file_writer,
  547. - const base::FilePath& swap_path,
  548. - NativeFileSystemFileWriterImpl::CloseCallback callback,
  549. - base::File::Error hash_result,
  550. - const std::string& hash,
  551. - int64_t size);
  552. static void DidAfterWriteCheck(
  553. base::WeakPtr<NativeFileSystemFileWriterImpl> file_writer,
  554. const base::FilePath& swap_path,
  555. @@ -101,7 +94,7 @@ class CONTENT_EXPORT NativeFileSystemFil
  556. // After write checks only apply to native local paths.
  557. bool RequireAfterWriteCheck() const {
  558. - return url().type() == storage::kFileSystemTypeNativeLocal;
  559. + return false;
  560. }
  561. // Quarantine checks only apply to native local paths.
  562. @@ -141,10 +134,6 @@ class CONTENT_EXPORT NativeFileSystemFil
  563. bool skip_quarantine_check_for_testing_ = false;
  564. - // Keeps track of user activation state at creation time for after write
  565. - // checks.
  566. - bool has_transient_user_activation_ = false;
  567. -
  568. base::WeakPtr<NativeFileSystemHandleBase> AsWeakPtr() override;
  569. base::WeakPtrFactory<NativeFileSystemFileWriterImpl> weak_factory_{this};
  570. --- a/content/public/browser/native_file_system_permission_context.h
  571. +++ b/content/public/browser/native_file_system_permission_context.h
  572. @@ -100,13 +100,6 @@ class NativeFileSystemPermissionContext
  573. base::OnceCallback<void(SensitiveDirectoryResult)> callback) = 0;
  574. enum class AfterWriteCheckResult { kAllow, kBlock };
  575. - // Runs a recently finished write operation through checks such as malware
  576. - // or other security checks to determine if the write should be allowed.
  577. - virtual void PerformAfterWriteChecks(
  578. - std::unique_ptr<NativeFileSystemWriteItem> item,
  579. - int process_id,
  580. - int frame_id,
  581. - base::OnceCallback<void(AfterWriteCheckResult)> callback) = 0;
  582. // Returns whether the give |origin| already allows write permission, or it is
  583. // possible to request one. This is used to block save file dialogs from being