| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_UI_GTK_BACK_FORWARD_BUTTON_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_BACK_FORWARD_BUTTON_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_BACK_FORWARD_BUTTON_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_BACK_FORWARD_BUTTON_GTK_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 11 #include "base/task.h" | 12 #include "base/task.h" |
| 12 #include "chrome/browser/ui/gtk/custom_button.h" | 13 #include "chrome/browser/ui/gtk/custom_button.h" |
| 13 #include "chrome/browser/ui/gtk/menu_gtk.h" | 14 #include "chrome/browser/ui/gtk/menu_gtk.h" |
| 14 #include "ui/base/gtk/gtk_signal.h" | 15 #include "ui/base/gtk/gtk_signal.h" |
| 15 | 16 |
| 16 class BackForwardMenuModel; | 17 class BackForwardMenuModel; |
| 17 class Browser; | 18 class Browser; |
| 18 | 19 |
| 19 typedef struct _GtkWidget GtkWidget; | 20 typedef struct _GtkWidget GtkWidget; |
| 20 | 21 |
| 21 // When clicked, these buttons will navigate forward or backward. When | 22 // When clicked, these buttons will navigate forward or backward. When |
| 22 // pressed and held, they show a dropdown menu of recent web sites. | 23 // pressed and held, they show a dropdown menu of recent web sites. |
| 23 class BackForwardButtonGtk : MenuGtk::Delegate { | 24 class BackForwardButtonGtk : MenuGtk::Delegate { |
| 24 public: | 25 public: |
| 25 BackForwardButtonGtk(Browser* browser, bool is_forward); | 26 BackForwardButtonGtk(Browser* browser, bool is_forward); |
| 26 virtual ~BackForwardButtonGtk(); | 27 virtual ~BackForwardButtonGtk(); |
| 27 | 28 |
| 28 // MenuGtk::Delegate implementation. | 29 // MenuGtk::Delegate implementation. |
| 29 virtual void StoppedShowing(); | 30 virtual void StoppedShowing() OVERRIDE; |
| 30 virtual bool AlwaysShowIconForCmd(int command_id) const; | 31 virtual bool AlwaysShowIconForCmd(int command_id) const OVERRIDE; |
| 31 | 32 |
| 32 GtkWidget* widget() { return button_->widget(); } | 33 GtkWidget* widget() { return button_->widget(); } |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 // Executes the browser command. | 36 // Executes the browser command. |
| 36 CHROMEGTK_CALLBACK_0(BackForwardButtonGtk, void, OnClick); | 37 CHROMEGTK_CALLBACK_0(BackForwardButtonGtk, void, OnClick); |
| 37 | 38 |
| 38 // Starts a timer to show the dropdown menu. | 39 // Starts a timer to show the dropdown menu. |
| 39 CHROMEGTK_CALLBACK_1(BackForwardButtonGtk, gboolean, OnButtonPress, | 40 CHROMEGTK_CALLBACK_1(BackForwardButtonGtk, gboolean, OnButtonPress, |
| 40 GdkEventButton*); | 41 GdkEventButton*); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 64 | 65 |
| 65 // The y position of the last mouse down event. | 66 // The y position of the last mouse down event. |
| 66 int y_position_of_last_press_; | 67 int y_position_of_last_press_; |
| 67 | 68 |
| 68 base::WeakPtrFactory<BackForwardButtonGtk> weak_factory_; | 69 base::WeakPtrFactory<BackForwardButtonGtk> weak_factory_; |
| 69 | 70 |
| 70 DISALLOW_COPY_AND_ASSIGN(BackForwardButtonGtk); | 71 DISALLOW_COPY_AND_ASSIGN(BackForwardButtonGtk); |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 #endif // CHROME_BROWSER_UI_GTK_BACK_FORWARD_BUTTON_GTK_H_ | 74 #endif // CHROME_BROWSER_UI_GTK_BACK_FORWARD_BUTTON_GTK_H_ |
| OLD | NEW |