| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_GLOBAL_MENU_BAR_H_ | 5 #ifndef CHROME_BROWSER_UI_GTK_GLOBAL_MENU_BAR_H_ |
| 6 #define CHROME_BROWSER_UI_GTK_GLOBAL_MENU_BAR_H_ | 6 #define CHROME_BROWSER_UI_GTK_GLOBAL_MENU_BAR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/command_updater.h" | 12 #include "chrome/browser/command_updater.h" |
| 12 #include "chrome/browser/prefs/pref_change_registrar.h" | 13 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 13 #include "chrome/browser/ui/gtk/global_history_menu.h" | 14 #include "chrome/browser/ui/gtk/global_history_menu.h" |
| 14 #include "content/public/browser/notification_observer.h" | 15 #include "content/public/browser/notification_observer.h" |
| 15 #include "ui/base/gtk/gtk_signal.h" | 16 #include "ui/base/gtk/gtk_signal.h" |
| 16 #include "ui/base/gtk/owned_widget_gtk.h" | 17 #include "ui/base/gtk/owned_widget_gtk.h" |
| 17 | 18 |
| 18 class Browser; | 19 class Browser; |
| 19 struct GlobalMenuBarCommand; | 20 struct GlobalMenuBarCommand; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 GlobalMenuOwner* owner); | 60 GlobalMenuOwner* owner); |
| 60 | 61 |
| 61 // Builds an individual menu item. | 62 // Builds an individual menu item. |
| 62 GtkWidget* BuildMenuItem(int string_id, | 63 GtkWidget* BuildMenuItem(int string_id, |
| 63 int command_id, | 64 int command_id, |
| 64 int tag_id, | 65 int tag_id, |
| 65 std::map<int, GtkWidget*>* id_to_menu_item, | 66 std::map<int, GtkWidget*>* id_to_menu_item, |
| 66 GtkWidget* menu_to_add_to); | 67 GtkWidget* menu_to_add_to); |
| 67 | 68 |
| 68 // CommandUpdater::CommandObserver: | 69 // CommandUpdater::CommandObserver: |
| 69 virtual void EnabledStateChangedForCommand(int id, bool enabled); | 70 virtual void EnabledStateChangedForCommand(int id, bool enabled) OVERRIDE; |
| 70 | 71 |
| 71 // content::NotificationObserver: | 72 // content::NotificationObserver: |
| 72 virtual void Observe(int type, | 73 virtual void Observe(int type, |
| 73 const content::NotificationSource& source, | 74 const content::NotificationSource& source, |
| 74 const content::NotificationDetails& details); | 75 const content::NotificationDetails& details) OVERRIDE; |
| 75 | 76 |
| 76 // Updates the visibility of the bookmark bar on pref changes. | 77 // Updates the visibility of the bookmark bar on pref changes. |
| 77 void OnBookmarkBarVisibilityChanged(); | 78 void OnBookmarkBarVisibilityChanged(); |
| 78 | 79 |
| 79 CHROMEGTK_CALLBACK_0(GlobalMenuBar, void, OnItemActivated); | 80 CHROMEGTK_CALLBACK_0(GlobalMenuBar, void, OnItemActivated); |
| 80 | 81 |
| 81 Browser* browser_; | 82 Browser* browser_; |
| 82 | 83 |
| 83 // Tracks value of the kShowBookmarkBar preference. | 84 // Tracks value of the kShowBookmarkBar preference. |
| 84 PrefChangeRegistrar pref_change_registrar_; | 85 PrefChangeRegistrar pref_change_registrar_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 98 // A mapping from command ids to GtkMenuItem objects. We use this to update | 99 // A mapping from command ids to GtkMenuItem objects. We use this to update |
| 99 // the command enable state. | 100 // the command enable state. |
| 100 CommandIDMenuItemMap id_to_menu_item_; | 101 CommandIDMenuItemMap id_to_menu_item_; |
| 101 | 102 |
| 102 // gtk_check_menu_item_set_active() will call the "activate" signal. We need | 103 // gtk_check_menu_item_set_active() will call the "activate" signal. We need |
| 103 // to block this activation while we change the checked state. | 104 // to block this activation while we change the checked state. |
| 104 bool block_activation_; | 105 bool block_activation_; |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 #endif // CHROME_BROWSER_UI_GTK_GLOBAL_MENU_BAR_H_ | 108 #endif // CHROME_BROWSER_UI_GTK_GLOBAL_MENU_BAR_H_ |
| OLD | NEW |