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

Unified Diff: chrome/browser/ui/gtk/download_shelf_gtk.h

Issue 6249022: Make the gtk download shelf autoclose on mouse out. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fewer changes Created 9 years, 11 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
« no previous file with comments | « chrome/browser/ui/gtk/download_item_gtk.cc ('k') | chrome/browser/ui/gtk/download_shelf_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/download_shelf_gtk.h
diff --git a/chrome/browser/ui/gtk/download_shelf_gtk.h b/chrome/browser/ui/gtk/download_shelf_gtk.h
index aee06291294263a644302b226607140b0d2504ce..d760f891077c7d0c219c12c1a46b5c95099a1331 100644
--- a/chrome/browser/ui/gtk/download_shelf_gtk.h
+++ b/chrome/browser/ui/gtk/download_shelf_gtk.h
@@ -10,6 +10,7 @@
#include <vector>
+#include "base/message_loop.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/download/download_shelf.h"
#include "chrome/browser/ui/gtk/owned_widget_gtk.h"
@@ -26,9 +27,14 @@ class DownloadItemGtk;
class GtkThemeProvider;
class SlideAnimatorGtk;
+namespace gfx {
+class Point;
+}
+
class DownloadShelfGtk : public DownloadShelf,
public NotificationObserver,
- public SlideAnimatorGtk::Delegate {
+ public SlideAnimatorGtk::Delegate,
+ public MessageLoopForUI::Observer {
public:
explicit DownloadShelfGtk(Browser* browser, gfx::NativeView view);
@@ -53,6 +59,10 @@ class DownloadShelfGtk : public DownloadShelf,
// Returns the current height of the shelf.
int GetHeight() const;
+ // MessageLoop::Observer implementation:
+ virtual void WillProcessEvent(GdkEvent* event);
+ virtual void DidProcessEvent(GdkEvent* event);
+
private:
// Remove |download_item| from the download shelf and delete it.
void RemoveDownloadItem(DownloadItemGtk* download_item);
@@ -65,6 +75,29 @@ class DownloadShelfGtk : public DownloadShelf,
// size is changed.
void MaybeShowMoreDownloadItems();
+ // Checks that all download items have been opened, and sets the auto-close
+ // state of the shelf if so.
+ void AutoCloseIfPossible();
+
+ // Cancels the auto-close state set by AutoCloseIfPossible, including any
+ // pending close tasks that have already been posted.
+ void CancelAutoClose();
+
+ // A download item has been opened. It might be possible to automatically
+ // close now.
+ void ItemOpened();
+
+ // Sets whether the shelf should automatically close.
+ void SetCloseOnMouseOut(bool close);
+
+ // Returns whether the given point is within the "zone" of the shelf, which is
+ // the shelf and a band of 40 pixels on the top of it.
+ bool IsCursorInShelfZone(const gfx::Point& cursor_screen_coords);
+
+ // Synthesized enter-notify and leave-notify events for the shelf's "zone".
+ void MouseLeftShelf();
+ void MouseEnteredShelf();
+
CHROMEGTK_CALLBACK_0(DownloadShelfGtk, void, OnButtonClick);
// The browser that owns this download shelf.
@@ -103,6 +136,15 @@ class DownloadShelfGtk : public DownloadShelf,
NotificationRegistrar registrar_;
+ // True if the shelf will automatically close when the user mouses out.
+ bool close_on_mouse_out_;
+
+ // True if the mouse is within the shelf's bounds, as of the last mouse event
+ // we received.
+ bool mouse_in_shelf_;
+
+ ScopedRunnableMethodFactory<DownloadShelfGtk> auto_close_factory_;
+
friend class DownloadItemGtk;
};
« no previous file with comments | « chrome/browser/ui/gtk/download_item_gtk.cc ('k') | chrome/browser/ui/gtk/download_shelf_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698