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

Side by Side Diff: chrome/browser/ui/gtk/global_menu_bar.cc

Issue 8293002: GTK: Remove the global bookmark menu code. It's been behind a flag and bitrotting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/global_menu_bar.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/gtk/global_menu_bar.h" 5 #include "chrome/browser/ui/gtk/global_menu_bar.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/gtk/accelerators_gtk.h" 14 #include "chrome/browser/ui/gtk/accelerators_gtk.h"
15 #include "chrome/browser/ui/gtk/global_bookmark_menu.h"
16 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 15 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
17 #include "chrome/browser/ui/gtk/gtk_util.h" 16 #include "chrome/browser/ui/gtk/gtk_util.h"
18 #include "chrome/common/chrome_notification_types.h" 17 #include "chrome/common/chrome_notification_types.h"
19 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
21 #include "content/common/notification_details.h" 20 #include "content/common/notification_details.h"
22 #include "content/common/notification_service.h" 21 #include "content/common/notification_service.h"
23 #include "content/common/notification_source.h" 22 #include "content/common/notification_source.h"
24 #include "grit/generated_resources.h" 23 #include "grit/generated_resources.h"
25 #include "ui/base/l10n/l10n_util.h" 24 #include "ui/base/l10n/l10n_util.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 { IDS_HISTORY_CLOSED_LINUX, MENU_DISABLED_LABEL, 110 { IDS_HISTORY_CLOSED_LINUX, MENU_DISABLED_LABEL,
112 GlobalMenuBar::TAG_RECENTLY_CLOSED_HEADER }, 111 GlobalMenuBar::TAG_RECENTLY_CLOSED_HEADER },
113 112
114 { MENU_SEPARATOR, MENU_SEPARATOR }, 113 { MENU_SEPARATOR, MENU_SEPARATOR },
115 114
116 { IDS_SHOWFULLHISTORY_LINK, IDC_SHOW_HISTORY }, 115 { IDS_SHOWFULLHISTORY_LINK, IDC_SHOW_HISTORY },
117 116
118 { MENU_END, MENU_END } 117 { MENU_END, MENU_END }
119 }; 118 };
120 119
121 GlobalMenuBarCommand bookmark_menu[] = {
122 { IDS_BOOKMARK_MANAGER, IDC_SHOW_BOOKMARK_MANAGER },
123 { IDS_BOOKMARK_CURRENT_PAGE_LINUX, IDC_BOOKMARK_PAGE },
124 { IDS_BOOKMARK_ALL_TABS_LINUX, IDC_BOOKMARK_ALL_TABS },
125
126 { MENU_END, MENU_END }
127 };
128
129 GlobalMenuBarCommand tools_menu[] = { 120 GlobalMenuBarCommand tools_menu[] = {
130 { IDS_SHOW_DOWNLOADS, IDC_SHOW_DOWNLOADS }, 121 { IDS_SHOW_DOWNLOADS, IDC_SHOW_DOWNLOADS },
131 { IDS_SHOW_HISTORY, IDC_SHOW_HISTORY }, 122 { IDS_SHOW_HISTORY, IDC_SHOW_HISTORY },
132 { IDS_SHOW_EXTENSIONS, IDC_MANAGE_EXTENSIONS }, 123 { IDS_SHOW_EXTENSIONS, IDC_MANAGE_EXTENSIONS },
133 124
134 { MENU_SEPARATOR, MENU_SEPARATOR }, 125 { MENU_SEPARATOR, MENU_SEPARATOR },
135 126
136 { IDS_TASK_MANAGER, IDC_TASK_MANAGER }, 127 { IDS_TASK_MANAGER, IDC_TASK_MANAGER },
137 { IDS_CLEAR_BROWSING_DATA, IDC_CLEAR_BROWSING_DATA }, 128 { IDS_CLEAR_BROWSING_DATA, IDC_CLEAR_BROWSING_DATA },
138 129
(...skipping 27 matching lines...) Expand all
166 157
167 // Set a nice name so it shows up in gtkparasite and others. 158 // Set a nice name so it shows up in gtkparasite and others.
168 gtk_widget_set_name(menu_bar_.get(), "chrome-hidden-global-menubar"); 159 gtk_widget_set_name(menu_bar_.get(), "chrome-hidden-global-menubar");
169 160
170 BuildGtkMenuFrom(IDS_FILE_MENU_LINUX, &id_to_menu_item_, file_menu, NULL); 161 BuildGtkMenuFrom(IDS_FILE_MENU_LINUX, &id_to_menu_item_, file_menu, NULL);
171 BuildGtkMenuFrom(IDS_EDIT_MENU_LINUX, &id_to_menu_item_, edit_menu, NULL); 162 BuildGtkMenuFrom(IDS_EDIT_MENU_LINUX, &id_to_menu_item_, edit_menu, NULL);
172 BuildGtkMenuFrom(IDS_VIEW_MENU_LINUX, &id_to_menu_item_, view_menu, NULL); 163 BuildGtkMenuFrom(IDS_VIEW_MENU_LINUX, &id_to_menu_item_, view_menu, NULL);
173 BuildGtkMenuFrom(IDS_HISTORY_MENU_LINUX, &id_to_menu_item_, 164 BuildGtkMenuFrom(IDS_HISTORY_MENU_LINUX, &id_to_menu_item_,
174 history_menu, &history_menu_); 165 history_menu, &history_menu_);
175 166
176 if (CommandLine::ForCurrentProcess()->HasSwitch(
177 switches::kEnableGlobalBookmarkMenu)) {
178 // TODO(erg): dbusmenu-glib in Ubuntu Natty does not like it when we shove
179 // 100k or more of favicon data over it. Users have reported that the
180 // browser hangs on startup for over a minute and breaking during this time
181 // shows a stack entirely of dbus/glib code (See #86715). For now, just
182 // hide the menu until appmenu-gtk catches up and doesn't hang if we throw
183 // (potentially) megs of icon data at it. (Some of our users have thousands
184 // of bookmarks and we're already unacceptably laggy at 100.)
185 //
186 // http://crbug.com/86715, http://crbug.com/85466
187 bookmark_menu_.reset(new GlobalBookmarkMenu(browser_));
188 BuildGtkMenuFrom(IDS_BOOKMARKS_MENU_LINUX, &id_to_menu_item_, bookmark_menu,
189 bookmark_menu_.get());
190 }
191
192 BuildGtkMenuFrom(IDS_TOOLS_MENU_LINUX, &id_to_menu_item_, tools_menu, NULL); 167 BuildGtkMenuFrom(IDS_TOOLS_MENU_LINUX, &id_to_menu_item_, tools_menu, NULL);
193 BuildGtkMenuFrom(IDS_HELP_MENU_LINUX, &id_to_menu_item_, help_menu, NULL); 168 BuildGtkMenuFrom(IDS_HELP_MENU_LINUX, &id_to_menu_item_, help_menu, NULL);
194 169
195 for (CommandIDMenuItemMap::const_iterator it = id_to_menu_item_.begin(); 170 for (CommandIDMenuItemMap::const_iterator it = id_to_menu_item_.begin();
196 it != id_to_menu_item_.end(); ++it) { 171 it != id_to_menu_item_.end(); ++it) {
197 // Get the starting enabled state. 172 // Get the starting enabled state.
198 gtk_widget_set_sensitive( 173 gtk_widget_set_sensitive(
199 it->second, 174 it->second,
200 browser_->command_updater()->IsCommandEnabled(it->first)); 175 browser_->command_updater()->IsCommandEnabled(it->first));
201 176
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 305 }
331 } 306 }
332 307
333 void GlobalMenuBar::OnItemActivated(GtkWidget* sender) { 308 void GlobalMenuBar::OnItemActivated(GtkWidget* sender) {
334 if (block_activation_) 309 if (block_activation_)
335 return; 310 return;
336 311
337 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(sender), "command-id")); 312 int id = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(sender), "command-id"));
338 browser_->ExecuteCommandIfEnabled(id); 313 browser_->ExecuteCommandIfEnabled(id);
339 } 314 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/global_menu_bar.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698