diff options
-rw-r--r-- | chrome/browser/ui/gtk/global_history_menu.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/global_menu_bar.cc | 22 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/global_menu_bar.h | 2 | ||||
-rw-r--r-- | chrome/common/chrome_switches.cc | 8 | ||||
-rw-r--r-- | chrome/common/chrome_switches.h | 4 |
5 files changed, 34 insertions, 6 deletions
diff --git a/chrome/browser/ui/gtk/global_history_menu.cc b/chrome/browser/ui/gtk/global_history_menu.cc index 349d6ea..faefe1e 100644 --- a/chrome/browser/ui/gtk/global_history_menu.cc +++ b/chrome/browser/ui/gtk/global_history_menu.cc @@ -32,10 +32,10 @@ namespace { // The maximum number of most visited items to display. -const unsigned int kMostVisitedCount = 12; +const unsigned int kMostVisitedCount = 8; // The number of recently closed items to get. -const unsigned int kRecentlyClosedCount = 10; +const unsigned int kRecentlyClosedCount = 8; // Menus more than this many chars long will get trimmed. const int kMaximumMenuWidthInChars = 50; diff --git a/chrome/browser/ui/gtk/global_menu_bar.cc b/chrome/browser/ui/gtk/global_menu_bar.cc index 76ac9ba..ccef09d 100644 --- a/chrome/browser/ui/gtk/global_menu_bar.cc +++ b/chrome/browser/ui/gtk/global_menu_bar.cc @@ -6,6 +6,7 @@ #include <gtk/gtk.h> +#include "base/command_line.h" #include "chrome/app/chrome_command_ids.h" #include "chrome/browser/prefs/pref_service.h" #include "chrome/browser/profiles/profile.h" @@ -13,6 +14,7 @@ #include "chrome/browser/ui/gtk/accelerators_gtk.h" #include "chrome/browser/ui/gtk/gtk_theme_service.h" #include "chrome/browser/ui/gtk/gtk_util.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "content/common/notification_service.h" #include "grit/generated_resources.h" @@ -152,7 +154,6 @@ GlobalMenuBar::GlobalMenuBar(Browser* browser) profile_(browser_->profile()), menu_bar_(gtk_menu_bar_new()), history_menu_(browser_), - bookmark_menu_(browser_), dummy_accel_group_(gtk_accel_group_new()), block_activation_(false) { // The global menu bar should never actually be shown in the app; it should @@ -168,8 +169,23 @@ GlobalMenuBar::GlobalMenuBar(Browser* browser) BuildGtkMenuFrom(IDS_VIEW_MENU_LINUX, &id_to_menu_item_, view_menu, NULL); BuildGtkMenuFrom(IDS_HISTORY_MENU_LINUX, &id_to_menu_item_, history_menu, &history_menu_); - BuildGtkMenuFrom(IDS_BOOKMARKS_MENU_LINUX, &id_to_menu_item_, bookmark_menu, - &bookmark_menu_); + + if (CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableGlobalBookmarkMenu)) { + // TODO(erg): dbusmenu-glib in Ubuntu Natty does not like it when we shove + // 100k or more of favicon data over it. Users have reported that the + // browser hangs on startup for over a minute and breaking during this time + // shows a stack entirely of dbus/glib code (See #86715). For now, just + // hide the menu until appmenu-gtk catches up and doesn't hang if we throw + // (potentially) megs of icon data at it. (Some of our users have thousands + // of bookmarks and we're already unacceptably laggy at 100.) + // + // http://crbug.com/86715, http://crbug.com/85466 + bookmark_menu_.reset(new GlobalBookmarkMenu(browser_)); + BuildGtkMenuFrom(IDS_BOOKMARKS_MENU_LINUX, &id_to_menu_item_, bookmark_menu, + bookmark_menu_.get()); + } + BuildGtkMenuFrom(IDS_TOOLS_MENU_LINUX, &id_to_menu_item_, tools_menu, NULL); BuildGtkMenuFrom(IDS_HELP_MENU_LINUX, &id_to_menu_item_, help_menu, NULL); diff --git a/chrome/browser/ui/gtk/global_menu_bar.h b/chrome/browser/ui/gtk/global_menu_bar.h index b375e57..d4dbc27 100644 --- a/chrome/browser/ui/gtk/global_menu_bar.h +++ b/chrome/browser/ui/gtk/global_menu_bar.h @@ -84,7 +84,7 @@ class GlobalMenuBar : public CommandUpdater::CommandObserver, GlobalHistoryMenu history_menu_; // Listens to the bookmark model and updates the menu. - GlobalBookmarkMenu bookmark_menu_; + scoped_ptr<GlobalBookmarkMenu> bookmark_menu_; // For some menu items, we want to show the accelerator, but not actually // explicitly handle it. To this end we connect those menu items' accelerators diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index dd69de5..173efa5 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -1127,6 +1127,14 @@ const char kRelauncherProcess[] = "relauncher"; const char kKioskMode[] = "kiosk"; #endif +#if defined(TOOLKIT_GTK) +// Enables the global bookmark menu in our global menu bar on Ubuntu +// Natty. This is disabled because of issues where dbus will hang for over a +// minute because it doesn't like it when we thrown hundreds of kilobytes (or +// even megabytes) of favicon data at it. +const char kEnableGlobalBookmarkMenu[] = "enable-global-bookmark-menu"; +#endif + #if defined(TOOLKIT_VIEWS) // Enables debug paint in views framework. Enabling this causes the damaged // region being painted to flash in red. diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 4bedff2..f79021a 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -325,6 +325,10 @@ extern const char kRelauncherProcess[]; extern const char kKioskMode[]; #endif +#if defined(TOOLKIT_GTK) +extern const char kEnableGlobalBookmarkMenu[]; +#endif + #if defined(TOOLKIT_VIEWS) extern const char kDebugViewsPaint[]; extern const char kViewsDesktop[]; |