Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(512)

Unified Diff: chrome/browser/ui/views/download/download_shelf_view.cc

Issue 209613002: Download shelf autohides on showing in shell, just same as regular open Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added browser and unit tests. Renamed 'UserActed' to 'OpenedOrShown'. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/download/download_shelf_view.cc
diff --git a/chrome/browser/ui/views/download/download_shelf_view.cc b/chrome/browser/ui/views/download/download_shelf_view.cc
index c9fcae9bbb09732462db62f9bc763f054c699399..843a6934a634884f4da1c72e4e2386b4dcdecee0 100644
--- a/chrome/browser/ui/views/download/download_shelf_view.cc
+++ b/chrome/browser/ui/views/download/download_shelf_view.cc
@@ -195,9 +195,12 @@ void DownloadShelfView::OnPaintBorder(gfx::Canvas* canvas) {
canvas->FillRect(gfx::Rect(0, 0, width(), 1), kBorderColor);
}
-void DownloadShelfView::OpenedDownload() {
- if (CanAutoClose())
- mouse_watcher_.Start();
+void DownloadShelfView::OnDownloadOpened() {
+ TriggerAutoClose();
+}
+
+void DownloadShelfView::OnDownloadShown() {
+ TriggerAutoClose();
}
content::PageNavigator* DownloadShelfView::GetNavigator() {
@@ -404,9 +407,9 @@ void DownloadShelfView::Closed() {
if (is_transfer_done && !download->IsDangerous()) {
RemoveDownloadView(download_views_[i]);
} else {
- // Treat the item as opened when we close. This way if we get shown again
+ // Treat the item as acted when we close. This way if we get shown again
// the user need not open this item for the shelf to auto-close.
- download->SetOpened(true);
+ DownloadItemModel(download)->SetOpenedOrShown(true);
++i;
}
}
@@ -415,8 +418,13 @@ void DownloadShelfView::Closed() {
bool DownloadShelfView::CanAutoClose() {
for (size_t i = 0; i < download_views_.size(); ++i) {
- if (!download_views_[i]->download()->GetOpened())
+ if (DownloadItemModel(!download_views_[i]->download()).GetOpenedOrShown())
return false;
}
return true;
}
+
+void DownloadShelfView::TriggerAutoClose() {
+ if (CanAutoClose())
+ mouse_watcher_.Start();
+}
« no previous file with comments | « chrome/browser/ui/views/download/download_shelf_view.h ('k') | content/browser/download/download_item_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698