Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(714)

Side by Side Diff: chrome/browser/ui/gtk/global_menu_bar.h

Issue 8135001: Fixed behavior of the bookmark bar visibility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DCHECK_EQ instead of DCHECK Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/memory/scoped_ptr.h"
10 #include "chrome/browser/command_updater.h" 11 #include "chrome/browser/command_updater.h"
11 #include "chrome/browser/ui/gtk/global_bookmark_menu.h" 12 #include "chrome/browser/prefs/pref_change_registrar.h"
12 #include "chrome/browser/ui/gtk/global_history_menu.h" 13 #include "chrome/browser/ui/gtk/global_history_menu.h"
13 #include "content/common/notification_observer.h" 14 #include "content/common/notification_observer.h"
14 #include "content/common/notification_registrar.h"
15 #include "ui/base/gtk/gtk_signal.h" 15 #include "ui/base/gtk/gtk_signal.h"
16 #include "ui/base/gtk/owned_widget_gtk.h" 16 #include "ui/base/gtk/owned_widget_gtk.h"
17 17
18 class Browser; 18 class Browser;
19 class GlobalBookmarkMenu;
19 struct GlobalMenuBarCommand; 20 struct GlobalMenuBarCommand;
20 class GlobalMenuOwner; 21 class GlobalMenuOwner;
21 22
22 typedef struct _GtkAccelGroup GtkAccelGroup; 23 typedef struct _GtkAccelGroup GtkAccelGroup;
23 typedef struct _GtkWidget GtkWidget; 24 typedef struct _GtkWidget GtkWidget;
24 25
25 // Controls the Mac style menu bar on Linux. 26 // Controls the Mac style menu bar on Linux.
26 // 27 //
27 // Unity and some configurations of GNOME have a Apple-like menu bar at the top 28 // Unity and some configurations of GNOME have a Apple-like menu bar at the top
28 // of the screen that changes depending on the active window. These mainly work 29 // of the screen that changes depending on the active window. These mainly work
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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);
70 71
71 // NotificationObserver: 72 // NotificationObserver:
72 virtual void Observe(int type, 73 virtual void Observe(int type,
73 const NotificationSource& source, 74 const NotificationSource& source,
74 const NotificationDetails& details); 75 const NotificationDetails& details);
75 76
77 // Updates the visibility of the bookmark bar on pref changes.
78 void OnBookmarkBarVisibilityChanged();
79
76 CHROMEGTK_CALLBACK_0(GlobalMenuBar, void, OnItemActivated); 80 CHROMEGTK_CALLBACK_0(GlobalMenuBar, void, OnItemActivated);
77 81
78 Browser* browser_; 82 Browser* browser_;
79 83
80 NotificationRegistrar registrar_; 84 // Tracks value of the kShowBookmarkBar preference.
85 PrefChangeRegistrar pref_change_registrar_;
81 86
82 // Our menu bar widget. 87 // Our menu bar widget.
83 ui::OwnedWidgetGtk menu_bar_; 88 ui::OwnedWidgetGtk menu_bar_;
84 89
85 // Listens to the TabRestoreService and the HistoryService and keeps the 90 // Listens to the TabRestoreService and the HistoryService and keeps the
86 // history menu fresh. 91 // history menu fresh.
87 GlobalHistoryMenu history_menu_; 92 GlobalHistoryMenu history_menu_;
88 93
89 // Listens to the bookmark model and updates the menu. 94 // Listens to the bookmark model and updates the menu.
90 scoped_ptr<GlobalBookmarkMenu> bookmark_menu_; 95 scoped_ptr<GlobalBookmarkMenu> bookmark_menu_;
91 96
92 // For some menu items, we want to show the accelerator, but not actually 97 // For some menu items, we want to show the accelerator, but not actually
93 // explicitly handle it. To this end we connect those menu items' accelerators 98 // explicitly handle it. To this end we connect those menu items' accelerators
94 // to this group, but don't attach this group to any top level window. 99 // to this group, but don't attach this group to any top level window.
95 GtkAccelGroup* dummy_accel_group_; 100 GtkAccelGroup* dummy_accel_group_;
96 101
97 // A mapping from command ids to GtkMenuItem objects. We use this to update 102 // A mapping from command ids to GtkMenuItem objects. We use this to update
98 // the command enable state. 103 // the command enable state.
99 CommandIDMenuItemMap id_to_menu_item_; 104 CommandIDMenuItemMap id_to_menu_item_;
100 105
101 // gtk_check_menu_item_set_active() will call the "activate" signal. We need 106 // gtk_check_menu_item_set_active() will call the "activate" signal. We need
102 // to block this activation while we change the checked state. 107 // to block this activation while we change the checked state.
103 bool block_activation_; 108 bool block_activation_;
104 }; 109 };
105 110
106 #endif // CHROME_BROWSER_UI_GTK_GLOBAL_MENU_BAR_H_ 111 #endif // CHROME_BROWSER_UI_GTK_GLOBAL_MENU_BAR_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/browser_window_cocoa_unittest.mm ('k') | chrome/browser/ui/gtk/global_menu_bar.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698