| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_GTK_BACK_FORWARD_BUTTON_GTK_ | 5 #ifndef CHROME_BROWSER_GTK_BACK_FORWARD_BUTTON_GTK_ |
| 6 #define CHROME_BROWSER_GTK_BACK_FORWARD_BUTTON_GTK_ | 6 #define CHROME_BROWSER_GTK_BACK_FORWARD_BUTTON_GTK_ |
| 7 | 7 |
| 8 #include "base/scoped_ptr.h" | 8 #include "base/scoped_ptr.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "chrome/browser/gtk/custom_button.h" | 10 #include "chrome/browser/gtk/custom_button.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 // Executes the browser command. | 31 // Executes the browser command. |
| 32 static void OnClick(GtkWidget* widget, BackForwardButtonGtk* button); | 32 static void OnClick(GtkWidget* widget, BackForwardButtonGtk* button); |
| 33 | 33 |
| 34 // Starts a timer to show the dropdown menu. | 34 // Starts a timer to show the dropdown menu. |
| 35 static gboolean OnButtonPress(GtkWidget* button, | 35 static gboolean OnButtonPress(GtkWidget* button, |
| 36 GdkEventButton* event, | 36 GdkEventButton* event, |
| 37 BackForwardButtonGtk* toolbar); | 37 BackForwardButtonGtk* toolbar); |
| 38 | 38 |
| 39 static gboolean OnButtonRelease(GtkWidget* button, |
| 40 GdkEventButton* event, |
| 41 BackForwardButtonGtk* toolbar); |
| 42 |
| 39 // If there is a timer to show the dropdown menu, and the mouse has moved | 43 // If there is a timer to show the dropdown menu, and the mouse has moved |
| 40 // sufficiently down the screen, cancel the timer and immediately show the | 44 // sufficiently down the screen, cancel the timer and immediately show the |
| 41 // menu. | 45 // menu. |
| 42 static gboolean OnMouseMove(GtkWidget* widget, | 46 static gboolean OnMouseMove(GtkWidget* widget, |
| 43 GdkEventMotion* event, | 47 GdkEventMotion* event, |
| 44 BackForwardButtonGtk* toolbar); | 48 BackForwardButtonGtk* toolbar); |
| 45 | 49 |
| 46 // Shows the dropdown menu. | 50 // Shows the dropdown menu. |
| 47 void ShowBackForwardMenu(); | 51 void ShowBackForwardMenu(); |
| 48 | 52 |
| 49 // The menu gets reset every time it is shown. | 53 // The menu gets reset every time it is shown. |
| 50 scoped_ptr<MenuGtk> menu_; | 54 scoped_ptr<MenuGtk> menu_; |
| 51 | 55 |
| 52 scoped_ptr<CustomDrawButton> button_; | 56 scoped_ptr<CustomDrawButton> button_; |
| 53 | 57 |
| 54 // The browser to which we will send commands. | 58 // The browser to which we will send commands. |
| 55 Browser* browser_; | 59 Browser* browser_; |
| 56 | 60 |
| 57 // Whether this button is a forward button. | 61 // Whether this button is a forward button. |
| 58 bool is_forward_; | 62 bool is_forward_; |
| 59 | 63 |
| 64 // The event state from the last button release. |
| 65 int last_release_event_flags_; |
| 66 |
| 60 // The dropdown menu delegate. | 67 // The dropdown menu delegate. |
| 61 scoped_ptr<BackForwardMenuModelGtk> menu_model_; | 68 scoped_ptr<BackForwardMenuModelGtk> menu_model_; |
| 62 | 69 |
| 63 // The y position of the last mouse down event. | 70 // The y position of the last mouse down event. |
| 64 int y_position_of_last_press_; | 71 int y_position_of_last_press_; |
| 65 | 72 |
| 66 ScopedRunnableMethodFactory<BackForwardButtonGtk> show_menu_factory_; | 73 ScopedRunnableMethodFactory<BackForwardButtonGtk> show_menu_factory_; |
| 67 | 74 |
| 68 DISALLOW_COPY_AND_ASSIGN(BackForwardButtonGtk); | 75 DISALLOW_COPY_AND_ASSIGN(BackForwardButtonGtk); |
| 69 }; | 76 }; |
| 70 | 77 |
| 71 #endif // CHROME_BROWSER_GTK_BACK_FORWARD_BUTTON_GTK_ | 78 #endif // CHROME_BROWSER_GTK_BACK_FORWARD_BUTTON_GTK_ |
| OLD | NEW |