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

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: Move the 'user acted' flag into DownloadItemModelData and get rid of SetOpened/SetShown in Download… Created 6 years, 6 months 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 aa24d10423398ee6dc9555d8d6b2af2798cbc8a0..0ea9e08cd064c29ecbcdff3bc28023fb92e0c182 100644
--- a/chrome/browser/ui/views/download/download_shelf_view.cc
+++ b/chrome/browser/ui/views/download/download_shelf_view.cc
@@ -160,7 +160,12 @@ void DownloadShelfView::OnPaintBorder(gfx::Canvas* canvas) {
canvas->FillRect(gfx::Rect(0, 0, width(), 1), kBorderColor);
}
-void DownloadShelfView::OpenedDownload(DownloadItemView* view) {
+void DownloadShelfView::OnDownloadOpened(DownloadItemView* view) {
+ if (CanAutoClose())
+ mouse_watcher_.Start();
+}
+
+void DownloadShelfView::OnDownloadShown(DownloadItemView* view) {
if (CanAutoClose())
mouse_watcher_.Start();
}
@@ -410,9 +415,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
- // the user need not open this item for the shelf to auto-close.
- download->SetOpened(true);
+ // Treat the item as acted when we close. This way if we get shown again
+ // the user need not act on this item for the shelf to auto-close.
+ DownloadItemModel(download).SetUserActed(true);
++i;
}
}
@@ -420,7 +425,7 @@ 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()).GetUserActed())
return false;
}
return true;

Powered by Google App Engine
This is Rietveld 408576698