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

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

Issue 7017028: Revert "Revert 85330 - GTK: Bring global menu out of about:flags." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 7 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/global_bookmark_menu.cc ('k') | chrome/browser/ui/gtk/global_history_menu.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/global_history_menu.h
diff --git a/chrome/browser/ui/gtk/global_history_menu.h b/chrome/browser/ui/gtk/global_history_menu.h
index ca2d1e1738a5ee929a56b4ff1d53ed8c9df6d3dc..0959fc2617d168b63d73818792636bedaa239f4e 100644
--- a/chrome/browser/ui/gtk/global_history_menu.h
+++ b/chrome/browser/ui/gtk/global_history_menu.h
@@ -11,6 +11,8 @@
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/sessions/tab_restore_service_observer.h"
+#include "chrome/browser/ui/gtk/global_menu_owner.h"
+#include "chrome/browser/ui/gtk/owned_widget_gtk.h"
#include "content/browser/cancelable_request.h"
#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
@@ -25,7 +27,8 @@ class TopSites;
typedef struct _GdkPixbuf GdkPixbuf;
// Controls the History menu.
-class GlobalHistoryMenu : public NotificationObserver,
+class GlobalHistoryMenu : public GlobalMenuOwner,
+ public NotificationObserver,
public TabRestoreServiceObserver {
public:
explicit GlobalHistoryMenu(Browser* browser);
@@ -33,7 +36,7 @@ class GlobalHistoryMenu : public NotificationObserver,
// Takes the history menu we need to modify based on the tab restore/most
// visited state.
- void Init(GtkWidget* history_menu);
+ virtual void Init(GtkWidget* history_menu, GtkWidget* history_menu_item);
private:
class HistoryItem;
@@ -100,20 +103,26 @@ class GlobalHistoryMenu : public NotificationObserver,
CHROMEGTK_CALLBACK_0(GlobalHistoryMenu, void, OnRecentlyClosedItemActivated);
+ // Listen for the first menu show command so we can then connect to the
+ // TabRestoreService. With how the global menus work, I'd prefer to register
+ // with the TabRestoreService as soon as we're constructed, but this breaks
+ // unit tests which test the service (because they force different
+ // construction ordering while us connecting to the TabRestoreService loads
+ // data now!)
+ CHROMEGTK_CALLBACK_0(GlobalHistoryMenu, void, OnMenuActivate);
+
Browser* browser_;
Profile* profile_;
+ // The history menu. We keep this since we need to rewrite parts of it
+ // periodically.
+ OwnedWidgetGtk history_menu_;
+
history::TopSites* top_sites_;
CancelableRequestConsumer top_sites_consumer_;
- NotificationRegistrar registrar_;
-
GdkPixbuf* default_favicon_;
- // The history menu. We keep this since we need to rewrite parts of it
- // periodically.
- GtkWidget* history_menu_;
-
TabRestoreService* tab_restore_service_; // weak
// A mapping from GtkMenuItems to HistoryItems that maintain data.
@@ -121,6 +130,8 @@ class GlobalHistoryMenu : public NotificationObserver,
// Maps HistoryItems to favicon request Handles.
CancelableRequestConsumerTSimple<HistoryItem*> favicon_consumer_;
+
+ NotificationRegistrar registrar_;
};
#endif // CHROME_BROWSER_UI_GTK_GLOBAL_HISTORY_MENU_H_
« no previous file with comments | « chrome/browser/ui/gtk/global_bookmark_menu.cc ('k') | chrome/browser/ui/gtk/global_history_menu.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698