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

Unified Diff: chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc

Issue 10561003: Implementaion for showing recently closed tabs list on right clicking new tab button. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 6 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/ui/gtk/tabs/tab_strip_gtk.cc
===================================================================
--- chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc (revision 141203)
+++ chrome/browser/ui/gtk/tabs/tab_strip_gtk.cc (working copy)
@@ -27,6 +27,7 @@
#include "chrome/browser/ui/gtk/tabs/dragged_tab_controller_gtk.h"
#include "chrome/browser/ui/gtk/tabs/tab_strip_menu_controller.h"
#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/browser/ui/tabs/recently_closed_tabs_menu_model.h"
#include "chrome/common/chrome_notification_types.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/web_contents.h"
@@ -2170,6 +2171,22 @@
return TRUE;
}
+void TabStripGtk::ShowRecentlyClosedTabsMenu(GtkWidget* widget,
+ int button, guint32 event_time) {
+ Browser* browser = window_->browser();
+ DCHECK(browser);
+ menu_model_.reset(new RecentlyClosedTabsMenuModel(browser));
+ menu_.reset(new MenuGtk(this, menu_model_.get()));
+ menu_->PopupForWidget(widget, button, event_time);
+}
+
+gboolean TabStripGtk::OnButtonPress(GtkWidget* widget,
+ GdkEventButton* event) {
+ if (event->button == 3)
+ ShowRecentlyClosedTabsMenu(widget, event->button, event->time);
+ return FALSE;
+}
+
void TabStripGtk::OnNewTabClicked(GtkWidget* widget) {
GdkEvent* event = gtk_get_current_event();
DCHECK_EQ(event->type, GDK_BUTTON_RELEASE);
@@ -2245,6 +2262,9 @@
gtk_widget_set_tooltip_text(button->widget(),
l10n_util::GetStringUTF8(IDS_TOOLTIP_NEW_TAB).c_str());
+ g_signal_connect(button->widget(), "button-press-event",
+ G_CALLBACK(OnButtonPressThunk), this);
+
// Let the middle mouse button initiate clicks as well.
gtk_util::SetButtonTriggersNavigation(button->widget());
g_signal_connect(button->widget(), "clicked",
@@ -2263,3 +2283,7 @@
SkBitmap* mask = theme_service_->GetBitmapNamed(IDR_NEWTAB_BUTTON_MASK);
newtab_button_->SetBackground(color, background, mask);
}
+
+bool TabStripGtk::AlwaysShowIconForCmd(int command_id) const {
+ return true;
+}
« no previous file with comments | « chrome/browser/ui/gtk/tabs/tab_strip_gtk.h ('k') | chrome/browser/ui/tabs/recently_closed_tabs_menu_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698