-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[M112][DownloadBubble] Pop partial view when item viewed in main view…
… finishes This CL marks the item as "actioned on" only if it is finished when viewed in the main view. Previously, opening the main view with an ongoing download would mark that downloads as "actioned on", so it would not pop the partial bubble upon completion. This is bad because the user might forget about a large download. After this change, if the item is still in progress when the main view is opened, it is not marked as "actioned on" and will still trigger the partial view upon completion (if there are no other in-progress downloads). (cherry picked from commit fcb377e) Bug: 1419000 Change-Id: I51057827f000fe12bfa0c2e31dda17b3bf9a8324 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4291368 Reviewed-by: Xinghui Lu <xinghuilu@chromium.org> Commit-Queue: Lily Chen <chlily@chromium.org> Cr-Original-Commit-Position: refs/heads/main@{#1109899} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4294542 Auto-Submit: Lily Chen <chlily@chromium.org> Commit-Queue: Xinghui Lu <xinghuilu@chromium.org> Cr-Commit-Position: refs/branch-heads/5615@{#38} Cr-Branched-From: 9c6408e-refs/heads/main@{#1109224}
- Loading branch information
Showing
6 changed files
with
84 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
chrome/browser/download/bubble/download_bubble_ui_model_utils.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chrome/browser/download/bubble/download_bubble_ui_model_utils.h" | ||
|
||
#include "base/time/time.h" | ||
#include "chrome/browser/download/download_ui_model.h" | ||
|
||
bool DownloadUIModelIsRecent(const DownloadUIModel* model, | ||
base::Time cutoff_time) { | ||
return ((model->GetStartTime().is_null() && !model->IsDone()) || | ||
model->GetStartTime() > cutoff_time); | ||
} | ||
|
||
bool IsPendingDeepScanning(const DownloadUIModel* model) { | ||
return model->GetState() == download::DownloadItem::IN_PROGRESS && | ||
model->GetDangerType() == | ||
download::DOWNLOAD_DANGER_TYPE_PROMPT_FOR_SCANNING; | ||
} | ||
|
||
bool IsModelInProgress(const DownloadUIModel* model) { | ||
if (model->IsDangerous() && !IsPendingDeepScanning(model)) { | ||
return false; | ||
} | ||
return model->GetState() == download::DownloadItem::IN_PROGRESS; | ||
} |
24 changes: 24 additions & 0 deletions
24
chrome/browser/download/bubble/download_bubble_ui_model_utils.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROME_BROWSER_DOWNLOAD_BUBBLE_DOWNLOAD_BUBBLE_UI_MODEL_UTILS_H_ | ||
#define CHROME_BROWSER_DOWNLOAD_BUBBLE_DOWNLOAD_BUBBLE_UI_MODEL_UTILS_H_ | ||
|
||
#include "base/time/time.h" | ||
#include "chrome/browser/download/download_ui_model.h" | ||
|
||
// Whether the download is more recent than |cutoff_time|. | ||
bool DownloadUIModelIsRecent(const DownloadUIModel* model, | ||
base::Time cutoff_time); | ||
|
||
// Whether the download is in progress and pending deep scanning. | ||
bool IsPendingDeepScanning(const DownloadUIModel* model); | ||
|
||
// Whether the download is considered in-progress from the UI's point of view. | ||
// Consider dangerous downloads as completed, because we don't want to encourage | ||
// users to interact with them. However, consider downloads pending scanning as | ||
// in progress, because we do want users to scan potential dangerous downloads. | ||
bool IsModelInProgress(const DownloadUIModel* model); | ||
|
||
#endif // CHROME_BROWSER_DOWNLOAD_BUBBLE_DOWNLOAD_BUBBLE_UI_MODEL_UTILS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters