diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-05 20:50:44 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-05 20:50:44 +0000 |
commit | b2cc43523f7bb309cecd6071de51a1677e5d15cf (patch) | |
tree | f35c93b5d7cdd95877f86f30cca96738856b7236 /chrome/browser/gtk/download_shelf_gtk.cc | |
parent | bef76ead355bfb64d93336a548b8b16602a853c1 (diff) | |
download | chromium_src-b2cc43523f7bb309cecd6071de51a1677e5d15cf.zip chromium_src-b2cc43523f7bb309cecd6071de51a1677e5d15cf.tar.gz chromium_src-b2cc43523f7bb309cecd6071de51a1677e5d15cf.tar.bz2 |
Linux download shelf: remove download items when the associated download is removed.
BUG=11381
TEST=in opt mode: download something, go to downloads tab, clear all, go back to tab with downloaded item. The shelf should be gone.
Review URL: http://codereview.chromium.org/100366
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15335 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/download_shelf_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/download_shelf_gtk.cc | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/chrome/browser/gtk/download_shelf_gtk.cc b/chrome/browser/gtk/download_shelf_gtk.cc index b476508..31d99dd 100644 --- a/chrome/browser/gtk/download_shelf_gtk.cc +++ b/chrome/browser/gtk/download_shelf_gtk.cc @@ -130,8 +130,7 @@ DownloadShelfGtk::~DownloadShelfGtk() { } void DownloadShelfGtk::AddDownload(BaseDownloadItemModel* download_model_) { - download_items_.push_back(new DownloadItemGtk(download_model_, hbox_, - link_hbox_)); + download_items_.push_back(new DownloadItemGtk(this, download_model_)); slide_widget_->Open(); } @@ -139,6 +138,27 @@ bool DownloadShelfGtk::IsShowing() const { return slide_widget_->IsShowing(); } +void DownloadShelfGtk::RemoveDownloadItem(DownloadItemGtk* download_item) { + DCHECK(download_item); + std::vector<DownloadItemGtk*>::iterator i = + find(download_items_.begin(), download_items_.end(), download_item); + DCHECK(i != download_items_.end()); + download_items_.erase(i); + delete download_item; + if (download_items_.empty()) { + slide_widget_->CloseWithoutAnimation(); + tab_contents_->SetDownloadShelfVisible(false); + } +} + +GtkWidget* DownloadShelfGtk::GetRightBoundingWidget() const { + return link_hbox_; +} + +GtkWidget* DownloadShelfGtk::GetHBox() const { + return hbox_; +} + // static void DownloadShelfGtk::OnButtonClick(GtkWidget* button, DownloadShelfGtk* shelf) { |