| Index: chrome/browser/gtk/tabs/tab_strip_gtk.cc
|
| diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
|
| index 2d80179ca728fb35477cb0cb7f91c73a3caf0b38..bdb526dea2535db0b3bb2e42c19d67f814a5871a 100644
|
| --- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc
|
| +++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
|
| @@ -467,6 +467,8 @@ void TabStripGtk::Init(int width, Profile* profile) {
|
| G_CALLBACK(OnExpose), this);
|
| g_signal_connect(G_OBJECT(tabstrip_.get()), "size-allocate",
|
| G_CALLBACK(OnSizeAllocate), this);
|
| + g_signal_connect(G_OBJECT(tabstrip_.get()), "button-press-event",
|
| + G_CALLBACK(OnButtonPress), this);
|
|
|
| newtab_button_.reset(MakeNewTabButton());
|
|
|
| @@ -1089,6 +1091,15 @@ void TabStripGtk::OnSizeAllocate(GtkWidget* widget, GtkAllocation* allocation,
|
| }
|
|
|
| // static
|
| +gboolean TabStripGtk::OnButtonPress(GtkWidget* widget, GdkEventButton* event,
|
| + TabStripGtk* tabstrip) {
|
| + if (3 == event->button)
|
| + tabstrip->ShowContextMenu();
|
| +
|
| + return TRUE;
|
| +}
|
| +
|
| +// static
|
| void TabStripGtk::OnNewTabClicked(GtkWidget* widget, TabStripGtk* tabstrip) {
|
| tabstrip->model_->delegate()->AddBlankTab(true);
|
| }
|
| @@ -1115,3 +1126,61 @@ CustomDrawButton* TabStripGtk::MakeNewTabButton() {
|
|
|
| return button;
|
| }
|
| +
|
| +void TabStripGtk::ShowContextMenu() {
|
| + if (!context_menu_.get()) {
|
| + context_menu_.reset(new MenuGtk(this, false));
|
| + context_menu_->AppendMenuItemWithLabel(
|
| + TabStripModel::CommandNewTab,
|
| + l10n_util::GetStringUTF8(IDS_TAB_CXMENU_NEWTAB));
|
| + context_menu_->AppendMenuItemWithLabel(
|
| + TabStripModel::CommandRestoreTab,
|
| + l10n_util::GetStringUTF8(IDS_RESTORE_TAB));
|
| +
|
| + context_menu_->AppendSeparator();
|
| +
|
| + context_menu_->AppendMenuItemWithLabel(
|
| + TabStripModel::CommandTaskManager,
|
| + l10n_util::GetStringUTF8(IDS_TASK_MANAGER));
|
| + }
|
| +
|
| + context_menu_->PopupAsContext(gtk_get_current_event_time());
|
| +}
|
| +
|
| +bool TabStripGtk::IsCommandEnabled(int command_id) const {
|
| + switch (command_id) {
|
| + case TabStripModel::CommandNewTab:
|
| + return true;
|
| +
|
| + case TabStripModel::CommandRestoreTab:
|
| + return model_->delegate()->CanRestoreTab();
|
| +
|
| + case TabStripModel::CommandTaskManager:
|
| + // TODO(tc): This needs to be implemented in the TabStripModelDelegate.
|
| + return false;
|
| +
|
| + default:
|
| + NOTREACHED();
|
| + }
|
| + return false;
|
| +}
|
| +
|
| +void TabStripGtk::ExecuteCommand(int command_id) {
|
| + switch (command_id) {
|
| + case TabStripModel::CommandNewTab:
|
| + model_->delegate()->AddBlankTab(true);
|
| + break;
|
| +
|
| + case TabStripModel::CommandRestoreTab:
|
| + model_->delegate()->RestoreTab();
|
| + break;
|
| +
|
| + case TabStripModel::CommandTaskManager:
|
| + // TODO(tc): This needs to be implemented in the TabStripModelDelegate.
|
| + NOTIMPLEMENTED();
|
| + break;
|
| +
|
| + default:
|
| + NOTREACHED();
|
| + }
|
| +}
|
|
|