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

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: Implement a separate callbacks flow for 'shown in shell' event to not mix with 'opened' Created 6 years, 7 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 2be559bf5be777c72f4bb051e277ee422ab059bb..07f6f3d413814f8e6b6cdac403f80735f15f03e3 100644
--- a/chrome/browser/ui/views/download/download_shelf_view.cc
+++ b/chrome/browser/ui/views/download/download_shelf_view.cc
@@ -161,6 +161,11 @@ void DownloadShelfView::OpenedDownload(DownloadItemView* view) {
mouse_watcher_.Start();
}
+void DownloadShelfView::ShownDownload(DownloadItemView* view) {
asanka 2014/05/14 18:40:59 Shall we rename this DownloadShown and also rename
DukeXar 2014/06/06 15:07:13 Renamed to match observer methods. Done.
+ if (CanAutoClose())
+ mouse_watcher_.Start();
+}
+
content::PageNavigator* DownloadShelfView::GetNavigator() {
return browser_;
}
@@ -409,6 +414,7 @@ void DownloadShelfView::Closed() {
// 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);
+ download->SetShownWhenComplete(true);
++i;
}
}
@@ -416,7 +422,8 @@ void DownloadShelfView::Closed() {
bool DownloadShelfView::CanAutoClose() {
for (size_t i = 0; i < download_views_.size(); ++i) {
- if (!download_views_[i]->download()->GetOpened())
+ const content::DownloadItem * download = download_views_[i]->download();
+ if (!download->GetOpened() && !download->GetShownWhenComplete())
return false;
}
return true;

Powered by Google App Engine
This is Rietveld 408576698