123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622 |
- # Additional changes to Inox's fix-building-without-safebrowsing.patch
- --- a/chrome/browser/chrome_content_browser_client.cc
- +++ b/chrome/browser/chrome_content_browser_client.cc
- @@ -4916,18 +4916,7 @@ ChromeContentBrowserClient::GetSafeBrows
- bool safe_browsing_enabled_for_profile) {
- DCHECK_CURRENTLY_ON(BrowserThread::IO);
-
- - if (!safe_browsing_enabled_for_profile)
- - return nullptr;
- -
- - // |safe_browsing_service_| may be unavailable in tests.
- - if (safe_browsing_service_ && !safe_browsing_url_checker_delegate_) {
- - safe_browsing_url_checker_delegate_ =
- - base::MakeRefCounted<safe_browsing::UrlCheckerDelegateImpl>(
- - safe_browsing_service_->database_manager(),
- - safe_browsing_service_->ui_manager());
- - }
- -
- - return safe_browsing_url_checker_delegate_;
- + return nullptr;
- }
-
- base::Optional<std::string>
- --- a/chrome/browser/download/download_item_model.cc
- +++ b/chrome/browser/download/download_item_model.cc
- @@ -25,16 +25,12 @@
- #include "chrome/browser/download/download_stats.h"
- #include "chrome/browser/download/offline_item_utils.h"
- #include "chrome/browser/profiles/profile.h"
- -#include "chrome/browser/safe_browsing/download_protection/deep_scanning_request.h"
- -#include "chrome/browser/safe_browsing/download_protection/download_feedback_service.h"
- #include "chrome/grit/chromium_strings.h"
- #include "chrome/grit/generated_resources.h"
- #include "components/download/public/common/download_danger_type.h"
- #include "components/download/public/common/download_interrupt_reasons.h"
- #include "components/download/public/common/download_item.h"
- #include "components/safe_browsing/buildflags.h"
- -#include "components/safe_browsing/core/file_type_policies.h"
- -#include "components/safe_browsing/core/proto/download_file_types.pb.h"
- #include "content/public/browser/download_item_utils.h"
- #include "ui/base/l10n/l10n_util.h"
- #include "ui/base/l10n/time_format.h"
- @@ -47,7 +43,6 @@
- using base::TimeDelta;
- using download::DownloadItem;
- using MixedContentStatus = download::DownloadItem::MixedContentStatus;
- -using safe_browsing::DownloadFileType;
-
- namespace {
-
- @@ -296,14 +291,7 @@ bool DownloadItemModel::IsMixedContent()
- }
-
- bool DownloadItemModel::ShouldAllowDownloadFeedback() const {
- -#if BUILDFLAG(FULL_SAFE_BROWSING)
- - if (!IsDangerous())
- - return false;
- - return safe_browsing::DownloadFeedbackService::IsEnabledForDownload(
- - *download_);
- -#else
- return false;
- -#endif
- }
-
- bool DownloadItemModel::ShouldRemoveFromShelfWhenComplete() const {
- --- a/chrome/browser/native_file_system/chrome_native_file_system_permission_context.cc
- +++ b/chrome/browser/native_file_system/chrome_native_file_system_permission_context.cc
- @@ -19,7 +19,6 @@
- #include "chrome/browser/native_file_system/native_file_system_permission_context_factory.h"
- #include "chrome/browser/native_file_system/native_file_system_permission_request_manager.h"
- #include "chrome/browser/profiles/profile.h"
- -#include "chrome/browser/safe_browsing/download_protection/download_protection_service.h"
- #include "chrome/browser/ui/native_file_system_dialogs.h"
- #include "chrome/common/chrome_paths.h"
- #include "components/content_settings/core/browser/host_content_settings_map.h"
- @@ -214,81 +213,6 @@ BindResultCallbackToCurrentSequence(
- base::SequencedTaskRunnerHandle::Get(), std::move(callback));
- }
-
- -void DoSafeBrowsingCheckOnUIThread(
- - int process_id,
- - int frame_id,
- - std::unique_ptr<content::NativeFileSystemWriteItem> item,
- - safe_browsing::CheckDownloadCallback callback) {
- - DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- - // Download Protection Service is not supported on Android.
- -#if BUILDFLAG(FULL_SAFE_BROWSING)
- - safe_browsing::SafeBrowsingService* sb_service =
- - g_browser_process->safe_browsing_service();
- - if (!sb_service || !sb_service->download_protection_service() ||
- - !sb_service->download_protection_service()->enabled()) {
- - std::move(callback).Run(safe_browsing::DownloadCheckResult::UNKNOWN);
- - return;
- - }
- -
- - if (!item->browser_context) {
- - content::RenderProcessHost* rph =
- - content::RenderProcessHost::FromID(process_id);
- - if (!rph) {
- - std::move(callback).Run(safe_browsing::DownloadCheckResult::UNKNOWN);
- - return;
- - }
- - item->browser_context = rph->GetBrowserContext();
- - }
- -
- - if (!item->web_contents) {
- - content::RenderFrameHost* rfh =
- - content::RenderFrameHost::FromID(process_id, frame_id);
- - if (rfh)
- - item->web_contents = content::WebContents::FromRenderFrameHost(rfh);
- - }
- -
- - sb_service->download_protection_service()->CheckNativeFileSystemWrite(
- - std::move(item), std::move(callback));
- -#endif
- -}
- -
- -ChromeNativeFileSystemPermissionContext::AfterWriteCheckResult
- -InterpretSafeBrowsingResult(safe_browsing::DownloadCheckResult result) {
- - using Result = safe_browsing::DownloadCheckResult;
- - switch (result) {
- - // Only allow downloads that are marked as SAFE or UNKNOWN by SafeBrowsing.
- - // All other types are going to be blocked. UNKNOWN could be the result of a
- - // failed safe browsing ping.
- - case Result::UNKNOWN:
- - case Result::SAFE:
- - case Result::WHITELISTED_BY_POLICY:
- - return ChromeNativeFileSystemPermissionContext::AfterWriteCheckResult::
- - kAllow;
- -
- - case Result::DANGEROUS:
- - case Result::UNCOMMON:
- - case Result::DANGEROUS_HOST:
- - case Result::POTENTIALLY_UNWANTED:
- - case Result::BLOCKED_PASSWORD_PROTECTED:
- - case Result::BLOCKED_TOO_LARGE:
- - case Result::BLOCKED_UNSUPPORTED_FILE_TYPE:
- - return ChromeNativeFileSystemPermissionContext::AfterWriteCheckResult::
- - kBlock;
- -
- - // This shouldn't be returned for Native File System write checks.
- - case Result::ASYNC_SCANNING:
- - case Result::SENSITIVE_CONTENT_WARNING:
- - case Result::SENSITIVE_CONTENT_BLOCK:
- - case Result::DEEP_SCANNED_SAFE:
- - case Result::PROMPT_FOR_SCANNING:
- - NOTREACHED();
- - return ChromeNativeFileSystemPermissionContext::AfterWriteCheckResult::
- - kAllow;
- - }
- - NOTREACHED();
- - return ChromeNativeFileSystemPermissionContext::AfterWriteCheckResult::kBlock;
- -}
- -
- } // namespace
-
- ChromeNativeFileSystemPermissionContext::Grants::Grants() = default;
- @@ -383,29 +307,6 @@ void ChromeNativeFileSystemPermissionCon
- frame_id, std::move(callback)));
- }
-
- -void ChromeNativeFileSystemPermissionContext::PerformAfterWriteChecks(
- - std::unique_ptr<content::NativeFileSystemWriteItem> item,
- - int process_id,
- - int frame_id,
- - base::OnceCallback<void(AfterWriteCheckResult)> callback) {
- - DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
- - base::PostTask(
- - FROM_HERE, {content::BrowserThread::UI},
- - base::BindOnce(
- - &DoSafeBrowsingCheckOnUIThread, process_id, frame_id, std::move(item),
- - base::BindOnce(
- - [](scoped_refptr<base::TaskRunner> task_runner,
- - base::OnceCallback<void(AfterWriteCheckResult result)>
- - callback,
- - safe_browsing::DownloadCheckResult result) {
- - task_runner->PostTask(
- - FROM_HERE,
- - base::BindOnce(std::move(callback),
- - InterpretSafeBrowsingResult(result)));
- - },
- - base::SequencedTaskRunnerHandle::Get(), std::move(callback))));
- -}
- -
- void ChromeNativeFileSystemPermissionContext::
- DidConfirmSensitiveDirectoryAccess(
- const url::Origin& origin,
- --- a/chrome/browser/native_file_system/chrome_native_file_system_permission_context.h
- +++ b/chrome/browser/native_file_system/chrome_native_file_system_permission_context.h
- @@ -59,11 +59,6 @@ class ChromeNativeFileSystemPermissionCo
- int process_id,
- int frame_id,
- base::OnceCallback<void(PermissionStatus)> callback) override;
- - void PerformAfterWriteChecks(
- - std::unique_ptr<content::NativeFileSystemWriteItem> item,
- - int process_id,
- - int frame_id,
- - base::OnceCallback<void(AfterWriteCheckResult)> callback) override;
- bool CanObtainWritePermission(const url::Origin& origin) override;
-
- ContentSetting GetReadGuardContentSetting(const url::Origin& origin);
- --- a/chrome/browser/password_manager/chrome_password_manager_client.cc
- +++ b/chrome/browser/password_manager/chrome_password_manager_client.cc
- @@ -26,7 +26,6 @@
- #include "chrome/browser/password_manager/password_store_factory.h"
- #include "chrome/browser/prerender/prerender_contents.h"
- #include "chrome/browser/profiles/profile.h"
- -#include "chrome/browser/safe_browsing/chrome_password_protection_service.h"
- #include "chrome/browser/signin/identity_manager_factory.h"
- #include "chrome/browser/site_isolation/site_isolation_policy.h"
- #include "chrome/browser/sync/profile_sync_service_factory.h"
- @@ -94,11 +93,11 @@
- #if BUILDFLAG(FULL_SAFE_BROWSING)
- #include "chrome/browser/safe_browsing/advanced_protection_status_manager.h"
- #include "chrome/browser/safe_browsing/advanced_protection_status_manager_factory.h"
- +#endif
- #include "services/service_manager/public/cpp/connector.h"
- #include "third_party/blink/public/mojom/clipboard/clipboard.mojom.h"
- #include "ui/base/clipboard/clipboard.h"
- #include "ui/events/keycodes/keyboard_codes.h"
- -#endif
-
- #if defined(OS_ANDROID)
- #include "chrome/browser/android/tab_android.h"
- @@ -606,6 +605,7 @@ bool ChromePasswordManagerClient::IsIsol
- return SiteIsolationPolicy::IsIsolationForPasswordSitesEnabled();
- }
-
- +#if BUILDFLAG(FULL_SAFE_BROWSING)
- #if defined(ON_FOCUS_PING_ENABLED) || \
- defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
- safe_browsing::PasswordProtectionService*
- @@ -628,6 +628,7 @@ void ChromePasswordManagerClient::CheckS
- }
- }
- #endif // defined(ON_FOCUS_PING_ENABLED)
- +#endif // BUILDFLAG(FULL_SAFE_BROWSING)
-
- #if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
- void ChromePasswordManagerClient::CheckProtectedPasswordEntry(
- @@ -636,24 +637,11 @@ void ChromePasswordManagerClient::CheckP
- const std::vector<password_manager::MatchingReusedCredential>&
- matching_reused_credentials,
- bool password_field_exists) {
- - safe_browsing::PasswordProtectionService* pps =
- - GetPasswordProtectionService();
- - if (!pps)
- - return;
- -
- - pps->MaybeStartProtectedPasswordEntryRequest(
- - web_contents(), web_contents()->GetLastCommittedURL(), username,
- - password_type, matching_reused_credentials, password_field_exists);
- }
- #endif // defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
-
- #if defined(SYNC_PASSWORD_REUSE_WARNING_ENABLED)
- void ChromePasswordManagerClient::LogPasswordReuseDetectedEvent() {
- - safe_browsing::PasswordProtectionService* pps =
- - GetPasswordProtectionService();
- - if (pps) {
- - pps->MaybeLogPasswordReuseDetectedEvent(web_contents());
- - }
- }
- #endif // defined(SYNC_PASSWORD_REUSE_WARNING_ENABLED)
-
- @@ -781,7 +769,9 @@ void ChromePasswordManagerClient::OnInpu
- if (key_event.windows_key_code == (ui::VKEY_V & 0x1f)) {
- OnPaste();
- } else {
- +#if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
- password_reuse_detection_manager_.OnKeyPressedCommitted(key_event.text);
- +#endif // defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
- }
- #endif // defined(OS_ANDROID)
- }
- @@ -907,9 +897,11 @@ void ChromePasswordManagerClient::OnPast
- base::string16 text;
- clipboard->ReadText(ui::ClipboardBuffer::kCopyPaste, &text);
- was_on_paste_called_ = true;
- +#if defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
- password_reuse_detection_manager_.OnPaste(std::move(text));
- +#endif // defined(SYNC_PASSWORD_REUSE_DETECTION_ENABLED)
- }
- -#endif
- +#endif // !defined(OS_ANDROID)
-
- gfx::RectF ChromePasswordManagerClient::GetBoundsInScreenSpace(
- const gfx::RectF& bounds) {
- --- a/chrome/browser/password_manager/chrome_password_manager_client.h
- +++ b/chrome/browser/password_manager/chrome_password_manager_client.h
- @@ -200,7 +200,7 @@ class ChromePasswordManagerClient
- void OnImeFinishComposingTextEvent() override;
- #endif // defined(OS_ANDROID)
-
- -#if defined(ON_FOCUS_PING_ENABLED)
- +#if defined(ON_FOCUS_PING_ENABLED) && BUILDFLAG(FULL_SAFE_BROWSING)
- void CheckSafeBrowsingReputation(const GURL& form_action,
- const GURL& frame_url) override;
- safe_browsing::PasswordProtectionService* GetPasswordProtectionService()
- --- a/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc
- +++ b/chrome/browser/permissions/contextual_notification_permission_ui_selector.cc
- @@ -18,12 +18,10 @@
- #include "chrome/browser/permissions/quiet_notification_permission_ui_config.h"
- #include "chrome/browser/permissions/quiet_notification_permission_ui_state.h"
- #include "chrome/browser/profiles/profile.h"
- -#include "chrome/browser/safe_browsing/safe_browsing_service.h"
- #include "chrome/common/chrome_features.h"
- #include "chrome/common/pref_names.h"
- #include "components/permissions/permission_request.h"
- #include "components/prefs/pref_service.h"
- -#include "components/safe_browsing/core/db/database_manager.h"
-
- namespace {
-
- @@ -114,50 +112,14 @@ void ContextualNotificationPermissionUiS
- Notify(UiToUse::kNormalUi, base::nullopt);
- return;
- }
- -
- - // Even if the quiet UI is enabled on all sites, the crowd deny trigger
- - // condition must be evaluated, so that the less prominent UI and the correct
- - // strings are shown on origins with crowd deny activated.
- - EvaluateCrowdDenyTrigger(url::Origin::Create(request->GetOrigin()));
- }
-
- void ContextualNotificationPermissionUiSelector::Cancel() {
- - // The computation either finishes synchronously above, or is waiting on the
- - // Safe Browsing check.
- - safe_browsing_request_.reset();
- }
-
- ContextualNotificationPermissionUiSelector::
- ~ContextualNotificationPermissionUiSelector() = default;
-
- -void ContextualNotificationPermissionUiSelector::EvaluateCrowdDenyTrigger(
- - url::Origin origin) {
- - if (!QuietNotificationPermissionUiConfig::IsCrowdDenyTriggeringEnabled()) {
- - OnCrowdDenyTriggerEvaluated(UiToUse::kNormalUi);
- - return;
- - }
- -
- - base::Optional<UiToUse> ui_to_use = GetUiToUseBasedOnSiteReputation(
- - CrowdDenyPreloadData::GetInstance()->GetReputationDataForSite(origin));
- - if (!ui_to_use || *ui_to_use == UiToUse::kNormalUi) {
- - OnCrowdDenyTriggerEvaluated(UiToUse::kNormalUi);
- - return;
- - }
- -
- - // PreloadData suggests a spammy site, ping safe browsing to verify.
- - DCHECK(!safe_browsing_request_);
- - DCHECK(g_browser_process->safe_browsing_service());
- -
- - // It is fine to use base::Unretained() here, as |safe_browsing_request_|
- - // guarantees not to fire the callback after its destruction.
- - safe_browsing_request_.emplace(
- - g_browser_process->safe_browsing_service()->database_manager(),
- - base::DefaultClock::GetInstance(), origin,
- - base::BindOnce(&ContextualNotificationPermissionUiSelector::
- - OnSafeBrowsingVerdictReceived,
- - base::Unretained(this)));
- -}
- -
- void ContextualNotificationPermissionUiSelector::OnSafeBrowsingVerdictReceived(
- CrowdDenySafeBrowsingRequest::Verdict verdict) {
- DCHECK(safe_browsing_request_);
- --- a/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop.cc
- +++ b/chrome/browser/ui/tab_contents/chrome_web_contents_view_handle_drop.cc
- @@ -78,33 +78,8 @@ void HandleOnPerformDrop(
- content::WebContents* web_contents,
- const content::DropData& drop_data,
- content::WebContentsViewDelegate::DropCompletionCallback callback) {
- - safe_browsing::DeepScanningDialogDelegate::Data data;
- - Profile* profile =
- - Profile::FromBrowserContext(web_contents->GetBrowserContext());
- - if (!safe_browsing::DeepScanningDialogDelegate::IsEnabled(
- - profile, web_contents->GetLastCommittedURL(), &data)) {
- - std::move(callback).Run(
- - content::WebContentsViewDelegate::DropCompletionResult::kContinue);
- - return;
- - }
- -
- - // Collect the data that needs to be scanned.
- - if (!drop_data.url_title.empty())
- - data.text.push_back(drop_data.url_title);
- - if (!drop_data.text.is_null())
- - data.text.push_back(drop_data.text.string());
- - if (!drop_data.html.is_null())
- - data.text.push_back(drop_data.html.string());
- - if (!drop_data.file_contents.empty())
- - data.text.push_back(base::UTF8ToUTF16(drop_data.file_contents));
- -
- - if (drop_data.filenames.empty()) {
- - ScanData(web_contents, std::move(callback), std::move(data));
- - } else {
- - base::ThreadPool::PostTaskAndReplyWithResult(
- - FROM_HERE, {base::TaskPriority::USER_VISIBLE, base::MayBlock()},
- - base::BindOnce(&GetPathsToScan, web_contents, std::move(drop_data),
- - std::move(data)),
- - base::BindOnce(&ScanData, web_contents, std::move(callback)));
- - }
- + // In the original code, this ran safe_browsing::DeepScanningDialogDelegate
- + // Instead, run the code under "if (!safe_browsing::DeepScanningDialogDelegate::IsEnabled(...)) ..."
- + std::move(callback).Run(
- + content::WebContentsViewDelegate::DropCompletionResult::kContinue);
- }
- --- a/chrome/browser/ui/views/download/download_item_view.cc
- +++ b/chrome/browser/ui/views/download/download_item_view.cc
- @@ -1306,6 +1306,7 @@ void DownloadItemView::ShowDeepScanningD
- },
- base::Unretained(this))));
-
- +#if BUILDFLAG(FULL_SAFE_BROWSING)
- int delay_delivery = g_browser_process->local_state()->GetInteger(
- prefs::kDelayDeliveryUntilVerdict);
- if (delay_delivery != safe_browsing::DELAY_DOWNLOADS &&
- @@ -1317,6 +1318,9 @@ void DownloadItemView::ShowDeepScanningD
- } else {
- open_button_->SetEnabled(false);
- }
- +#else
- + open_button_->SetEnabled(false);
- +#endif // BUILDFLAG(FULL_SAFE_BROWSING)
-
- file_name_label_->SetVisible(false);
- status_label_->SetVisible(false);
- @@ -1627,7 +1631,9 @@ base::string16 DownloadItemView::ElidedF
- }
-
- void DownloadItemView::OpenDownloadDuringAsyncScanning() {
- +#if BUILDFLAG(FULL_SAFE_BROWSING)
- model_->CompleteSafeBrowsingScan();
- +#endif
- model_->SetOpenWhenComplete(true);
- }
-
- --- a/chrome/browser/ui/views/safe_browsing/password_reuse_modal_warning_dialog.cc
- +++ b/chrome/browser/ui/views/safe_browsing/password_reuse_modal_warning_dialog.cc
- @@ -184,10 +184,7 @@ PasswordReuseModalWarningDialog::Passwor
- placeholder_offsets);
- } else {
- views::Label* message_body_label = CreateMessageBodyLabel(
- - service_
- - ? service_->GetWarningDetailText(password_type,
- - &placeholder_offsets)
- - : l10n_util::GetStringUTF16(IDS_PAGE_INFO_CHANGE_PASSWORD_DETAILS));
- + l10n_util::GetStringUTF16(IDS_PAGE_INFO_CHANGE_PASSWORD_DETAILS));
- CreateGaiaPasswordReuseModalWarningDialog(message_body_label);
- }
- modal_construction_start_time_ = base::TimeTicks::Now();
- --- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
- +++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
- @@ -83,8 +83,6 @@
- #include "components/nacl/common/buildflags.h"
- #include "components/prefs/pref_service.h"
- #include "components/safe_browsing/buildflags.h"
- -#include "components/safe_browsing/content/web_ui/safe_browsing_ui.h"
- -#include "components/safe_browsing/core/web_ui/constants.h"
- #include "components/security_interstitials/content/connection_help_ui.h"
- #include "components/security_interstitials/content/known_interception_disclosure_ui.h"
- #include "components/security_interstitials/content/urls.h"
- @@ -444,8 +442,6 @@ WebUIFactoryFunction GetWebUIFactoryFunc
- return &NewWebUI<PredictorsUI>;
- if (url.host_piece() == chrome::kChromeUIQuotaInternalsHost)
- return &NewWebUI<QuotaInternalsUI>;
- - if (url.host_piece() == safe_browsing::kChromeUISafeBrowsingHost)
- - return &NewWebUI<safe_browsing::SafeBrowsingUI>;
- if (url.host_piece() == chrome::kChromeUISignInInternalsHost)
- return &NewWebUI<SignInInternalsUI>;
- if (url.host_piece() == chrome::kChromeUISuggestionsHost)
- --- a/components/password_manager/content/browser/content_password_manager_driver.cc
- +++ b/components/password_manager/content/browser/content_password_manager_driver.cc
- @@ -310,7 +310,7 @@ void ContentPasswordManagerDriver::ShowT
- void ContentPasswordManagerDriver::CheckSafeBrowsingReputation(
- const GURL& form_action,
- const GURL& frame_url) {
- -#if defined(ON_FOCUS_PING_ENABLED)
- +#if defined(ON_FOCUS_PING_ENABLED) && BUILDFLAG(FULL_SAFE_BROWSING)
- client_->CheckSafeBrowsingReputation(form_action, frame_url);
- #endif
- }
- --- a/components/password_manager/core/browser/password_manager_client.h
- +++ b/components/password_manager/core/browser/password_manager_client.h
- @@ -310,7 +310,7 @@ class PasswordManagerClient {
- // Returns the current best guess as to the page's display language.
- virtual std::string GetPageLanguage() const;
-
- -#if defined(ON_FOCUS_PING_ENABLED)
- +#if defined(ON_FOCUS_PING_ENABLED) && BUILDFLAG(FULL_SAFE_BROWSING)
- // Return the PasswordProtectionService associated with this instance.
- virtual safe_browsing::PasswordProtectionService*
- GetPasswordProtectionService() const = 0;
- --- a/components/safe_browsing/content/common/safe_browsing.mojom
- +++ b/components/safe_browsing/content/common/safe_browsing.mojom
- @@ -117,7 +117,6 @@ enum PhishingDetectorResult {
- INVALID_SCORE = 4,
- };
-
- -[EnableIf=full_safe_browsing]
- interface PhishingDetector {
- // Tells the renderer to begin phishing detection for the given toplevel URL
- // which it has started loading. Returns the serialized request proto and a
- --- a/content/browser/native_file_system/native_file_system_file_writer_impl.cc
- +++ b/content/browser/native_file_system/native_file_system_file_writer_impl.cc
- @@ -94,8 +94,7 @@ NativeFileSystemFileWriterImpl::NativeFi
- url,
- handle_state,
- /*is_directory=*/false),
- - swap_url_(swap_url),
- - has_transient_user_activation_(has_transient_user_activation) {
- + swap_url_(swap_url) {
- DCHECK_EQ(swap_url.type(), url.type());
- }
-
- @@ -303,51 +302,7 @@ void NativeFileSystemFileWriterImpl::Clo
- // swap file even if the writer was destroyed at that point.
- state_ = State::kClosePending;
-
- - if (!RequireAfterWriteCheck() || !manager()->permission_context()) {
- - DidPassAfterWriteCheck(std::move(callback));
- - return;
- - }
- -
- - ComputeHashForSwapFile(base::BindOnce(
- - &NativeFileSystemFileWriterImpl::DoAfterWriteCheck,
- - weak_factory_.GetWeakPtr(), swap_url().path(), std::move(callback)));
- -}
- -
- -// static
- -void NativeFileSystemFileWriterImpl::DoAfterWriteCheck(
- - base::WeakPtr<NativeFileSystemFileWriterImpl> file_writer,
- - const base::FilePath& swap_path,
- - NativeFileSystemFileWriterImpl::CloseCallback callback,
- - base::File::Error hash_result,
- - const std::string& hash,
- - int64_t size) {
- - if (!file_writer || hash_result != base::File::FILE_OK) {
- - // If writer was deleted, or calculating the hash failed try deleting the
- - // swap file and invoke the callback.
- - base::ThreadPool::PostTask(
- - FROM_HERE, {base::MayBlock()},
- - base::BindOnce(base::IgnoreResult(&base::DeleteFile), swap_path,
- - /*recursive=*/false));
- - std::move(callback).Run(native_file_system_error::FromStatus(
- - NativeFileSystemStatus::kOperationAborted,
- - "Failed to perform Safe Browsing check."));
- - return;
- - }
- -
- - DCHECK_CALLED_ON_VALID_SEQUENCE(file_writer->sequence_checker_);
- -
- - auto item = std::make_unique<NativeFileSystemWriteItem>();
- - item->target_file_path = file_writer->url().path();
- - item->full_path = file_writer->swap_url().path();
- - item->sha256_hash = hash;
- - item->size = size;
- - item->frame_url = file_writer->context().url;
- - item->has_user_gesture = file_writer->has_transient_user_activation_;
- - file_writer->manager()->permission_context()->PerformAfterWriteChecks(
- - std::move(item), file_writer->context().process_id,
- - file_writer->context().frame_id,
- - base::BindOnce(&NativeFileSystemFileWriterImpl::DidAfterWriteCheck,
- - file_writer, swap_path, std::move(callback)));
- + DidPassAfterWriteCheck(std::move(callback));
- }
-
- // static
- --- a/content/browser/native_file_system/native_file_system_file_writer_impl.h
- +++ b/content/browser/native_file_system/native_file_system_file_writer_impl.h
- @@ -80,15 +80,8 @@ class CONTENT_EXPORT NativeFileSystemFil
- bool complete);
- void TruncateImpl(uint64_t length, TruncateCallback callback);
- void CloseImpl(CloseCallback callback);
- - // The following two methods are static, because they need to be invoked to
- + // The following method is static because they need to be invoked to
- // perform cleanup even if the writer was deleted before they were invoked.
- - static void DoAfterWriteCheck(
- - base::WeakPtr<NativeFileSystemFileWriterImpl> file_writer,
- - const base::FilePath& swap_path,
- - NativeFileSystemFileWriterImpl::CloseCallback callback,
- - base::File::Error hash_result,
- - const std::string& hash,
- - int64_t size);
- static void DidAfterWriteCheck(
- base::WeakPtr<NativeFileSystemFileWriterImpl> file_writer,
- const base::FilePath& swap_path,
- @@ -101,7 +94,7 @@ class CONTENT_EXPORT NativeFileSystemFil
-
- // After write checks only apply to native local paths.
- bool RequireAfterWriteCheck() const {
- - return url().type() == storage::kFileSystemTypeNativeLocal;
- + return false;
- }
-
- // Quarantine checks only apply to native local paths.
- @@ -141,10 +134,6 @@ class CONTENT_EXPORT NativeFileSystemFil
-
- bool skip_quarantine_check_for_testing_ = false;
-
- - // Keeps track of user activation state at creation time for after write
- - // checks.
- - bool has_transient_user_activation_ = false;
- -
- base::WeakPtr<NativeFileSystemHandleBase> AsWeakPtr() override;
-
- base::WeakPtrFactory<NativeFileSystemFileWriterImpl> weak_factory_{this};
- --- a/content/public/browser/native_file_system_permission_context.h
- +++ b/content/public/browser/native_file_system_permission_context.h
- @@ -100,13 +100,6 @@ class NativeFileSystemPermissionContext
- base::OnceCallback<void(SensitiveDirectoryResult)> callback) = 0;
-
- enum class AfterWriteCheckResult { kAllow, kBlock };
- - // Runs a recently finished write operation through checks such as malware
- - // or other security checks to determine if the write should be allowed.
- - virtual void PerformAfterWriteChecks(
- - std::unique_ptr<NativeFileSystemWriteItem> item,
- - int process_id,
- - int frame_id,
- - base::OnceCallback<void(AfterWriteCheckResult)> callback) = 0;
-
- // Returns whether the give |origin| already allows write permission, or it is
- // possible to request one. This is used to block save file dialogs from being
|