diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-26 15:35:13 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-26 15:35:13 +0000 |
commit | e959f0b97dba7228c76b7722cf4227fdf6416524 (patch) | |
tree | 7af84f30c8a3560c19e17f7cb1dc220e1e4fa0be /chrome/browser/views/bookmark_menu_controller_views.h | |
parent | bf6a46bed6770a7041c222e4505135bd30701576 (diff) | |
download | chromium_src-e959f0b97dba7228c76b7722cf4227fdf6416524.zip chromium_src-e959f0b97dba7228c76b7722cf4227fdf6416524.tar.gz chromium_src-e959f0b97dba7228c76b7722cf4227fdf6416524.tar.bz2 |
Makes it so that when a folder is open on the bookmark bar and the
mouse moves over another folder, the menu for that folder is shown.
BUG=355
TEST=thorougly test all possible permutations of bookmark menus you
can think of, including drag and drop to the menus.
Review URL: http://codereview.chromium.org/328012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30049 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/bookmark_menu_controller_views.h')
-rw-r--r-- | chrome/browser/views/bookmark_menu_controller_views.h | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/chrome/browser/views/bookmark_menu_controller_views.h b/chrome/browser/views/bookmark_menu_controller_views.h index fa6462f..f19c3cc 100644 --- a/chrome/browser/views/bookmark_menu_controller_views.h +++ b/chrome/browser/views/bookmark_menu_controller_views.h @@ -16,8 +16,13 @@ namespace gfx { class Rect; -} +} // namespace gfx +namespace views { +class MenuButton; +} // namespace views + +class BookmarkBarView; class BookmarkContextMenu; class BookmarkNode; class Browser; @@ -48,8 +53,10 @@ class BookmarkMenuController : public BaseBookmarkModelObserver, int start_child_index, bool show_other_folder); + void RunMenuAt(BookmarkBarView* bookmark_bar, bool for_drop); + // Shows the menu. - void RunMenuAt(const gfx::Rect& bounds, + void RunMenuAt(views::MenuButton* button, views::MenuItemView::AnchorPosition position, bool for_drop); @@ -60,7 +67,7 @@ class BookmarkMenuController : public BaseBookmarkModelObserver, const BookmarkNode* node() const { return node_; } // Returns the menu. - views::MenuItemView* menu() const { return menu_.get(); } + views::MenuItemView* menu() const { return menu_; } // Returns the context menu, or NULL if the context menu isn't showing. views::MenuItemView* context_menu() const { @@ -93,7 +100,14 @@ class BookmarkMenuController : public BaseBookmarkModelObserver, virtual bool CanDrag(views::MenuItemView* menu); virtual void WriteDragData(views::MenuItemView* sender, OSExchangeData* data); virtual int GetDragOperations(views::MenuItemView* sender); + virtual views::MenuItemView* GetSiblingMenu( + views::MenuItemView* menu, + const gfx::Point& screen_point, + views::MenuItemView::AnchorPosition* anchor, + bool* has_mnemonics, + views::MenuButton** button); + // BookmarkModelObserver methods. virtual void BookmarkModelChanged(); virtual void BookmarkNodeFavIconLoaded(BookmarkModel* model, const BookmarkNode* node); @@ -102,9 +116,14 @@ class BookmarkMenuController : public BaseBookmarkModelObserver, // BookmarkMenuController deletes itself as necessary. ~BookmarkMenuController(); + // Creates a menu and adds it to node_to_menu_id_map_. This uses + // BuildMenu to recursively populate the menu. + views::MenuItemView* CreateMenu(const BookmarkNode* parent, + int start_child_index); + // Builds the menu for the other bookmarks folder. This is added as the last // item to menu_. - void BuildOtherFolderMenu(int* next_menu_id); + void BuildOtherFolderMenu(views::MenuItemView* menu, int* next_menu_id); // Creates an entry in menu for each child node of |parent| starting at // |start_child_index|. @@ -132,8 +151,8 @@ class BookmarkMenuController : public BaseBookmarkModelObserver, // URL. std::map<const BookmarkNode*, int> node_to_menu_id_map_; - // The menu. - scoped_ptr<views::MenuItemView> menu_; + // Current menu. + views::MenuItemView* menu_; // Data for the drop. BookmarkDragData drop_data_; @@ -150,6 +169,16 @@ class BookmarkMenuController : public BaseBookmarkModelObserver, // Should the other folder be shown? bool show_other_folder_; + // The bookmark bar. This is only non-null if we're showing a menu item + // for a folder on the bookmark bar and not for drop. + BookmarkBarView* bookmark_bar_; + + typedef std::map<const BookmarkNode*, views::MenuItemView*> NodeToMenuMap; + NodeToMenuMap node_to_menu_map_; + + // ID of the next menu item. + int next_menu_id_; + DISALLOW_COPY_AND_ASSIGN(BookmarkMenuController); }; |