Add ability to gather metrics to BubbleManager.
[chromium-blink-merge.git] / chrome / browser / ui / libgtk2ui / app_indicator_icon_menu.h
bloba204710f9c181a165a1007c503cb1d02862a5d76
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;
14 namespace ui {
15 class MenuModel;
18 namespace libgtk2ui {
20 // The app indicator icon's menu.
21 class AppIndicatorIconMenu {
22 public:
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
28 // is activated.
29 void UpdateClickActionReplacementMenuItem(const char* label,
30 const base::Closure& callback);
32 // Refreshes all the menu item labels and menu item checked/enabled states.
33 void Refresh();
35 GtkMenu* GetGtkMenu();
37 private:
38 // Callback for when the "click action replacement" menu item is activated.
39 CHROMEGTK_CALLBACK_0(AppIndicatorIconMenu,
40 void,
41 OnClickActionReplacementMenuItemActivated);
43 // Callback for when a menu item is activated.
44 CHROMEGTK_CALLBACK_0(AppIndicatorIconMenu, void, OnMenuItemActivated);
46 // Not owned.
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_;
57 GtkWidget* gtk_menu_;
59 bool block_activation_;
61 DISALLOW_COPY_AND_ASSIGN(AppIndicatorIconMenu);
64 } // namespace libgtk2ui
66 #endif // CHROME_BROWSER_UI_LIBGTK2UI_APP_INDICATOR_ICON_MENU_H_