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

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

Issue 6933037: Multi-tab selection for Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removing unnecessary includes 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
Index: chrome/browser/ui/gtk/tabs/context_menu_controller.cc
diff --git a/chrome/browser/ui/gtk/tabs/context_menu_controller.cc b/chrome/browser/ui/gtk/tabs/context_menu_controller.cc
new file mode 100644
index 0000000000000000000000000000000000000000..364a1b4fef107862732b79da532604e21a4e79ff
--- /dev/null
+++ b/chrome/browser/ui/gtk/tabs/context_menu_controller.cc
@@ -0,0 +1,68 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/gtk/tabs/context_menu_controller.h"
+
+#include "chrome/browser/tabs/tab_strip_model.h"
+#include "chrome/browser/ui/gtk/accelerators_gtk.h"
+#include "chrome/browser/ui/gtk/menu_gtk.h"
+#include "chrome/browser/ui/gtk/tabs/tab_gtk.h"
+
+ContextMenuController::ContextMenuController(TabGtk* tab,
Evan Stade 2011/05/11 20:58:27 this class should probably be TabStripContextMenuC
dpapad 2011/05/11 23:30:20 Done.
+ TabStripModel* model,
+ int index)
+ : tab_(tab),
+ model_(this, model, index) {
+ menu_.reset(new MenuGtk(this, &model_));
+}
+
+void ContextMenuController::RunMenu(const gfx::Point& point,
+ guint32 event_time) {
+ menu_->PopupAsContext(point, event_time);
+}
+
+void ContextMenuController::Cancel() {
+ tab_ = NULL;
+ menu_->Cancel();
+}
+
+bool ContextMenuController::IsCommandIdChecked(int command_id) const {
+ return false;
+}
+
+bool ContextMenuController::IsCommandIdEnabled(int command_id) const {
+ return tab_ && tab_->delegate()->IsCommandEnabledForTab(
+ static_cast<TabStripModel::ContextMenuCommand>(command_id),
+ tab_);
+}
+
+bool ContextMenuController::GetAcceleratorForCommandId(
+ int command_id,
+ ui::Accelerator* accelerator) {
+ int browser_command;
+ if (!TabStripModel::ContextMenuCommandToBrowserCommand(command_id,
+ &browser_command))
+ return false;
+ const ui::AcceleratorGtk* accelerator_gtk =
+ AcceleratorsGtk::GetInstance()->GetPrimaryAcceleratorForCommand(
+ browser_command);
+ if (accelerator_gtk)
+ *accelerator = *accelerator_gtk;
+ return !!accelerator_gtk;
+}
+
+void ContextMenuController::ExecuteCommand(int command_id) {
+ if (!tab_)
Evan Stade 2011/05/11 20:58:27 when would this be null?
dpapad 2011/05/11 23:30:20 Again, I did not change these checks. tab_ is set
Evan Stade 2011/05/12 00:05:27 so I guess it depends on whether you could call Ca
dpapad 2011/05/12 00:34:25 I will try and see and also ask James, since svn b
+ return;
+ tab_->delegate()->ExecuteCommandForTab(
+ static_cast<TabStripModel::ContextMenuCommand>(command_id), tab_);
+}
+
+GtkWidget* ContextMenuController::GetImageForCommandId(int command_id) const {
+ int browser_cmd_id;
+ return TabStripModel::ContextMenuCommandToBrowserCommand(command_id,
+ &browser_cmd_id) ?
+ MenuGtk::Delegate::GetDefaultImageForCommandId(browser_cmd_id) :
+ NULL;
+}

Powered by Google App Engine
This is Rietveld 408576698