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

Unified Diff: chrome/browser/download/download_item.cc

Issue 3177034: Makes the download shelf auto-close after the user opens all downloads (Closed)
Patch Set: Have OnDownloadOpened invoked before opened to match old behavior Created 10 years, 4 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/download/download_item.cc
diff --git a/chrome/browser/download/download_item.cc b/chrome/browser/download/download_item.cc
index c05823a65171623ea0c6acbc8019f05716b66a16..48538fc5281aa11c8d642c1ec44e4f576750dc7f 100644
--- a/chrome/browser/download/download_item.cc
+++ b/chrome/browser/download/download_item.cc
@@ -63,7 +63,8 @@ DownloadItem::DownloadItem(DownloadManager* download_manager,
is_extension_install_(info.is_extension_install),
name_finalized_(false),
is_temporary_(false),
- need_final_rename_(false) {
+ need_final_rename_(false),
+ opened_(false) {
if (state_ == IN_PROGRESS)
state_ = CANCELLED;
Init(false /* don't start progress timer */);
@@ -99,7 +100,8 @@ DownloadItem::DownloadItem(DownloadManager* download_manager,
is_extension_install_(info.is_extension_install),
name_finalized_(false),
is_temporary_(!info.save_info.file_path.empty()),
- need_final_rename_(false) {
+ need_final_rename_(false),
+ opened_(false) {
Init(true /* start progress timer */);
}
@@ -134,7 +136,8 @@ DownloadItem::DownloadItem(DownloadManager* download_manager,
is_extension_install_(false),
name_finalized_(false),
is_temporary_(false),
- need_final_rename_(false) {
+ need_final_rename_(false),
+ opened_(false) {
Init(true /* start progress timer */);
}
@@ -180,11 +183,15 @@ void DownloadItem::OpenDownload() {
if (state() == DownloadItem::IN_PROGRESS) {
open_when_complete_ = !open_when_complete_;
} else if (state() == DownloadItem::COMPLETE) {
- FOR_EACH_OBSERVER(Observer, observers_, OnDownloadOpened(this));
download_manager_->OpenDownload(this, NULL);
}
}
+void DownloadItem::Opened() {
+ opened_ = true;
+ FOR_EACH_OBSERVER(Observer, observers_, OnDownloadOpened(this));
+}
+
void DownloadItem::ShowDownloadInShell() {
download_manager_->ShowDownloadInShell(this);
}

Powered by Google App Engine
This is Rietveld 408576698