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

Side by Side Diff: chrome/browser/ui/views/frame/global_menu_bar_x11.h

Issue 1350653004: [sessions] Properly namespace recently-componentized TabRestore code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Mac Created 5 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_VIEWS_FRAME_GLOBAL_MENU_BAR_X11_H_ 5 #ifndef CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_X11_H_
6 #define CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_X11_H_ 6 #define CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_X11_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // Unity has an Apple-like menu bar at the top of the screen that changes 46 // Unity has an Apple-like menu bar at the top of the screen that changes
47 // depending on the active window. In the GTK port, we had a hidden GtkMenuBar 47 // depending on the active window. In the GTK port, we had a hidden GtkMenuBar
48 // object in each GtkWindow which existed only to be scrapped by the 48 // object in each GtkWindow which existed only to be scrapped by the
49 // libdbusmenu-gtk code. Since we don't have GtkWindows anymore, we need to 49 // libdbusmenu-gtk code. Since we don't have GtkWindows anymore, we need to
50 // interface directly with the lower level libdbusmenu-glib, which we 50 // interface directly with the lower level libdbusmenu-glib, which we
51 // opportunistically dlopen() since not everyone is running Ubuntu. 51 // opportunistically dlopen() since not everyone is running Ubuntu.
52 class GlobalMenuBarX11 : public AvatarMenuObserver, 52 class GlobalMenuBarX11 : public AvatarMenuObserver,
53 public chrome::BrowserListObserver, 53 public chrome::BrowserListObserver,
54 public CommandObserver, 54 public CommandObserver,
55 public history::TopSitesObserver, 55 public history::TopSitesObserver,
56 public TabRestoreServiceObserver, 56 public sessions::TabRestoreServiceObserver,
57 public views::DesktopWindowTreeHostObserverX11 { 57 public views::DesktopWindowTreeHostObserverX11 {
58 public: 58 public:
59 GlobalMenuBarX11(BrowserView* browser_view, 59 GlobalMenuBarX11(BrowserView* browser_view,
60 BrowserDesktopWindowTreeHostX11* host); 60 BrowserDesktopWindowTreeHostX11* host);
61 ~GlobalMenuBarX11() override; 61 ~GlobalMenuBarX11() override;
62 62
63 // Creates the object path for DbusemenuServer which is attached to |xid|. 63 // Creates the object path for DbusemenuServer which is attached to |xid|.
64 static std::string GetPathForWindow(unsigned long xid); 64 static std::string GetPathForWindow(unsigned long xid);
65 65
66 private: 66 private:
(...skipping 17 matching lines...) Expand all
84 // |menu_str_id|. Then appends it to |parent|. 84 // |menu_str_id|. Then appends it to |parent|.
85 DbusmenuMenuitem* BuildStaticMenu(DbusmenuMenuitem* parent, 85 DbusmenuMenuitem* BuildStaticMenu(DbusmenuMenuitem* parent,
86 int menu_str_id, 86 int menu_str_id,
87 GlobalMenuBarCommand* commands); 87 GlobalMenuBarCommand* commands);
88 88
89 // Sets the accelerator for |item|. 89 // Sets the accelerator for |item|.
90 void RegisterAccelerator(DbusmenuMenuitem* item, 90 void RegisterAccelerator(DbusmenuMenuitem* item,
91 const ui::Accelerator& accelerator); 91 const ui::Accelerator& accelerator);
92 92
93 // Creates a HistoryItem from the data in |entry|. 93 // Creates a HistoryItem from the data in |entry|.
94 HistoryItem* HistoryItemForTab(const TabRestoreService::Tab& entry); 94 HistoryItem* HistoryItemForTab(const sessions::TabRestoreService::Tab& entry);
95 95
96 // Creates a menu item form |item| and inserts it in |menu| at |index|. 96 // Creates a menu item form |item| and inserts it in |menu| at |index|.
97 void AddHistoryItemToMenu(HistoryItem* item, 97 void AddHistoryItemToMenu(HistoryItem* item,
98 DbusmenuMenuitem* menu, 98 DbusmenuMenuitem* menu,
99 int tag, 99 int tag,
100 int index); 100 int index);
101 101
102 // Sends a message off to History for data. 102 // Sends a message off to History for data.
103 void GetTopSitesData(); 103 void GetTopSitesData();
104 104
(...skipping 24 matching lines...) Expand all
129 129
130 // Overridden from CommandObserver: 130 // Overridden from CommandObserver:
131 void EnabledStateChangedForCommand(int id, bool enabled) override; 131 void EnabledStateChangedForCommand(int id, bool enabled) override;
132 132
133 // Overridden from history::TopSitesObserver: 133 // Overridden from history::TopSitesObserver:
134 void TopSitesLoaded(history::TopSites* top_sites) override; 134 void TopSitesLoaded(history::TopSites* top_sites) override;
135 void TopSitesChanged(history::TopSites* top_sites, 135 void TopSitesChanged(history::TopSites* top_sites,
136 ChangeReason change_reason) override; 136 ChangeReason change_reason) override;
137 137
138 // Overridden from TabRestoreServiceObserver: 138 // Overridden from TabRestoreServiceObserver:
139 void TabRestoreServiceChanged(TabRestoreService* service) override; 139 void TabRestoreServiceChanged(sessions::TabRestoreService* service) override;
140 void TabRestoreServiceDestroyed(TabRestoreService* service) override; 140 void TabRestoreServiceDestroyed(
141 sessions::TabRestoreService* service) override;
141 142
142 // Overridden from views::DesktopWindowTreeHostObserverX11: 143 // Overridden from views::DesktopWindowTreeHostObserverX11:
143 void OnWindowMapped(unsigned long xid) override; 144 void OnWindowMapped(unsigned long xid) override;
144 void OnWindowUnmapped(unsigned long xid) override; 145 void OnWindowUnmapped(unsigned long xid) override;
145 146
146 CHROMEG_CALLBACK_1(GlobalMenuBarX11, void, OnItemActivated, DbusmenuMenuitem*, 147 CHROMEG_CALLBACK_1(GlobalMenuBarX11, void, OnItemActivated, DbusmenuMenuitem*,
147 unsigned int); 148 unsigned int);
148 CHROMEG_CALLBACK_1(GlobalMenuBarX11, void, OnHistoryItemActivated, 149 CHROMEG_CALLBACK_1(GlobalMenuBarX11, void, OnHistoryItemActivated,
149 DbusmenuMenuitem*, unsigned int); 150 DbusmenuMenuitem*, unsigned int);
150 CHROMEG_CALLBACK_0(GlobalMenuBarX11, void, OnHistoryMenuAboutToShow, 151 CHROMEG_CALLBACK_0(GlobalMenuBarX11, void, OnHistoryMenuAboutToShow,
(...skipping 17 matching lines...) Expand all
168 DbusmenuServer* server_; 169 DbusmenuServer* server_;
169 DbusmenuMenuitem* root_item_; 170 DbusmenuMenuitem* root_item_;
170 DbusmenuMenuitem* history_menu_; 171 DbusmenuMenuitem* history_menu_;
171 DbusmenuMenuitem* profiles_menu_; 172 DbusmenuMenuitem* profiles_menu_;
172 173
173 // Tracks value of the kShowBookmarkBar preference. 174 // Tracks value of the kShowBookmarkBar preference.
174 PrefChangeRegistrar pref_change_registrar_; 175 PrefChangeRegistrar pref_change_registrar_;
175 176
176 scoped_refptr<history::TopSites> top_sites_; 177 scoped_refptr<history::TopSites> top_sites_;
177 178
178 TabRestoreService* tab_restore_service_; // weak 179 sessions::TabRestoreService* tab_restore_service_; // weak
179 180
180 scoped_ptr<AvatarMenu> avatar_menu_; 181 scoped_ptr<AvatarMenu> avatar_menu_;
181 182
182 ScopedObserver<history::TopSites, history::TopSitesObserver> scoped_observer_; 183 ScopedObserver<history::TopSites, history::TopSitesObserver> scoped_observer_;
183 184
184 // For callbacks may be run after destruction. 185 // For callbacks may be run after destruction.
185 base::WeakPtrFactory<GlobalMenuBarX11> weak_ptr_factory_; 186 base::WeakPtrFactory<GlobalMenuBarX11> weak_ptr_factory_;
186 187
187 DISALLOW_COPY_AND_ASSIGN(GlobalMenuBarX11); 188 DISALLOW_COPY_AND_ASSIGN(GlobalMenuBarX11);
188 }; 189 };
189 190
190 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_X11_H_ 191 #endif // CHROME_BROWSER_UI_VIEWS_FRAME_GLOBAL_MENU_BAR_X11_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc ('k') | chrome/browser/ui/views/frame/global_menu_bar_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698