Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_ACTION_BOX_BUTTON_GTK_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_ACTION_BOX_BUTTON_GTK_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_ACTION_BOX_BUTTON_GTK_H_ | 6 #define CHROME_BROWSER_UI_GTK_ACTION_BOX_BUTTON_GTK_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/ui/gtk/menu_gtk.h" | |
| 10 #include "ui/base/gtk/gtk_signal.h" | 11 #include "ui/base/gtk/gtk_signal.h" |
| 11 | 12 |
| 13 class ActionBoxMenuModel; | |
| 12 class Browser; | 14 class Browser; |
| 13 class CustomDrawButton; | 15 class CustomDrawButton; |
| 16 class MenuGtk; | |
|
msw
2012/08/30 03:39:22
nit: forward decl is redundant with include.
beaudoin
2012/08/30 20:55:05
Done.
| |
| 14 | 17 |
| 15 typedef struct _GtkWidget GtkWidget; | 18 typedef struct _GtkWidget GtkWidget; |
| 16 | 19 |
| 17 // This class displays the action box button with an associated menu. This is | 20 // This class displays the action box button with an associated menu. This is |
| 18 // where extension actions and the bookmark star live. | 21 // where extension actions and the bookmark star live. |
| 19 class ActionBoxButtonGtk { | 22 class ActionBoxButtonGtk : MenuGtk::Delegate { |
|
msw
2012/08/30 03:39:22
nit: explicitly specify public inheritance.
beaudoin
2012/08/30 20:55:05
Done.
| |
| 20 public: | 23 public: |
| 21 explicit ActionBoxButtonGtk(Browser* browser); | 24 explicit ActionBoxButtonGtk(Browser* browser); |
| 22 virtual ~ActionBoxButtonGtk(); | 25 virtual ~ActionBoxButtonGtk(); |
| 23 | 26 |
| 27 // MenuGtk::Delegate implementation. | |
| 28 virtual bool AlwaysShowIconForCmd(int command_id) const OVERRIDE; | |
| 29 | |
| 24 GtkWidget* widget(); | 30 GtkWidget* widget(); |
| 25 | 31 |
| 26 private: | 32 private: |
| 27 // Executes the browser command. | 33 // Show the action box menu. |
| 28 CHROMEGTK_CALLBACK_0(ActionBoxButtonGtk, void, OnClick); | 34 CHROMEGTK_CALLBACK_1(ActionBoxButtonGtk, gboolean, OnButtonPress, |
| 35 GdkEventButton*); | |
| 29 | 36 |
| 30 scoped_ptr<CustomDrawButton> button_; | 37 scoped_ptr<CustomDrawButton> button_; |
| 31 | 38 |
| 32 // The browser to which we will send commands. | 39 // The browser to which we will send commands. |
| 33 Browser* browser_; | 40 Browser* browser_; |
| 34 | 41 |
| 42 // The model and menu displayed when the button is clicked. The menu is | |
| 43 // recreated every time it is displayed. | |
| 44 scoped_ptr<ActionBoxMenuModel> model_; | |
| 45 scoped_ptr<MenuGtk> menu_; | |
| 46 | |
| 35 DISALLOW_COPY_AND_ASSIGN(ActionBoxButtonGtk); | 47 DISALLOW_COPY_AND_ASSIGN(ActionBoxButtonGtk); |
| 36 }; | 48 }; |
| 37 | 49 |
| 38 #endif // CHROME_BROWSER_UI_GTK_ACTION_BOX_BUTTON_GTK_H_ | 50 #endif // CHROME_BROWSER_UI_GTK_ACTION_BOX_BUTTON_GTK_H_ |
| OLD | NEW |