| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_UI_LIBGTK2UI_APP_INDICATOR_ICON_MENU_H_ | |
| 6 #define CHROME_BROWSER_UI_LIBGTK2UI_APP_INDICATOR_ICON_MENU_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h" | |
| 11 | |
| 12 typedef struct _GtkMenu GtkMenu; | |
| 13 typedef struct _GtkWidget GtkWidget; | |
| 14 | |
| 15 namespace ui { | |
| 16 class MenuModel; | |
| 17 } | |
| 18 | |
| 19 namespace libgtk2ui { | |
| 20 | |
| 21 // The app indicator icon's menu. | |
| 22 class AppIndicatorIconMenu { | |
| 23 public: | |
| 24 explicit AppIndicatorIconMenu(ui::MenuModel* model); | |
| 25 virtual ~AppIndicatorIconMenu(); | |
| 26 | |
| 27 // Sets a menu item at the top of |gtk_menu_| as a replacement for the app | |
| 28 // indicator icon's click action. |callback| is called when the menu item | |
| 29 // is activated. | |
| 30 void UpdateClickActionReplacementMenuItem(const char* label, | |
| 31 const base::Closure& callback); | |
| 32 | |
| 33 // Refreshes all the menu item labels and menu item checked/enabled states. | |
| 34 void Refresh(); | |
| 35 | |
| 36 GtkMenu* GetGtkMenu(); | |
| 37 | |
| 38 private: | |
| 39 // Callback for when the "click action replacement" menu item is activated. | |
| 40 CHROMEGTK_CALLBACK_0(AppIndicatorIconMenu, | |
| 41 void, | |
| 42 OnClickActionReplacementMenuItemActivated); | |
| 43 | |
| 44 // Callback for when a menu item is activated. | |
| 45 CHROMEGTK_CALLBACK_0(AppIndicatorIconMenu, void, OnMenuItemActivated); | |
| 46 | |
| 47 // Not owned. | |
| 48 ui::MenuModel* menu_model_; | |
| 49 | |
| 50 // Whether a "click action replacement" menu item has been added to the menu. | |
| 51 bool click_action_replacement_menu_item_added_; | |
| 52 | |
| 53 // Called when the click action replacement menu item is activated. When a | |
| 54 // menu item from |menu_model_| is activated, MenuModel::ActivatedAt() is | |
| 55 // invoked and is assumed to do any necessary processing. | |
| 56 base::Closure click_action_replacement_callback_; | |
| 57 | |
| 58 GtkWidget* gtk_menu_; | |
| 59 | |
| 60 bool block_activation_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(AppIndicatorIconMenu); | |
| 63 }; | |
| 64 | |
| 65 } // namespace libgtk2ui | |
| 66 | |
| 67 #endif // CHROME_BROWSER_UI_LIBGTK2UI_APP_INDICATOR_ICON_MENU_H_ | |
| OLD | NEW |