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