| 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 "chrome/browser/ui/gtk/menu_gtk.h" |
| 11 #include "chrome/browser/ui/toolbar/action_box_button_controller.h" | 11 #include "chrome/browser/ui/toolbar/action_box_button_controller.h" |
| 12 #include "ui/base/gtk/gtk_signal.h" | 12 #include "ui/base/gtk/gtk_signal.h" |
| 13 | 13 |
| 14 class ActionBoxMenuModel; | 14 class ActionBoxMenuModel; |
| 15 class Browser; | 15 class Browser; |
| 16 class CustomDrawButton; | 16 class CustomDrawButton; |
| 17 | 17 |
| 18 typedef struct _GtkWidget GtkWidget; | 18 typedef struct _GtkWidget GtkWidget; |
| 19 | 19 |
| 20 // 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 |
| 21 // where extension actions and the bookmark star live. | 21 // where extension actions and the bookmark star live. |
| 22 class ActionBoxButtonGtk : public MenuGtk::Delegate, | 22 class ActionBoxButtonGtk : public MenuGtk::Delegate, |
| 23 public ActionBoxButtonController::Delegate { | 23 public ActionBoxButtonController::Delegate { |
| 24 public: | 24 public: |
| 25 explicit ActionBoxButtonGtk(Browser* browser); | 25 explicit ActionBoxButtonGtk(Browser* browser); |
| 26 virtual ~ActionBoxButtonGtk(); | 26 virtual ~ActionBoxButtonGtk(); |
| 27 | 27 |
| 28 // MenuGtk::Delegate implementation. | 28 // MenuGtk::Delegate implementation. |
| 29 virtual bool AlwaysShowIconForCmd(int command_id) const OVERRIDE; | 29 virtual bool AlwaysShowIconForCmd(int command_id) const OVERRIDE; |
| 30 virtual GtkWidget* GetImageForCommandId(int command_id) const OVERRIDE; |
| 30 | 31 |
| 31 GtkWidget* widget(); | 32 GtkWidget* widget(); |
| 32 | 33 |
| 33 ActionBoxButtonController* action_box_button_controller() { | 34 ActionBoxButtonController* action_box_button_controller() { |
| 34 return &controller_; | 35 return &controller_; |
| 35 } | 36 } |
| 36 | 37 |
| 37 private: | 38 private: |
| 38 // ActionBoxButtonController::Delegate implementation. | 39 // ActionBoxButtonController::Delegate implementation. |
| 39 virtual void ShowMenu(scoped_ptr<ActionBoxMenuModel> model) OVERRIDE; | 40 virtual void ShowMenu(scoped_ptr<ActionBoxMenuModel> model) OVERRIDE; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 51 | 52 |
| 52 // The model and menu displayed when the button is clicked. The menu is | 53 // The model and menu displayed when the button is clicked. The menu is |
| 53 // recreated every time it is displayed. | 54 // recreated every time it is displayed. |
| 54 scoped_ptr<ActionBoxMenuModel> model_; | 55 scoped_ptr<ActionBoxMenuModel> model_; |
| 55 scoped_ptr<MenuGtk> menu_; | 56 scoped_ptr<MenuGtk> menu_; |
| 56 | 57 |
| 57 DISALLOW_COPY_AND_ASSIGN(ActionBoxButtonGtk); | 58 DISALLOW_COPY_AND_ASSIGN(ActionBoxButtonGtk); |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 #endif // CHROME_BROWSER_UI_GTK_ACTION_BOX_BUTTON_GTK_H_ | 61 #endif // CHROME_BROWSER_UI_GTK_ACTION_BOX_BUTTON_GTK_H_ |
| OLD | NEW |