Skip to content

Commit

Permalink
[M102] Appropriately handle the "Open now" button for deep scanning.
Browse files Browse the repository at this point in the history
Currently the "Open now" button doesn't update the state of the download
(see screen record http://shortn/_4ImCfguWXO).

Let DownloadCommands handles the press event from the "Open now" button.
Since the button can be clicked while scanning is in progress (and it's
not considered dangerous at this point), return early when executing the
command when the download state is DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING.

(cherry picked from commit 9164d05)

Bug: 1311867
Change-Id: I1b6a3631836b8f678d38662b79f304dbb300a30c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3588795
Reviewed-by: David Trainor <dtrainor@chromium.org>
Reviewed-by: Daniel Rubery <drubery@chromium.org>
Reviewed-by: Rohit Bhatia <bhatiarohit@google.com>
Commit-Queue: Xinghui Lu <xinghuilu@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#994455}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3601428
Auto-Submit: Xinghui Lu <xinghuilu@chromium.org>
Commit-Queue: David Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/branch-heads/5005@{#112}
Cr-Branched-From: 5b4d945-refs/heads/main@{#992738}
  • Loading branch information
Xinghui Lu authored and Chromium LUCI CQ committed Apr 22, 2022
1 parent 5b0aea4 commit 169d333
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 1 addition & 4 deletions chrome/browser/download/bubble/download_bubble_controller.cc
Expand Up @@ -323,14 +323,11 @@ void DownloadBubbleUIController::ProcessDownloadButtonPress(
case DownloadCommands::DISCARD:
ProcessDownloadWarningButtonPress(model, command);
break;
case DownloadCommands::BYPASS_DEEP_SCANNING:
model->CompleteSafeBrowsingScan();
model->SetOpenWhenComplete(true);
break;
case DownloadCommands::CANCEL:
RemoveContentIdFromPartialView(model->GetContentId());
[[fallthrough]];
case DownloadCommands::DEEP_SCAN:
case DownloadCommands::BYPASS_DEEP_SCANNING:
commands.ExecuteCommand(command);
break;
default:
Expand Down
4 changes: 4 additions & 0 deletions chrome/browser/download/download_item_model.cc
Expand Up @@ -718,6 +718,7 @@ void DownloadItemModel::ExecuteCommand(DownloadCommands* download_commands,
case DownloadCommands::BYPASS_DEEP_SCANNING:
#if BUILDFLAG(FULL_SAFE_BROWSING)
CompleteSafeBrowsingScan();
SetOpenWhenComplete(true);
#endif
[[fallthrough]];
case DownloadCommands::KEEP:
Expand All @@ -731,6 +732,9 @@ void DownloadItemModel::ExecuteCommand(DownloadCommands* download_commands,
download_->ValidateMixedContentDownload();
break;
}
if (GetDangerType() == download::DOWNLOAD_DANGER_TYPE_ASYNC_SCANNING) {
break;
}
DCHECK(IsDangerous());
// Only sends uncommon download accept report if :
// 1. FULL_SAFE_BROWSING is enabled, and
Expand Down

0 comments on commit 169d333

Please sign in to comment.