| OLD | NEW |
| 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 | 14 |
| 15 // TODO(port): Port this file. | 15 // TODO(port): Port this file. |
| 16 #if defined(TOOLKIT_VIEWS) | 16 #if defined(TOOLKIT_VIEWS) |
| 17 #include "views/controls/menu/menu_delegate.h" | 17 #include "views/controls/menu/menu_delegate.h" |
| 18 #elif defined(OS_LINUX) | 18 #elif defined(USE_X11) |
| 19 #include "chrome/browser/gtk/menu_gtk.h" | 19 #include "chrome/browser/gtk/menu_gtk.h" |
| 20 #else | 20 #else |
| 21 #include "chrome/common/temp_scaffolding_stubs.h" | 21 #include "chrome/common/temp_scaffolding_stubs.h" |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 class Browser; | 24 class Browser; |
| 25 class PageNavigator; | 25 class PageNavigator; |
| 26 class Profile; | 26 class Profile; |
| 27 | 27 |
| 28 // BookmarkContextMenu manages the context menu shown for the | 28 // BookmarkContextMenu manages the context menu shown for the |
| 29 // bookmark bar, items on the bookmark bar, submenus of the bookmark bar and | 29 // bookmark bar, items on the bookmark bar, submenus of the bookmark bar and |
| 30 // the bookmark manager. | 30 // the bookmark manager. |
| 31 class BookmarkContextMenu : public BookmarkModelObserver, | 31 class BookmarkContextMenu : public BookmarkModelObserver, |
| 32 #if defined(TOOLKIT_VIEWS) | 32 #if defined(TOOLKIT_VIEWS) |
| 33 public views::MenuDelegate | 33 public views::MenuDelegate |
| 34 #elif defined(OS_LINUX) | 34 #elif defined(USE_X11) |
| 35 public MenuGtk::Delegate | 35 public MenuGtk::Delegate |
| 36 #endif | 36 #endif |
| 37 { | 37 { |
| 38 public: | 38 public: |
| 39 // Used to configure what the context menu shows. | 39 // Used to configure what the context menu shows. |
| 40 enum ConfigurationType { | 40 enum ConfigurationType { |
| 41 BOOKMARK_BAR, | 41 BOOKMARK_BAR, |
| 42 BOOKMARK_MANAGER_TABLE, | 42 BOOKMARK_MANAGER_TABLE, |
| 43 // Used when the source is the table in the bookmark manager and the table | 43 // Used when the source is the table in the bookmark manager and the table |
| 44 // is showing recently bookmarked or searched. | 44 // is showing recently bookmarked or searched. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 65 const std::vector<const BookmarkNode*>& selection, | 65 const std::vector<const BookmarkNode*>& selection, |
| 66 ConfigurationType configuration); | 66 ConfigurationType configuration); |
| 67 virtual ~BookmarkContextMenu(); | 67 virtual ~BookmarkContextMenu(); |
| 68 | 68 |
| 69 #if defined(TOOLKIT_VIEWS) | 69 #if defined(TOOLKIT_VIEWS) |
| 70 // Shows the menu at the specified place. | 70 // Shows the menu at the specified place. |
| 71 void RunMenuAt(int x, int y); | 71 void RunMenuAt(int x, int y); |
| 72 | 72 |
| 73 // Returns the menu. | 73 // Returns the menu. |
| 74 views::MenuItemView* menu() const { return menu_.get(); } | 74 views::MenuItemView* menu() const { return menu_.get(); } |
| 75 #elif defined(OS_LINUX) | 75 #elif defined(USE_X11) |
| 76 // Pops up this menu. This call doesn't block. | 76 // Pops up this menu. This call doesn't block. |
| 77 void PopupAsContext(guint32 event_time); | 77 void PopupAsContext(guint32 event_time); |
| 78 | 78 |
| 79 // Returns the menu. | 79 // Returns the menu. |
| 80 GtkWidget* menu() const { return menu_->widget(); } | 80 GtkWidget* menu() const { return menu_->widget(); } |
| 81 #endif | 81 #endif |
| 82 | 82 |
| 83 // Menu::Delegate / MenuGtk::Delegate methods. | 83 // Menu::Delegate / MenuGtk::Delegate methods. |
| 84 virtual void ExecuteCommand(int id); | 84 virtual void ExecuteCommand(int id); |
| 85 virtual bool IsItemChecked(int id) const; | 85 virtual bool IsItemChecked(int id) const; |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 Profile* profile_; | 139 Profile* profile_; |
| 140 Browser* browser_; | 140 Browser* browser_; |
| 141 PageNavigator* navigator_; | 141 PageNavigator* navigator_; |
| 142 const BookmarkNode* parent_; | 142 const BookmarkNode* parent_; |
| 143 std::vector<const BookmarkNode*> selection_; | 143 std::vector<const BookmarkNode*> selection_; |
| 144 BookmarkModel* model_; | 144 BookmarkModel* model_; |
| 145 ConfigurationType configuration_; | 145 ConfigurationType configuration_; |
| 146 | 146 |
| 147 #if defined(OS_WIN) || defined(TOOLKIT_VIEWS) | 147 #if defined(OS_WIN) || defined(TOOLKIT_VIEWS) |
| 148 scoped_ptr<views::MenuItemView> menu_; | 148 scoped_ptr<views::MenuItemView> menu_; |
| 149 #elif defined(OS_LINUX) | 149 #elif defined(USE_X11) |
| 150 scoped_ptr<MenuGtk> menu_; | 150 scoped_ptr<MenuGtk> menu_; |
| 151 #endif | 151 #endif |
| 152 | 152 |
| 153 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenu); | 153 DISALLOW_COPY_AND_ASSIGN(BookmarkContextMenu); |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 #endif // CHROME_BROWSER_GTK_BOOKMARK_CONTEXT_MENU_H_ | 156 #endif // CHROME_BROWSER_GTK_BOOKMARK_CONTEXT_MENU_H_ |
| OLD | NEW |