Commit d02f5659 authored by sky@chromium.org's avatar sky@chromium.org

Makes bookmark bar view reset PageNavigator on menu when PageNavigator

of BookmarkBarView changes. My last patch added the plumbing, this
wires it up.

BUG=92994
TEST=make sure bookmark menus still work; covered by tests too.
R=ben@chromium.org

Review URL: http://codereview.chromium.org/7787001

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98700 0039d316-1c4b-4281-b951-d872f2087c98
parent 25fbafb7
...@@ -394,8 +394,12 @@ BookmarkBarView::~BookmarkBarView() { ...@@ -394,8 +394,12 @@ BookmarkBarView::~BookmarkBarView() {
// It's possible for the menu to outlive us, reset the observer to make sure // It's possible for the menu to outlive us, reset the observer to make sure
// it doesn't have a reference to us. // it doesn't have a reference to us.
if (bookmark_menu_) if (bookmark_menu_) {
bookmark_menu_->set_observer(NULL); bookmark_menu_->set_observer(NULL);
bookmark_menu_->SetPageNavigator(NULL);
}
if (context_menu_.get())
context_menu_->SetPageNavigator(NULL);
StopShowFolderDropMenuTimer(); StopShowFolderDropMenuTimer();
...@@ -405,6 +409,10 @@ BookmarkBarView::~BookmarkBarView() { ...@@ -405,6 +409,10 @@ BookmarkBarView::~BookmarkBarView() {
void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) { void BookmarkBarView::SetPageNavigator(PageNavigator* navigator) {
page_navigator_ = navigator; page_navigator_ = navigator;
if (bookmark_menu_)
bookmark_menu_->SetPageNavigator(navigator);
if (context_menu_.get())
context_menu_->SetPageNavigator(navigator);
} }
void BookmarkBarView::SetBookmarkBarState( void BookmarkBarView::SetBookmarkBarState(
...@@ -1097,9 +1105,9 @@ void BookmarkBarView::ShowContextMenuForView(View* source, ...@@ -1097,9 +1105,9 @@ void BookmarkBarView::ShowContextMenuForView(View* source,
bool close_on_remove = bool close_on_remove =
(parent == profile->GetBookmarkModel()->other_node()) && (parent == profile->GetBookmarkModel()->other_node()) &&
(parent->child_count() == 1); (parent->child_count() == 1);
BookmarkContextMenu controller(GetWidget(), profile, context_menu_.reset(new BookmarkContextMenu(GetWidget(), profile,
browser_->GetSelectedTabContents(), parent, nodes, close_on_remove); browser_->GetSelectedTabContents(), parent, nodes, close_on_remove));
controller.RunMenuAt(p); context_menu_->RunMenuAt(p);
} }
void BookmarkBarView::Observe(int type, void BookmarkBarView::Observe(int type,
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "views/controls/menu/view_menu_delegate.h" #include "views/controls/menu/view_menu_delegate.h"
#include "views/drag_controller.h" #include "views/drag_controller.h"
class BookmarkContextMenu;
class Browser; class Browser;
class PageNavigator; class PageNavigator;
class PrefService; class PrefService;
...@@ -374,6 +375,10 @@ class BookmarkBarView : public DetachableToolbarView, ...@@ -374,6 +375,10 @@ class BookmarkBarView : public DetachableToolbarView,
// contents of the node. // contents of the node.
BookmarkMenuController* bookmark_drop_menu_; BookmarkMenuController* bookmark_drop_menu_;
// If non-NULL we're showing a context menu for one of the items on the
// bookmark bar.
scoped_ptr<BookmarkContextMenu> context_menu_;
// Shows the other bookmark entries. // Shows the other bookmark entries.
views::MenuButton* other_bookmarked_button_; views::MenuButton* other_bookmarked_button_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment