Chromium Code Reviews| 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 f60424a4e1b14b7c3968ceeffb6c5f5a96cf0c69..70b82af7e48794b93c2c21c0937fb47e4d277bb5 100644 |
| --- a/chrome/browser/ui/views/download/download_shelf_view.cc |
| +++ b/chrome/browser/ui/views/download/download_shelf_view.cc |
| @@ -15,6 +15,7 @@ |
| #include "chrome/browser/ui/views/download/download_item_view.h" |
| #include "chrome/browser/ui/views/frame/browser_view.h" |
| #include "content/browser/download/download_item.h" |
| +#include "content/browser/download/download_stats.h" |
| #include "content/browser/download/download_manager.h" |
| #include "content/browser/tab_contents/navigation_entry.h" |
| #include "grit/generated_resources.h" |
| @@ -87,6 +88,7 @@ int CenterPosition(int size, int target_size) { |
| DownloadShelfView::DownloadShelfView(Browser* browser, BrowserView* parent) |
| : browser_(browser), |
| parent_(parent), |
| + auto_closed_(false), |
| ALLOW_THIS_IN_INITIALIZER_LIST( |
| mouse_watcher_(this, this, gfx::Insets())) { |
| mouse_watcher_.set_notify_on_exit_time_ms(kNotifyOnExitTimeMS); |
| @@ -152,6 +154,7 @@ void DownloadShelfView::AddDownload(BaseDownloadItemModel* download_model) { |
| } |
| void DownloadShelfView::MouseMovedOutOfView() { |
| + auto_closed_ = true; |
|
Randy Smith (Not in Mondays)
2011/10/04 18:34:31
This seems weird to me. Are you sure? Two concer
benjhayden
2011/10/06 21:25:16
Done.
|
| Close(); |
| } |
| @@ -383,6 +386,13 @@ void DownloadShelfView::Show() { |
| } |
| void DownloadShelfView::Close() { |
| + int num_pending = 0; |
| + for (size_t i = 0; i < download_views_.size(); ++i) { |
| + if (download_views_[i]->download()->IsInProgress()) |
| + ++num_pending; |
| + } |
| + download_stats::RecordShelfClose( |
| + download_views_.size(), num_pending, auto_closed_); |
| parent_->SetDownloadShelfVisible(false); |
| shelf_animation_->Hide(); |
| } |