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

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

Issue 261013: Renames browser/gtk/bookmark_context_menu to... (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. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/chrome/browser/gtk/bookmark_context_menu.h:r69-2775
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_CONTEXT_MENU_H_ 5 #ifndef CHROME_BROWSER_GTK_BOOKMARK_CONTEXT_MENU_H_
6 #define CHROME_BROWSER_GTK_BOOKMARK_CONTEXT_MENU_H_ 6 #define CHROME_BROWSER_GTK_BOOKMARK_CONTEXT_MENU_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/gfx/native_widget_types.h" 11 #include "base/gfx/native_widget_types.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "chrome/browser/bookmarks/bookmark_model_observer.h" 13 #include "chrome/browser/bookmarks/bookmark_model_observer.h"
14
15 // TODO(port): Port this file.
16 #if defined(TOOLKIT_VIEWS)
17 #include "views/controls/menu/menu_delegate.h"
18 #elif defined(OS_LINUX)
19 #include "chrome/browser/gtk/menu_gtk.h" 14 #include "chrome/browser/gtk/menu_gtk.h"
20 #else
21 #include "chrome/common/temp_scaffolding_stubs.h"
22 #endif
23 15
24 class Browser; 16 class Browser;
25 class PageNavigator; 17 class PageNavigator;
26 class Profile; 18 class Profile;
27 19
28 // BookmarkContextMenu manages the context menu shown for the 20 // BookmarkContextMenu manages the context menu shown for the
29 // bookmark bar, items on the bookmark bar, submenus of the bookmark bar and 21 // bookmark bar, items on the bookmark bar, submenus of the bookmark bar and
30 // the bookmark manager. 22 // the bookmark manager.
31 class BookmarkContextMenu : public BookmarkModelObserver, 23 class BookmarkContextMenuGtk : public BookmarkModelObserver,
32 #if defined(TOOLKIT_VIEWS) 24 public MenuGtk::Delegate {
33 public views::MenuDelegate
34 #elif defined(OS_LINUX)
35 public MenuGtk::Delegate
36 #endif
37 {
38 public: 25 public:
39 // Used to configure what the context menu shows. 26 // Used to configure what the context menu shows.
40 enum ConfigurationType { 27 enum ConfigurationType {
41 BOOKMARK_BAR, 28 BOOKMARK_BAR,
42 BOOKMARK_MANAGER_TABLE, 29 BOOKMARK_MANAGER_TABLE,
43 // Used when the source is the table in the bookmark manager and the table 30 // Used when the source is the table in the bookmark manager and the table
44 // is showing recently bookmarked or searched. 31 // is showing recently bookmarked or searched.
45 BOOKMARK_MANAGER_TABLE_OTHER, 32 BOOKMARK_MANAGER_TABLE_OTHER,
46 BOOKMARK_MANAGER_TREE, 33 BOOKMARK_MANAGER_TREE,
47 BOOKMARK_MANAGER_ORGANIZE_MENU, 34 BOOKMARK_MANAGER_ORGANIZE_MENU,
48 // Used when the source is the bookmark manager and the table is showing 35 // Used when the source is the bookmark manager and the table is showing
49 // recently bookmarked or searched. 36 // recently bookmarked or searched.
50 BOOKMARK_MANAGER_ORGANIZE_MENU_OTHER 37 BOOKMARK_MANAGER_ORGANIZE_MENU_OTHER
51 }; 38 };
52 39
53 class Delegate { 40 class Delegate {
54 public: 41 public:
55 // Called when one of the menu items is selected and executed. 42 // Called when one of the menu items is selected and executed.
56 virtual void WillExecuteCommand() = 0; 43 virtual void WillExecuteCommand() = 0;
57 }; 44 };
58 45
59 // Creates the bookmark context menu. 46 // Creates the bookmark context menu.
60 // |profile| is used for opening urls as well as enabling 'open incognito'. 47 // |profile| is used for opening urls as well as enabling 'open incognito'.
61 // |browser| is used to determine the PageNavigator and may be null. 48 // |browser| is used to determine the PageNavigator and may be null.
62 // |navigator| is used if |browser| is null, and is provided for testing. 49 // |navigator| is used if |browser| is null, and is provided for testing.
63 // |parent| is the parent for newly created nodes if |selection| is empty. 50 // |parent| is the parent for newly created nodes if |selection| is empty.
64 // |selection| is the nodes the context menu operates on and may be empty. 51 // |selection| is the nodes the context menu operates on and may be empty.
65 // |configuration| determines which items to show. 52 // |configuration| determines which items to show.
66 BookmarkContextMenu(gfx::NativeView hwnd, 53 BookmarkContextMenuGtk(gfx::NativeView hwnd,
67 Profile* profile, 54 Profile* profile,
68 Browser* browser, 55 Browser* browser,
69 PageNavigator* navigator, 56 PageNavigator* navigator,
70 const BookmarkNode* parent, 57 const BookmarkNode* parent,
71 const std::vector<const BookmarkNode*>& selection, 58 const std::vector<const BookmarkNode*>& selection,
72 ConfigurationType configuration, 59 ConfigurationType configuration,
73 Delegate* delegate); 60 Delegate* delegate);
74 virtual ~BookmarkContextMenu(); 61 virtual ~BookmarkContextMenuGtk();
75 62
76 #if defined(TOOLKIT_VIEWS)
77 // Shows the menu at the specified place.
78 void RunMenuAt(int x, int y);
79
80 // Returns the menu.
81 views::MenuItemView* menu() const { return menu_.get(); }
82 #elif defined(OS_LINUX)
83 // Pops up this menu. This call doesn't block. 63 // Pops up this menu. This call doesn't block.
84 void PopupAsContext(guint32 event_time); 64 void PopupAsContext(guint32 event_time);
85 65
86 // Returns the menu. 66 // Returns the menu.
87 GtkWidget* menu() const { return menu_->widget(); } 67 GtkWidget* menu() const { return menu_->widget(); }
88 #endif
89 68
90 // Should be called by the delegate when it is no longer valid. 69 // Should be called by the delegate when it is no longer valid.
91 void DelegateDestroyed(); 70 void DelegateDestroyed();
92 71
93 // Menu::Delegate / MenuGtk::Delegate methods. 72 // Menu::Delegate / MenuGtk::Delegate methods.
94 virtual void ExecuteCommand(int id); 73 virtual void ExecuteCommand(int id);
95 virtual bool IsItemChecked(int id) const; 74 virtual bool IsItemChecked(int id) const;
96 virtual bool IsCommandEnabled(int id) const; 75 virtual bool IsCommandEnabled(int id) const;
97 76
98 private: 77 private:
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 126
148 gfx::NativeView wnd_; 127 gfx::NativeView wnd_;
149 Profile* profile_; 128 Profile* profile_;
150 Browser* browser_; 129 Browser* browser_;
151 PageNavigator* navigator_; 130 PageNavigator* navigator_;
152 const BookmarkNode* parent_; 131 const BookmarkNode* parent_;
153 std::vector<const BookmarkNode*> selection_; 132 std::vector<const BookmarkNode*> selection_;
154 BookmarkModel* model_; 133 BookmarkModel* model_;
155 ConfigurationType configuration_; 134 ConfigurationType configuration_;
156 Delegate* delegate_; 135 Delegate* delegate_;
136 scoped_ptr<MenuGtk> menu_;
157 137
158 #if defined(OS_WIN) || defined(TOOLKIT_VIEWS) 138 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenuGtk);
159 scoped_ptr<views::MenuItemView> menu_;
160 #elif defined(OS_LINUX)
161 scoped_ptr<MenuGtk> menu_;
162 #endif
163
164 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenu);
165 }; 139 };
166 140
167 #endif // CHROME_BROWSER_GTK_BOOKMARK_CONTEXT_MENU_H_ 141 #endif // CHROME_BROWSER_GTK_BOOKMARK_CONTEXT_MENU_H_
OLDNEW
« no previous file with comments | « chrome/browser/gtk/bookmark_context_menu.cc ('k') | chrome/browser/gtk/bookmark_context_menu_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698