diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 20:18:21 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-26 20:18:21 +0000 |
commit | 6463cb2a117dcd866a12becb513cfdba935c16e5 (patch) | |
tree | 929c60acd2a4bd78e9b6f4ccbbf0c3bfa4bcf495 /chrome/browser/gtk/browser_toolbar_gtk.h | |
parent | 32d0ef5d82ef2e972635245107825e776072dc82 (diff) | |
download | chromium_src-6463cb2a117dcd866a12becb513cfdba935c16e5.zip chromium_src-6463cb2a117dcd866a12becb513cfdba935c16e5.tar.gz chromium_src-6463cb2a117dcd866a12becb513cfdba935c16e5.tar.bz2 |
Refactor back/forward buttons to their own class. Fix them so the menu pops up on drags and the buttons look depressed when the menu is showing.
BUG=12427
TEST=back/forward button behavior should be as on windows (see bug desc. for details).
Review URL: http://codereview.chromium.org/113806
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16898 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/browser_toolbar_gtk.h')
-rw-r--r-- | chrome/browser/gtk/browser_toolbar_gtk.h | 48 |
1 files changed, 5 insertions, 43 deletions
diff --git a/chrome/browser/gtk/browser_toolbar_gtk.h b/chrome/browser/gtk/browser_toolbar_gtk.h index 2cda352..ceafeba 100644 --- a/chrome/browser/gtk/browser_toolbar_gtk.h +++ b/chrome/browser/gtk/browser_toolbar_gtk.h @@ -9,13 +9,12 @@ #include <string> #include "base/scoped_ptr.h" -#include "base/task.h" #include "chrome/browser/autocomplete/autocomplete_popup_view.h" #include "chrome/browser/command_updater.h" #include "chrome/browser/gtk/menu_gtk.h" #include "chrome/common/pref_member.h" -class BackForwardMenuModelGtk; +class BackForwardButtonGtk; class Browser; class CustomDrawButton; class GoButtonGtk; @@ -94,9 +93,7 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver, // Adds a keyboard accelerator which triggers a button (e.g., ctrl+r is now // equivalent to a reload click). void AddAcceleratorToButton( - const scoped_ptr<CustomDrawButton>& button, - unsigned int accelerator, - unsigned int accelerator_mod); + GtkWidget*, unsigned int accelerator, unsigned int accelerator_mod); // Gtk callback for the "expose-event" signal. static gboolean OnToolbarExpose(GtkWidget* widget, GdkEventExpose* e, @@ -107,15 +104,9 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver, // Gtk callback to intercept mouse clicks to the menu buttons. static gboolean OnMenuButtonPressEvent(GtkWidget* button, - GdkEvent *event, + GdkEventButton* event, BrowserToolbarGtk* toolbar); - // Displays the page menu. - void RunPageMenu(GdkEvent* button_press_event); - - // Displays the app menu. - void RunAppMenu(GdkEvent* button_press_event); - // Construct the Home button. CustomDrawButton* MakeHomeButton(); @@ -136,7 +127,7 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver, GtkAccelGroup* accel_group_; // All the buttons in the toolbar. - scoped_ptr<CustomDrawButton> back_, forward_; + scoped_ptr<BackForwardButtonGtk> back_, forward_; scoped_ptr<CustomDrawButton> reload_; scoped_ptr<CustomDrawButton> home_; // May be NULL. scoped_ptr<ToolbarStarToggleGtk> star_; @@ -155,36 +146,7 @@ class BrowserToolbarGtk : public CommandUpdater::CommandObserver, // Controls whether or not a home button should be shown on the toolbar. BooleanPrefMember show_home_button_; - // Back/Forward menus ------------------------------------------------------ - // When clicked, these buttons will navigate forward or backward. When - // pressed and held, they show a dropdown menu of recent web sites. - // TODO(port): to match windows, we need to immediately show the back/forward - // menu when the user starts dragging the mouse. - - // Builds a toolbar button for the back or forward dropdown menus. - CustomDrawButton* BuildBackForwardButton( - int normal_id, - int active_id, - int highlight_id, - int depressed_id, - const std::string& localized_tooltip); - - // Starts a timer to show the dropdown menu. - static gboolean OnBackForwardPressEvent(GtkWidget* button, - GdkEventButton* event, - BrowserToolbarGtk* toolbar); - - // Shows the dropdown menu when the timer fires. |button_type| refers to the - // click that originated the button press event. - void ShowBackForwardMenu(GtkWidget* button, gint button_type); - - // The back/forward menu gets reset every time it is shown. - scoped_ptr<MenuGtk> back_forward_menu_; - - scoped_ptr<BackForwardMenuModelGtk> back_menu_model_; - scoped_ptr<BackForwardMenuModelGtk> forward_menu_model_; - - ScopedRunnableMethodFactory<BrowserToolbarGtk> show_menu_factory_; + DISALLOW_COPY_AND_ASSIGN(BrowserToolbarGtk); }; #endif // CHROME_BROWSER_GTK_BROWSER_TOOLBAR_GTK_H_ |