1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_APP_INDICATOR_ICON_MENU_H_
6 #define CHROME_BROWSER_UI_LIBGTK2UI_APP_INDICATOR_ICON_MENU_H_
8 #include "base/callback.h"
9 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h"
11 typedef struct _GtkMenu GtkMenu
;
12 typedef struct _GtkWidget GtkWidget
;
20 // The app indicator icon's menu.
21 class AppIndicatorIconMenu
{
23 explicit AppIndicatorIconMenu(ui::MenuModel
* model
);
24 virtual ~AppIndicatorIconMenu();
26 // Sets a menu item at the top of |gtk_menu_| as a replacement for the app
27 // indicator icon's click action. |callback| is called when the menu item
29 void UpdateClickActionReplacementMenuItem(const char* label
,
30 const base::Closure
& callback
);
32 // Refreshes all the menu item labels and menu item checked/enabled states.
35 GtkMenu
* GetGtkMenu();
38 // Callback for when the "click action replacement" menu item is activated.
39 CHROMEGTK_CALLBACK_0(AppIndicatorIconMenu
,
41 OnClickActionReplacementMenuItemActivated
);
43 // Callback for when a menu item is activated.
44 CHROMEGTK_CALLBACK_0(AppIndicatorIconMenu
, void, OnMenuItemActivated
);
47 ui::MenuModel
* menu_model_
;
49 // Whether a "click action replacement" menu item has been added to the menu.
50 bool click_action_replacement_menu_item_added_
;
52 // Called when the click action replacement menu item is activated. When a
53 // menu item from |menu_model_| is activated, MenuModel::ActivatedAt() is
54 // invoked and is assumed to do any necessary processing.
55 base::Closure click_action_replacement_callback_
;
59 bool block_activation_
;
61 DISALLOW_COPY_AND_ASSIGN(AppIndicatorIconMenu
);
64 } // namespace libgtk2ui
66 #endif // CHROME_BROWSER_UI_LIBGTK2UI_APP_INDICATOR_ICON_MENU_H_