Chromium Code Reviews

Side by Side Diff: chrome/browser/gtk/bookmark_menu_controller_gtk.h

Issue 211056: GTK: Dismiss the bookmark folder menu(s) when a context menu item is executed... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_ 5 #ifndef CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_
6 #define CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_ 6 #define CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_
7 7
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include <map> 10 #include <map>
11 11
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "chrome/browser/bookmarks/base_bookmark_model_observer.h" 13 #include "chrome/browser/bookmarks/base_bookmark_model_observer.h"
14 #include "chrome/browser/gtk/bookmark_context_menu.h"
14 #include "chrome/common/owned_widget_gtk.h" 15 #include "chrome/common/owned_widget_gtk.h"
15 #include "webkit/glue/window_open_disposition.h" 16 #include "webkit/glue/window_open_disposition.h"
16 17
17 class BookmarkContextMenu;
18 class Browser; 18 class Browser;
19 class Profile; 19 class Profile;
20 class Profiler; 20 class Profiler;
21 class PageNavigator; 21 class PageNavigator;
22 class BookmarkModel; 22 class BookmarkModel;
23 class BookmarkNode; 23 class BookmarkNode;
24 24
25 class BookmarkMenuController : public BaseBookmarkModelObserver { 25 class BookmarkMenuController : public BaseBookmarkModelObserver,
26 public BookmarkContextMenu::Delegate {
26 public: 27 public:
27 // Creates a BookmarkMenuController showing the children of |node| starting 28 // Creates a BookmarkMenuController showing the children of |node| starting
28 // at index |start_child_index|. 29 // at index |start_child_index|.
29 BookmarkMenuController(Browser* browser, 30 BookmarkMenuController(Browser* browser,
30 Profile* profile, 31 Profile* profile,
31 PageNavigator* page_navigator, 32 PageNavigator* page_navigator,
32 GtkWindow* window, 33 GtkWindow* window,
33 const BookmarkNode* node, 34 const BookmarkNode* node,
34 int start_child_index, 35 int start_child_index,
35 bool show_other_folder); 36 bool show_other_folder);
36 virtual ~BookmarkMenuController(); 37 virtual ~BookmarkMenuController();
37 38
38 GtkWidget* widget() { return menu_; } 39 GtkWidget* widget() { return menu_; }
39 40
40 // Pops up the menu. |widget| must be a GtkChromeButton. 41 // Pops up the menu. |widget| must be a GtkChromeButton.
41 void Popup(GtkWidget* widget, gint button_type, guint32 timestamp); 42 void Popup(GtkWidget* widget, gint button_type, guint32 timestamp);
42 43
43 // Overridden from BaseBookmarkModelObserver: 44 // Overridden from BaseBookmarkModelObserver:
44 virtual void BookmarkModelChanged(); 45 virtual void BookmarkModelChanged();
45 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, 46 virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model,
46 const BookmarkNode* node); 47 const BookmarkNode* node);
47 48
49 // Overridden from BookmarkContextMenu::Delegate:
50 virtual void WillExecuteCommand();
51
48 private: 52 private:
49 // Recursively change the bookmark hierarchy rooted in |parent| into a set of 53 // Recursively change the bookmark hierarchy rooted in |parent| into a set of
50 // gtk menus rooted in |menu|. 54 // gtk menus rooted in |menu|.
51 void BuildMenu(const BookmarkNode* parent, 55 void BuildMenu(const BookmarkNode* parent,
52 int start_child_index, 56 int start_child_index,
53 GtkWidget* menu); 57 GtkWidget* menu);
54 58
55 // Calls the page navigator to navigate to the node represented by 59 // Calls the page navigator to navigate to the node represented by
56 // |menu_item|. 60 // |menu_item|.
57 void NavigateToMenuItem(GtkWidget* menu_item, 61 void NavigateToMenuItem(GtkWidget* menu_item,
(...skipping 61 matching lines...)
119 // nodes of type URL. 123 // nodes of type URL.
120 std::map<const BookmarkNode*, GtkWidget*> node_to_menu_widget_map_; 124 std::map<const BookmarkNode*, GtkWidget*> node_to_menu_widget_map_;
121 125
122 // Owns our right click context menu. 126 // Owns our right click context menu.
123 scoped_ptr<BookmarkContextMenu> context_menu_; 127 scoped_ptr<BookmarkContextMenu> context_menu_;
124 128
125 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuController); 129 DISALLOW_COPY_AND_ASSIGN(BookmarkMenuController);
126 }; 130 };
127 131
128 #endif // CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_ 132 #endif // CHROME_BROWSER_GTK_BOOKMARK_MENU_CONTROLLER_GTK_H_
OLDNEW
« no previous file with comments | « chrome/browser/gtk/bookmark_manager_gtk.cc ('k') | chrome/browser/gtk/bookmark_menu_controller_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine