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

Unified Diff: chrome/browser/gtk/browser_toolbar_gtk.cc

Issue 3163035: Revert "Clean up the WrenchMenuModel so that it uses SimpleMenu::Delegate." (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 4 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/gtk/browser_toolbar_gtk.h ('k') | chrome/browser/views/toolbar_view.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/browser_toolbar_gtk.cc
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.cc b/chrome/browser/gtk/browser_toolbar_gtk.cc
index 2d8562af4c9b63693d5024fb94d4aff2f7e6c439..a28abed6727a227bb7e50bb502e2d1c916b45809 100644
--- a/chrome/browser/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_toolbar_gtk.cc
@@ -227,7 +227,7 @@ void BrowserToolbarGtk::Init(Profile* profile,
gtk_container_add(GTK_CONTAINER(wrench_box), wrench_button);
gtk_box_pack_start(GTK_BOX(toolbar_), wrench_box, FALSE, FALSE, 4);
- wrench_menu_.reset(new MenuGtk(this, wrench_menu_model_.menu_model()));
+ wrench_menu_.reset(new MenuGtk(this, &wrench_menu_model_));
g_signal_connect(wrench_menu_->widget(), "show",
G_CALLBACK(OnWrenchMenuShowThunk), this);
@@ -333,7 +333,33 @@ GtkIconSet* BrowserToolbarGtk::GetIconSetForId(int idr) {
return theme_provider_->GetIconSetForId(idr);
}
-// menus::AcceleratorProvider
+// menus::SimpleMenuModel::Delegate
+
+bool BrowserToolbarGtk::IsCommandIdEnabled(int id) const {
+ return browser_->command_updater()->IsCommandEnabled(id);
+}
+
+bool BrowserToolbarGtk::IsCommandIdChecked(int id) const {
+ if (!profile_)
+ return false;
+
+ EncodingMenuController controller;
+ if (id == IDC_SHOW_BOOKMARK_BAR) {
+ return profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar);
+ } else if (controller.DoesCommandBelongToEncodingMenu(id)) {
+ TabContents* tab_contents = browser_->GetSelectedTabContents();
+ if (tab_contents) {
+ return controller.IsItemChecked(profile_, tab_contents->encoding(),
+ id);
+ }
+ }
+
+ return false;
+}
+
+void BrowserToolbarGtk::ExecuteCommand(int id) {
+ browser_->ExecuteCommand(id);
+}
bool BrowserToolbarGtk::GetAcceleratorForCommandId(
int id,
« no previous file with comments | « chrome/browser/gtk/browser_toolbar_gtk.h ('k') | chrome/browser/views/toolbar_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698