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

Unified Diff: chrome/browser/views/download_shelf_view.h

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/views/download_shelf_view.h
diff --git a/chrome/browser/views/download_shelf_view.h b/chrome/browser/views/download_shelf_view.h
index 83fab7c8a1963c5ddf19309a864d2ed48e78c3e9..db7e53e062ba517106e66e29a611e5086503db00 100644
--- a/chrome/browser/views/download_shelf_view.h
+++ b/chrome/browser/views/download_shelf_view.h
@@ -10,6 +10,7 @@
#include "chrome/browser/download/download_shelf.h"
#include "views/controls/button/button.h"
#include "views/controls/link.h"
+#include "views/mouse_watcher.h"
namespace views {
class ImageButton;
@@ -28,15 +29,19 @@ class DownloadItemView;
//
// DownloadShelfView does not hold an infinite number of download views, rather
// it'll automatically remove views once a certain point is reached.
-class DownloadShelfView : public DownloadShelf,
- public views::View,
+class DownloadShelfView : public AnimationDelegate,
+ public DownloadShelf,
public views::ButtonListener,
public views::LinkController,
- public AnimationDelegate {
+ public views::MouseWatcherListener,
+ public views::View {
public:
DownloadShelfView(Browser* browser, BrowserView* parent);
virtual ~DownloadShelfView();
+ // Sent from the DownloadItemView when the user opens an item.
+ void OpenedDownload(DownloadItemView* view);
+
// Implementation of View.
virtual gfx::Size GetPreferredSize();
virtual void Layout();
@@ -63,6 +68,9 @@ class DownloadShelfView : public DownloadShelf,
virtual void Close();
virtual Browser* browser() const { return browser_; }
+ // Implementation of MouseWatcherDelegate.
+ virtual void MouseMovedOutOfView();
+
// Removes a specified download view. The supplied view is deleted after
// it's removed.
void RemoveDownloadView(views::View* view);
@@ -90,6 +98,10 @@ class DownloadShelfView : public DownloadShelf,
// Called when the "close shelf" animation ended.
void Closed();
+ // Returns true if we can auto close. We can auto-close if all the items on
+ // the shelf have been opened.
+ bool CanAutoClose();
+
// The browser for this shelf.
Browser* browser_;
@@ -117,6 +129,8 @@ class DownloadShelfView : public DownloadShelf,
// The window this shelf belongs to.
BrowserView* parent_;
+ views::MouseWatcher mouse_watcher_;
+
DISALLOW_COPY_AND_ASSIGN(DownloadShelfView);
};

Powered by Google App Engine
This is Rietveld 408576698